ai-chat-bot-interface 1.6.8 → 1.6.10
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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
/>
|
|
13
13
|
<div>
|
|
14
14
|
<div class="name">
|
|
15
|
-
<span>{{ info.skuname }}
|
|
15
|
+
<span>{{ info.skuname }}</span>
|
|
16
16
|
<span>×1</span>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="sub">{{ subStr }}</div>
|
|
@@ -117,7 +117,9 @@ const subStr = computed(() => {
|
|
|
117
117
|
return `${props.defMsg.energy}${props.info.energy}kcal,${props.defMsg.protein}${props.info.protein}g,${props.defMsg.fat}${props.info.fat}g,${props.defMsg.carbonwater}${props.info.carbonwater}g`;
|
|
118
118
|
});
|
|
119
119
|
const materialText = computed(() => {
|
|
120
|
-
const list = props.info?.makeMaterialList?.map(
|
|
120
|
+
const list = props.info?.makeMaterialList?.map(
|
|
121
|
+
(item) => item.material + item.usage + 'g',
|
|
122
|
+
);
|
|
121
123
|
return (list || []).join('、');
|
|
122
124
|
});
|
|
123
125
|
const hasDetails = computed(() => {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
width: fit-content;
|
|
25
25
|
white-space: nowrap;
|
|
26
26
|
font-weight: 400;
|
|
27
|
-
font-size:
|
|
27
|
+
font-size: 14px;
|
|
28
28
|
color: #333;
|
|
29
29
|
line-height: 16px;
|
|
30
30
|
text-align: left;
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
border: 1px solid #d0d0d0;
|
|
34
34
|
}
|
|
35
35
|
.icon {
|
|
36
|
-
font-size:
|
|
36
|
+
font-size: 18px;
|
|
37
37
|
color: @primary-color;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -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
|
-
{
|
|
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
|
-
|
|
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 = '日常运动水平';
|
|
@@ -245,13 +278,25 @@ const selectTag = (item, type) => {
|
|
|
245
278
|
dialogInfo.value[type].push(item);
|
|
246
279
|
}
|
|
247
280
|
};
|
|
281
|
+
|
|
282
|
+
const selectSport = (item) => {
|
|
283
|
+
dialogInfo.value.sport = item.name;
|
|
284
|
+
handleConfirm();
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
const selectSex = (item) => {
|
|
288
|
+
dialogInfo.value.sex = item;
|
|
289
|
+
handleConfirm();
|
|
290
|
+
};
|
|
248
291
|
</script>
|
|
249
292
|
|
|
250
293
|
<template>
|
|
251
294
|
<div class="pf_wrap">
|
|
252
295
|
<div class="pf_form">
|
|
253
296
|
<div v-for="item in pfForm" :key="item.key" class="pf_row">
|
|
254
|
-
<div class="title"
|
|
297
|
+
<div class="title" :class="{ is_required: item.required }">
|
|
298
|
+
{{ item.label }}
|
|
299
|
+
</div>
|
|
255
300
|
<div class="content" @click="handleSelect(item)">
|
|
256
301
|
<span
|
|
257
302
|
class="text_row"
|
|
@@ -269,7 +314,7 @@ const selectTag = (item, type) => {
|
|
|
269
314
|
:class="{ disabled: !isValid }"
|
|
270
315
|
@click.stop="handleSubmit"
|
|
271
316
|
>
|
|
272
|
-
|
|
317
|
+
按身体数据领取7天食谱
|
|
273
318
|
</div>
|
|
274
319
|
</div>
|
|
275
320
|
|
|
@@ -283,13 +328,13 @@ const selectTag = (item, type) => {
|
|
|
283
328
|
<div v-if="dialogInfo.key === 'sex'" class="sex_wrap">
|
|
284
329
|
<div
|
|
285
330
|
:class="{ sex: true, selected: dialogInfo.sex === '男' }"
|
|
286
|
-
@click="
|
|
331
|
+
@click.stop="selectSex('男')"
|
|
287
332
|
>
|
|
288
333
|
男
|
|
289
334
|
</div>
|
|
290
335
|
<div
|
|
291
336
|
:class="{ sex: true, selected: dialogInfo.sex === '女' }"
|
|
292
|
-
@click="
|
|
337
|
+
@click.stop="selectSex('女')"
|
|
293
338
|
>
|
|
294
339
|
女
|
|
295
340
|
</div>
|
|
@@ -298,10 +343,13 @@ const selectTag = (item, type) => {
|
|
|
298
343
|
v-if="['age', 'height', 'weight'].includes(dialogInfo.key)"
|
|
299
344
|
class="input_wrap"
|
|
300
345
|
>
|
|
301
|
-
<
|
|
346
|
+
<Field
|
|
302
347
|
v-model="dialogInfo[dialogInfo.key]"
|
|
303
348
|
class="input"
|
|
304
|
-
type="
|
|
349
|
+
:type="dialogInfo.type"
|
|
350
|
+
:min="dialogInfo.min"
|
|
351
|
+
:max="dialogInfo.max"
|
|
352
|
+
@keyup.enter="handleConfirm"
|
|
305
353
|
placeholder="请输入"
|
|
306
354
|
/>
|
|
307
355
|
<div class="unit">{{ dialogInfo.unit }}</div>
|
|
@@ -311,7 +359,7 @@ const selectTag = (item, type) => {
|
|
|
311
359
|
v-for="item in sportList"
|
|
312
360
|
:key="item.key"
|
|
313
361
|
:class="{ row: true, selected: dialogInfo.sport === item.name }"
|
|
314
|
-
@click.stop="
|
|
362
|
+
@click.stop="selectSport(item)"
|
|
315
363
|
>
|
|
316
364
|
<div class="name">{{ item.name }}</div>
|
|
317
365
|
<div class="sub">{{ item.sub }}</div>
|
|
@@ -360,6 +408,7 @@ const selectTag = (item, type) => {
|
|
|
360
408
|
|
|
361
409
|
&_row {
|
|
362
410
|
display: flex;
|
|
411
|
+
gap: 6px;
|
|
363
412
|
flex-direction: row;
|
|
364
413
|
align-items: center;
|
|
365
414
|
justify-content: space-between;
|
|
@@ -374,6 +423,19 @@ const selectTag = (item, type) => {
|
|
|
374
423
|
.title {
|
|
375
424
|
font-size: 14px;
|
|
376
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
|
+
}
|
|
377
439
|
}
|
|
378
440
|
|
|
379
441
|
.content {
|
|
@@ -391,7 +453,7 @@ const selectTag = (item, type) => {
|
|
|
391
453
|
display: inline-block;
|
|
392
454
|
font-size: 14px;
|
|
393
455
|
text-align: right;
|
|
394
|
-
width:
|
|
456
|
+
width: 156px;
|
|
395
457
|
text-overflow: ellipsis;
|
|
396
458
|
white-space: nowrap;
|
|
397
459
|
overflow: hidden;
|
|
@@ -455,6 +517,10 @@ const selectTag = (item, type) => {
|
|
|
455
517
|
width: 200px;
|
|
456
518
|
outline: none;
|
|
457
519
|
border: none;
|
|
520
|
+
margin: auto;
|
|
521
|
+
/deep/ .van-field__control {
|
|
522
|
+
text-align: center;
|
|
523
|
+
}
|
|
458
524
|
}
|
|
459
525
|
.unit {
|
|
460
526
|
font-size: 15px;
|