From 818e50d7a4e9fee2ed31e79f3394f5023f44e082 Mon Sep 17 00:00:00 2001 From: 梁保满 Date: Fri, 13 Jan 2023 14:35:32 +0800 Subject: [PATCH] 标签删除,修改 --- public/index.html | 7 +++++-- src/api/apis/answerSheet.js | 16 ++++++++++++++++ src/api/urls/answerSheet.js | 4 ++++ src/views/examinationPaper/add.vue | 129 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------- 4 files changed, 139 insertions(+), 17 deletions(-) diff --git a/public/index.html b/public/index.html index 9b1b7ec..069f526 100644 --- a/public/index.html +++ b/public/index.html @@ -5,6 +5,9 @@ + + + <%= htmlWebpackPlugin.options.title %> @@ -16,8 +19,8 @@ var link = document.querySelector("link[rel*='icon']") || document.createElement('link'); link.type = 'image/x-icon'; link.rel = 'shortcut icon'; - var csCode = localStorage.getItem("csCode")||"" - link.href = csCode?"./331icon.ico":"./favicon.ico"; + var csCode = localStorage.getItem("csCode") || "" + link.href = csCode ? "./331icon.ico" : "./favicon.ico"; document.getElementsByTagName('head')[0].appendChild(link); </script> <noscript> diff --git a/src/api/apis/answerSheet.js b/src/api/apis/answerSheet.js index 9208541..fca1ed0 100644 --- a/src/api/apis/answerSheet.js +++ b/src/api/apis/answerSheet.js @@ -59,6 +59,22 @@ export default { data }) }, + // 修改答题卡测验类型 + editPaperType(data) { + return service({ + url: answerSheet.editPaperType, + method: 'POST', + data + }) + }, + // 删除答题卡测验类型 + delPaperType(data) { + return service({ + url: answerSheet.delPaperType, + method: 'POST', + data + }) + }, // 保存答题卡 addPaper(data) { return service({ diff --git a/src/api/urls/answerSheet.js b/src/api/urls/answerSheet.js index c529f41..b40e597 100644 --- a/src/api/urls/answerSheet.js +++ b/src/api/urls/answerSheet.js @@ -13,6 +13,10 @@ export default { subjectList: "/api_html/teaching/subjectList", // 添加答题卡测验类型 addPaperType: "/api_html/teaching/addPaperType", + // 修改答题卡测验类型 + editPaperType: "/api_html/teaching/modifyPaperType", + // 删除答题卡测验类型 + delPaperType: "/api_html/teaching/delPaperType", // 保存答题卡 addPaper: "/api_html/teaching/addPaper", // 删除答题卡 diff --git a/src/views/examinationPaper/add.vue b/src/views/examinationPaper/add.vue index 6cbdc13..cfa88e2 100644 --- a/src/views/examinationPaper/add.vue +++ b/src/views/examinationPaper/add.vue @@ -51,8 +51,8 @@ type="primary" round circle - icon="el-icon-plus" - @click="dialogVisible = true" + icon="el-icon-edit" + @click="openTagDia" ></el-button> </el-form-item> <el-form-item label="年级:" prop="gradeName"> @@ -107,24 +107,76 @@ <el-button type="primary" round @click="setStep1">下一步</el-button> </div> <el-dialog - title="添加测验类型" + title="设置测验类型" :visible.sync="dialogVisible" width="500px" > <div class="dia-content"> + <p class="add-type" v-for="item in tagList" :key="item.id"> + <el-row :gutter="10"> + <el-col :span="18" + ><el-input v-model="item.typeName" placeholder=""></el-input + ></el-col> + <el-col :span="6"> + <el-tooltip effect="dark" content="修改" placement="top"> + <el-button + class="js-set" + type="primary" + size="small" + round + circle + icon="el-icon-edit" + @click="editTypeName(item)" + ></el-button> + </el-tooltip> + <el-tooltip effect="dark" content="删除" placement="right"> + <el-popconfirm + title="确定删除这道大题吗?" + @confirm="removeTypeName(item)" + > + <el-button + class="js-set" + type="danger" + size="small" + round + circle + icon="el-icon-delete" + slot="reference" + ></el-button> + </el-popconfirm> + </el-tooltip> + </el-col> + </el-row> + </p> <p class="add-type"> - <el-input - type="text" - placeholder="请输入答题卡类型名称" - v-model.trim="answerTypeName" - :maxlength="10" - > - </el-input> + <el-row :gutter="10"> + <el-col :span="18"> + <el-input + type="text" + placeholder="请输入答题卡类型名称" + v-model.trim="answerTypeName" + :maxlength="10" + > + </el-input> + </el-col> + <el-col :span="6"> + <el-tooltip effect="dark" content="添加" placement="right"> + <el-button + class="js-set" + type="primary" + size="small" + round + circle + icon="el-icon-plus" + @click="addPaperType" + ></el-button> + </el-tooltip> + </el-col> + </el-row> </p> </div> <div class="" slot="footer"> - <el-button type="primary" @click="addPaperType">确 定</el-button> - <el-button @click="dialogVisible = false">取 消</el-button> + <el-button @click="dialogVisible = false">关 闭</el-button> </div> </el-dialog> </div> @@ -703,6 +755,7 @@ export default { { required: true, message: "请设置考试时长", trigger: "blur" }, ], }, + tagList: [], diaSetAns: false, formAns: { listIndex: 0, //大题位置 @@ -788,7 +841,7 @@ export default { return !!item.questionType; }); lengths = subArr.length; - return lengths + return lengths; }, setBigNum(num) { let txt = ""; @@ -1196,6 +1249,47 @@ export default { sub.correctAnswer = arrs.sort().join(""); } }, + openTagDia() { + this.tagList = deepClone(this.answerTypeList); + this.dialogVisible = true; + }, + async editTypeName(obj) { + let isRepeat = false; + this.answerTypeList.map((item) => { + if (item.typeName == obj.typeName) { + isRepeat = true; + } + }); + if (isRepeat) { + this.$message.error("类型已存在请重新填写!"); + return; + } + //修改测验类型 + const { data, status, info } = await this.$request.editPaperType({ + tagId: obj.id, + tag: obj.typeName, + }); + if (status == 0) { + await this._TypeList(); + this.tagList = deepClone(this.answerTypeList); + this.$message.success("修改成功"); + } else { + this.$message.error(info); + } + }, + async removeTypeName(obj) { + //删除测验类型 + const { data, status, info } = await this.$request.delPaperType({ + tagId: obj.id, + }); + if (status == 0) { + await this._TypeList(); + this.tagList = deepClone(this.answerTypeList); + this.$message.success("删除成功"); + } else { + this.$message.error(info); + } + }, async addPaperType() { //保存测验类型 if (!this.answerTypeName) { @@ -1218,8 +1312,8 @@ export default { }); if (status == 0) { await this._TypeList(); + this.tagList = deepClone(this.answerTypeList); this.form.tagId = data || ""; - this.dialogVisible = false; this.answerTypeName = ""; this.$message.success("添加成功"); } else { @@ -1405,7 +1499,12 @@ export default { text-align: center; } .add-type { - display: flex; + width: 100%; + margin-bottom: 10px; + .js-set { + margin: 2.5px 10px 0 0; + font-size: 14px; + } } .add-btn { margin-left: 20px; -- libgit2 0.21.4