ai-chat-bot-interface 1.6.9 → 1.6.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ai-chat-bot-interface",
3
3
  "private": false,
4
- "version": "1.6.9",
4
+ "version": "1.6.11",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
package/src/App.vue CHANGED
@@ -10,7 +10,7 @@ const handleLog = (log) => {
10
10
  <chat-ui
11
11
  bot-id="7574379096097439754"
12
12
  token="sat_cSmj7ZyuePbkEpOKR7F259YuIfp2fjX9rJ3Om2O0gB9JzrGjAk8pSL269rbu8kzr"
13
- uid="262598"
13
+ uid="0"
14
14
  :def-msg="{ placeholder: '发消息...' }"
15
15
  :show-header="false"
16
16
  :card-list="{ dishes: true, personalForm: true }"
@@ -12,7 +12,7 @@
12
12
  />
13
13
  <div>
14
14
  <div class="name">
15
- <span>{{ info.skuname }}{{ contentHeight }}</span>
15
+ <span>{{ info.skuname }}</span>
16
16
  <span>×1</span>
17
17
  </div>
18
18
  <div class="sub">{{ subStr }}</div>
@@ -68,6 +68,9 @@
68
68
  {{ materialText }}
69
69
  </div>
70
70
  <div class="title">制作工艺</div>
71
+ <div v-if="info.skuVideo">
72
+ <video :src="info.skuVideo" width="100%" controls="true" />
73
+ </div>
71
74
  <div
72
75
  v-for="(item, index) in info.makeCraftList"
73
76
  :key="index"
@@ -77,8 +80,16 @@
77
80
  <div class="num">第{{ index + 1 }}步</div>
78
81
  <div class="desc">{{ item.content }}</div>
79
82
  </div>
83
+ <div>
84
+ <img
85
+ v-for="(img, index) in getImageList(item.craftImg)"
86
+ :key="index"
87
+ :src="img"
88
+ width="100%"
89
+ alt="step image"
90
+ />
91
+ </div>
80
92
  </div>
81
-
82
93
  <div class="collapse_btn" @click.stop="isOpen = false">收起</div>
83
94
  </div>
84
95
  </div>
@@ -142,6 +153,17 @@ const previewImg = (url) => {
142
153
  const switchOpen = () => {
143
154
  isOpen.value = !isOpen.value;
144
155
  };
156
+
157
+ const getImageList = (str) => {
158
+ let list = [];
159
+ try {
160
+ list = JSON.parse(str);
161
+ } catch (e) {
162
+ console.warn('====== get image list error =======', e);
163
+ }
164
+
165
+ return list;
166
+ };
145
167
  </script>
146
168
 
147
169
  <style scoped lang="less">
@@ -3,6 +3,7 @@ import { computed, onMounted, ref } from 'vue';
3
3
  import ArrowRight from '../icons/ArrowRight.vue';
4
4
  import Popup from '../popup/popup.vue';
5
5
  import { showToast } from 'vant';
6
+ import { Field } from 'vant';
6
7
 
7
8
  const showPopup = ref(false);
8
9
 
@@ -18,6 +19,9 @@ const dialogInfo = ref({
18
19
  title: '标题',
19
20
  unit: '',
20
21
  dialogHeight: '50vh',
22
+ min: 0,
23
+ max: 100,
24
+ type: 'digit',
21
25
  });
22
26
 
23
27
  const sportList = [
@@ -62,13 +66,20 @@ const tasteList = [
62
66
  const tabooList = ['高GI', '高饱和脂肪酸', '高嘌呤', '高盐', '高胆固醇'];
63
67
 
64
68
  const pfForm = ref([
65
- { key: 'sex', label: '性别', value: '', placeholder: '请输选择' },
69
+ {
70
+ key: 'sex',
71
+ label: '性别',
72
+ value: '',
73
+ placeholder: '请输选择',
74
+ required: true,
75
+ },
66
76
  {
67
77
  key: 'age',
68
78
  label: '年龄',
69
79
  value: '',
70
80
  placeholder: '请输入年龄',
71
81
  unit: '岁',
82
+ required: true,
72
83
  },
73
84
  {
74
85
  key: 'height',
@@ -76,6 +87,7 @@ const pfForm = ref([
76
87
  value: '',
77
88
  placeholder: '请输入身高',
78
89
  unit: 'cm',
90
+ required: true,
79
91
  },
80
92
  {
81
93
  key: 'weight',
@@ -83,8 +95,15 @@ const pfForm = ref([
83
95
  value: '',
84
96
  placeholder: '请输入体重',
85
97
  unit: 'kg',
98
+ required: true,
99
+ },
100
+ {
101
+ key: 'sport',
102
+ label: '日常运动水平',
103
+ value: '',
104
+ placeholder: '请输入',
105
+ required: true,
86
106
  },
87
- { key: 'sport', label: '日常运动水平', value: '', placeholder: '请输入' },
88
107
  {
89
108
  key: 'taste',
90
109
  label: '口味偏好及饮食禁忌',
@@ -92,6 +111,7 @@ const pfForm = ref([
92
111
  taste: [],
93
112
  taboo: [],
94
113
  placeholder: '请输入',
114
+ required: false,
95
115
  },
96
116
  ]);
97
117
 
@@ -100,7 +120,11 @@ const Emits = defineEmits(['submit']);
100
120
  onMounted(() => {
101
121
  const form = localStorage.getItem('personalInfo');
102
122
  if (form) {
103
- pfForm.value = JSON.parse(form);
123
+ const formData = JSON.parse(form);
124
+ for (let i = 0; i < pfForm.value.length; i++) {
125
+ const idx = formData.findIndex((con) => con.key === pfForm.value[i].key);
126
+ pfForm.value[i] = { ...pfForm.value[i], ...formData[idx] };
127
+ }
104
128
  }
105
129
  });
106
130
 
@@ -124,18 +148,27 @@ const handleSelect = (item) => {
124
148
  dialogInfo.value.dialogHeight = '240px';
125
149
  dialogInfo.value.unit = item.unit;
126
150
  dialogInfo.value.age = item.value;
151
+ dialogInfo.value.min = 0;
152
+ dialogInfo.value.max = 100;
153
+ dialogInfo.value.type = 'number';
127
154
  break;
128
155
  case 'height':
129
156
  dialogInfo.value.title = '设置身高';
130
157
  dialogInfo.value.dialogHeight = '240px';
131
158
  dialogInfo.value.unit = item.unit;
132
159
  dialogInfo.value.height = item.value;
160
+ dialogInfo.value.min = 0;
161
+ dialogInfo.value.max = 300;
162
+ dialogInfo.value.type = 'digit';
133
163
  break;
134
164
  case 'weight':
135
165
  dialogInfo.value.title = '设置体重';
136
166
  dialogInfo.value.dialogHeight = '240px';
137
167
  dialogInfo.value.unit = item.unit;
138
168
  dialogInfo.value.weight = item.value;
169
+ dialogInfo.value.min = 0;
170
+ dialogInfo.value.max = 300;
171
+ dialogInfo.value.type = 'digit';
139
172
  break;
140
173
  case 'sport':
141
174
  dialogInfo.value.title = '日常运动水平';
@@ -261,7 +294,9 @@ const selectSex = (item) => {
261
294
  <div class="pf_wrap">
262
295
  <div class="pf_form">
263
296
  <div v-for="item in pfForm" :key="item.key" class="pf_row">
264
- <div class="title">{{ item.label }}</div>
297
+ <div class="title" :class="{ is_required: item.required }">
298
+ {{ item.label }}
299
+ </div>
265
300
  <div class="content" @click="handleSelect(item)">
266
301
  <span
267
302
  class="text_row"
@@ -308,10 +343,12 @@ const selectSex = (item) => {
308
343
  v-if="['age', 'height', 'weight'].includes(dialogInfo.key)"
309
344
  class="input_wrap"
310
345
  >
311
- <input
346
+ <Field
312
347
  v-model="dialogInfo[dialogInfo.key]"
313
348
  class="input"
314
- type="text"
349
+ :type="dialogInfo.type"
350
+ :min="dialogInfo.min"
351
+ :max="dialogInfo.max"
315
352
  @keyup.enter="handleConfirm"
316
353
  placeholder="请输入"
317
354
  />
@@ -386,6 +423,19 @@ const selectSex = (item) => {
386
423
  .title {
387
424
  font-size: 14px;
388
425
  font-weight: 600;
426
+ position: relative;
427
+ line-height: 24px;
428
+
429
+ &.is_required {
430
+ &::after {
431
+ content: '*';
432
+ color: #ff0000;
433
+ font-size: 14px;
434
+ line-height: 24px;
435
+ position: absolute;
436
+ right: -0.6em;
437
+ }
438
+ }
389
439
  }
390
440
 
391
441
  .content {
@@ -467,6 +517,10 @@ const selectSex = (item) => {
467
517
  width: 200px;
468
518
  outline: none;
469
519
  border: none;
520
+ margin: auto;
521
+ /deep/ .van-field__control {
522
+ text-align: center;
523
+ }
470
524
  }
471
525
  .unit {
472
526
  font-size: 15px;