diff --git a/package-lock.json b/package-lock.json index 24957ab..0f39627 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "axios": "^1.8.2", "dotenv": "^16.4.7", "element-plus": "^2.7.8", + "js-base64": "^3.7.7", "lodash": "^4.17.21", "pinia": "^2.1.7", "sortablejs": "^1.15.6", @@ -7676,6 +7677,11 @@ "node": ">= 0.4" } }, + "node_modules/js-base64": { + "version": "3.7.7", + "resolved": "https://registry.npmmirror.com/js-base64/-/js-base64-3.7.7.tgz", + "integrity": "sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw==" + }, "node_modules/js-tokens": { "version": "4.0.0", "dev": true, diff --git a/package.json b/package.json index a2c9510..acb3df2 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "axios": "^1.8.2", "dotenv": "^16.4.7", "element-plus": "^2.7.8", + "js-base64": "^3.7.7", "lodash": "^4.17.21", "pinia": "^2.1.7", "sortablejs": "^1.15.6", diff --git a/src/api/design/index.js b/src/api/design/index.js index a01a619..11acd83 100644 --- a/src/api/design/index.js +++ b/src/api/design/index.js @@ -16,8 +16,7 @@ export function saveQuestion(params) { export function sync(params) { return request({ url: `console/surveys/${params.sn}/sync`, - method: 'post', - data: params + method: 'get' }); } export function questionDetails(params) { @@ -29,3 +28,18 @@ export function questionDetails(params) { data: params }); } + +// 获取setting +export function getSetting(params) { + return request({ + url: `/console/surveys/${params.sn}/answer_setting`, + method: 'get' + }); +} +export function saveSettings(params) { + return request({ + url: `/console/surveys/${params.sn}/answer_setting`, + method: 'put', + data: params + }); +} diff --git a/src/components/YLPicker.vue b/src/components/YLPicker.vue index 1e98e52..a172ec1 100644 --- a/src/components/YLPicker.vue +++ b/src/components/YLPicker.vue @@ -167,8 +167,8 @@ const getMaxDateLimit = computed(() => { props.format ); const tempStr = '0000-12-31 23:59:59'; - const result - = props.maxDate.length !== 0 && thisMax.length > props.maxDate.length + const result = + props.maxDate.length !== 0 && thisMax.length > props.maxDate.length ? thisMax.slice(0, props.maxDate.length) + tempStr.slice(props.maxDate.length) : thisMax; return result.slice(0, props.format.length); @@ -191,8 +191,8 @@ function onChange({ selectedValues, columnIndex }) { renderMinuteColumns, renderSecondColumns ]; - updateColumns[columnIndex] - && updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false); + updateColumns[columnIndex] && + updateColumns[columnIndex](changeValue, getMinDateLimit.value, getMaxDateLimit.value, false); } // 渲染全部列 diff --git a/src/stores/modules/common.ts b/src/stores/modules/common.ts index bc77f9d..4f214ff 100644 --- a/src/stores/modules/common.ts +++ b/src/stores/modules/common.ts @@ -70,9 +70,13 @@ export const useCommonStore = defineStore('common', { } }, setQuestionInfo(questionInfo) { - console.log(questionInfo, 9998); - console.log(this); - this.questionsInfo = questionInfo; + // 保持原有响应式引用,仅更新变化的部分 + this.questionsInfo = Object.assign({}, this.questionsInfo, questionInfo); + + // 对嵌套结构特殊处理(如数组需要保持引用) + if (questionInfo.questions) { + this.questionsInfo.questions = [...questionInfo.questions]; + } } }, getters: { diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index 4e30306..d0e7121 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -121,7 +121,7 @@