From 402f8635c37482ded24afc2e5f91df91b82a7952 Mon Sep 17 00:00:00 2001 From: wanganmao <525987762@qq.com> Date: Thu, 20 Oct 2022 16:40:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=203D=E6=A8=A1=E5=9D=97=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Layouts/utils.js | 80 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 69 insertions(+), 11 deletions(-) diff --git a/src/Layouts/utils.js b/src/Layouts/utils.js index 39fa5ee5..5c2cca72 100644 --- a/src/Layouts/utils.js +++ b/src/Layouts/utils.js @@ -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(
{titleStr} 未选择场景,请选择场景后进行发布
); + 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; } \ No newline at end of file