diff --git a/src/assets/css/main.scss b/src/assets/css/main.scss index 603da52..cb69b36 100644 --- a/src/assets/css/main.scss +++ b/src/assets/css/main.scss @@ -3,6 +3,16 @@ @import 'vant'; @import '../../fonts/moblie/iconfont.css'; +$theme-color: #70b936; + +::v-deep .theme-color { + color: $theme-color; +} + +::v-deep .theme-back-color { + background-color: $theme-color; +} + a, .green { padding: 3px; diff --git a/src/components/YLPicker.vue b/src/components/YLPicker.vue index a172ec1..1e98e52 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/components/contenteditable.vue b/src/components/contenteditable.vue index cf0b12a..c689936 100644 --- a/src/components/contenteditable.vue +++ b/src/components/contenteditable.vue @@ -134,6 +134,7 @@ onMounted(() => { bottom: 0; left: 0; z-index: 2008; + display: flex; width: 100%; height: 40px; padding: 0 10px; diff --git a/src/main.ts b/src/main.ts index 676ac4d..b195972 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import './assets/css/main.scss'; +import '@/assets/css/main.scss'; import 'amfe-flexible'; import { createApp } from 'vue'; import { createPinia } from 'pinia'; diff --git a/src/utils/public.js b/src/utils/public.js new file mode 100644 index 0000000..a9b4b7c --- /dev/null +++ b/src/utils/public.js @@ -0,0 +1,12 @@ +// 根据是否是每页一体 处理成不同的结构类型 +export function getPages(questions, isOnePageOneQuestion) { + const pages = []; + questions.map((item) => { + if (isOnePageOneQuestion === 1) { + pages.push([item.question_index]); + } else { + pages.push(item.question_index); + } + }); + return isOnePageOneQuestion === 1 ? pages : [pages]; +} diff --git a/src/views/Design/Index.vue b/src/views/Design/Index.vue index d0e7121..ef7a969 100644 --- a/src/views/Design/Index.vue +++ b/src/views/Design/Index.vue @@ -15,6 +15,7 @@ :index="index" :chooseQuestionId="chooseQuestionId" @get-choose-question-id="getChooseQuestionId" + @move="emitFun.move" > + + @@ -295,6 +298,14 @@ const actionFun = { } }; +// emit 事件 + +const emitFun = { + move: (ev) => { + console.log(ev); + } +}; + onMounted(() => { questionInfo.value = store.questionsInfo.value; }); diff --git a/src/views/Design/components/ActionCompoents/QuestionAction.vue b/src/views/Design/components/ActionCompoents/QuestionAction.vue index a9fce0c..43440c2 100644 --- a/src/views/Design/components/ActionCompoents/QuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/QuestionAction.vue @@ -158,6 +158,8 @@ const deleteQuestion = () => { }); }; +// emit +const emit = defineEmits(['move', 'copy']); // 打开题目弹窗 const openQuestionActionModel = () => { show.value = true; @@ -166,6 +168,7 @@ const openQuestionActionModel = () => { const openQuestionSettingModel = () => { questionShow.value = true; }; + // 题目上下移动 const questionMove = (action) => { if (action.action === 'down') { @@ -175,6 +178,8 @@ 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) { return; @@ -182,6 +187,7 @@ 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', 'up'); } else { // 复制 题目 生成新的id 更新最新的 last index const temp = questions.value[props.questionIndex]; @@ -191,6 +197,7 @@ const questionMove = (action) => { question_index: questionsInfo.value.survey.last_question_index + 1 }); questionsInfo.value.survey.last_question_index += 1; + emit('copy', 'down'); } }; diff --git a/src/views/Design/components/ChooseQuestion.vue b/src/views/Design/components/ChooseQuestion.vue index 2a8eef2..1efbc81 100644 --- a/src/views/Design/components/ChooseQuestion.vue +++ b/src/views/Design/components/ChooseQuestion.vue @@ -17,20 +17,10 @@ v-model:data="element" :questions="questions" :questionIndex="index" + @move="emit('move', $event)" + @copy="emit('copy', $event)" > - - - - - - - - - - - - @@ -59,70 +49,14 @@ const props = defineProps({ } }); const element = ref(props.element); - // 选中题目后出现的操作 -// const questionAction = ref([ -// { -// icon: '', -// name: '编辑', -// key: 'edit', -// class: '' -// }, -// { -// icon: '', -// name: '复制', -// key: 'copy', -// class: '' -// }, -// { -// icon: '', -// name: '移动', -// key: 'moveUp', -// class: 'moverQues' -// }, -// // { -// // icon:'', -// // name:'下移', -// // key:'moveDown', -// // class:'' -// // }, -// { -// icon: '', -// name: '删除', -// key: 'delete', -// class: '' -// } -// ]); -const emit = defineEmits(['getChooseQuestionId']); +const emit = defineEmits(['getChooseQuestionId', 'move', 'copy']); // 选中题目 const chooseItem = () => { // 使用从 defineProps 接收的 element 对象 emit('getChooseQuestionId', props.element); }; - -// const itemAction = (item) => { -// switch (item.key) { -// case 'edit': -// // vue router跳转到/edit -// -// router.push({ -// path: '/design/edit', -// query: { -// id: props.element.id -// } -// }); -// break; -// case 'copy': -// break; -// case 'moveUp': -// break; -// case 'moveDown': -// break; -// case 'delete': -// break; -// } -// };