diff --git a/components.d.ts b/components.d.ts index bb994ba..a50d18f 100644 --- a/components.d.ts +++ b/components.d.ts @@ -32,6 +32,7 @@ declare module 'vue' { VanGrid: typeof import('vant/es')['Grid'] VanGridItem: typeof import('vant/es')['GridItem'] VanIcon: typeof import('vant/es')['Icon'] + VanList: typeof import('vant/es')['List'] VanNavBar: typeof import('vant/es')['NavBar'] VanPicker: typeof import('vant/es')['Picker'] VanPopup: typeof import('vant/es')['Popup'] diff --git a/src/App.vue b/src/App.vue index 1301bf3..aee81b0 100644 --- a/src/App.vue +++ b/src/App.vue @@ -4,7 +4,7 @@ import { onMounted } from 'vue'; import appBridge from '@/assets/js/appBridge'; import utils from '@/assets/js/common'; -onMounted(async() => { +onMounted(async () => { if (utils.getParameter('digitalYiliToken')) { // 隐藏/显示 header appBridge.setHeaderShown(false); diff --git a/src/api/common.js b/src/api/common.js index 1c90620..fc4dfe9 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -85,9 +85,9 @@ export default class CommonApi { }; /* eslint-disable no-useless-escape */ const reg = /\\|\/|\?|\?|\*|"|“|”|'|‘|’|<|>|{|}|\[|\]|\【|\】|:|:|、|\^|\$|!|~|`|\s|\+/g; - name - = name - || getRandomFileName(file?.name?.replace(reg, '') ?? '' ?? `${new Date().getTime()}.png`); + name = + name || + getRandomFileName(file?.name?.replace(reg, '') ?? '' ?? `${new Date().getTime()}.png`); const res = await CommonApi.getOssInfo(); /* eslint-enable no-useless-escape */ diff --git a/src/api/home/index.js b/src/api/home/index.js index fc236bb..0dd135f 100644 --- a/src/api/home/index.js +++ b/src/api/home/index.js @@ -65,3 +65,11 @@ export function deleteTemplate(sn) { method: 'delete' }); } +// 保存为模板 +export function saveTemplates(sn, data) { + return request({ + url: `/console/surveys/${sn}/templates`, + method: 'post', + data + }); +} diff --git a/src/assets/css/public.scss b/src/assets/css/public.scss index c1cc89a..db24ef4 100644 --- a/src/assets/css/public.scss +++ b/src/assets/css/public.scss @@ -224,3 +224,8 @@ color: $theme-color; } } +.el-dropdown-menu__item:not(.is-disabled):focus, +.el-dropdown-menu__item:not(.is-disabled):hover { + background-color: #fff !important; + color: #2dc26b !important; +} diff --git a/src/assets/img/publish/edit.png b/src/assets/img/publish/edit.png new file mode 100644 index 0000000..7135c4e Binary files /dev/null and b/src/assets/img/publish/edit.png differ diff --git a/src/assets/img/publish/end.png b/src/assets/img/publish/end.png new file mode 100644 index 0000000..4da6e51 Binary files /dev/null and b/src/assets/img/publish/end.png differ diff --git a/src/assets/img/publish/publish.png b/src/assets/img/publish/publish.png new file mode 100644 index 0000000..c9d6a54 Binary files /dev/null and b/src/assets/img/publish/publish.png differ diff --git a/src/components/YLPicker.vue b/src/components/YLPicker.vue index c5108d0..7e5cf8f 100644 --- a/src/components/YLPicker.vue +++ b/src/components/YLPicker.vue @@ -170,8 +170,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); @@ -194,8 +194,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 ca0cbd0..b49a89b 100644 --- a/src/components/contenteditable.vue +++ b/src/components/contenteditable.vue @@ -62,7 +62,7 @@ const functions = { document.execCommand('italic', false, null); }, - uploadImage: async() => { + uploadImage: async () => { // 保存当前光标位置 savedRange.value = saveSelection(); @@ -71,7 +71,7 @@ const functions = { fileInput.click(); - fileInput.onchange = async(e) => { + fileInput.onchange = async (e) => { const [file] = e.target.files; if (!file) return; if (file.size > 2 * 1024 * 1024) { diff --git a/src/fonts/demo.css b/src/fonts/demo.css index 12ec742..18e8077 100644 --- a/src/fonts/demo.css +++ b/src/fonts/demo.css @@ -4,11 +4,11 @@ src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') - format('embedded-opentype'), + format('embedded-opentype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') - format('svg'); + format('svg'); } .logo { diff --git a/src/fonts/moblie/demo.css b/src/fonts/moblie/demo.css index 12ec742..18e8077 100644 --- a/src/fonts/moblie/demo.css +++ b/src/fonts/moblie/demo.css @@ -4,11 +4,11 @@ src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834'); src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') - format('embedded-opentype'), + format('embedded-opentype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') - format('svg'); + format('svg'); } .logo { diff --git a/src/layouts/logic.js b/src/layouts/logic.js index dd6beaf..c121a41 100644 --- a/src/layouts/logic.js +++ b/src/layouts/logic.js @@ -376,39 +376,39 @@ export function isCross(range1, range2) { const isSibling = isLeft || isRight; // 逻辑包含循环 - const contain - = (isPlainSequence - && (((isNullish(start2) || isSequence(judge, start2, start1)) - && (isNullish(end2) || isSequence(judge, end2, start1))) - || ((isNullish(start2) || isSequence(start1, start2, end1)) - && (isNullish(end2) || isSequence(start1, end2, end1))))) - || (!isPlainSequence - && (judge < start1 - ? ((isNullish(start2) || isSequence(judge, start2, start1)) - && (isNullish(end2) || isSequence(judge, end2, start1))) - || ((isNullish(start2) || isSequence(start1, start2, end1)) - && (isNullish(end2) || isSequence(start1, end2, end1))) - : ((isNullish(start2) || isSequence(start1, start2, judge)) - && (isNullish(end2) || isSequence(start1, end2, judge))) - || ((isNullish(start2) || isSequence(judge, start2, end1)) - && (isNullish(end2) || isSequence(judge, end2, end1))))); + const contain = + (isPlainSequence && + (((isNullish(start2) || isSequence(judge, start2, start1)) && + (isNullish(end2) || isSequence(judge, end2, start1))) || + ((isNullish(start2) || isSequence(start1, start2, end1)) && + (isNullish(end2) || isSequence(start1, end2, end1))))) || + (!isPlainSequence && + (judge < start1 + ? ((isNullish(start2) || isSequence(judge, start2, start1)) && + (isNullish(end2) || isSequence(judge, end2, start1))) || + ((isNullish(start2) || isSequence(start1, start2, end1)) && + (isNullish(end2) || isSequence(start1, end2, end1))) + : ((isNullish(start2) || isSequence(start1, start2, judge)) && + (isNullish(end2) || isSequence(start1, end2, judge))) || + ((isNullish(start2) || isSequence(judge, start2, end1)) && + (isNullish(end2) || isSequence(judge, end2, end1))))); // 循环存在封闭区间,并且循环包含逻辑 - const contained - = !isNullish(start2) - && !isNullish(end2) + const contained = + !isNullish(start2) && + !isNullish(end2) && // [judge, start1, end1]; - && ((isPlainSequence && start2 <= judge && end1 <= end2) + ((isPlainSequence && start2 <= judge && end1 <= end2) || // [judge, start1, end1]; // [start1, judge, end1]; - || (!isPlainSequence && start2 <= start1 && start2 <= judge && end1 <= end2)); + (!isPlainSequence && start2 <= start1 && start2 <= judge && end1 <= end2)); // 循环不存在封闭区间 - const unCircled - = (!isNullish(start2) - && isNullish(end2) - && ((isPlainSequence && start2 === judge) || (!isPlainSequence && judge < start1) + const unCircled = + (!isNullish(start2) && + isNullish(end2) && + ((isPlainSequence && start2 === judge) || (!isPlainSequence && judge < start1) ? start2 === judge - : start2 === start1)) - || (isNullish(start2) && !isNullish(end2) && end2 === end1); + : start2 === start1)) || + (isNullish(start2) && !isNullish(end2) && end2 === end1); return !(isSibling || contain || contained || unCircled); } @@ -428,8 +428,8 @@ function isSequence(s1, s2, s3, equal) { * @param store */ export function updateNewQuestionsByLoopingEffect(quesSaveParam, store) { - const { questionInfoBeforeModified = {}, questionInfo = {} } - = JSON.parse(JSON.stringify(store.state.common)) || {}; + const { questionInfoBeforeModified = {}, questionInfo = {} } = + JSON.parse(JSON.stringify(store.state.common)) || {}; const oldPages = questionInfoBeforeModified.survey.pages; const newQuestions = questionInfo.questions; diff --git a/src/layouts/utils.js b/src/layouts/utils.js index 06fe828..d195998 100644 --- a/src/layouts/utils.js +++ b/src/layouts/utils.js @@ -43,13 +43,13 @@ function showModal(options) { * @param {*} data * @returns */ -const canPlanetPublishPSM = function(data) { +const canPlanetPublishPSM = function (data) { let isFb = true; let message = ''; let title = '题目设置未完成'; const incompleteQuestionList = []; - data.questions - && data.questions.forEach((s) => { + data.questions && + data.questions.forEach((s) => { if (s.question_type === 101 && s.config.price_gradient.length <= 0) { isFb = false; message = 'psm题目未完成设置,请设置价格区间后投放'; @@ -73,15 +73,15 @@ const canPlanetPublishPSM = function(data) { * @param {*} data * @returns */ -const canPlanetPublishMxdAndHotArea = function(data) { +const canPlanetPublishMxdAndHotArea = function (data) { let isFb = true; let message = ''; const qSteams = []; const incompleteQuestionList = []; let type = 0; let title = '题目设置未完成'; - data.questions - && data.questions.forEach((s) => { + data.questions && + data.questions.forEach((s) => { if (s.question_type === 105 && s.config.design_version <= 0) { isFb = false; message = 'maxdiff题目未完成设置,请生成设计后投放'; @@ -120,14 +120,14 @@ const canPlanetPublishMxdAndHotArea = function(data) { * @param {*} data * @returns */ -const canPlanetPublish3D = function(data) { +const canPlanetPublish3D = function (data) { { let canFB = true; let message = ''; const qSteams = []; let title = ''; - data.questions - && data.questions.forEach((s) => { + data.questions && + data.questions.forEach((s) => { if (QUESTION_TYPE.contains(s.question_type)) { try { if (s.config.is_three_dimensions && !s.config.scene) { @@ -157,15 +157,15 @@ const canPlanetPublish3D = function(data) { let message = ''; const qSteams = []; let title = ''; - data.questions - && data.questions.forEach((s) => { + data.questions && + data.questions.forEach((s) => { if (QUESTION_TYPE.contains(s.question_type)) { try { if (s.config.is_three_dimensions && s.config.is_binding_goods) { const wares = []; const _sceneInformation = s.config.scene_information; - const sceneInformation - = typeof _sceneInformation === 'string' + const sceneInformation = + typeof _sceneInformation === 'string' ? JSON.parse(_sceneInformation) : _sceneInformation; sceneInformation.shelves.forEach((shelf) => { @@ -215,14 +215,14 @@ const canPlanetPublish3D = function(data) { * @param {*} data * @returns */ -const canPlanetPublishImage = function(data) { +const canPlanetPublishImage = function (data) { { let canFB = true; let message = ''; const qSteams = []; let title = ''; - data.questions - && data.questions.forEach((s) => { + data.questions && + data.questions.forEach((s) => { if (s.question_type === 13) { try { if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) { @@ -317,8 +317,8 @@ function canPublishRandom(data, publishType) { if (!isValidated) { errors.push({ message: - field.message - || `请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"` + field.message || + `请填写"${random.title}"中第${index + 1}组"随机题组"的"${field.name}"` }); } }); @@ -397,11 +397,11 @@ function isLoopingLogicValid(data, publishType) { if ( (data?.cycle_pages || []).every((i) => { return ( - i.question_index - && i.relation_type !== undefined - && i.relation_type !== null - && i.first_page - && i.last_page + i.question_index && + i.relation_type !== undefined && + i.relation_type !== null && + i.first_page && + i.last_page ); }) ) { @@ -425,7 +425,7 @@ function isLoopingLogicValid(data, publishType) { * @param sn * @param publishType undefined投放;null投放;0投放;1预览;2投放;3测试 */ -export const canPlanetPublish = async function(sn, publishType) { +export const canPlanetPublish = async function (sn, publishType) { const parsedPublishType = !publishType ? 2 : publishType; const num = window.location.href.indexOf('code='); let code; diff --git a/src/request/api/modules/survey.ts b/src/request/api/modules/survey.ts index 24a3eba..c665a46 100644 --- a/src/request/api/modules/survey.ts +++ b/src/request/api/modules/survey.ts @@ -1,2 +1,2 @@ -export const surveyQuestion - = 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions'; +export const surveyQuestion = + 'https://yls-api-uat.dctest.digitalyili.com/api/console/surveys/RWNK9BYp/questions'; diff --git a/src/request/axios/index.ts b/src/request/axios/index.ts index bded0ab..9f947d0 100644 --- a/src/request/axios/index.ts +++ b/src/request/axios/index.ts @@ -39,10 +39,10 @@ service.interceptors.request.use( service.interceptors.response.use( (response) => { if ( - response.status === 200 - || response.status === 201 - || response.status === 202 - || response.status === 204 + response.status === 200 || + response.status === 201 || + response.status === 202 || + response.status === 204 ) { if (response.config.method === 'put') { // message.success('保存中...'); diff --git a/src/utils/request.js b/src/utils/request.js index 9f27953..22eaabf 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -45,10 +45,10 @@ service.interceptors.request.use( service.interceptors.response.use( (response) => { if ( - response.status === 200 - || response.status === 201 - || response.status === 202 - || response.status === 204 + response.status === 200 || + response.status === 201 || + response.status === 202 || + response.status === 204 ) { if (response.config.method === 'put') { // message.success('保存中...'); diff --git a/src/views/Design/components/ActionCompoents/OptionAction.vue b/src/views/Design/components/ActionCompoents/OptionAction.vue index 46b991b..0042287 100644 --- a/src/views/Design/components/ActionCompoents/OptionAction.vue +++ b/src/views/Design/components/ActionCompoents/OptionAction.vue @@ -134,23 +134,23 @@ const openOptionActionModel = (item, index) => { // 上下移动 const optionMove = (action) => { switch (action.action) { - case 'up': - if (activeIndex.value === 0) { - moveShow.value = false; - return false; - } - // 向上移动 - element.value.splice(activeIndex.value - 1, 0, element.value.splice(activeIndex.value, 1)[0]); - activeIndex.value -= 1; - break; - case 'down': - if (activeIndex.value === element.value.length - 1) { - moveShow.value = false; - return false; - } - element.value.splice(activeIndex.value + 1, 0, element.value.splice(activeIndex.value, 1)[0]); - activeIndex.value += 1; - break; + case 'up': + if (activeIndex.value === 0) { + moveShow.value = false; + return false; + } + // 向上移动 + element.value.splice(activeIndex.value - 1, 0, element.value.splice(activeIndex.value, 1)[0]); + activeIndex.value -= 1; + break; + case 'down': + if (activeIndex.value === element.value.length - 1) { + moveShow.value = false; + return false; + } + element.value.splice(activeIndex.value + 1, 0, element.value.splice(activeIndex.value, 1)[0]); + activeIndex.value += 1; + break; } }; diff --git a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue index 4b9a9e8..4c3be6e 100644 --- a/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue +++ b/src/views/Design/components/ActionCompoents/components/QuestionItemAction/RateQuestionAction.vue @@ -108,9 +108,9 @@ function isSurplus() { return false; } else { return ( - parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10)) - % parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10)) - === 0 + parseFloat(((localConfig.value.max - localConfig.value.min) * 1000).toFixed(4, 10)) % + parseFloat((localConfig.value.score_interval * 1000).toFixed(4, 10)) === + 0 ); } } diff --git a/src/views/Design/components/Questions/MartrixQuestion.vue b/src/views/Design/components/Questions/MartrixQuestion.vue index 0f91776..537389c 100644 --- a/src/views/Design/components/Questions/MartrixQuestion.vue +++ b/src/views/Design/components/Questions/MartrixQuestion.vue @@ -21,14 +21,14 @@ const { element } = toRefs(props); */ const tableInputTypeMapping = (/** regx?: any */) => { switch (element.value.question_type) { - case 8: - return 'text'; - case 9: - return 'radio'; - case 10: - return 'checkbox'; - default: - return 'radio'; + case 8: + return 'text'; + case 9: + return 'radio'; + case 10: + return 'checkbox'; + default: + return 'radio'; } }; diff --git a/src/views/Design/components/Questions/MatrixQuestion.vue b/src/views/Design/components/Questions/MatrixQuestion.vue index d2fb2c5..be7534f 100644 --- a/src/views/Design/components/Questions/MatrixQuestion.vue +++ b/src/views/Design/components/Questions/MatrixQuestion.vue @@ -23,14 +23,14 @@ const matrixAnswer = ref({ */ const tableInputTypeMapping = (/** regx?: any */) => { switch (element.question_type) { - case 8: - return 'text'; - case 9: - return 'radio'; - case 10: - return 'checkbox'; - default: - return 'radio'; + case 8: + return 'text'; + case 9: + return 'radio'; + case 10: + return 'checkbox'; + default: + return 'radio'; } }; @@ -67,55 +67,55 @@ function handleColNameChange(rowOption: string, colOption: string, e: any) { // 不同的 question_type 的 matrix 问卷处理不同的结果 switch (element.question_type) { - case 8: { - // 获取输入框元素 - const inputElement = e.target as HTMLInputElement; - // 如果没有获取到输入框元素,则直接返回 - if (!inputElement) return; - // 将输入框的值保存到 rowRecord 对应位置 - rowRecord[col] = e!.target!.value; - // 清空 matrixAnswer 的 answer 属性 - matrixAnswer.value.answer = {}; - // 遍历所有行选项 - element.options[0].forEach((_, rowIndex) => { - // 获取当前行记录 - const colOptions = rowRecord[rowIndex]; - // 如果当前行有记录,则更新 matrixAnswer 的 answer 属性 - if (colOptions) { - matrixAnswer.value.answer[`R${rowIndex + 1}_C${col + 1}`] = colOptions; - } - }); - break; - } - case 9: - // 将选择的行索引加1后保存到 rowRecord 对应位置 - rowRecord[col] = row + 1; - // 清空 matrixAnswer 的 answer 属性 - matrixAnswer.value.answer = {}; - // 遍历 rowRecord,更新 matrixAnswer 的 answer 属性 - rowRecord.forEach((row, index) => { - matrixAnswer.value.answer[`${index + 1}_${row}`] = 1; - }); - break; - case 10: - // 将选择的行索引加1后添加到 rowRecord 对应位置的数组中 - rowRecord[col] = (rowRecord[col] || []).concat(row + 1); - // 清空 matrixAnswer 的 answer 属性 - matrixAnswer.value.answer = {}; - // 遍历所有行选项 - element.options[0].forEach((rowOption, rowIndex) => { - // 获取当前行记录 - const colOptions = rowRecord[rowIndex]; - // 如果当前行有记录,则更新 matrixAnswer 的 answer 属性 - if (colOptions) { - colOptions.forEach((col: any) => { - matrixAnswer.value.answer[`R${rowIndex + 1}_C${col}`] = true; - }); - } - }); - break; - default: - break; + case 8: { + // 获取输入框元素 + const inputElement = e.target as HTMLInputElement; + // 如果没有获取到输入框元素,则直接返回 + if (!inputElement) return; + // 将输入框的值保存到 rowRecord 对应位置 + rowRecord[col] = e!.target!.value; + // 清空 matrixAnswer 的 answer 属性 + matrixAnswer.value.answer = {}; + // 遍历所有行选项 + element.options[0].forEach((_, rowIndex) => { + // 获取当前行记录 + const colOptions = rowRecord[rowIndex]; + // 如果当前行有记录,则更新 matrixAnswer 的 answer 属性 + if (colOptions) { + matrixAnswer.value.answer[`R${rowIndex + 1}_C${col + 1}`] = colOptions; + } + }); + break; + } + case 9: + // 将选择的行索引加1后保存到 rowRecord 对应位置 + rowRecord[col] = row + 1; + // 清空 matrixAnswer 的 answer 属性 + matrixAnswer.value.answer = {}; + // 遍历 rowRecord,更新 matrixAnswer 的 answer 属性 + rowRecord.forEach((row, index) => { + matrixAnswer.value.answer[`${index + 1}_${row}`] = 1; + }); + break; + case 10: + // 将选择的行索引加1后添加到 rowRecord 对应位置的数组中 + rowRecord[col] = (rowRecord[col] || []).concat(row + 1); + // 清空 matrixAnswer 的 answer 属性 + matrixAnswer.value.answer = {}; + // 遍历所有行选项 + element.options[0].forEach((rowOption, rowIndex) => { + // 获取当前行记录 + const colOptions = rowRecord[rowIndex]; + // 如果当前行有记录,则更新 matrixAnswer 的 answer 属性 + if (colOptions) { + colOptions.forEach((col: any) => { + matrixAnswer.value.answer[`R${rowIndex + 1}_C${col}`] = true; + }); + } + }); + break; + default: + break; } } diff --git a/src/views/Design/components/Questions/paging/Paging.vue b/src/views/Design/components/Questions/paging/Paging.vue index 62d9592..57eb0e1 100644 --- a/src/views/Design/components/Questions/paging/Paging.vue +++ b/src/views/Design/components/Questions/paging/Paging.vue @@ -11,7 +11,8 @@ class="iconfont active-icon" :style="{ marginRight: isLastPage ? '0' : '16px' }" @click="activePage" - > + > diff --git a/src/views/Survey/Index.vue b/src/views/Survey/Index.vue index 758e579..cacd92b 100644 --- a/src/views/Survey/Index.vue +++ b/src/views/Survey/Index.vue @@ -36,7 +36,14 @@
- -{{ item.status_txt }}- + + + +
@@ -59,12 +66,16 @@ 开启投放 - + @@ -77,9 +88,9 @@