From 03f79ee66ad8b90b1fbbceac1f801011c8e210ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=98=B1=E8=BE=BE?= Date: Fri, 21 Mar 2025 17:59:15 +0800 Subject: [PATCH] =?UTF-8?q?fix(Design):=20=E4=BF=AE=E5=A4=8D=E4=B8=8A?= =?UTF-8?q?=E4=BC=A0=E7=BB=84=E4=BB=B6=E6=9C=80=E5=B0=8F=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E6=9C=80=E5=A4=A7=E6=95=B0=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 van-field 组件的 type 从 "number" 改为 "digit",以限制输入为非负整数 - 添加 minMax 函数,在输入最小数量时同步更新最大数量 - 在最小数量输入框失焦时调用 minMax 函数,并触发保存选项事件 --- src/utils/request.js | 71 +++++++++---------- src/views/Design/Index.vue | 6 +- .../CheckboxQuestionAction.vue | 13 +++- .../FieldUploadQuestionAction.vue | 13 +++- .../MartrixQuestionAction.vue | 14 +++- .../Design/components/Questions/Choice.vue | 4 +- 6 files changed, 68 insertions(+), 53 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index 0d3daef..183d93c 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,5 +1,4 @@ import axios from 'axios'; -import { showToast } from 'vant'; // import router from '@/router/index'; // import { A_COMMON_CLEAR_TOKEN } from '@/stores/constance/constance.common.js'; @@ -56,45 +55,39 @@ service.interceptors.response.use( return Promise.resolve(response); } // return Promise.reject(/* new Error(response.message || 'Error') */); - }, - (error) => { - // for debug - // if (error.response.status === 401) { - // const query = router.currentRoute.value.query; - // //关闭已弹出的所有弹框,防止弹框重叠 - // // Modal.destroyAll(); - // store.dispatch(A_COMMON_CLEAR_TOKEN); - // window.parent.postMessage( - // { - // code: '301', - // params: {} - // }, - // '*' - // ); - // store.commit('common/M_COMMON_SET_TOKEN_UNAUTHORIZED', false); - // } else if (error.response.status === 403) { - // router.push({ - // path: '/error/403' - // }); - // } else if (error.response.status === 404) { - // router.push({ - // path: '/error/404' - // }); - // } else if (error.response.status === 500) { - // router.push({ - // path: '/error/500' - // }); - // } else { - // // message.error(error.response.data?.message || '服务器错误'); - // } - if (error.response.data?.message) { - showToast({ - message: error.response.data?.message - }); - } - - return Promise.reject(error.response); } + // (error) => { + // // for debug + // if (error.response.status === 401) { + // const query = router.currentRoute.value.query; + // //关闭已弹出的所有弹框,防止弹框重叠 + // // Modal.destroyAll(); + // store.dispatch(A_COMMON_CLEAR_TOKEN); + // window.parent.postMessage( + // { + // code: '301', + // params: {} + // }, + // '*' + // ); + // store.commit('common/M_COMMON_SET_TOKEN_UNAUTHORIZED', false); + // } else if (error.response.status === 403) { + // router.push({ + // path: '/error/403' + // }); + // } else if (error.response.status === 404) { + // router.push({ + // path: '/error/404' + // }); + // } else if (error.response.status === 500) { + // router.push({ + // path: '/error/500' + // }); + // } else { + // // message.error(error.response.data?.message || '服务器错误'); + // } + // return Promise.reject(error.response); + // } ); export default service; diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index 780c631..5458e95 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -271,15 +271,15 @@ const debouncedSaveQueItem = debounce((logics, newVal) => { }; }); // 保存全部 更新title - saveQueItem(questionInfo.value.logics, questionCopy); + // saveQueItem(questionInfo.value.logics, questionCopy); } }, 1000); // 在 watch 回调中调用这个已经防抖过的函数 watch( () => questionInfo.value.questions, - (newVal) => { - debouncedSaveQueItem(questionInfo.value.logics, newVal); + () => { + // debouncedSaveQueItem(questionInfo.value.logics, newVal); }, { deep: true } ); diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue index b31fbe1..fc7272c 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue @@ -3,13 +3,13 @@ { + if (Number(e.target.value) > Number(actionQuestion.value.config.max_select)) { + actionQuestion.value.config.min_select = actionQuestion.value.config.max_select; + } + emit('saveOption'); +};