|
@@ -238,7 +238,6 @@ import {
|
|
saveCard,
|
|
saveCard,
|
|
submitCard
|
|
submitCard
|
|
} from "../api";
|
|
} from "../api";
|
|
-import { saveWaitTask } from "@/modules/exam-center/api";
|
|
|
|
import {
|
|
import {
|
|
getElementModel,
|
|
getElementModel,
|
|
getCardHeadModel,
|
|
getCardHeadModel,
|
|
@@ -386,7 +385,15 @@ export default {
|
|
// 操作
|
|
// 操作
|
|
async toPreview() {
|
|
async toPreview() {
|
|
await this.toSave(this.$refs.SavePage.getPageModel());
|
|
await this.toSave(this.$refs.SavePage.getPageModel());
|
|
- window.open(`/#/card/preview/${this.cardId}/view`);
|
|
|
|
|
|
+ window.open(
|
|
|
|
+ this.getRouterPath({
|
|
|
|
+ name: "CardPreview",
|
|
|
|
+ params: {
|
|
|
|
+ cardId: this.cardId,
|
|
|
|
+ viewType: "view"
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ );
|
|
},
|
|
},
|
|
swithPage(pindex) {
|
|
swithPage(pindex) {
|
|
if (this.curPageNo === pindex) return;
|
|
if (this.curPageNo === pindex) return;
|
|
@@ -422,39 +429,29 @@ export default {
|
|
};
|
|
};
|
|
if (this.cardDetailId) data.tcPCardDetail.id = this.cardDetailId;
|
|
if (this.cardDetailId) data.tcPCardDetail.id = this.cardDetailId;
|
|
if (contentTemp) data.tcPCardDetail.contentTemp = contentTemp;
|
|
if (contentTemp) data.tcPCardDetail.contentTemp = contentTemp;
|
|
|
|
+
|
|
|
|
+ if (this.prepareTcPCard.taskId && this.prepareTcPCard.cardSource === "1")
|
|
|
|
+ data.tcPExamTaskDetail = {
|
|
|
|
+ ...this.prepareTcPCard,
|
|
|
|
+ cardId: this.cardId
|
|
|
|
+ };
|
|
return data;
|
|
return data;
|
|
},
|
|
},
|
|
async save() {
|
|
async save() {
|
|
if (!this.cardConfig.cardName) {
|
|
if (!this.cardConfig.cardName) {
|
|
this.$message.error("题卡标题不能为空!");
|
|
this.$message.error("题卡标题不能为空!");
|
|
- return Promise.reject("error:题卡标题不能为空");
|
|
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
const result = await saveCard(this.getCardData());
|
|
const result = await saveCard(this.getCardData());
|
|
this.cardDetailId = result.cardDetailId;
|
|
this.cardDetailId = result.cardDetailId;
|
|
this.cardId = result.cardId;
|
|
this.cardId = result.cardId;
|
|
this.$ls.set("cardDetailId", this.cardDetailId);
|
|
this.$ls.set("cardDetailId", this.cardDetailId);
|
|
this.$ls.set("cardId", this.cardId);
|
|
this.$ls.set("cardId", this.cardId);
|
|
|
|
+ return true;
|
|
},
|
|
},
|
|
async toSave() {
|
|
async toSave() {
|
|
- await this.save();
|
|
|
|
- this.$message.success("保存成功!");
|
|
|
|
-
|
|
|
|
- // 自助创建时暂存任务
|
|
|
|
- if (
|
|
|
|
- this.prepareTcPCard.taskId &&
|
|
|
|
- this.prepareTcPCard.cardSource === "1"
|
|
|
|
- ) {
|
|
|
|
- saveWaitTask({
|
|
|
|
- tcPExamTaskDetail: { ...this.prepareTcPCard, cardId: this.cardId }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- },
|
|
|
|
- registWindowSubmit() {
|
|
|
|
- window.submitCardTemp = async cardContentTemp => {
|
|
|
|
- await submitCard(this.getCardData(cardContentTemp));
|
|
|
|
- this.$message.success("提交成功!");
|
|
|
|
- this.cardPreviewUrl = "";
|
|
|
|
- };
|
|
|
|
|
|
+ const result = await this.save();
|
|
|
|
+ if (result) this.$message.success("保存成功!");
|
|
},
|
|
},
|
|
toSubmit() {
|
|
toSubmit() {
|
|
this.$confirm("确定要提交当前题卡吗?", "提示", {
|
|
this.$confirm("确定要提交当前题卡吗?", "提示", {
|
|
@@ -463,10 +460,18 @@ export default {
|
|
type: "warning"
|
|
type: "warning"
|
|
})
|
|
})
|
|
.then(async () => {
|
|
.then(async () => {
|
|
- await this.save();
|
|
|
|
- this.cardPreviewUrl = `/#/card/preview/${this.cardId}/frame`;
|
|
|
|
|
|
+ const result = await this.save();
|
|
|
|
+ if (result)
|
|
|
|
+ this.cardPreviewUrl = `/#/card/preview/${this.cardId}/frame`;
|
|
})
|
|
})
|
|
.catch(() => {});
|
|
.catch(() => {});
|
|
|
|
+ },
|
|
|
|
+ registWindowSubmit() {
|
|
|
|
+ window.submitCardTemp = async cardContentTemp => {
|
|
|
|
+ await submitCard(this.getCardData(cardContentTemp));
|
|
|
|
+ this.$message.success("提交成功!");
|
|
|
|
+ this.cardPreviewUrl = "";
|
|
|
|
+ };
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeDestroy() {
|
|
beforeDestroy() {
|