fix: 问卷发布验证

This commit is contained in:
wanganmao
2022-10-20 14:52:17 +08:00
parent 803dadf534
commit 6af4603171
4 changed files with 143 additions and 60 deletions

View File

@@ -126,7 +126,8 @@ import Avatar from "@/views/Home/components/Avatar.vue";
import { tr } from "element-plus/lib/locale";
import { Modal } from "ant-design-vue";
import { cloneDeep } from "lodash";
import DownloadCenter from "@/views/DownloadCenter/index.vue"
import DownloadCenter from "@/views/DownloadCenter/index.vue";
import { canPlanetPublish } from "./utils";
const router = useRouter();
const route = useRoute();
@@ -229,50 +230,58 @@ const toPreview = () => {
document.title = name;
};
const openPublishModal = () => {
//console.log();
// return;
let isFb = true;
let content = "";
const qSteams = [];
let type = 0;
let title = "推荐提示";
store.state.common.questionInfo.questions &&
store.state.common.questionInfo.questions.forEach((s) => {
if (s.question_type === 105 && s.config.design_version <= 0) {
isFb = false;
content = createVNode(<div>maxdiff未生成设计请先进行生成设计才能进行发布</div>);
title = "推荐提示";
type = 1;
}
if (s.question_type === 25 || s.question_type === 26) {
if ((s.options?.[0]?.length || 0) <= 0 && (s?.associate?.length || 0) <= 0) {
isFb = false;
qSteams.push(`(${s.title})`);
type = 2;
}
}
});
const openPublishModal = async () => {
if (isFb === true) {
var res = await canPlanetPublish(route.query.sn);
if(res){
visible.value = true;
} else {
if (type === 2) {
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;
}
// //console.log();
// // return;
// let isFb = true;
// let content = "";
// const qSteams = [];
// let type = 0;
// let title = "推荐提示";
// store.state.common.questionInfo.questions &&
// store.state.common.questionInfo.questions.forEach((s) => {
// if (s.question_type === 105 && s.config.design_version <= 0) {
// isFb = false;
// content = createVNode(<div>maxdiff未生成设计请先进行生成设计才能进行发布</div>);
// title = "推荐提示";
// type = 1;
// }
// if (s.question_type === 25 || s.question_type === 26) {
// if ((s.options?.[0]?.length || 0) <= 0 && (s?.associate?.length || 0) <= 0) {
// isFb = false;
// qSteams.push(`(${s.title})`);
// type = 2;
// }
// }
// });
// if (isFb === true) {
// visible.value = true;
// } else {
// if (type === 2) {
// 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",
// });
// }
};
const handlePublish = () => {