Commit d5987f6abf3096cca742d8315a75f9e954bf9a28
1 parent
75a5cc20
组件修改答案
Showing
7 changed files
with
420 additions
and
662 deletions
src/components/setAnswer.vue
0 → 100644
| 1 | +<template> | ||
| 2 | + <el-dialog :visible.sync="diaVisible" width="400" center> | ||
| 3 | + <div slot="title"> | ||
| 4 | + <p> | ||
| 5 | + <!-- 设置答案 <i class="fa fa-exchange" @click="editType = !editType"></i> --> | ||
| 6 | + 设置答案 | ||
| 7 | + </p> | ||
| 8 | + </div> | ||
| 9 | + <div v-show="editType"> | ||
| 10 | + <div v-for="(item, index) in FormQuestionList" :key="index"> | ||
| 11 | + <template v-for="(subQuestions, indexs) in item.subQuestions"> | ||
| 12 | + <div | ||
| 13 | + class="sub-questions" | ||
| 14 | + :key="indexs" | ||
| 15 | + v-if="subQuestions.correctAnswer" | ||
| 16 | + > | ||
| 17 | + <div class="qs-num">题{{ subQuestions.questionIndex }}</div> | ||
| 18 | + <div class="qs-options qs-options2"> | ||
| 19 | + <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
| 20 | + <span | ||
| 21 | + class="answer-s" | ||
| 22 | + :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
| 23 | + @click="subQuestions.correctAnswer = 1" | ||
| 24 | + >✓</span | ||
| 25 | + > | ||
| 26 | + <span | ||
| 27 | + class="answer-s" | ||
| 28 | + :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
| 29 | + @click="subQuestions.correctAnswer = 2" | ||
| 30 | + >✗</span | ||
| 31 | + > | ||
| 32 | + </p> | ||
| 33 | + <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
| 34 | + <span | ||
| 35 | + class="answer-s" | ||
| 36 | + v-for="option in subQuestions.answerOptions" | ||
| 37 | + :class=" | ||
| 38 | + subQuestions.correctAnswer.includes(option) ? 'active' : '' | ||
| 39 | + " | ||
| 40 | + :key="option" | ||
| 41 | + @click="changAnswer(subQuestions, option)" | ||
| 42 | + >{{ option }}</span | ||
| 43 | + > | ||
| 44 | + </p> | ||
| 45 | + <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
| 46 | + <span | ||
| 47 | + class="answer-s" | ||
| 48 | + v-for="option in subQuestions.answerOptions" | ||
| 49 | + :class="subQuestions.correctAnswer == option ? 'active' : ''" | ||
| 50 | + :key="option" | ||
| 51 | + @click="subQuestions.correctAnswer = option" | ||
| 52 | + >{{ option }}</span | ||
| 53 | + > | ||
| 54 | + </p> | ||
| 55 | + </div> | ||
| 56 | + </div> | ||
| 57 | + </template> | ||
| 58 | + </div> | ||
| 59 | + </div> | ||
| 60 | + <!-- <div v-show="!editType"> | ||
| 61 | + <p class="dia-tips"> | ||
| 62 | + 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” | ||
| 63 | + </p> | ||
| 64 | + <div class="dia-question-box"> | ||
| 65 | + <div v-for="(item, index) in FormQuestionList2" :key="index"> | ||
| 66 | + <template v-for="(items, indexs) in item.subQuestions"> | ||
| 67 | + <div class="set-questions" :key="indexs"> | ||
| 68 | + <div class="qs-num"> | ||
| 69 | + <p>{{ items.name }}</p> | ||
| 70 | + <p>共{{ items.list.length }}题</p> | ||
| 71 | + </div> | ||
| 72 | + <div class="qs-options"> | ||
| 73 | + <p class="ipt"> | ||
| 74 | + <el-input | ||
| 75 | + v-model="items.answerList" | ||
| 76 | + @keydown.native="keydownAnswer($event)" | ||
| 77 | + ></el-input> | ||
| 78 | + </p> | ||
| 79 | + <p class="answer-box"> | ||
| 80 | + <template v-if="items.list[0].questionType == 4"> | ||
| 81 | + <span | ||
| 82 | + class="answer-s active" | ||
| 83 | + @click=" | ||
| 84 | + items.answerList.length < items.list.length | ||
| 85 | + ? (items.answerList += '✓') | ||
| 86 | + : '' | ||
| 87 | + " | ||
| 88 | + >✓</span | ||
| 89 | + > | ||
| 90 | + <span | ||
| 91 | + class="answer-s active" | ||
| 92 | + @click=" | ||
| 93 | + items.answerList.length < items.list.length | ||
| 94 | + ? (items.answerList += '✗') | ||
| 95 | + : '' | ||
| 96 | + " | ||
| 97 | + >✗</span | ||
| 98 | + > | ||
| 99 | + </template> | ||
| 100 | + <template v-if="items.list[0].questionType == 3"> | ||
| 101 | + <span | ||
| 102 | + class="answer-s active" | ||
| 103 | + v-for="option in items.list[0].answerOptions" | ||
| 104 | + :key="option" | ||
| 105 | + @click="setAnswer(items,option)" | ||
| 106 | + >{{ option }}</span | ||
| 107 | + > | ||
| 108 | + <span | ||
| 109 | + class="answer-s active" | ||
| 110 | + @click=" | ||
| 111 | + items.answerList.split(',').length < items.list.length | ||
| 112 | + ? (items.answerList += ',') | ||
| 113 | + : '' | ||
| 114 | + " | ||
| 115 | + >,</span | ||
| 116 | + > | ||
| 117 | + </template> | ||
| 118 | + <template | ||
| 119 | + v-if="items.list[0].questionType == 2" | ||
| 120 | + class="answer-box" | ||
| 121 | + > | ||
| 122 | + <span | ||
| 123 | + class="answer-s active" | ||
| 124 | + v-for="option in items.list[0].answerOptions" | ||
| 125 | + :key="option" | ||
| 126 | + @click=" | ||
| 127 | + items.answerList.length < items.list.length | ||
| 128 | + ? (items.answerList += option) | ||
| 129 | + : '' | ||
| 130 | + " | ||
| 131 | + >{{ option }}</span | ||
| 132 | + > | ||
| 133 | + </template> | ||
| 134 | + <span | ||
| 135 | + class="answer-s delButton" | ||
| 136 | + @click="items.answerList = items.answerList.slice(0, -1)" | ||
| 137 | + >x</span | ||
| 138 | + > | ||
| 139 | + <span | ||
| 140 | + class="answer-s ac" | ||
| 141 | + @click="items.answerList = ''" | ||
| 142 | + >AC</span | ||
| 143 | + > | ||
| 144 | + </p> | ||
| 145 | + </div> | ||
| 146 | + </div> | ||
| 147 | + </template> | ||
| 148 | + </div> | ||
| 149 | + </div> | ||
| 150 | + </div> --> | ||
| 151 | + <div slot="footer"> | ||
| 152 | + <el-button class="dia-btn" type="primary" @click="saveAnswer" | ||
| 153 | + >确 定</el-button | ||
| 154 | + > | ||
| 155 | + <el-button class="dia-btn" type="danger" @click="cancel">取 消</el-button> | ||
| 156 | + </div> | ||
| 157 | + </el-dialog> | ||
| 158 | +</template> | ||
| 159 | + | ||
| 160 | +<script> | ||
| 161 | +import { deepClone } from "utils"; | ||
| 162 | +export default { | ||
| 163 | + name: "SetAnswer", | ||
| 164 | + props: { | ||
| 165 | + diaVisible: false, //修改答案 | ||
| 166 | + paperId: "", | ||
| 167 | + questionList: Array, | ||
| 168 | + }, | ||
| 169 | + data() { | ||
| 170 | + return { | ||
| 171 | + editType: true, //修改答案模式 | ||
| 172 | + FormQuestionList: [], | ||
| 173 | + }; | ||
| 174 | + }, | ||
| 175 | + watch: { | ||
| 176 | + questionList: { | ||
| 177 | + handler: function () { | ||
| 178 | + this.FormQuestionList = deepClone(this.questionList); | ||
| 179 | + console.log(this.questionList); | ||
| 180 | + //组合每道大题中的相同题目 | ||
| 181 | + // let questionList = deepClone(item.questionList); | ||
| 182 | + // for (let i = 0; i < questionList.length; i++) { | ||
| 183 | + // let jsons = {}; | ||
| 184 | + // let answerOptions = []; | ||
| 185 | + // questionList[i].subQuestions.map((items) => { | ||
| 186 | + // let txt = this.setSubPro(items.questionType); | ||
| 187 | + // if (jsons[txt]) { | ||
| 188 | + // jsons[txt].push(items); | ||
| 189 | + // } else { | ||
| 190 | + // jsons[txt] = [items]; | ||
| 191 | + // } | ||
| 192 | + // if (items.questionType == 2 || items.questionType == 3) { | ||
| 193 | + // if (items.answerOptions.length > answerOptions.length) { | ||
| 194 | + // answerOptions = items.answerOptions; | ||
| 195 | + // } | ||
| 196 | + // jsons[txt][0].answerOptions = answerOptions; | ||
| 197 | + // } | ||
| 198 | + // }); | ||
| 199 | + // this.FormQuestionList2[i].subQuestions = Object.keys(jsons).map( | ||
| 200 | + // (item) => { | ||
| 201 | + // return { | ||
| 202 | + // name: item, | ||
| 203 | + // list: jsons[item], | ||
| 204 | + // answerList: "", | ||
| 205 | + // }; | ||
| 206 | + // } | ||
| 207 | + // ); | ||
| 208 | + // } | ||
| 209 | + }, | ||
| 210 | + deep: true, | ||
| 211 | + }, | ||
| 212 | + }, | ||
| 213 | + methods: { | ||
| 214 | + setSubPro(type) { | ||
| 215 | + let tit; | ||
| 216 | + switch (type) { | ||
| 217 | + case 2: | ||
| 218 | + tit = "单选题"; | ||
| 219 | + break; | ||
| 220 | + case 3: | ||
| 221 | + tit = "多选题"; | ||
| 222 | + break; | ||
| 223 | + case 4: | ||
| 224 | + tit = "判断题"; | ||
| 225 | + break; | ||
| 226 | + case 5: | ||
| 227 | + tit = "主观题"; | ||
| 228 | + break; | ||
| 229 | + } | ||
| 230 | + return tit; | ||
| 231 | + }, | ||
| 232 | + keydownAnswer(event) { | ||
| 233 | + //快速答案设置禁止输入 | ||
| 234 | + if ( | ||
| 235 | + event.key == "Meta" || | ||
| 236 | + event.key == "CapsLock" || | ||
| 237 | + event.key == "Shift" || | ||
| 238 | + event.key == "Enter" || | ||
| 239 | + event.key == "Alt" || | ||
| 240 | + event.key == "Backspace" || | ||
| 241 | + event.key == "Delete" || | ||
| 242 | + event.key == "ArrowUp" || | ||
| 243 | + event.key == "ArrowDown" || | ||
| 244 | + event.key == "ArrowLeft" || | ||
| 245 | + event.key == "v" || | ||
| 246 | + event.key == "V" || | ||
| 247 | + event.key == "ArrowRight" | ||
| 248 | + ) { | ||
| 249 | + return; | ||
| 250 | + } else { | ||
| 251 | + event.returnValue = ""; | ||
| 252 | + } | ||
| 253 | + }, | ||
| 254 | + setAnswer(obj, answer) { | ||
| 255 | + //多选答案设置 | ||
| 256 | + obj.answerList += answer; | ||
| 257 | + let str = obj.answerList; | ||
| 258 | + let str2 = checkAnswer( | ||
| 259 | + str, | ||
| 260 | + 3, | ||
| 261 | + obj.list[0].answerOptions, | ||
| 262 | + obj.list.length | ||
| 263 | + ); | ||
| 264 | + obj.answerList = str2; | ||
| 265 | + }, | ||
| 266 | + changAnswer(sub, option) { | ||
| 267 | + //设置多选答案 | ||
| 268 | + let str = new RegExp(option, "g"); | ||
| 269 | + if (sub.correctAnswer?.includes(option)) { | ||
| 270 | + sub.correctAnswer = sub.correctAnswer.replace(str, ""); | ||
| 271 | + } else { | ||
| 272 | + let arrs = (sub.correctAnswer && sub.correctAnswer.split("")) || []; | ||
| 273 | + arrs.push(option); | ||
| 274 | + sub.correctAnswer = arrs.sort().join(""); | ||
| 275 | + } | ||
| 276 | + }, | ||
| 277 | + async saveAnswer() { | ||
| 278 | + const { data, status, message } = await this.$request.modifyPaper({ | ||
| 279 | + paperId: this.paperId, | ||
| 280 | + questionList: questionList, | ||
| 281 | + }); | ||
| 282 | + if (status == 0) { | ||
| 283 | + this.$emit('saveSuccess') | ||
| 284 | + } else { | ||
| 285 | + this.$message.error(message); | ||
| 286 | + } | ||
| 287 | + }, | ||
| 288 | + cancel() { | ||
| 289 | + this.$emit('cancel') | ||
| 290 | + }, | ||
| 291 | + }, | ||
| 292 | +}; | ||
| 293 | +</script> | ||
| 294 | + | ||
| 295 | +<style lang="scss" scoped> | ||
| 296 | +.sub-questions { | ||
| 297 | + width: 100%; | ||
| 298 | + display: flex; | ||
| 299 | + &:hover { | ||
| 300 | + background: #f8f8f8; | ||
| 301 | + } | ||
| 302 | + & > div { | ||
| 303 | + min-height: 40px; | ||
| 304 | + padding: 5px; | ||
| 305 | + flex-shrink: 0; | ||
| 306 | + display: flex; | ||
| 307 | + justify-content: center; | ||
| 308 | + align-items: center; | ||
| 309 | + } | ||
| 310 | + .qs-num { | ||
| 311 | + width: 80px; | ||
| 312 | + font-size: 16px; | ||
| 313 | + color: #333; | ||
| 314 | + font-weight: 500; | ||
| 315 | + } | ||
| 316 | + .qs-options { | ||
| 317 | + flex: 1; | ||
| 318 | + } | ||
| 319 | + .qs-options2 { | ||
| 320 | + text-align: left; | ||
| 321 | + justify-content: flex-start; | ||
| 322 | + padding-left: 20px; | ||
| 323 | + .answer-s { | ||
| 324 | + cursor: pointer; | ||
| 325 | + border-color: #667ffd; | ||
| 326 | + color: #667ffd; | ||
| 327 | + margin: 0 15px; | ||
| 328 | + &.active { | ||
| 329 | + color: #fff; | ||
| 330 | + } | ||
| 331 | + } | ||
| 332 | + } | ||
| 333 | + :deep(.el-select) { | ||
| 334 | + .el-input__inner { | ||
| 335 | + border-radius: 20px; | ||
| 336 | + border-color: #667ffd; | ||
| 337 | + width: 150px; | ||
| 338 | + height: 32px; | ||
| 339 | + line-height: 32px; | ||
| 340 | + background: rgba($color: #667ffd, $alpha: 0.05); | ||
| 341 | + } | ||
| 342 | + .el-input__icon { | ||
| 343 | + line-height: 32px; | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | +} | ||
| 347 | +</style> | ||
| 0 | \ No newline at end of file | 348 | \ No newline at end of file |
src/components/userForm/userInfo.vue deleted
| 1 | -<template> | ||
| 2 | - <el-dialog :title="title" width="800px" :visible.sync="visible" destroy-on-close @close="closeCallback"> | ||
| 3 | - <div class="card"> | ||
| 4 | - <p class="title"><i class="fa fa-th-large fa-lg"></i>个人资料</p> | ||
| 5 | - <el-form :model="ruleForm2" status-icon :rules="rules" ref="ruleForm2" label-width="100px" class="demo-ruleForm"> | ||
| 6 | - <el-form-item label="用户名" prop="username"> | ||
| 7 | - <el-input v-model="ruleForm2.username" autocomplete="off"></el-input> | ||
| 8 | - </el-form-item> | ||
| 9 | - <el-form-item v-if="!userId" label="密码" prop="password"> | ||
| 10 | - <el-input type="password" v-model="ruleForm2.password" autocomplete="off"></el-input> | ||
| 11 | - </el-form-item> | ||
| 12 | - <el-form-item v-if="!userId" label="确认密码" prop="checkPass"> | ||
| 13 | - <el-input type="password" v-model="ruleForm2.checkPass" autocomplete="off"></el-input> | ||
| 14 | - </el-form-item> | ||
| 15 | - <el-form-item label="角色"> | ||
| 16 | - <el-select v-if="roleName" v-model="ruleForm2.roleId" disabled placeholder="请选择等级"> | ||
| 17 | - <el-option | ||
| 18 | - v-for="item in roleData" | ||
| 19 | - :key="item.id" | ||
| 20 | - :label="item.name" | ||
| 21 | - :value="item.id"> | ||
| 22 | - </el-option> | ||
| 23 | - </el-select> | ||
| 24 | - <el-select v-else v-model="ruleForm2.roleId" placeholder="请选择等级"> | ||
| 25 | - <el-option | ||
| 26 | - v-for="item in roleData" | ||
| 27 | - :key="item.id" | ||
| 28 | - :label="item.name" | ||
| 29 | - :value="item.id" | ||
| 30 | - :disabled="item.disabled"> | ||
| 31 | - </el-option> | ||
| 32 | - </el-select> | ||
| 33 | - </el-form-item> | ||
| 34 | - <el-form-item label="姓名" prop="name"> | ||
| 35 | - <el-input v-model="ruleForm2.name" autocomplete="off"></el-input> | ||
| 36 | - </el-form-item> | ||
| 37 | - <el-form-item label="性别"> | ||
| 38 | - <el-radio-group v-model="ruleForm2.sex"> | ||
| 39 | - <el-radio label="1">男</el-radio> | ||
| 40 | - <el-radio label="2">女</el-radio> | ||
| 41 | - </el-radio-group> | ||
| 42 | - </el-form-item> | ||
| 43 | - <el-form-item label="年龄" prop="age"> | ||
| 44 | - <el-input v-model="ruleForm2.age" autocomplete="off"></el-input> | ||
| 45 | - </el-form-item> | ||
| 46 | - <el-form-item label="手机号" prop="mobilePhone"> | ||
| 47 | - <el-input v-model="ruleForm2.mobilePhone" autocomplete="off"></el-input> | ||
| 48 | - </el-form-item> | ||
| 49 | - <el-form-item label="是否启用"> | ||
| 50 | - <el-switch v-model="ruleForm2.status"></el-switch> | ||
| 51 | - </el-form-item> | ||
| 52 | - <el-form-item label="头像上传"> | ||
| 53 | - <el-upload | ||
| 54 | - class="avatar-uploader" | ||
| 55 | - action="/api/editor/uploadImg" | ||
| 56 | - :show-file-list="false" | ||
| 57 | - :on-success="handleAvatarSuccess" | ||
| 58 | - :before-upload="beforeAvatarUpload"> | ||
| 59 | - <img v-if="ruleForm2.avatar" :src="ruleForm2.avatar" class="avatar"> | ||
| 60 | - <i v-else class="el-icon-plus avatar-uploader-icon"></i> | ||
| 61 | - </el-upload> | ||
| 62 | - </el-form-item> | ||
| 63 | - <el-form-item> | ||
| 64 | - <el-button type="primary" @click="submitForm('ruleForm2')">确 定</el-button> | ||
| 65 | - <el-button @click="resetForm('ruleForm2')">重 置</el-button> | ||
| 66 | - </el-form-item> | ||
| 67 | - </el-form> | ||
| 68 | - </div> | ||
| 69 | - </el-dialog> | ||
| 70 | -</template> | ||
| 71 | - | ||
| 72 | -<script> | ||
| 73 | -export default { | ||
| 74 | - name: "userInfo", | ||
| 75 | - props: { | ||
| 76 | - title: { | ||
| 77 | - type: String, | ||
| 78 | - default: "账号信息" | ||
| 79 | - }, | ||
| 80 | - dialogVisible: { | ||
| 81 | - type: Boolean, | ||
| 82 | - default: false | ||
| 83 | - }, | ||
| 84 | - userId: { | ||
| 85 | - type: String, | ||
| 86 | - default: "" | ||
| 87 | - } | ||
| 88 | - }, | ||
| 89 | - data () { | ||
| 90 | - var validatePass = (rule, value, callback) => { | ||
| 91 | - if (value === "") { | ||
| 92 | - callback(new Error("请输入密码")) | ||
| 93 | - } else { | ||
| 94 | - if (this.ruleForm2.checkPass !== "") { | ||
| 95 | - this.$refs.ruleForm2.validateField("checkPass") | ||
| 96 | - } | ||
| 97 | - callback() | ||
| 98 | - } | ||
| 99 | - } | ||
| 100 | - var validatePass2 = (rule, value, callback) => { | ||
| 101 | - if (value === "") { | ||
| 102 | - callback(new Error("请再次输入密码")) | ||
| 103 | - } else if (value !== this.ruleForm2.password) { | ||
| 104 | - callback(new Error("两次输入密码不一致!")) | ||
| 105 | - } else { | ||
| 106 | - callback() | ||
| 107 | - } | ||
| 108 | - } | ||
| 109 | - return { | ||
| 110 | - roleName: false, | ||
| 111 | - roleData: "", | ||
| 112 | - visible: this.dialogVisible, | ||
| 113 | - ruleForm2: { | ||
| 114 | - mobilePhone: "", | ||
| 115 | - username: "", | ||
| 116 | - password: "", | ||
| 117 | - checkPass: "", | ||
| 118 | - roleId: "", | ||
| 119 | - status: "", | ||
| 120 | - sex: "1", | ||
| 121 | - age: 0, | ||
| 122 | - name: "", | ||
| 123 | - avatar: "" | ||
| 124 | - }, | ||
| 125 | - rules: { | ||
| 126 | - username: [ | ||
| 127 | - { required: true, message: "请输入用户名", trigger: "blur" }, | ||
| 128 | - { min: 3, max: 18, message: "长度在 3 到 18 个字符", trigger: "blur" } | ||
| 129 | - ], | ||
| 130 | - password: [ | ||
| 131 | - {required: true, validator: validatePass, trigger: "blur"} | ||
| 132 | - ], | ||
| 133 | - checkPass: [ | ||
| 134 | - {required: true, validator: validatePass2, trigger: "blur"} | ||
| 135 | - ], | ||
| 136 | - roleId: [ | ||
| 137 | - { required: true, message: "请选择用户角色", trigger: "change" } | ||
| 138 | - ] | ||
| 139 | - } | ||
| 140 | - } | ||
| 141 | - }, | ||
| 142 | - methods: { | ||
| 143 | - handleAvatarSuccess (res, file) { | ||
| 144 | - this.ruleForm2.avatar = res.data[0] | ||
| 145 | - }, | ||
| 146 | - closeCallback () { | ||
| 147 | - this.$emit("successCallback") | ||
| 148 | - }, | ||
| 149 | - beforeAvatarUpload (file) { | ||
| 150 | - const isJPG = file.type === "image/jpeg" | ||
| 151 | - const isPNG = file.type === "image/png" | ||
| 152 | - const isLt2M = file.size / 1024 / 1024 < 2 | ||
| 153 | - | ||
| 154 | - if (!(isJPG || isPNG)) { | ||
| 155 | - this.$message.error("上传头像图片只能是 JPG/PNG 格式!") | ||
| 156 | - } | ||
| 157 | - if (!isLt2M) { | ||
| 158 | - this.$message.error("上传头像图片大小不能超过 2MB!") | ||
| 159 | - } | ||
| 160 | - // eslint-disable-next-line no-mixed-operators | ||
| 161 | - return isLt2M && isJPG || isPNG | ||
| 162 | - }, | ||
| 163 | - getList () { | ||
| 164 | - let that = this | ||
| 165 | - this.$request.fetchGetRoleList().then(function (response) { | ||
| 166 | - that.roleData = response.data.rows | ||
| 167 | - let userId = that.userId | ||
| 168 | - if (!userId) { | ||
| 169 | - return false | ||
| 170 | - } | ||
| 171 | - that.$request.fetchGetUserInfoId({id: userId}) | ||
| 172 | - .then(function (res) { | ||
| 173 | - console.log(res) | ||
| 174 | - res.data.password = "" | ||
| 175 | - if (res.data.status === "1") { | ||
| 176 | - res.data.status = true | ||
| 177 | - } else { | ||
| 178 | - res.data.status = false | ||
| 179 | - } | ||
| 180 | - | ||
| 181 | - that.ruleForm2 = res.data | ||
| 182 | - that.roleName = true | ||
| 183 | - for (let i = 0; i < that.roleData.length; i++) { | ||
| 184 | - if (that.$store.getters.info.role === "超级管理员" && that.$store.getters.info.uid !== userId) { | ||
| 185 | - that.roleName = false | ||
| 186 | - } | ||
| 187 | - } | ||
| 188 | - return false | ||
| 189 | - }) | ||
| 190 | - .catch(function (error) { | ||
| 191 | - console.log(error) | ||
| 192 | - }) | ||
| 193 | - }) | ||
| 194 | - .catch(function (error) { | ||
| 195 | - console.log(error) | ||
| 196 | - }) | ||
| 197 | - }, | ||
| 198 | - submitForm (formName) { | ||
| 199 | - let that = this | ||
| 200 | - this.$refs[formName].validate((valid) => { | ||
| 201 | - if (valid) { | ||
| 202 | - let newData = {} | ||
| 203 | - let fetchFn = this.$request.fetchEditUser | ||
| 204 | - if (!that.userId) { | ||
| 205 | - for (let item in that.ruleForm2) { | ||
| 206 | - if (item !== "checkPass") { | ||
| 207 | - newData[item] = that.ruleForm2[item] | ||
| 208 | - } | ||
| 209 | - } | ||
| 210 | - fetchFn = this.$request.fetchRegister | ||
| 211 | - } else { | ||
| 212 | - for (let item in that.ruleForm2) { | ||
| 213 | - if (item !== "password" && item !== "checkPass") { | ||
| 214 | - newData[item] = that.ruleForm2[item] | ||
| 215 | - } | ||
| 216 | - } | ||
| 217 | - } | ||
| 218 | - fetchFn(newData).then((res) => { | ||
| 219 | - that.$message({ | ||
| 220 | - showClose: true, | ||
| 221 | - message: res.data.message, | ||
| 222 | - type: "success" | ||
| 223 | - }) | ||
| 224 | - }).catch((err) => { | ||
| 225 | - console.log(err) | ||
| 226 | - }) | ||
| 227 | - } else { | ||
| 228 | - console.log("error submit!!") | ||
| 229 | - return false | ||
| 230 | - } | ||
| 231 | - }) | ||
| 232 | - }, | ||
| 233 | - resetForm (formName) { | ||
| 234 | - this.$refs[formName].resetFields() | ||
| 235 | - } | ||
| 236 | - }, | ||
| 237 | - mounted () { | ||
| 238 | - // this.getList() | ||
| 239 | - } | ||
| 240 | -} | ||
| 241 | -</script> | ||
| 242 | -<style scoped> | ||
| 243 | - .demo-ruleForm { | ||
| 244 | - width: 460px; | ||
| 245 | - padding-top: 25px; | ||
| 246 | - } | ||
| 247 | - .el-select { | ||
| 248 | - width: 100%; | ||
| 249 | - } | ||
| 250 | - .card { | ||
| 251 | - width: 560px; | ||
| 252 | - padding-bottom: 15px; | ||
| 253 | - margin: 0px auto; | ||
| 254 | - } | ||
| 255 | - .avatar-uploader .el-upload { | ||
| 256 | - border: 1px dashed #d9d9d9; | ||
| 257 | - border-radius: 6px; | ||
| 258 | - cursor: pointer; | ||
| 259 | - position: relative; | ||
| 260 | - overflow: hidden; | ||
| 261 | - } | ||
| 262 | - .avatar-uploader .el-upload:hover { | ||
| 263 | - border-color: #409EFF; | ||
| 264 | - } | ||
| 265 | - .avatar-uploader-icon { | ||
| 266 | - font-size: 28px; | ||
| 267 | - color: #8c939d; | ||
| 268 | - width: 178px; | ||
| 269 | - height: 178px; | ||
| 270 | - line-height: 178px; | ||
| 271 | - text-align: center; | ||
| 272 | - } | ||
| 273 | - .avatar { | ||
| 274 | - width: 178px; | ||
| 275 | - height: 178px; | ||
| 276 | - display: block; | ||
| 277 | - } | ||
| 278 | -</style> |
src/views/ask/index.vue
| @@ -9,8 +9,8 @@ | @@ -9,8 +9,8 @@ | ||
| 9 | <div class="sel-box"> | 9 | <div class="sel-box"> |
| 10 | <el-select | 10 | <el-select |
| 11 | class="sel" | 11 | class="sel" |
| 12 | - v-model="query.clazzId" | ||
| 13 | - placeholder="" | 12 | + v-model="query.classId" |
| 13 | + placeholder="选择班级" | ||
| 14 | @change="changClazz" | 14 | @change="changClazz" |
| 15 | > | 15 | > |
| 16 | <el-option | 16 | <el-option |
| @@ -18,11 +18,11 @@ | @@ -18,11 +18,11 @@ | ||
| 18 | :key="item.value" | 18 | :key="item.value" |
| 19 | :label="item.label" | 19 | :label="item.label" |
| 20 | :value="item.value" | 20 | :value="item.value" |
| 21 | - >{{ item.label }} | 21 | + > |
| 22 | </el-option> | 22 | </el-option> |
| 23 | </el-select> | 23 | </el-select> |
| 24 | <el-select | 24 | <el-select |
| 25 | - v-if="role == '班主任'" | 25 | + v-if="role == 'ROLE_BANZHUREN'" |
| 26 | class="sel" | 26 | class="sel" |
| 27 | multiple | 27 | multiple |
| 28 | collapse-tags | 28 | collapse-tags |
| @@ -89,7 +89,7 @@ | @@ -89,7 +89,7 @@ | ||
| 89 | <div class="table-box"> | 89 | <div class="table-box"> |
| 90 | <el-radio-group v-model="tabIndex" style="margin-bottom: 20px"> | 90 | <el-radio-group v-model="tabIndex" style="margin-bottom: 20px"> |
| 91 | <el-radio-button :label="1">单课时报表</el-radio-button> | 91 | <el-radio-button :label="1">单课时报表</el-radio-button> |
| 92 | - <el-radio-button :label="2" v-if="this.role != '班主任'" | 92 | + <el-radio-button :label="2" v-if="this.role != 'ROLE_BANZHUREN'" |
| 93 | >阶段问答报表</el-radio-button | 93 | >阶段问答报表</el-radio-button |
| 94 | > | 94 | > |
| 95 | <el-radio-button :label="3">阶段互动报表</el-radio-button> | 95 | <el-radio-button :label="3">阶段互动报表</el-radio-button> |
| @@ -283,187 +283,23 @@ | @@ -283,187 +283,23 @@ | ||
| 283 | <el-button type="info" plain round icon="fa fa-cloud-download">导出报表</el-button> | 283 | <el-button type="info" plain round icon="fa fa-cloud-download">导出报表</el-button> |
| 284 | </p> | 284 | </p> |
| 285 | </div> | 285 | </div> |
| 286 | - <el-dialog :visible.sync="dialogVisible" width="400" center> | ||
| 287 | - <div slot="title"> | ||
| 288 | - <p> | ||
| 289 | - <!-- 设置答案 <i class="fa fa-exchange" @click="editType = !editType"></i> --> | ||
| 290 | - 设置答案 | ||
| 291 | - </p> | ||
| 292 | - </div> | ||
| 293 | - <div v-show="editType"> | ||
| 294 | - <div v-for="(item, index) in form.questionList" :key="index"> | ||
| 295 | - <template v-for="(subQuestions, indexs) in item.subQuestions"> | ||
| 296 | - <div | ||
| 297 | - class="sub-questions" | ||
| 298 | - :key="indexs" | ||
| 299 | - v-if="subQuestions.correctAnswer" | ||
| 300 | - > | ||
| 301 | - <div class="qs-num">题{{ subQuestions.questionIndex }}</div> | ||
| 302 | - <div class="qs-options qs-options2"> | ||
| 303 | - <p v-if="subQuestions.questionType == 4" class="answer-box"> | ||
| 304 | - <span | ||
| 305 | - class="answer-s" | ||
| 306 | - :class="subQuestions.correctAnswer == 1 ? 'active' : ''" | ||
| 307 | - @click="subQuestions.correctAnswer = 1" | ||
| 308 | - >✓</span | ||
| 309 | - > | ||
| 310 | - <span | ||
| 311 | - class="answer-s" | ||
| 312 | - :class="subQuestions.correctAnswer == 2 ? 'active' : ''" | ||
| 313 | - @click="subQuestions.correctAnswer = 2" | ||
| 314 | - >✗</span | ||
| 315 | - > | ||
| 316 | - </p> | ||
| 317 | - <p v-if="subQuestions.questionType == 3" class="answer-box"> | ||
| 318 | - <span | ||
| 319 | - class="answer-s" | ||
| 320 | - v-for="option in subQuestions.answerOptions" | ||
| 321 | - :class=" | ||
| 322 | - subQuestions.correctAnswer.includes(option) | ||
| 323 | - ? 'active' | ||
| 324 | - : '' | ||
| 325 | - " | ||
| 326 | - :key="option" | ||
| 327 | - @click="changAnswer(subQuestions, option)" | ||
| 328 | - >{{ option }}</span | ||
| 329 | - > | ||
| 330 | - </p> | ||
| 331 | - <p v-if="subQuestions.questionType == 2" class="answer-box"> | ||
| 332 | - <span | ||
| 333 | - class="answer-s" | ||
| 334 | - v-for="option in subQuestions.answerOptions" | ||
| 335 | - :class=" | ||
| 336 | - subQuestions.correctAnswer == option ? 'active' : '' | ||
| 337 | - " | ||
| 338 | - :key="option" | ||
| 339 | - @click="subQuestions.correctAnswer = option" | ||
| 340 | - >{{ option }}</span | ||
| 341 | - > | ||
| 342 | - </p> | ||
| 343 | - </div> | ||
| 344 | - </div> | ||
| 345 | - </template> | ||
| 346 | - </div> | ||
| 347 | - </div> | ||
| 348 | - <!-- <div v-show="!editType"> | ||
| 349 | - <p class="dia-tips"> | ||
| 350 | - 请点击选项按钮设置答案,多选题题目之间用“,”隔开,若添加5道题:“AC,AD,BD,AC,CD” | ||
| 351 | - </p> | ||
| 352 | - <div class="dia-question-box"> | ||
| 353 | - <div v-for="(item, index) in form2.questionList" :key="index"> | ||
| 354 | - <template v-for="(items, indexs) in item.subQuestions"> | ||
| 355 | - <div class="set-questions" :key="indexs"> | ||
| 356 | - <div class="qs-num"> | ||
| 357 | - <p>{{ items.name }}</p> | ||
| 358 | - <p>共{{ items.list.length }}题</p> | ||
| 359 | - </div> | ||
| 360 | - <div class="qs-options"> | ||
| 361 | - <p class="ipt"> | ||
| 362 | - <el-input | ||
| 363 | - v-model="items.answerList" | ||
| 364 | - @keydown.native="keydownAnswer($event)" | ||
| 365 | - ></el-input> | ||
| 366 | - </p> | ||
| 367 | - <p class="answer-box"> | ||
| 368 | - <template v-if="items.list[0].questionType == 4"> | ||
| 369 | - <span | ||
| 370 | - class="answer-s active" | ||
| 371 | - @click=" | ||
| 372 | - items.answerList.length < items.list.length | ||
| 373 | - ? (items.answerList += '✓') | ||
| 374 | - : '' | ||
| 375 | - " | ||
| 376 | - >✓</span | ||
| 377 | - > | ||
| 378 | - <span | ||
| 379 | - class="answer-s active" | ||
| 380 | - @click=" | ||
| 381 | - items.answerList.length < items.list.length | ||
| 382 | - ? (items.answerList += '✗') | ||
| 383 | - : '' | ||
| 384 | - " | ||
| 385 | - >✗</span | ||
| 386 | - > | ||
| 387 | - </template> | ||
| 388 | - <template v-if="items.list[0].questionType == 3"> | ||
| 389 | - <span | ||
| 390 | - class="answer-s active" | ||
| 391 | - v-for="option in items.list[0].answerOptions" | ||
| 392 | - :key="option" | ||
| 393 | - @click="setAnswer(items,option)" | ||
| 394 | - >{{ option }}</span | ||
| 395 | - > | ||
| 396 | - <span | ||
| 397 | - class="answer-s active" | ||
| 398 | - @click=" | ||
| 399 | - items.answerList.split(',').length < items.list.length | ||
| 400 | - ? (items.answerList += ',') | ||
| 401 | - : '' | ||
| 402 | - " | ||
| 403 | - >,</span | ||
| 404 | - > | ||
| 405 | - </template> | ||
| 406 | - <template | ||
| 407 | - v-if="items.list[0].questionType == 2" | ||
| 408 | - class="answer-box" | ||
| 409 | - > | ||
| 410 | - <span | ||
| 411 | - class="answer-s active" | ||
| 412 | - v-for="option in items.list[0].answerOptions" | ||
| 413 | - :key="option" | ||
| 414 | - @click=" | ||
| 415 | - items.answerList.length < items.list.length | ||
| 416 | - ? (items.answerList += option) | ||
| 417 | - : '' | ||
| 418 | - " | ||
| 419 | - >{{ option }}</span | ||
| 420 | - > | ||
| 421 | - </template> | ||
| 422 | - <span | ||
| 423 | - class="answer-s delButton" | ||
| 424 | - @click="items.answerList = items.answerList.slice(0, -1)" | ||
| 425 | - >x</span | ||
| 426 | - > | ||
| 427 | - <span | ||
| 428 | - class="answer-s ac" | ||
| 429 | - @click="items.answerList = ''" | ||
| 430 | - >AC</span | ||
| 431 | - > | ||
| 432 | - </p> | ||
| 433 | - </div> | ||
| 434 | - </div> | ||
| 435 | - </template> | ||
| 436 | - </div> | ||
| 437 | - </div> | ||
| 438 | - </div> --> | ||
| 439 | - <div slot="footer"> | ||
| 440 | - <el-button class="dia-btn" type="primary" @click="saveAnswer" | ||
| 441 | - >确 定</el-button | ||
| 442 | - > | ||
| 443 | - <el-button class="dia-btn" type="danger" @click="dialogVisible = false" | ||
| 444 | - >取 消</el-button | ||
| 445 | - > | ||
| 446 | - </div> | ||
| 447 | - </el-dialog> | 286 | + <set-answer :diaVisible="dialogVisible" :questionList="form.questionList" :paperId="form.id" @saveSuccess="handleSuccess" @cancel="cancel"/> |
| 448 | </div> | 287 | </div> |
| 449 | </template> | 288 | </template> |
| 450 | 289 | ||
| 451 | <script> | 290 | <script> |
| 452 | -import { formatDate, deepClone,checkAnswer } from "utils"; | 291 | +import { formatDate, deepClone, checkAnswer } from "utils"; |
| 453 | export default { | 292 | export default { |
| 454 | data() { | 293 | data() { |
| 455 | return { | 294 | return { |
| 456 | role: "", | 295 | role: "", |
| 457 | loading: false, | 296 | loading: false, |
| 458 | - dialogVisible: false, //修改答案 | ||
| 459 | - editType: true, //修改答案模式 | ||
| 460 | - editId: "", | 297 | + dialogVisible:false, |
| 461 | form: { questionList: [] }, | 298 | form: { questionList: [] }, |
| 462 | - form2: { questionList: [] }, | ||
| 463 | date: "", //今天-昨天-本周 | 299 | date: "", //今天-昨天-本周 |
| 464 | query: { | 300 | query: { |
| 465 | //搜索条件 | 301 | //搜索条件 |
| 466 | - clazzId: "", | 302 | + classId: "", |
| 467 | subjectId: "", | 303 | subjectId: "", |
| 468 | startDay: "", | 304 | startDay: "", |
| 469 | endDay: "", | 305 | endDay: "", |
| @@ -563,7 +399,7 @@ export default { | @@ -563,7 +399,7 @@ export default { | ||
| 563 | ], | 399 | ], |
| 564 | }, | 400 | }, |
| 565 | ], | 401 | ], |
| 566 | - tableAsk:[ | 402 | + tableAsk: [ |
| 567 | { | 403 | { |
| 568 | xuehao: 1, | 404 | xuehao: 1, |
| 569 | xingming: "丁芳菲", | 405 | xingming: "丁芳菲", |
| @@ -571,8 +407,8 @@ export default { | @@ -571,8 +407,8 @@ export default { | ||
| 571 | dadui: 60, | 407 | dadui: 60, |
| 572 | canyudu: 90, | 408 | canyudu: 90, |
| 573 | allzheng: 80, | 409 | allzheng: 80, |
| 574 | - yidazheng:50, | ||
| 575 | - zongpaiming:5 | 410 | + yidazheng: 50, |
| 411 | + zongpaiming: 5, | ||
| 576 | }, | 412 | }, |
| 577 | { | 413 | { |
| 578 | xuehao: 1, | 414 | xuehao: 1, |
| @@ -581,11 +417,11 @@ export default { | @@ -581,11 +417,11 @@ export default { | ||
| 581 | dadui: 20, | 417 | dadui: 20, |
| 582 | canyudu: 80, | 418 | canyudu: 80, |
| 583 | allzheng: 60, | 419 | allzheng: 60, |
| 584 | - yidazheng:65, | ||
| 585 | - zongpaiming:4 | ||
| 586 | - } | 420 | + yidazheng: 65, |
| 421 | + zongpaiming: 4, | ||
| 422 | + }, | ||
| 587 | ], | 423 | ], |
| 588 | - tableStage:[ | 424 | + tableStage: [ |
| 589 | { | 425 | { |
| 590 | xuehao: 1, | 426 | xuehao: 1, |
| 591 | xingming: "丁芳菲", | 427 | xingming: "丁芳菲", |
| @@ -593,19 +429,19 @@ export default { | @@ -593,19 +429,19 @@ export default { | ||
| 593 | dadui: 60, | 429 | dadui: 60, |
| 594 | chouda: 90, | 430 | chouda: 90, |
| 595 | choudadui: 80, | 431 | choudadui: 80, |
| 596 | - canyu:50, | ||
| 597 | - duicuo:5 | ||
| 598 | - } | ||
| 599 | - ] | 432 | + canyu: 50, |
| 433 | + duicuo: 5, | ||
| 434 | + }, | ||
| 435 | + ], | ||
| 600 | }; | 436 | }; |
| 601 | }, | 437 | }, |
| 602 | async created() { | 438 | async created() { |
| 603 | - this.role = this.$store.getters.info.permissions[0]?.roleName; | ||
| 604 | - if (this.role == "班主任") { | 439 | + this.role = this.$store.getters.info.permissions[0]?.role||""; |
| 440 | + if (this.role == "ROLE_BANZHUREN") { | ||
| 605 | this.query.subjectId = []; | 441 | this.query.subjectId = []; |
| 606 | } | 442 | } |
| 607 | - // await this._QueryClassList(); | ||
| 608 | - // await this._QuerySubjectList(); | 443 | + await this._QueryClassList(); |
| 444 | + await this._QuerySubjectList(); | ||
| 609 | // await this.setDate(1); | 445 | // await this.setDate(1); |
| 610 | let startDay = this.query?.startDay; | 446 | let startDay = this.query?.startDay; |
| 611 | if (!startDay) { | 447 | if (!startDay) { |
| @@ -623,90 +459,7 @@ export default { | @@ -623,90 +459,7 @@ export default { | ||
| 623 | }, | 459 | }, |
| 624 | }); | 460 | }); |
| 625 | }, | 461 | }, |
| 626 | - setSubPro(type) { | ||
| 627 | - let tit; | ||
| 628 | - switch (type) { | ||
| 629 | - case 2: | ||
| 630 | - tit = "单选题"; | ||
| 631 | - break; | ||
| 632 | - case 3: | ||
| 633 | - tit = "多选题"; | ||
| 634 | - break; | ||
| 635 | - case 4: | ||
| 636 | - tit = "判断题"; | ||
| 637 | - break; | ||
| 638 | - case 5: | ||
| 639 | - tit = "主观题"; | ||
| 640 | - break; | ||
| 641 | - } | ||
| 642 | - return tit; | ||
| 643 | - }, | ||
| 644 | - edit(item) { | ||
| 645 | - this.form = deepClone(item); | ||
| 646 | - // this.form2 = deepClone(item); | ||
| 647 | - // //组合每道大题中的相同题目 | ||
| 648 | - // let questionList = deepClone(item.questionList); | ||
| 649 | - // for (let i = 0; i < questionList.length; i++) { | ||
| 650 | - // let jsons = {}; | ||
| 651 | - // let answerOptions = []; | ||
| 652 | - // questionList[i].subQuestions.map((items) => { | ||
| 653 | - // let txt = this.setSubPro(items.questionType); | ||
| 654 | - // if (jsons[txt]) { | ||
| 655 | - // jsons[txt].push(items); | ||
| 656 | - // } else { | ||
| 657 | - // jsons[txt] = [items]; | ||
| 658 | - // } | ||
| 659 | - // if (items.questionType == 2 || items.questionType == 3) { | ||
| 660 | - // if (items.answerOptions.length > answerOptions.length) { | ||
| 661 | - // answerOptions = items.answerOptions; | ||
| 662 | - // } | ||
| 663 | - // jsons[txt][0].answerOptions = answerOptions; | ||
| 664 | - // } | ||
| 665 | - // }); | ||
| 666 | - // this.form2.questionList[i].subQuestions = Object.keys(jsons).map( | ||
| 667 | - // (item) => { | ||
| 668 | - // return { | ||
| 669 | - // name: item, | ||
| 670 | - // list: jsons[item], | ||
| 671 | - // answerList: "", | ||
| 672 | - // }; | ||
| 673 | - // } | ||
| 674 | - // ); | ||
| 675 | - // } | ||
| 676 | - this.dialogVisible = true; | ||
| 677 | - }, | ||
| 678 | - keydownAnswer(event) {//快速答案设置禁止输入 | ||
| 679 | - if ( | ||
| 680 | - event.key == "Meta" || | ||
| 681 | - event.key == "CapsLock" || | ||
| 682 | - event.key == "Shift" || | ||
| 683 | - event.key == "Enter" || | ||
| 684 | - event.key == "Alt" || | ||
| 685 | - event.key == "Backspace" || | ||
| 686 | - event.key == "Delete" || | ||
| 687 | - event.key == "ArrowUp" || | ||
| 688 | - event.key == "ArrowDown" || | ||
| 689 | - event.key == "ArrowLeft" || | ||
| 690 | - event.key == "v" || | ||
| 691 | - event.key == "V" || | ||
| 692 | - event.key == "ArrowRight" | ||
| 693 | - ) { | ||
| 694 | - return; | ||
| 695 | - } else { | ||
| 696 | - event.returnValue = ""; | ||
| 697 | - } | ||
| 698 | - }, | ||
| 699 | - setAnswer(obj,answer){//多选答案设置 | ||
| 700 | - obj.answerList+=answer | ||
| 701 | - let str = obj.answerList; | ||
| 702 | - let str2 = checkAnswer( | ||
| 703 | - str, | ||
| 704 | - 3, | ||
| 705 | - obj.list[0].answerOptions, | ||
| 706 | - obj.list.length | ||
| 707 | - ); | ||
| 708 | - obj.answerList = str2; | ||
| 709 | - }, | 462 | + |
| 710 | setDate(index) { | 463 | setDate(index) { |
| 711 | const that = this; | 464 | const that = this; |
| 712 | this.date = index == this.date ? "" : index; | 465 | this.date = index == this.date ? "" : index; |
| @@ -762,68 +515,55 @@ export default { | @@ -762,68 +515,55 @@ export default { | ||
| 762 | } | 515 | } |
| 763 | } | 516 | } |
| 764 | }, | 517 | }, |
| 765 | - changAnswer(sub, option) { | ||
| 766 | - //设置多选答案 | ||
| 767 | - let str = new RegExp(option, "g"); | ||
| 768 | - if (sub.correctAnswer?.includes(option)) { | ||
| 769 | - sub.correctAnswer = sub.correctAnswer.replace(str, ""); | ||
| 770 | - } else { | ||
| 771 | - let arrs = (sub.correctAnswer && sub.correctAnswer.split("")) || []; | ||
| 772 | - arrs.push(option); | ||
| 773 | - sub.correctAnswer = arrs.sort().join(""); | ||
| 774 | - } | 518 | + edit(item) { |
| 519 | + this.form = deepClone(item); | ||
| 520 | + this.dialogVisible = true; | ||
| 775 | }, | 521 | }, |
| 776 | - async saveAnswer(){ | ||
| 777 | - // const { data, code, message } = await this.$request.modifyPaper({...this.form}); | ||
| 778 | - // if (code == 0) { | ||
| 779 | - this.dialogVisible = false | ||
| 780 | - // } else { | ||
| 781 | - // this.$message.error(message); | ||
| 782 | - // } | 522 | + cancel(){ |
| 523 | + this.dialogVisible = false | ||
| 524 | + }, | ||
| 525 | + handleSuccess(){ | ||
| 526 | + this.dialogVisible = false | ||
| 527 | + this._QueryData() | ||
| 783 | }, | 528 | }, |
| 784 | async changClazz() { | 529 | async changClazz() { |
| 785 | await this._QuerySubjectList(); | 530 | await this._QuerySubjectList(); |
| 786 | await this.setDate(1); | 531 | await this.setDate(1); |
| 787 | }, | 532 | }, |
| 788 | async _QueryClassList() { | 533 | async _QueryClassList() { |
| 789 | - const { data, code, message } = await this.$request.fetchClassList(); | ||
| 790 | - if (code === 0) { | 534 | + const { data, status, info } = await this.$request.fetchClassList(); |
| 535 | + if (status === 0) { | ||
| 791 | this.classList = data.list.map((item) => { | 536 | this.classList = data.list.map((item) => { |
| 792 | return { | 537 | return { |
| 793 | - value: item.clazzId, | 538 | + value: item.classId, |
| 794 | label: item.clazzName, | 539 | label: item.clazzName, |
| 795 | }; | 540 | }; |
| 796 | }); | 541 | }); |
| 797 | - this.query.clazzId = this.classList[0].value; | 542 | + this.query.classId = this.classList[0]?.value; |
| 798 | } else { | 543 | } else { |
| 799 | - this.$message.error(message); | 544 | + this.$message.error(info); |
| 800 | } | 545 | } |
| 801 | }, | 546 | }, |
| 802 | async _QuerySubjectList() { | 547 | async _QuerySubjectList() { |
| 803 | - const datas = this.query.clazzId | ||
| 804 | - ? { | ||
| 805 | - clazzId: this.query.clazzId, | ||
| 806 | - } | ||
| 807 | - : {}; | ||
| 808 | - const { data, code, message } = await this.$request.fetchSubjectList( | ||
| 809 | - datas | 548 | + const { data, status, info } = await this.$request.fetchSubjectList( |
| 549 | + {classId: this.query.classId,} | ||
| 810 | ); | 550 | ); |
| 811 | - if (code === 0) { | ||
| 812 | - this.subjectList = data.list.map((item) => { | 551 | + if (status === 0) { |
| 552 | + this.subjectList = data.list?.map((item) => { | ||
| 813 | return { | 553 | return { |
| 814 | value: item.subjectId, | 554 | value: item.subjectId, |
| 815 | label: item.subjectName, | 555 | label: item.subjectName, |
| 816 | }; | 556 | }; |
| 817 | - }); | ||
| 818 | - if (this.role == "班主任") { | 557 | + })||[]; |
| 558 | + if (this.role == "ROLE_BANZHUREN") { | ||
| 819 | this.subjectList.unshift({ | 559 | this.subjectList.unshift({ |
| 820 | value: "", | 560 | value: "", |
| 821 | label: "全部", | 561 | label: "全部", |
| 822 | }); | 562 | }); |
| 823 | } | 563 | } |
| 824 | - this.query.subjectId = this.subjectList[0].value; | 564 | + this.query.subjectId = this.subjectList[0]?.value; |
| 825 | } else { | 565 | } else { |
| 826 | - this.$message.error(message); | 566 | + this.$message.error(info); |
| 827 | } | 567 | } |
| 828 | }, | 568 | }, |
| 829 | async _QueryData() { | 569 | async _QueryData() { |
| @@ -835,13 +575,13 @@ export default { | @@ -835,13 +575,13 @@ export default { | ||
| 835 | query[key] = this.query[key]; | 575 | query[key] = this.query[key]; |
| 836 | } | 576 | } |
| 837 | } | 577 | } |
| 838 | - const { data, code, message } = await this.$request.fetchQuizList({ | 578 | + const { data, status, info } = await this.$request.fetchQuizList({ |
| 839 | ...query, | 579 | ...query, |
| 840 | }); | 580 | }); |
| 841 | this.loading = false; | 581 | this.loading = false; |
| 842 | - if (code === 0) { | 582 | + if (status === 0) { |
| 843 | } else { | 583 | } else { |
| 844 | - this.$message.error(message); | 584 | + this.$message.error(info); |
| 845 | } | 585 | } |
| 846 | }, | 586 | }, |
| 847 | }, | 587 | }, |
| @@ -862,57 +602,7 @@ export default { | @@ -862,57 +602,7 @@ export default { | ||
| 862 | } | 602 | } |
| 863 | } | 603 | } |
| 864 | 604 | ||
| 865 | -.sub-questions { | ||
| 866 | - width: 100%; | ||
| 867 | - display: flex; | ||
| 868 | - &:hover { | ||
| 869 | - background: #f8f8f8; | ||
| 870 | - } | ||
| 871 | - & > div { | ||
| 872 | - min-height: 40px; | ||
| 873 | - padding: 5px; | ||
| 874 | - flex-shrink: 0; | ||
| 875 | - display: flex; | ||
| 876 | - justify-content: center; | ||
| 877 | - align-items: center; | ||
| 878 | - } | ||
| 879 | - .qs-num { | ||
| 880 | - width: 80px; | ||
| 881 | - font-size: 16px; | ||
| 882 | - color: #333; | ||
| 883 | - font-weight: 500; | ||
| 884 | - } | ||
| 885 | - .qs-options { | ||
| 886 | - flex: 1; | ||
| 887 | - } | ||
| 888 | - .qs-options2 { | ||
| 889 | - text-align: left; | ||
| 890 | - justify-content: flex-start; | ||
| 891 | - padding-left: 20px; | ||
| 892 | - .answer-s { | ||
| 893 | - cursor: pointer; | ||
| 894 | - border-color: #667ffd; | ||
| 895 | - color: #667ffd; | ||
| 896 | - margin: 0 15px; | ||
| 897 | - &.active { | ||
| 898 | - color: #fff; | ||
| 899 | - } | ||
| 900 | - } | ||
| 901 | - } | ||
| 902 | - :deep(.el-select) { | ||
| 903 | - .el-input__inner { | ||
| 904 | - border-radius: 20px; | ||
| 905 | - border-color: #667ffd; | ||
| 906 | - width: 150px; | ||
| 907 | - height: 32px; | ||
| 908 | - line-height: 32px; | ||
| 909 | - background: rgba($color: #667ffd, $alpha: 0.05); | ||
| 910 | - } | ||
| 911 | - .el-input__icon { | ||
| 912 | - line-height: 32px; | ||
| 913 | - } | ||
| 914 | - } | ||
| 915 | -} | 605 | + |
| 916 | .fa-exchange { | 606 | .fa-exchange { |
| 917 | color: #667ffd; | 607 | color: #667ffd; |
| 918 | cursor: pointer; | 608 | cursor: pointer; |
| @@ -924,14 +614,14 @@ export default { | @@ -924,14 +614,14 @@ export default { | ||
| 924 | margin: 0 20px; | 614 | margin: 0 20px; |
| 925 | padding: 10px 20px; | 615 | padding: 10px 20px; |
| 926 | } | 616 | } |
| 927 | -.dia-tips{ | ||
| 928 | - padding-bottom:10px; | ||
| 929 | - } | 617 | +.dia-tips { |
| 618 | + padding-bottom: 10px; | ||
| 619 | +} | ||
| 930 | .dia-question-box { | 620 | .dia-question-box { |
| 931 | padding: 16px 16px 1px; | 621 | padding: 16px 16px 1px; |
| 932 | background: #f8f8f8; | 622 | background: #f8f8f8; |
| 933 | border-radius: 10px; | 623 | border-radius: 10px; |
| 934 | - | 624 | + |
| 935 | .answer-s { | 625 | .answer-s { |
| 936 | width: 36px; | 626 | width: 36px; |
| 937 | height: 28px; | 627 | height: 28px; |
| @@ -958,13 +648,13 @@ export default { | @@ -958,13 +648,13 @@ export default { | ||
| 958 | background-size: 19px; | 648 | background-size: 19px; |
| 959 | color: transparent; | 649 | color: transparent; |
| 960 | } | 650 | } |
| 961 | - .ac{ | 651 | + .ac { |
| 962 | border-color: #ff6868; | 652 | border-color: #ff6868; |
| 963 | background: #ff6868; | 653 | background: #ff6868; |
| 964 | - color:#fff | 654 | + color: #fff; |
| 965 | } | 655 | } |
| 966 | } | 656 | } |
| 967 | -.down{ | ||
| 968 | -padding-top:16px; | 657 | +.down { |
| 658 | + padding-top: 16px; | ||
| 969 | } | 659 | } |
| 970 | </style> | 660 | </style> |
| 971 | \ No newline at end of file | 661 | \ No newline at end of file |
src/views/examinationPaper/add.vue
| @@ -807,7 +807,7 @@ export default { | @@ -807,7 +807,7 @@ export default { | ||
| 807 | }); | 807 | }); |
| 808 | if (status == 0) { | 808 | if (status == 0) { |
| 809 | this.answerTypeList = | 809 | this.answerTypeList = |
| 810 | - data.list.map((item) => { | 810 | + data.list?.map((item) => { |
| 811 | return { | 811 | return { |
| 812 | typeName: item.tag, | 812 | typeName: item.tag, |
| 813 | id: item.tagId, | 813 | id: item.tagId, |
| @@ -824,7 +824,7 @@ export default { | @@ -824,7 +824,7 @@ export default { | ||
| 824 | //查询年级列表 | 824 | //查询年级列表 |
| 825 | const { data, status, info } = await this.$request.fetchGradeList(); | 825 | const { data, status, info } = await this.$request.fetchGradeList(); |
| 826 | if (status == 0) { | 826 | if (status == 0) { |
| 827 | - this.gradeList = [...data.gradeNames] || []; | 827 | + this.gradeList = data.gradeNames&&[...data.gradeNames] || []; |
| 828 | if (this.type != 2) { | 828 | if (this.type != 2) { |
| 829 | this.form.gradeName = this.gradeList[0]; | 829 | this.form.gradeName = this.gradeList[0]; |
| 830 | } | 830 | } |
| @@ -838,12 +838,12 @@ export default { | @@ -838,12 +838,12 @@ export default { | ||
| 838 | gradeName: grade, | 838 | gradeName: grade, |
| 839 | }); | 839 | }); |
| 840 | if (status === 0) { | 840 | if (status === 0) { |
| 841 | - this.subjectList = data.subjectNames.map((item) => { | 841 | + this.subjectList = data.subjectNames?.map((item) => { |
| 842 | return { | 842 | return { |
| 843 | value: item, | 843 | value: item, |
| 844 | label: item, | 844 | label: item, |
| 845 | }; | 845 | }; |
| 846 | - }); | 846 | + })||[]; |
| 847 | console.log(this.subjectList); | 847 | console.log(this.subjectList); |
| 848 | if (this.subjectList.length) { | 848 | if (this.subjectList.length) { |
| 849 | this.form.subjectName = this.subjectList[0].value; | 849 | this.form.subjectName = this.subjectList[0].value; |
src/views/examinationPaper/index.vue
| @@ -296,12 +296,12 @@ export default { | @@ -296,12 +296,12 @@ export default { | ||
| 296 | console.log(status) | 296 | console.log(status) |
| 297 | if (status === 0) { | 297 | if (status === 0) { |
| 298 | if (!!data.list) { | 298 | if (!!data.list) { |
| 299 | - this.classList = data.list.map((item) => { | 299 | + this.classList = data.list?.map((item) => { |
| 300 | return { | 300 | return { |
| 301 | value: item.classId, | 301 | value: item.classId, |
| 302 | label: item.className, | 302 | label: item.className, |
| 303 | }; | 303 | }; |
| 304 | - }); | 304 | + })||[]; |
| 305 | this.query.classId = this.classList[0]?.value; | 305 | this.query.classId = this.classList[0]?.value; |
| 306 | } | 306 | } |
| 307 | } else { | 307 | } else { |
| @@ -314,12 +314,12 @@ export default { | @@ -314,12 +314,12 @@ export default { | ||
| 314 | classId: this.query.classId, | 314 | classId: this.query.classId, |
| 315 | }); | 315 | }); |
| 316 | if (status === 0) { | 316 | if (status === 0) { |
| 317 | - this.subjectList = data.subjectNames.map((item) => { | 317 | + this.subjectList = data.subjectNames?.map((item) => { |
| 318 | return { | 318 | return { |
| 319 | value: item, | 319 | value: item, |
| 320 | label: item, | 320 | label: item, |
| 321 | }; | 321 | }; |
| 322 | - }); | 322 | + })||[]; |
| 323 | this.query.subjectName = this.subjectList[0]?.value; | 323 | this.query.subjectName = this.subjectList[0]?.value; |
| 324 | } else { | 324 | } else { |
| 325 | this.$message.error(info); | 325 | this.$message.error(info); |
src/views/examinationPaper/recycle.vue
| @@ -250,12 +250,12 @@ export default { | @@ -250,12 +250,12 @@ export default { | ||
| 250 | console.log(status); | 250 | console.log(status); |
| 251 | if (status === 0) { | 251 | if (status === 0) { |
| 252 | if (!!data.list) { | 252 | if (!!data.list) { |
| 253 | - this.classList = data.list.map((item) => { | 253 | + this.classList = data.list?.map((item) => { |
| 254 | return { | 254 | return { |
| 255 | value: item.classId, | 255 | value: item.classId, |
| 256 | label: item.className, | 256 | label: item.className, |
| 257 | }; | 257 | }; |
| 258 | - }); | 258 | + })||[]; |
| 259 | this.query.classId = this.classList[0]?.value; | 259 | this.query.classId = this.classList[0]?.value; |
| 260 | } | 260 | } |
| 261 | } else { | 261 | } else { |
| @@ -268,12 +268,12 @@ export default { | @@ -268,12 +268,12 @@ export default { | ||
| 268 | classId: this.query.classId, | 268 | classId: this.query.classId, |
| 269 | }); | 269 | }); |
| 270 | if (status === 0) { | 270 | if (status === 0) { |
| 271 | - this.subjectList = data.subjectNames.map((item) => { | 271 | + this.subjectList = data.subjectNames?.map((item) => { |
| 272 | return { | 272 | return { |
| 273 | value: item, | 273 | value: item, |
| 274 | label: item, | 274 | label: item, |
| 275 | }; | 275 | }; |
| 276 | - }); | 276 | + })||[]; |
| 277 | this.query.subjectName = this.subjectList[0]?.value; | 277 | this.query.subjectName = this.subjectList[0]?.value; |
| 278 | } else { | 278 | } else { |
| 279 | this.$message.error(info); | 279 | this.$message.error(info); |
| @@ -287,7 +287,7 @@ export default { | @@ -287,7 +287,7 @@ export default { | ||
| 287 | }); | 287 | }); |
| 288 | if (status === 0) { | 288 | if (status === 0) { |
| 289 | this.typeList = | 289 | this.typeList = |
| 290 | - data.list.map((item) => { | 290 | + data.list?.map((item) => { |
| 291 | return { | 291 | return { |
| 292 | value: item.tagId, | 292 | value: item.tagId, |
| 293 | label: item.tag, | 293 | label: item.tag, |
src/views/layout/header/header.vue
| @@ -63,11 +63,10 @@ | @@ -63,11 +63,10 @@ | ||
| 63 | import Cookies from "js-cookie"; | 63 | import Cookies from "js-cookie"; |
| 64 | import langSelect from "../../../components/lang/langSelect"; | 64 | import langSelect from "../../../components/lang/langSelect"; |
| 65 | import tabNav from "./tabNav"; | 65 | import tabNav from "./tabNav"; |
| 66 | -import UserInfo from "../../../components/userForm/userInfo"; | ||
| 67 | 66 | ||
| 68 | export default { | 67 | export default { |
| 69 | name: "Header", | 68 | name: "Header", |
| 70 | - components: { tabNav, langSelect, UserInfo }, | 69 | + components: { tabNav, langSelect }, |
| 71 | computed: { | 70 | computed: { |
| 72 | permissions: function () { | 71 | permissions: function () { |
| 73 | return this.$store.getters.info.permissions || []; | 72 | return this.$store.getters.info.permissions || []; |