fix: 3D模块发布验证
This commit is contained in:
@@ -6,18 +6,11 @@ import { ExclamationCircleOutlined } from "@ant-design/icons-vue";
|
||||
import { QUESTION_TYPE } from "@/views/planetDesign/Design/components/config/config3d.constant.js"
|
||||
|
||||
/**
|
||||
* 判断问卷是否可以发布(原本应该后端实现,前端实现会有并发的问题,但后端表示做不了)
|
||||
* Mxd和热区的判断
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
export const canPlanetPublish = async function(sn) {
|
||||
|
||||
let num = window.location.href.indexOf("code=");
|
||||
let code;
|
||||
if (num > -1) {
|
||||
code = window.location.href.slice(num + 5, window.location.href.length);
|
||||
} else {
|
||||
code = "";
|
||||
}
|
||||
const { data } = await getQuestionList(sn, code);
|
||||
const canPlanetPublishMxdAndHotArea = function (data) {
|
||||
|
||||
let isFb = true;
|
||||
let content = "";
|
||||
@@ -60,4 +53,69 @@ export const canPlanetPublish = async function(sn) {
|
||||
class: "test",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 3D相关的判断
|
||||
* @param {*} data
|
||||
* @returns
|
||||
*/
|
||||
const canPlanetPublish3D = function (data) {
|
||||
|
||||
let canFB = true;
|
||||
let content = "";
|
||||
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})`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.warn(error)
|
||||
}
|
||||
canFB = false;
|
||||
qSteams.push(`(${s.title})`);
|
||||
}
|
||||
});
|
||||
|
||||
if (!canFB === true) {
|
||||
const titleStr = qSteams.join(",");
|
||||
title = "选择场景";
|
||||
content = createVNode(<div>{titleStr} 未选择场景,请选择场景后进行发布</div>);
|
||||
Modal.confirm({
|
||||
title: title,
|
||||
icon: createVNode(ExclamationCircleOutlined),
|
||||
content: content,
|
||||
onOk () { },
|
||||
width: "640px",
|
||||
height: "364px",
|
||||
onCancel () { },
|
||||
class: "test",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 判断问卷是否可以发布(原本应该后端实现,前端实现会有并发的问题,但后端表示做不了)
|
||||
*/
|
||||
export const canPlanetPublish = async function(sn) {
|
||||
|
||||
let num = window.location.href.indexOf("code=");
|
||||
let code;
|
||||
if (num > -1) {
|
||||
code = window.location.href.slice(num + 5, window.location.href.length);
|
||||
} else {
|
||||
code = "";
|
||||
}
|
||||
const { data } = await getQuestionList(sn, code);
|
||||
|
||||
if(!canPlanetPublishMxdAndHotArea(data)) return false;
|
||||
if(!canPlanetPublish3D(data)) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user