fix: 发布验证

This commit is contained in:
wanganmao
2022-10-20 16:54:57 +08:00
parent 402f8635c3
commit d619f83f22

View File

@@ -18,7 +18,7 @@ const canPlanetPublishMxdAndHotArea = function (data) {
let type = 0;
let title = "推荐提示";
data.questions &&
data.questions.forEach((s) => {
data.questions.forEach((s) => {
if (s.question_type === 105 && s.config.design_version <= 0) {
isFb = false;
content = createVNode(<div>maxdiff未生成设计请先进行生成设计才能进行发布</div>);
@@ -46,10 +46,10 @@ const canPlanetPublishMxdAndHotArea = function (data) {
title: title,
icon: createVNode(ExclamationCircleOutlined),
content: content,
onOk () { },
onOk() { },
width: "640px",
height: "364px",
onCancel () { },
onCancel() { },
class: "test",
});
}
@@ -67,19 +67,18 @@ const canPlanetPublish3D = function (data) {
const qSteams = [];
let title = "";
data.questions &&
data.questions.forEach((s) => {
if (QUESTION_TYPE.contains(s.question_type)) {
try {
if(s.config.is_three_dimensions && !s.config.scene){
qSteams.push(`(${s.title})`);
data.questions.forEach((s) => {
if (QUESTION_TYPE.contains(s.question_type)) {
try {
if (s.config.is_three_dimensions && !s.config.scene) {
canFB = false;
qSteams.push(`(${s.title})`);
}
} catch (error) {
console.warn(error)
}
} catch (error) {
console.warn(error)
}
canFB = false;
qSteams.push(`(${s.title})`);
}
});
});
if (!canFB === true) {
const titleStr = qSteams.join(",");
@@ -89,22 +88,22 @@ const canPlanetPublish3D = function (data) {
title: title,
icon: createVNode(ExclamationCircleOutlined),
content: content,
onOk () { },
onOk() { },
width: "640px",
height: "364px",
onCancel () { },
onCancel() { },
class: "test",
});
return;
}
}
return true;
}
/**
* 判断问卷是否可以发布(原本应该后端实现,前端实现会有并发的问题,但后端表示做不了)
*/
export const canPlanetPublish = async function(sn) {
export const canPlanetPublish = async function (sn) {
let num = window.location.href.indexOf("code=");
let code;
if (num > -1) {
@@ -114,8 +113,8 @@ export const canPlanetPublish = async function(sn) {
}
const { data } = await getQuestionList(sn, code);
if(!canPlanetPublishMxdAndHotArea(data)) return false;
if(!canPlanetPublish3D(data)) return false;
if (!canPlanetPublishMxdAndHotArea(data)) return false;
if (!canPlanetPublish3D(data)) return false;
return true;
}