|
|
@@ -148,7 +148,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column label="排序" align="center" prop="sort" />
|
|
|
- <el-table-column label="答案" align="center" prop="answer" />
|
|
|
+ <el-table-column v-if="!hideAnswerFields" label="答案" align="center" prop="answer" />
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
@@ -179,7 +179,7 @@
|
|
|
|
|
|
<!-- 添加或修改题库对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
|
|
|
- <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form ref="form" :model="form" :rules="dynamicRules" label-width="80px">
|
|
|
<el-form-item label="标题" prop="title">
|
|
|
<el-input v-model="form.title" placeholder="请输入问题" />
|
|
|
</el-form-item>
|
|
|
@@ -239,7 +239,7 @@
|
|
|
<el-input v-model="scope.row.name" :placeholder="getOptionLabel(scope.$index) + ':' + '请输入标题'" ></el-input>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="是否为答案" prop="isWrite" >
|
|
|
+ <el-table-column v-if="!hideAnswerFields" label="是否为答案" prop="isWrite" >
|
|
|
<template slot-scope="scope">
|
|
|
<el-tooltip
|
|
|
v-if="!scope.row.name"
|
|
|
@@ -272,12 +272,10 @@
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="答案:" prop="answer">
|
|
|
- <template slot-scope="scope">
|
|
|
- <span style="background-color: #faedc9; font-size: 20px;">
|
|
|
- {{ form.answer }}
|
|
|
- </span>
|
|
|
- </template>
|
|
|
+ <el-form-item v-if="!hideAnswerFields" label="答案:" prop="answer">
|
|
|
+ <span style="background-color: #faedc9; font-size: 20px;">
|
|
|
+ {{ form.answer }}
|
|
|
+ </span>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
@@ -338,6 +336,7 @@ import {
|
|
|
getCatePidList,
|
|
|
getCateListByPid
|
|
|
} from '@/api/course/userCourseCategory'
|
|
|
+import { getConfigByKey } from '@/api/system/config'
|
|
|
|
|
|
export default {
|
|
|
name: "CourseQuestionBank",
|
|
|
@@ -345,6 +344,22 @@ export default {
|
|
|
alphabet() {
|
|
|
return 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
|
|
},
|
|
|
+ /** 点播配置:不校验答案时隐藏列表/表单中的答案相关项(与 validateAnswerWhenWatch 为 false / "0" 一致) */
|
|
|
+ hideAnswerFields() {
|
|
|
+ const cfg = this.courseConfig;
|
|
|
+ if (!cfg || !Object.prototype.hasOwnProperty.call(cfg, 'validateAnswerWhenWatch')) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const v = cfg.validateAnswerWhenWatch;
|
|
|
+ return v === false || v === '0' || v === 0 || v === 'false';
|
|
|
+ },
|
|
|
+ dynamicRules() {
|
|
|
+ const r = { ...this.rules };
|
|
|
+ if (this.hideAnswerFields) {
|
|
|
+ delete r.answer;
|
|
|
+ }
|
|
|
+ return r;
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
},
|
|
|
@@ -352,6 +367,8 @@ export default {
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
|
+ /** course.config 解析后的对象 */
|
|
|
+ courseConfig: {},
|
|
|
exportFailLoading: false,
|
|
|
//单选
|
|
|
selectedAnswer:null,
|
|
|
@@ -433,6 +450,15 @@ export default {
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
+ getConfigByKey('course.config').then(response => {
|
|
|
+ if (response.data && response.data.configValue) {
|
|
|
+ try {
|
|
|
+ this.courseConfig = JSON.parse(response.data.configValue) || {};
|
|
|
+ } catch (e) {
|
|
|
+ this.courseConfig = {};
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }).catch(() => { this.courseConfig = {}; });
|
|
|
this.getDicts("sys_course_temp_type").then(response => {
|
|
|
this.typeOptions = response.data;
|
|
|
});
|
|
|
@@ -631,6 +657,17 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ if (this.hideAnswerFields) {
|
|
|
+ this.question.forEach(q => { q.isAnswer = 0 });
|
|
|
+ this.selectedAnswer = null;
|
|
|
+ this.selectedAnswers = [];
|
|
|
+ if (this.form.type === 2) {
|
|
|
+ this.form.answer = [];
|
|
|
+ } else {
|
|
|
+ this.form.answer = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.form.question=JSON.stringify(this.question)
|
|
|
|
|
|
if (this.form.type===2){
|