diff --git a/src/layouts/utils.js b/src/layouts/utils.js index 6b55ed1..d8d5538 100644 --- a/src/layouts/utils.js +++ b/src/layouts/utils.js @@ -1,9 +1,8 @@ import { showConfirmDialog } from 'vant'; -import { getQuestionList, getCheckSurvey } from '@/api/survey'; +import { getQuestionList } from '@/api/survey'; import { QUESTION_TYPE } from '@/layouts/config3d.constant.js'; import { loopingAvailable } from '@/layouts/logic.js'; import { getDomText } from '@/utils/utils'; -import utils from '@/assets/js/common'; // /** // * 统一的弹窗 // * @param options @@ -31,13 +30,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题目未完成设置,请设置价格区间后投放'; @@ -61,15 +60,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题目未完成设置,请生成设计后投放'; @@ -108,14 +107,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) { @@ -145,15 +144,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) => { @@ -203,14 +202,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)) { @@ -305,8 +304,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}"` }); } }); @@ -385,11 +384,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 ); }) ) { @@ -413,7 +412,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; @@ -431,6 +430,7 @@ export const canPlanetPublish = async function(sn, publishType) { if (!canPublishRandom(data?.data, parsedPublishType)) return false; if (!isLoopingLogicValid(data?.data, parsedPublishType)) return false; + /* eslint-disable */ // if (parsedPublishType === 2) { // const qrcodeRes = await getCheckSurvey(sn); // if (qrcodeRes?.data?.data?.show_test_button) { @@ -478,6 +478,6 @@ export const canPlanetPublish = async function(sn, publishType) { // if (!res) return; // } // } - + /* eslint-enable */ return true; }; diff --git a/src/views/Survey/views/Create/Index.vue b/src/views/Survey/views/Create/Index.vue index a3767bb..ac09b7f 100644 --- a/src/views/Survey/views/Create/Index.vue +++ b/src/views/Survey/views/Create/Index.vue @@ -109,12 +109,36 @@