ai-chat-bot-interface 1.6.11 → 1.6.13

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.11",
4
+ "version": "1.6.13",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
7
  "description": "A AI chat bot interface. (private)",
@@ -119,9 +119,13 @@ const contentRef = ref(null); // 用于引用内容 DOM 元素
119
119
  const contentHeight = ref(0); // 存储内容的实际高度
120
120
 
121
121
  onMounted(() => {
122
- contentHeight.value = hasDetails.value ? contentRef.value.scrollHeight : 0;
122
+ getContentHeight();
123
123
  });
124
124
 
125
+ const getContentHeight = () => {
126
+ contentHeight.value = hasDetails.value ? contentRef.value.scrollHeight : 0;
127
+ };
128
+
125
129
  // const Emits = defineEmits(['update:open']);
126
130
 
127
131
  const subStr = computed(() => {
@@ -151,6 +155,9 @@ const previewImg = (url) => {
151
155
  };
152
156
 
153
157
  const switchOpen = () => {
158
+ if (!isOpen.value) {
159
+ getContentHeight();
160
+ }
154
161
  isOpen.value = !isOpen.value;
155
162
  };
156
163
 
@@ -177,6 +177,8 @@
177
177
  }
178
178
  }
179
179
  &_ai_tips {
180
+ height: 24px;
181
+ line-height: 10px;
180
182
  text-align: center;
181
183
  font-size: 10px;
182
184
  color: #bbb;
@@ -148,7 +148,7 @@ const handleSelect = (item) => {
148
148
  dialogInfo.value.dialogHeight = '240px';
149
149
  dialogInfo.value.unit = item.unit;
150
150
  dialogInfo.value.age = item.value;
151
- dialogInfo.value.min = 0;
151
+ dialogInfo.value.min = 6;
152
152
  dialogInfo.value.max = 100;
153
153
  dialogInfo.value.type = 'number';
154
154
  break;
@@ -157,8 +157,8 @@ const handleSelect = (item) => {
157
157
  dialogInfo.value.dialogHeight = '240px';
158
158
  dialogInfo.value.unit = item.unit;
159
159
  dialogInfo.value.height = item.value;
160
- dialogInfo.value.min = 0;
161
- dialogInfo.value.max = 300;
160
+ dialogInfo.value.min = 100;
161
+ dialogInfo.value.max = 220;
162
162
  dialogInfo.value.type = 'digit';
163
163
  break;
164
164
  case 'weight':
@@ -166,8 +166,8 @@ const handleSelect = (item) => {
166
166
  dialogInfo.value.dialogHeight = '240px';
167
167
  dialogInfo.value.unit = item.unit;
168
168
  dialogInfo.value.weight = item.value;
169
- dialogInfo.value.min = 0;
170
- dialogInfo.value.max = 300;
169
+ dialogInfo.value.min = 10;
170
+ dialogInfo.value.max = 150;
171
171
  dialogInfo.value.type = 'digit';
172
172
  break;
173
173
  case 'sport':
@@ -250,17 +250,35 @@ const handleSubmit = () => {
250
250
  showToast('请填写完整信息');
251
251
  return;
252
252
  }
253
+
254
+ const ageIdx = pfForm.value.findIndex((item) => item.key === 'age');
255
+ const heightIdx = pfForm.value.findIndex((item) => item.key === 'height');
256
+ const weightIdx = pfForm.value.findIndex((item) => item.key === 'weight');
257
+
258
+ if (pfForm.value[ageIdx].value < 6 || pfForm.value[ageIdx].value > 100) {
259
+ showToast('年龄需要在6-100岁');
260
+ return;
261
+ }
262
+ if (
263
+ pfForm.value[heightIdx].value < 100 ||
264
+ pfForm.value[heightIdx].value > 220
265
+ ) {
266
+ showToast('身高需要在100-220cm');
267
+ return;
268
+ }
269
+ if (
270
+ pfForm.value[weightIdx].value < 10 ||
271
+ pfForm.value[weightIdx].value > 150
272
+ ) {
273
+ showToast('体重需要在10-150kg');
274
+ return;
275
+ }
276
+
253
277
  localStorage.setItem('personalInfo', JSON.stringify(pfForm.value));
254
278
  const msg = `性别:${pfForm.value.find((item) => item.key === 'sex').value};
255
- 年龄:${pfForm.value.find((item) => item.key === 'age').value}${
256
- pfForm.value.find((item) => item.key === 'age').unit || ''
257
- };
258
- 身高:${pfForm.value.find((item) => item.key === 'height').value}${
259
- pfForm.value.find((item) => item.key === 'height').unit || ''
260
- };
261
- 体重:${pfForm.value.find((item) => item.key === 'weight').value}${
262
- pfForm.value.find((item) => item.key === 'weight').unit || ''
263
- };
279
+ 年龄:${pfForm.value[ageIdx].value}${pfForm.value[ageIdx].unit || ''}
280
+ 身高:${pfForm.value[heightIdx].value}${pfForm.value[heightIdx].unit || ''};
281
+ 体重:${pfForm.value[weightIdx].value}${pfForm.value[weightIdx].unit || ''}
264
282
  日常运动水平:${pfForm.value.find((item) => item.key === 'sport').value};
265
283
  口味偏好及饮食禁忌:${
266
284
  pfForm.value.find((item) => item.key === 'taste').value
@@ -509,9 +527,10 @@ const selectSex = (item) => {
509
527
  &_wrap {
510
528
  text-align: center;
511
529
  padding: 20px 0;
530
+
512
531
  .input {
513
- height: 50px;
514
- line-height: 50px;
532
+ height: 64px;
533
+ line-height: 64px;
515
534
  font-size: 36px;
516
535
  text-align: center;
517
536
  width: 200px;