+ alt="" />
diff --git a/src/api/publish/index.js b/src/api/publish/index.js deleted file mode 100644 index 7ac20a6..0000000 --- a/src/api/publish/index.js +++ /dev/null @@ -1,45 +0,0 @@ -import request from '@/utils/request'; - -// 投放问卷 -export function publishSurvey(data) { - return request({ - url: `/console/survey_publishes`, - method: 'post', - data - }); -} - -// 问卷详情 -export function getSurveyInfo(sn) { - return request({ - url: `/console/surveys/${sn}`, - method: 'get' - }); -} - -// 查看二维码 -export function getQrcode(sn) { - return request({ - url: `/console/survey_publishes/${sn}/qrcode`, - method: 'get' - }); -} - -// 获取问卷测试是否弹层 -export function getCheckSurvey(sn) { - return request({ - url: `/console/check_survey_test/${sn}`, - method: 'get' - }); -} - -/* 获取问题列表 */ -export function getQuestionList(params, code) { - return request({ - headers: { - 'survey-invite-code': code || '' - }, - url: `/console/surveys/${params}/questions`, - method: 'get' - }); -} diff --git a/src/api/survey/index.js b/src/api/survey/index.js index 80a6418..d0fe02a 100644 --- a/src/api/survey/index.js +++ b/src/api/survey/index.js @@ -32,3 +32,14 @@ export function getCheckSurvey(sn) { method: 'get' }); } + +/* 获取问题列表 */ +export function getQuestionList(params, code) { + return request({ + headers: { + 'survey-invite-code': code || '' + }, + url: `/console/surveys/${params}/questions`, + method: 'get' + }); +} \ No newline at end of file diff --git a/src/assets/img/publish/copy_icon.png b/src/assets/img/publish/copy_icon.png new file mode 100644 index 0000000..3816763 Binary files /dev/null and b/src/assets/img/publish/copy_icon.png differ diff --git a/src/assets/img/publish/download_icon.png b/src/assets/img/publish/download_icon.png new file mode 100644 index 0000000..6ccdd68 Binary files /dev/null and b/src/assets/img/publish/download_icon.png differ diff --git a/src/assets/img/publish/share_icon.png b/src/assets/img/publish/share_icon.png new file mode 100644 index 0000000..cee047e Binary files /dev/null and b/src/assets/img/publish/share_icon.png differ diff --git a/src/layouts/index.vue b/src/layouts/index.vue index 67aa4d6..babf8bd 100644 --- a/src/layouts/index.vue +++ b/src/layouts/index.vue @@ -54,32 +54,25 @@ const table = [ } ]; function tabPath(path) { - router.push({ - path - }); - // if (utils.getParameter('digitalYiliToken')) { - // const appToken = utils.getParameter('digitalYiliToken'); - // getUserInfo(appToken) - // .then((res) => { - // if (res.data) { - // utils.setSessionStorage('userInfo', res.data.data); - // router.push({ - // path - // }); - // } else { - // showFailToast( - // error.response.data?.message || error.data?.message || error.message || '服务器错误' - // ); - // } - // }) - // .catch((error) => { - // showFailToast(error?.response?.data?.message || error?.message || '服务器错误'); - // }); - // } else { - // router.push({ - // path - // }); - // } + if (utils.getParameter('digitalYiliToken')) { + const appToken = utils.getParameter('digitalYiliToken'); + getUserInfo(appToken).then((res) => { + if (res.data) { + utils.setSessionStorage('userInfo', res.data.data); + router.push({ + path + }); + } else { + showFailToast(error.response.data?.message || error.data?.message || error.message || '服务器错误'); + } + }).catch((error) => { + showFailToast(error?.response?.data?.message || error?.message || '服务器错误'); + }); + } else { + router.push({ + path + }); + } } @@ -91,16 +84,10 @@ function tabPath(path) { } .header { - .header-nav { - background: var(--primary-color) !important; - } - - .header-search { - padding: 13px; - - //.input-class { - //} - } + position: sticky; + top: 0; + z-index: 1000; + background-color: #a5d380; .title { display: flex; diff --git a/src/layouts/utils.js b/src/layouts/utils.js index 7b11928..d67d177 100644 --- a/src/layouts/utils.js +++ b/src/layouts/utils.js @@ -1,10 +1,6 @@ -// import { getQuesByPages } from '@/views/planetDesign/Design/js/util'; -// import { A_COMMON_SET_ACTIVEQUESTION } from '@store/constance/constance.common' -// import { createVNode } from 'vue'; -import { showConfirmDialog } from 'vant'; -import { getQuestionList, getCheckSurvey } from '@/api/publish'; -// import store from '@/store'; -// import Scroll from '@views/planetDesign/Design/js/scroll' + +import { showConfirmDialog, showDialog } from 'vant'; +import { getQuestionList, getCheckSurvey } from '@/api/survey'; // /** // * 统一的弹窗 // * @param options @@ -19,11 +15,11 @@ function showModal(options) { if (options.onOk) { options.onOk(...rest); } - // const firstQuestion = options.incompleteQuestionList[0]; + const firstQuestion = options.incompleteQuestionList[0]; // store.commit(`common/${A_COMMON_SET_ACTIVEQUESTION}`, JSON.stringify(firstQuestion)); - // const el = document.getElementById(firstQuestion.id); + const el = document.getElementById(firstQuestion.id); - // new Scroll(el).animate(); + new Scroll(el).animate(); } }; @@ -36,9 +32,7 @@ function showModal(options) { .then(() => { confirm(); }) - .catch(() => { - /**/ - }); + .catch(() => {}); } /** @@ -139,7 +133,7 @@ const canPlanetPublish3D = function(data) { qSteams.push(`(${s.title})`); } } catch (error) { - // console.warn(error); + console.warn(error); } } }); @@ -167,11 +161,11 @@ const canPlanetPublish3D = function(data) { try { if (s.config.is_three_dimensions && s.config.is_binding_goods) { const wares = []; - const _sceneInformation = s.config.scene_information; + const scene_information = s.config.scene_information; const sceneInformation - = typeof _sceneInformation === 'string' - ? JSON.parse(_sceneInformation) - : _sceneInformation; + = typeof scene_information === 'string' + ? JSON.parse(scene_information) + : scene_information; sceneInformation.shelves.forEach((shelf) => { shelf.wares.forEach((ware) => { if (!ware.option_index) return; @@ -181,9 +175,7 @@ const canPlanetPublish3D = function(data) { const options = s.options.flat(); s.associate.forEach((ass) => { - const question = data.questions.find( - (q) => q.question_index === ass.question_index - ); + const question = data.questions.find((q) => q.question_index == ass.question_index); if (!question) return; options.push(...question.options.flat()); }); @@ -197,7 +189,7 @@ const canPlanetPublish3D = function(data) { } } } catch (error) { - // console.warn(error); + console.warn(error); } } }); @@ -229,14 +221,14 @@ const canPlanetPublishImage = function(data) { let title = ''; data.questions && data.questions.forEach((s) => { - if (s.question_type === 13) { + if (s.question_type == 13) { try { if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) { canFB = false; qSteams.push(`(${s.title})`); } } catch (error) { - // 错误返回 + console.warn(error); } } }); @@ -301,7 +293,7 @@ function canPublishRandom(data, publishType) { const errors = []; const randomList = data?.survey?.group_pages || []; - randomList.forEach((random /* randomIndex */) => { + randomList.forEach((random, randomIndex) => { const list = random.list || []; // 每一个随机,至少要有两个随机题组 @@ -347,36 +339,36 @@ function canPublishRandom(data, publishType) { * @param data * @param publishType */ -// function isLoopingLogicValid(data, publishType) { -// const publishStr = ['', '预览', '投放'][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 -// ); -// }) -// ) { -// return loopingAvailable({ -// cycles: data.cycle_pages || [], -// questions: getQuesByPages(data.questions || [], data.survey.pages), -// logics: data.logics || [], -// isPerPage: data.survey?.is_one_page_one_question -// }); -// } -// -// showDialog({ -// class: 'custom-modal custom-modal-title-notice show-icon', -// title: '修改循环', -// content: `循环题组不完全,请前往循环列表修改后${publishStr}` -// }); -// -// return false; -// } +function isLoopingLogicValid(data, publishType) { + const publishStr = ['', '预览', '投放'][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 + ); + }) + ) { + return loopingAvailable({ + cycles: data.cycle_pages || [], + questions: getQuesByPages(data.questions || [], data.survey.pages), + logics: data.logics || [], + isPerPage: data.survey?.is_one_page_one_question + }); + } + + showDialog({ + class: 'custom-modal custom-modal-title-notice show-icon', + title: '修改循环', + content: `循环题组不完全,请前往循环列表修改后${publishStr}` + }); + + return false; +} export const canPlanetPublish = async function(sn, publishType) { const parsedPublishType = !publishType ? 2 : publishType; @@ -395,7 +387,7 @@ export const canPlanetPublish = async function(sn, publishType) { if (!canPlanetPublishImage(data)) return false; if (!canPublishMultiCompletion(data, parsedPublishType)) return false; if (!canPublishRandom(data, parsedPublishType)) return false; - // if (!isLoopingLogicValid(data, parsedPublishType)) return false; + if (!isLoopingLogicValid(data, parsedPublishType)) return false; if (parsedPublishType === 2) { const qrcodeRes = await getCheckSurvey(sn); diff --git a/src/views/Survey/views/Publish/Index.vue b/src/views/Survey/views/Publish/Index.vue index b2075c8..8df6c27 100644 --- a/src/views/Survey/views/Publish/Index.vue +++ b/src/views/Survey/views/Publish/Index.vue @@ -2,19 +2,16 @@
+ alt="" />