fix:投放
This commit is contained in:
@@ -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'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -32,3 +32,14 @@ export function getCheckSurvey(sn) {
|
|||||||
method: 'get'
|
method: 'get'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 获取问题列表 */
|
||||||
|
export function getQuestionList(params, code) {
|
||||||
|
return request({
|
||||||
|
headers: {
|
||||||
|
'survey-invite-code': code || ''
|
||||||
|
},
|
||||||
|
url: `/console/surveys/${params}/questions`,
|
||||||
|
method: 'get'
|
||||||
|
});
|
||||||
|
}
|
||||||
BIN
src/assets/img/publish/copy_icon.png
Normal file
BIN
src/assets/img/publish/copy_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
BIN
src/assets/img/publish/download_icon.png
Normal file
BIN
src/assets/img/publish/download_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.9 KiB |
BIN
src/assets/img/publish/share_icon.png
Normal file
BIN
src/assets/img/publish/share_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.6 KiB |
@@ -54,32 +54,25 @@ const table = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
function tabPath(path) {
|
function tabPath(path) {
|
||||||
router.push({
|
if (utils.getParameter('digitalYiliToken')) {
|
||||||
path
|
const appToken = utils.getParameter('digitalYiliToken');
|
||||||
});
|
getUserInfo(appToken).then((res) => {
|
||||||
// if (utils.getParameter('digitalYiliToken')) {
|
if (res.data) {
|
||||||
// const appToken = utils.getParameter('digitalYiliToken');
|
utils.setSessionStorage('userInfo', res.data.data);
|
||||||
// getUserInfo(appToken)
|
router.push({
|
||||||
// .then((res) => {
|
path
|
||||||
// if (res.data) {
|
});
|
||||||
// utils.setSessionStorage('userInfo', res.data.data);
|
} else {
|
||||||
// router.push({
|
showFailToast(error.response.data?.message || error.data?.message || error.message || '服务器错误');
|
||||||
// path
|
}
|
||||||
// });
|
}).catch((error) => {
|
||||||
// } else {
|
showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
|
||||||
// showFailToast(
|
});
|
||||||
// error.response.data?.message || error.data?.message || error.message || '服务器错误'
|
} else {
|
||||||
// );
|
router.push({
|
||||||
// }
|
path
|
||||||
// })
|
});
|
||||||
// .catch((error) => {
|
}
|
||||||
// showFailToast(error?.response?.data?.message || error?.message || '服务器错误');
|
|
||||||
// });
|
|
||||||
// } else {
|
|
||||||
// router.push({
|
|
||||||
// path
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -91,16 +84,10 @@ function tabPath(path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
.header-nav {
|
position: sticky;
|
||||||
background: var(--primary-color) !important;
|
top: 0;
|
||||||
}
|
z-index: 1000;
|
||||||
|
background-color: #a5d380;
|
||||||
.header-search {
|
|
||||||
padding: 13px;
|
|
||||||
|
|
||||||
//.input-class {
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
.title {
|
.title {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
// import { getQuesByPages } from '@/views/planetDesign/Design/js/util';
|
|
||||||
// import { A_COMMON_SET_ACTIVEQUESTION } from '@store/constance/constance.common'
|
import { showConfirmDialog, showDialog } from 'vant';
|
||||||
// import { createVNode } from 'vue';
|
import { getQuestionList, getCheckSurvey } from '@/api/survey';
|
||||||
import { showConfirmDialog } from 'vant';
|
|
||||||
import { getQuestionList, getCheckSurvey } from '@/api/publish';
|
|
||||||
// import store from '@/store';
|
|
||||||
// import Scroll from '@views/planetDesign/Design/js/scroll'
|
|
||||||
// /**
|
// /**
|
||||||
// * 统一的弹窗
|
// * 统一的弹窗
|
||||||
// * @param options
|
// * @param options
|
||||||
@@ -19,11 +15,11 @@ function showModal(options) {
|
|||||||
if (options.onOk) {
|
if (options.onOk) {
|
||||||
options.onOk(...rest);
|
options.onOk(...rest);
|
||||||
}
|
}
|
||||||
// const firstQuestion = options.incompleteQuestionList[0];
|
const firstQuestion = options.incompleteQuestionList[0];
|
||||||
// store.commit(`common/${A_COMMON_SET_ACTIVEQUESTION}`, JSON.stringify(firstQuestion));
|
// 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(() => {
|
.then(() => {
|
||||||
confirm();
|
confirm();
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {});
|
||||||
/**/
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -139,7 +133,7 @@ const canPlanetPublish3D = function(data) {
|
|||||||
qSteams.push(`(${s.title})`);
|
qSteams.push(`(${s.title})`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.warn(error);
|
console.warn(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -167,11 +161,11 @@ const canPlanetPublish3D = function(data) {
|
|||||||
try {
|
try {
|
||||||
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
if (s.config.is_three_dimensions && s.config.is_binding_goods) {
|
||||||
const wares = [];
|
const wares = [];
|
||||||
const _sceneInformation = s.config.scene_information;
|
const scene_information = s.config.scene_information;
|
||||||
const sceneInformation
|
const sceneInformation
|
||||||
= typeof _sceneInformation === 'string'
|
= typeof scene_information === 'string'
|
||||||
? JSON.parse(_sceneInformation)
|
? JSON.parse(scene_information)
|
||||||
: _sceneInformation;
|
: scene_information;
|
||||||
sceneInformation.shelves.forEach((shelf) => {
|
sceneInformation.shelves.forEach((shelf) => {
|
||||||
shelf.wares.forEach((ware) => {
|
shelf.wares.forEach((ware) => {
|
||||||
if (!ware.option_index) return;
|
if (!ware.option_index) return;
|
||||||
@@ -181,9 +175,7 @@ const canPlanetPublish3D = function(data) {
|
|||||||
|
|
||||||
const options = s.options.flat();
|
const options = s.options.flat();
|
||||||
s.associate.forEach((ass) => {
|
s.associate.forEach((ass) => {
|
||||||
const question = data.questions.find(
|
const question = data.questions.find((q) => q.question_index == ass.question_index);
|
||||||
(q) => q.question_index === ass.question_index
|
|
||||||
);
|
|
||||||
if (!question) return;
|
if (!question) return;
|
||||||
options.push(...question.options.flat());
|
options.push(...question.options.flat());
|
||||||
});
|
});
|
||||||
@@ -197,7 +189,7 @@ const canPlanetPublish3D = function(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// console.warn(error);
|
console.warn(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -229,14 +221,14 @@ const canPlanetPublishImage = function(data) {
|
|||||||
let title = '';
|
let title = '';
|
||||||
data.questions
|
data.questions
|
||||||
&& data.questions.forEach((s) => {
|
&& data.questions.forEach((s) => {
|
||||||
if (s.question_type === 13) {
|
if (s.question_type == 13) {
|
||||||
try {
|
try {
|
||||||
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
if (s.options.length <= 0 || s.options.some((y) => y.length <= 0)) {
|
||||||
canFB = false;
|
canFB = false;
|
||||||
qSteams.push(`(${s.title})`);
|
qSteams.push(`(${s.title})`);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 错误返回
|
console.warn(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -301,7 +293,7 @@ function canPublishRandom(data, publishType) {
|
|||||||
const errors = [];
|
const errors = [];
|
||||||
const randomList = data?.survey?.group_pages || [];
|
const randomList = data?.survey?.group_pages || [];
|
||||||
|
|
||||||
randomList.forEach((random /* randomIndex */) => {
|
randomList.forEach((random, randomIndex) => {
|
||||||
const list = random.list || [];
|
const list = random.list || [];
|
||||||
|
|
||||||
// 每一个随机,至少要有两个随机题组
|
// 每一个随机,至少要有两个随机题组
|
||||||
@@ -347,36 +339,36 @@ function canPublishRandom(data, publishType) {
|
|||||||
* @param data
|
* @param data
|
||||||
* @param publishType
|
* @param publishType
|
||||||
*/
|
*/
|
||||||
// function isLoopingLogicValid(data, publishType) {
|
function isLoopingLogicValid(data, publishType) {
|
||||||
// const publishStr = ['', '预览', '投放'][publishType] || '投放';
|
const publishStr = ['', '预览', '投放'][publishType] || '投放';
|
||||||
//
|
|
||||||
// if (
|
if (
|
||||||
// (data?.cycle_pages || []).every((i) => {
|
(data?.cycle_pages || []).every((i) => {
|
||||||
// return (
|
return (
|
||||||
// i.question_index
|
i.question_index
|
||||||
// && i.relation_type !== undefined
|
&& i.relation_type !== undefined
|
||||||
// && i.relation_type !== null
|
&& i.relation_type !== null
|
||||||
// && i.first_page
|
&& i.first_page
|
||||||
// && i.last_page
|
&& i.last_page
|
||||||
// );
|
);
|
||||||
// })
|
})
|
||||||
// ) {
|
) {
|
||||||
// return loopingAvailable({
|
return loopingAvailable({
|
||||||
// cycles: data.cycle_pages || [],
|
cycles: data.cycle_pages || [],
|
||||||
// questions: getQuesByPages(data.questions || [], data.survey.pages),
|
questions: getQuesByPages(data.questions || [], data.survey.pages),
|
||||||
// logics: data.logics || [],
|
logics: data.logics || [],
|
||||||
// isPerPage: data.survey?.is_one_page_one_question
|
isPerPage: data.survey?.is_one_page_one_question
|
||||||
// });
|
});
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// showDialog({
|
showDialog({
|
||||||
// class: 'custom-modal custom-modal-title-notice show-icon',
|
class: 'custom-modal custom-modal-title-notice show-icon',
|
||||||
// title: '修改循环',
|
title: '修改循环',
|
||||||
// content: `循环题组不完全,请前往循环列表修改后${publishStr}`
|
content: `循环题组不完全,请前往循环列表修改后${publishStr}`
|
||||||
// });
|
});
|
||||||
//
|
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
export const canPlanetPublish = async function(sn, publishType) {
|
export const canPlanetPublish = async function(sn, publishType) {
|
||||||
const parsedPublishType = !publishType ? 2 : publishType;
|
const parsedPublishType = !publishType ? 2 : publishType;
|
||||||
@@ -395,7 +387,7 @@ export const canPlanetPublish = async function(sn, publishType) {
|
|||||||
if (!canPlanetPublishImage(data)) return false;
|
if (!canPlanetPublishImage(data)) return false;
|
||||||
if (!canPublishMultiCompletion(data, parsedPublishType)) return false;
|
if (!canPublishMultiCompletion(data, parsedPublishType)) return false;
|
||||||
if (!canPublishRandom(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) {
|
if (parsedPublishType === 2) {
|
||||||
const qrcodeRes = await getCheckSurvey(sn);
|
const qrcodeRes = await getCheckSurvey(sn);
|
||||||
|
|||||||
@@ -2,19 +2,16 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<van-nav-bar :title="surveyTitle" left-arrow @click-left="$router.go(-1)" />
|
<van-nav-bar :title="surveyTitle" left-arrow @click-left="$router.go(-1)" />
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<!-- <van-cell-group v-if="status === 1" inset style="padding-top: 15px"> -->
|
<van-cell-group v-if="status === 1" inset style="padding-top: 15px">
|
||||||
<van-cell-group inset style="padding-top: 15px">
|
|
||||||
<div>
|
<div>
|
||||||
<img
|
<img width="100%"
|
||||||
width="100%"
|
|
||||||
src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333"
|
src="https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u14.jpg?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333"
|
||||||
alt=""
|
alt="" />
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="qrcode">
|
<div class="qrcode">
|
||||||
<img :src="publishInfo.img_url" alt="" width="100px" height="100px" />
|
<img :src="publishInfo?.img_url" alt="" width="100px" height="100px" />
|
||||||
<div class="tit">
|
<div class="tit">
|
||||||
<div>液态奶产品研究标准化问卷</div>
|
<div>{{ publishInfo?.download_url?.title || '' }}</div>
|
||||||
<div>扫码填写问卷</div>
|
<div>扫码填写问卷</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -26,7 +23,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</van-cell-group>
|
</van-cell-group>
|
||||||
<!-- <div v-if="status === 0 || status === 2" class="pulish-container">
|
<div v-if="status === 0 || status === 2" class="pulish-container">
|
||||||
<img class="not-publish-icon" src="@/assets/img/publish/not_pulish.png" alt="" />
|
<img class="not-publish-icon" src="@/assets/img/publish/not_pulish.png" alt="" />
|
||||||
<div class="text">点击"启用"按钮后,问卷才可以开始回收数据</div>
|
<div class="text">点击"启用"按钮后,问卷才可以开始回收数据</div>
|
||||||
<van-button type="primary" style="margin-top: 20px" class="publish-btn" color="#70b936"
|
<van-button type="primary" style="margin-top: 20px" class="publish-btn" color="#70b936"
|
||||||
@@ -34,9 +31,9 @@
|
|||||||
<template #icon>
|
<template #icon>
|
||||||
<i class="iconfont icon-fabu3" style="margin-right: 6px"></i>
|
<i class="iconfont icon-fabu3" style="margin-right: 6px"></i>
|
||||||
</template>
|
</template>
|
||||||
启用
|
启用
|
||||||
</van-button>
|
</van-button>
|
||||||
</div> -->
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -47,31 +44,35 @@ import { onMounted, reactive, ref, watch } from 'vue';
|
|||||||
import { showFailToast, showToast } from 'vant';
|
import { showFailToast, showToast } from 'vant';
|
||||||
import utils from '@/assets/js/common';
|
import utils from '@/assets/js/common';
|
||||||
import appBridge from '@/assets/js/appBridge';
|
import appBridge from '@/assets/js/appBridge';
|
||||||
import { getQrcode } from '@/api/publish';
|
import { getQrcode, getSurveyInfo, publishSurvey } from '@/api/survey';
|
||||||
// import { canPlanetPublish } from '@/layouts/utils.js';
|
import { canPlanetPublish } from '@/layouts/utils.js';
|
||||||
import configUrl from '../../../../config';
|
// import configUrl from '../../../../config';
|
||||||
|
import copyIcon from '@/assets/img/publish/copy_icon.png';
|
||||||
|
import shareIcon from '@/assets/img/publish/share_icon.png';
|
||||||
|
import downloadIcon from '@/assets/img/publish/download_icon.png';
|
||||||
|
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const surveyTitle = route.meta.title as string;
|
const surveyTitle = route.meta.title as string;
|
||||||
appBridge.setTitle(surveyTitle);
|
appBridge.setTitle(surveyTitle);
|
||||||
const sn = route.query.sn;
|
const sn = route.query.sn;
|
||||||
const status = ref<number>(0); // `0`: 编辑中 `1`: 投放中 `2`: 已结束
|
const status = ref<number>(0); // `0`: 编辑中 `1`: 投放中 `2`: 已结束
|
||||||
// const publishType = ref(0);
|
const publishType = ref(0);
|
||||||
const operateList = reactive([
|
const operateList = reactive([
|
||||||
{
|
{
|
||||||
title: '复制链接',
|
title: '复制链接',
|
||||||
type: 'copyLink',
|
type: 'copyLink',
|
||||||
icon: 'https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u21.png?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333'
|
icon: copyIcon
|
||||||
|
// icon: 'https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u21.png?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '转发到微信',
|
title: '转发到微信',
|
||||||
type: 'shareLink',
|
type: 'shareLink',
|
||||||
icon: 'https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u21.png?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333'
|
icon: shareIcon
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '下载二维码',
|
title: '下载二维码',
|
||||||
type: 'qrCode',
|
type: 'qrCode',
|
||||||
icon: 'https://files.axshare.com/gsc/DR6075/44/1a/03/441a03a8b1004755a7a392b311acf97f/images/%E6%8A%95%E6%94%BE/u21.png?pageId=2f9ba10c-92b8-4c9b-b40b-04e65a0b4333'
|
icon: downloadIcon
|
||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@@ -87,82 +88,24 @@ interface PublishInfo {
|
|||||||
|
|
||||||
const publishInfo = ref<PublishInfo>({} as PublishInfo);
|
const publishInfo = ref<PublishInfo>({} as PublishInfo);
|
||||||
type OperateItem = (typeof operateList)[0];
|
type OperateItem = (typeof operateList)[0];
|
||||||
// function handlePublish() {
|
|
||||||
// publishSurvey({
|
|
||||||
// sn,
|
|
||||||
// publish_type: publishType.value
|
|
||||||
// })
|
|
||||||
// .then(() => {
|
|
||||||
// // store.commit('common/M_COMMON_SET_SURVEY_STATUS', 1);
|
|
||||||
// fetchInfo();
|
|
||||||
// })
|
|
||||||
// .catch(() => {
|
|
||||||
// // emitter.emit('app-loading', false);
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
|
|
||||||
// async function openPublishModal() {
|
|
||||||
// const res = await canPlanetPublish(route.query.sn);
|
|
||||||
// if (res) {
|
|
||||||
// handlePublish();
|
|
||||||
// } else {
|
|
||||||
// emitter.emit('app-loading', false);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
function getCode() {
|
|
||||||
publishInfo.value.img_url
|
|
||||||
= 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
|
|
||||||
publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`;
|
|
||||||
publishInfo.value.download_url = {
|
|
||||||
title: '问卷下载',
|
|
||||||
url: 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png'
|
|
||||||
};
|
|
||||||
getQrcode(sn)
|
|
||||||
.then((res) => {
|
|
||||||
if (res.data) {
|
|
||||||
publishInfo.value = res.data.data || {};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.catch((error) => {
|
|
||||||
showFailToast(error.data?.message || error.message || '服务器错误');
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// function fetchInfo() {
|
|
||||||
// getSurveyInfo(sn)
|
|
||||||
// .then((res) => {
|
|
||||||
// status.value = Number(res.data.data.status);
|
|
||||||
// })
|
|
||||||
// .finally(() => {
|
|
||||||
// /**/
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
watch(status, (val) => {
|
|
||||||
if (val === 1) {
|
|
||||||
getCode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
onMounted(async() => {
|
|
||||||
// fetchInfo();
|
|
||||||
getCode();
|
|
||||||
});
|
|
||||||
const operateBtn = (item: OperateItem) => {
|
const operateBtn = (item: OperateItem) => {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'shareLink':
|
case 'shareLink':
|
||||||
shareLink();
|
shareLink();
|
||||||
break;
|
break;
|
||||||
case 'copyLink':
|
case 'copyLink':
|
||||||
copyLink();
|
copyLink();
|
||||||
break;
|
break;
|
||||||
case 'qrCode':
|
case 'qrCode':
|
||||||
downLoadImg();
|
downLoadImg();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// 复制链接
|
// 复制链接
|
||||||
function copyLink() {
|
function copyLink () {
|
||||||
const input = document.createElement('input');
|
const input = document.createElement('input');
|
||||||
input.value = publishInfo.value.url;
|
input.value = publishInfo.value.url;
|
||||||
document.body.appendChild(input);
|
document.body.appendChild(input);
|
||||||
@@ -172,7 +115,7 @@ function copyLink() {
|
|||||||
showToast('复制成功');
|
showToast('复制成功');
|
||||||
}
|
}
|
||||||
// 分享链接
|
// 分享链接
|
||||||
function shareLink() {
|
function shareLink () {
|
||||||
const params = {
|
const params = {
|
||||||
type: 'shareToWx',
|
type: 'shareToWx',
|
||||||
title: publishInfo.value.download_url.title,
|
title: publishInfo.value.download_url.title,
|
||||||
@@ -186,7 +129,7 @@ function shareLink() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 下载二维码
|
// 下载二维码
|
||||||
function downLoadImg() {
|
function downLoadImg () {
|
||||||
const { title, url } = publishInfo.value.download_url;
|
const { title, url } = publishInfo.value.download_url;
|
||||||
if (utils.getSessionStorage('xToken')) {
|
if (utils.getSessionStorage('xToken')) {
|
||||||
appBridge.save2Album(url, () => {
|
appBridge.save2Album(url, () => {
|
||||||
@@ -201,6 +144,61 @@ function downLoadImg() {
|
|||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function handlePublish () {
|
||||||
|
publishSurvey({
|
||||||
|
sn,
|
||||||
|
publish_type: publishType.value
|
||||||
|
})
|
||||||
|
.then(() => {
|
||||||
|
fetchInfo();
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
showFailToast(error.data?.message || error.message || '服务器错误');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
async function openPublishModal () {
|
||||||
|
const res = await canPlanetPublish(route.query.sn as string);
|
||||||
|
if (res) {
|
||||||
|
handlePublish();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCode () {
|
||||||
|
getQrcode(sn)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.data) {
|
||||||
|
publishInfo.value = res.data.data || {};
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
showFailToast(error.data?.message || error.message || '服务器错误');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function fetchInfo () {
|
||||||
|
getSurveyInfo(sn)
|
||||||
|
.then((res) => {
|
||||||
|
status.value = Number(res.data.data.status);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
showFailToast(error.data?.message || error.message || '服务器错误');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
watch(status, (val) => {
|
||||||
|
if (val === 1) {
|
||||||
|
getCode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
onMounted(async () => {
|
||||||
|
status.value = 1;
|
||||||
|
// publishInfo.value.img_url
|
||||||
|
// = 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png';
|
||||||
|
// publishInfo.value.url = `${configUrl.proxyDomain}/publish?sn=${sn && sn !== undefined ? sn : ''}`;
|
||||||
|
// publishInfo.value.download_url = {
|
||||||
|
// title: '问卷下载dadad阿萨法发是否反反复复烦烦烦烦烦阿三大苏打烦烦烦烦',
|
||||||
|
// url: 'https://test-cxp-pubcos.yili.com/uat-yls//survey-api/publish/202503130938138261340.png'
|
||||||
|
// };
|
||||||
|
fetchInfo();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped lang="scss">
|
<style scoped lang="scss">
|
||||||
|
|||||||
Reference in New Issue
Block a user