Commit 818e50d7a4e9fee2ed31e79f3394f5023f44e082

Authored by 梁保满
1 parent a0d49348

标签删除,修改

public/index.html
... ... @@ -5,6 +5,9 @@
5 5 <meta charset="utf-8">
6 6 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
7 7 <meta name="viewport" content="width=device-width,initial-scale=1.0">
  8 + <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  9 + <meta http-equiv="Pragma" content="no-cache" />
  10 + <meta http-equiv="Expires" content="0" />
8 11 <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico"> -->
9 12 <title>
10 13 <%= htmlWebpackPlugin.options.title %>
... ... @@ -16,8 +19,8 @@
16 19 var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
17 20 link.type = 'image/x-icon';
18 21 link.rel = 'shortcut icon';
19   - var csCode = localStorage.getItem("csCode")||""
20   - link.href = csCode?"./331icon.ico":"./favicon.ico";
  22 + var csCode = localStorage.getItem("csCode") || ""
  23 + link.href = csCode ? "./331icon.ico" : "./favicon.ico";
21 24 document.getElementsByTagName('head')[0].appendChild(link);
22 25 </script>
23 26 <noscript>
... ...
src/api/apis/answerSheet.js
... ... @@ -59,6 +59,22 @@ export default {
59 59 data
60 60 })
61 61 },
  62 + // 修改答题卡测验类型
  63 + editPaperType(data) {
  64 + return service({
  65 + url: answerSheet.editPaperType,
  66 + method: 'POST',
  67 + data
  68 + })
  69 + },
  70 + // 删除答题卡测验类型
  71 + delPaperType(data) {
  72 + return service({
  73 + url: answerSheet.delPaperType,
  74 + method: 'POST',
  75 + data
  76 + })
  77 + },
