diff --git a/components.d.ts b/components.d.ts index f8ab87f..be642d8 100644 --- a/components.d.ts +++ b/components.d.ts @@ -40,6 +40,7 @@ declare module 'vue' { VanRadioGroup: typeof import('vant/es')['RadioGroup'] VanRow: typeof import('vant/es')['Row'] VanSearch: typeof import('vant/es')['Search'] + VanStep: typeof import('vant/es')['Step'] VanStepper: typeof import('vant/es')['Stepper'] VanSwitch: typeof import('vant/es')['Switch'] VanTab: typeof import('vant/es')['Tab'] diff --git a/src/api/design/index.js b/src/api/design/index.js index 6e23209..a58ce9b 100644 --- a/src/api/design/index.js +++ b/src/api/design/index.js @@ -43,3 +43,10 @@ export function saveSettings(params) { data: params }); } +export function saveProjectName(sn, params) { + return request({ + url: `/console/surveys/${sn}/project_name`, + method: 'PATCH', + data: params + }); +} diff --git a/src/assets/css/public.scss b/src/assets/css/public.scss index a557ca5..3734a0f 100644 --- a/src/assets/css/public.scss +++ b/src/assets/css/public.scss @@ -224,7 +224,7 @@ } input { - outline-color: transparent; + outline: none; } .el-input__wrapper, diff --git a/src/views/Design/components/ActionCompoents/QuestionAction.vue b/src/views/Design/components/ActionCompoents/QuestionAction.vue index c54de64..4414c7e 100644 --- a/src/views/Design/components/ActionCompoents/QuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/QuestionAction.vue @@ -235,7 +235,6 @@ const questionMove = (action) => { const temp = questions.value[props.questionIndex]; questions.value.splice(props.questionIndex, 1); questions.value.splice(props.questionIndex + 1, 0, temp); - emit('move', 'down'); } else if (action.action === 'up') { if (props.questionIndex === 0) { @@ -247,14 +246,12 @@ const questionMove = (action) => { emit('move', 'up'); } else { // 复制 题目 生成新的id 更新最新的 last index - const temp = questions.value[props.questionIndex]; - + const temp = JSON.parse(JSON.stringify(questions.value[props.questionIndex])); const newQuestion = { ...temp, id: uuidv4(), question_index: questionsInfo.value.survey.last_question_index + 1 }; - questions.value.splice(props.questionIndex + 1, 0, newQuestion); questionsInfo.value.survey.last_question_index += 1; emit('copy', newQuestion); diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue index 1663f58..b31fbe1 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CheckboxQuestionAction.vue @@ -12,10 +12,13 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min_select = Number(value); + actionQuestion.config.min_select = value; } " > + + + @@ -31,7 +34,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.max_select = Number(value); + actionQuestion.config.max_select = value; } " > diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CompletionQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CompletionQuestionAction.vue index 4aa4e19..d4fe323 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CompletionQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/CompletionQuestionAction.vue @@ -29,7 +29,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.line_height = Number(value); + actionQuestion.config.line_height = value; } " > @@ -52,7 +52,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.line_height = Number(value); + actionQuestion.config.line_height = value; } " > @@ -90,7 +90,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min = Number(value); + actionQuestion.config.min = value; } " > @@ -110,7 +110,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.max = Number(value); + actionQuestion.config.max = value; } " > @@ -151,7 +151,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.line_height = Number(value); + actionQuestion.config.line_height = value; } " > @@ -170,7 +170,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.line_height = Number(value); + actionQuestion.config.line_height = value; } " > diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/FieldUploadQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/FieldUploadQuestionAction.vue index 6572557..8aa07c4 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/FieldUploadQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/FieldUploadQuestionAction.vue @@ -12,7 +12,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min_number = Number(value); + actionQuestion.config.min_number = value; } " > @@ -31,7 +31,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.max_number = Number(value); + actionQuestion.config.max_number = value; } " > @@ -53,7 +53,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min_size = Number(value); + actionQuestion.config.min_size = value; } " > @@ -72,7 +72,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.max_size = Number(value); + actionQuestion.config.max_size = value; } " > diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/MartrixQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/MartrixQuestionAction.vue index dfd2485..677a7d5 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/MartrixQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/MartrixQuestionAction.vue @@ -25,7 +25,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min_select = Number(value); + actionQuestion.config.min_select = value; } " > @@ -95,7 +95,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.min_select = Number(value); + actionQuestion.config.min_select = value; } " > @@ -114,7 +114,7 @@ @blur="emit('saveOption')" @update:model-value=" (value) => { - actionQuestion.config.max_select = Number(value); + actionQuestion.config.max_select = value; } " > diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue index 4b9a9e8..2d296e2 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue @@ -120,14 +120,14 @@ function emitInfo() { } function intervalChange(value) { - localConfig.value.score_interval = Number(value) === 0 ? 1 : Number(value); + localConfig.value.score_interval = value === 0 ? 1 : value; setDefaultMax(); emitInfo(); } const minChange = (value) => { const oldMax = Number(props.config.min); - localConfig.value.min = Number(value); + localConfig.value.min = value; if (localConfig.value.min > localConfig.value.max) { localConfig.value.min = oldMax; } @@ -137,7 +137,7 @@ const minChange = (value) => { function maxChange(value) { const oldMax = Number(props.config.max); - localConfig.value.max = Number(value); + localConfig.value.max = value; if (!isSurplus()) { localConfig.value.max = oldMax; } diff --git a/src/views/Design/components/Questions/MartrixQuestion.vue b/src/views/Design/components/Questions/MartrixQuestion.vue index 5fa266d..2600b0a 100644 --- a/src/views/Design/components/Questions/MartrixQuestion.vue +++ b/src/views/Design/components/Questions/MartrixQuestion.vue @@ -4,16 +4,21 @@ import MatrixCheckbox from '@/views/Design/components/Questions/MatrixCheckbox.v import MatrixText from '@/views/Design/components/Questions/MatrixText.vue'; import MatrixRadio from '@/views/Design/components/Questions/MatrixRadio.vue'; -const question = defineModel('element', { default: () => ({}), required: false }); +const question = defineModel('element', { + type: Object, + default: () => { + return {}; + } +}); // eslint-disable-next-line const activeComponent = computed(() => { switch (question.value.question_type) { - case 8: - return MatrixText; - case 9: - return MatrixRadio; - case 10: - return MatrixCheckbox; + case 8: + return MatrixText; + case 9: + return MatrixRadio; + case 10: + return MatrixCheckbox; } }); @@ -33,30 +38,33 @@ console.log(rows.value, cols.value); active: boolean; }>(); +const emit = defineEmits(['update:element']); const emitValue = () => { - emit('update:element', element.value); + console.log(question.value); + emit('update:element', question.value); }; - diff --git a/src/views/Design/components/Questions/MatrixCheckbox.vue b/src/views/Design/components/Questions/MatrixCheckbox.vue index d4053f7..188bee7 100644 --- a/src/views/Design/components/Questions/MatrixCheckbox.vue +++ b/src/views/Design/components/Questions/MatrixCheckbox.vue @@ -26,6 +26,7 @@ - + diff --git a/src/views/Design/components/Questions/MatrixRadio.vue b/src/views/Design/components/Questions/MatrixRadio.vue index 2063cb2..180ab98 100644 --- a/src/views/Design/components/Questions/MatrixRadio.vue +++ b/src/views/Design/components/Questions/MatrixRadio.vue @@ -24,6 +24,7 @@ { }; - + diff --git a/src/views/Design/components/Questions/MatrixText.vue b/src/views/Design/components/Questions/MatrixText.vue index 3b7a620..4efdb53 100644 --- a/src/views/Design/components/Questions/MatrixText.vue +++ b/src/views/Design/components/Questions/MatrixText.vue @@ -26,6 +26,7 @@ - + diff --git a/src/views/Survey/views/Create/Index.vue b/src/views/Survey/views/Create/Index.vue index c8655cd..de2e58a 100644 --- a/src/views/Survey/views/Create/Index.vue +++ b/src/views/Survey/views/Create/Index.vue @@ -350,7 +350,8 @@ import { saveQuestion, snQuestions, sync, - saveSettings + saveSettings, + saveProjectName } from '@/api/design/index'; import Design from '@/views/Design/Index.vue'; import { useCounterStore } from '@/stores/counter'; @@ -419,6 +420,10 @@ const saveTitle = () => { sn: route.query.sn, title: questionInfo.value.survey.title, introduction: questionInfo.value.survey.introduction + }).then((res) => { + if (res.data) { + saveProjectName(route.query.sn, { project_name: questionInfo.value.survey.title }); + } }); }; @@ -436,14 +441,14 @@ const questionEvent = (item) => { options: item.json.options.length > 0 ? item.json.options.map((item) => { - return item.map((it) => { - return { - ...it, - // 主键生成 - id: uuidv4() - }; - }); - }) + return item.map((it) => { + return { + ...it, + // 主键生成 + id: uuidv4() + }; + }); + }) : [] }) ); @@ -580,7 +585,7 @@ const previewQuestion = () => { router.push({ name: 'preview', query: { ...route.query } }); }; -onMounted(async() => { +onMounted(async () => { await getQuestionDetail(); });