62 78 // 保存答题卡
63 79 addPaper(data) {
64 80 return service({
... ...
src/api/urls/answerSheet.js
... ... @@ -13,6 +13,10 @@ export default {
13 13 subjectList: "/api_html/teaching/subjectList",
14 14 // 添加答题卡测验类型
15 15 addPaperType: "/api_html/teaching/addPaperType",
  16 + // 修改答题卡测验类型
  17 + editPaperType: "/api_html/teaching/modifyPaperType",
  18 + // 删除答题卡测验类型
  19 + delPaperType: "/api_html/teaching/delPaperType",
16 20 // 保存答题卡
17 21 addPaper: "/api_html/teaching/addPaper",
18 22 // 删除答题卡
... ...
src/views/examinationPaper/add.vue
... ... @@ -51,8 +51,8 @@
51 51 type="primary"
52 52 round
53 53 circle
54   - icon="el-icon-plus"
55   - @click="dialogVisible = true"
  54 + icon="el-icon-edit"
  55 + @click="openTagDia"
56 56 ></el-button>
57 57 </el-form-item>
58 58 <el-form-item label="年级:" prop="gradeName">
... ... @@ -107,24 +107,76 @@
107 107 <el-button type="primary" round @click="setStep1">下一步</el-button>
108 108 </div>
109 109 <el-dialog
110   - title="添加测验类型"
  110 + title="设置测验类型"
111 111 :visible.sync="dialogVisible"
112 112 width="500px"
113 113 >
114 114 <div class="dia-content">
  115 + <p class="add-type" v-for="item in tagList" :key="item.id">
  116 + <el-row :gutter="10">
  117 + <el-col :span="18"
  118 + ><el-input v-model="item.typeName" placeholder=""></el-input
  119 + ></el-col>
  120 + <el-col :span="6">
  121 + <el-tooltip effect="dark" content="修改" placement="top">
  122 + <el-button
  123 + class="js-set"
  124 + type="primary"
  125 + size="small"
  126 + round
  127 + circle
  128 + icon="el-icon-edit"
  129 + @click="editTypeName(item)"
  130 + ></el-button>
  131 + </el-tooltip>
  132 + <el-tooltip effect="dark" content="删除" placement="right">
  133 + <el-popconfirm
  134 + title="确定删除这道大题吗?"
  135 + @confirm="removeTypeName(item)"
  136 + >
  137 + <el-button
  138 + class="js-set"
  139 + type="danger"
  140 + size="small"
  141 + round
  142 + circle
  143 + icon="el-icon-delete"
  144 + slot="reference"
  145 + ></el-button>
  146 + </el-popconfirm>
  147 + </el-tooltip>
  148 + </el-col>
  149 + </el-row>
  150 + </p>
115 151 <p class="add-type">
116   - <el-input
117   - type="text"
118   - placeholder="请输入答题卡类型名称"
119   - v-model.trim="answerTypeName"
120   - :maxlength="10"
121   - >
122   - </el-input>
  152 + <el-row :gutter="10">
  153 + <el-col :span="18">
  154 + <el-input
  155 + type="text"
  156 + placeholder="请输入答题卡类型名称"
  157 + v-model.trim="answerTypeName"
  158 + :maxlength="10"
  159 + >
  160 + </el-input>
  161 + </el-col>
  162 + <el-col :span="6">
  163 + <el-tooltip effect="dark" content="添加" placement="right">
  164 + <el-button
  165 + class="js-set"
  166 + type="primary"
  167 + size="small"
  168 + round
  169 + circle
  170 + icon="el-icon-plus"
  171 + @click="addPaperType"
  172 + ></el-button>
  173 + </el-tooltip>
  174 + </el-col>
  175 + </el-row>
123 176 </p>
124 177 </div>
125 178 <div class="" slot="footer">
126   - <el-button type="primary" @click="addPaperType">确 定</el-button>
127   - <el-button @click="dialogVisible = false">取 消</el-button>
  179 + <el-button @click="dialogVisible = false">关 闭</el-button>
128 180 </div>
129 181 </el-dialog>
130 182 </div>
... ... @@ -703,6 +755,7 @@ export default {
703 755 { required: true, message: "请设置考试时长", trigger: "blur" },
704 756 ],
705 757 },
  758 + tagList: [],
706 759 diaSetAns: false,
707 760 formAns: {
708 761 listIndex: 0, //大题位置
... ... @@ -788,7 +841,7 @@ export default {
788 841 return !!item.questionType;
789 842 });
790 843 lengths = subArr.length;
791   - return lengths
  844 + return lengths;
792 845 },
793 846 setBigNum(num) {
794 847 let txt = "";
... ... @@ -1196,6 +1249,47 @@ export default {
1196 1249 sub.correctAnswer = arrs.sort().join("");
1197 1250 }
1198 1251 },
  1252 + openTagDia() {
  1253 + this.tagList = deepClone(this.answerTypeList);
  1254 + this.dialogVisible = true;
  1255 + },
  1256 + async editTypeName(obj) {
  1257 + let isRepeat = false;
  1258 + this.answerTypeList.map((item) => {
  1259 + if (item.typeName == obj.typeName) {
  1260 + isRepeat = true;
  1261 + }
  1262 + });
  1263 + if (isRepeat) {
  1264 + this.$message.error("类型已存在请重新填写!");
  1265 + return;
  1266 + }
  1267 + //修改测验类型
  1268 + const { data, status, info } = await this.$request.editPaperType({
  1269 + tagId: obj.id,
  1270 + tag: obj.typeName,
  1271 + });
  1272 + if (status == 0) {
  1273 + await this._TypeList();
  1274 + this.tagList = deepClone(this.answerTypeList);
  1275 + this.$message.success("修改成功");
  1276 + } else {
  1277 + this.$message.error(info);
  1278 + }
  1279 + },
  1280 + async removeTypeName(obj) {
  1281 + //删除测验类型
  1282 + const { data, status, info } = await this.$request.delPaperType({
  1283 + tagId: obj.id,
  1284 + });
  1285 + if (status == 0) {
  1286 + await this._TypeList();
  1287 + this.tagList = deepClone(this.answerTypeList);
  1288 + this.$message.success("删除成功");
  1289 + } else {
  1290 + this.$message.error(info);
  1291 + }
  1292 + },
1199 1293 async addPaperType() {
1200 1294 //保存测验类型
1201 1295 if (!this.answerTypeName) {
... ... @@ -1218,8 +1312,8 @@ export default {
1218 1312 });
1219 1313 if (status == 0) {
1220 1314 await this._TypeList();
  1315 + this.tagList = deepClone(this.answerTypeList);
1221 1316 this.form.tagId = data || "";
1222   - this.dialogVisible = false;
1223 1317 this.answerTypeName = "";
1224 1318 this.$message.success("添加成功");
1225 1319 } else {
... ... @@ -1405,7 +1499,12 @@ export default {
1405 1499 text-align: center;
1406 1500 }
1407 1501 .add-type {
1408   - display: flex;
  1502 + width: 100%;
  1503 + margin-bottom: 10px;
  1504 + .js-set {
  1505 + margin: 2.5px 10px 0 0;
  1506 + font-size: 14px;
  1507 + }
1409 1508 }
1410 1509 .add-btn {
1411 1510 margin-left: 20px;
... ...