|
@@ -30,14 +30,28 @@
|
|
<el-form label-width="100px">
|
|
<el-form label-width="100px">
|
|
<el-form-item label="题型">
|
|
<el-form-item label="题型">
|
|
<el-button
|
|
<el-button
|
|
- v-for="item in QUESTION_TYPES"
|
|
|
|
- :key="item.code"
|
|
|
|
- :type="curQuestionType === item.code ? 'primary' : 'default'"
|
|
|
|
|
|
+ v-for="item in sourceDetailList"
|
|
|
|
+ :key="item.id"
|
|
|
|
+ :type="
|
|
|
|
+ questionModel.sourceDetailId === item.id ? 'primary' : 'default'
|
|
|
|
+ "
|
|
size="small"
|
|
size="small"
|
|
- :disabled="isEdit"
|
|
|
|
|
|
+ :disabled="isEdit || loading"
|
|
@click="switchType(item)"
|
|
@click="switchType(item)"
|
|
>{{ item.name }}</el-button
|
|
>{{ item.name }}</el-button
|
|
>
|
|
>
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="sourceDetailAllList.length > limitShowCount && !isEdit"
|
|
|
|
+ size="small"
|
|
|
|
+ :icon="showMore ? 'el-icon-arrow-up' : 'el-icon-more'"
|
|
|
|
+ @click="switchMoreSourceDetail"
|
|
|
|
+ ></el-button>
|
|
|
|
+ <el-button
|
|
|
|
+ v-if="!isEdit"
|
|
|
|
+ size="small"
|
|
|
|
+ icon="el-icon-plus"
|
|
|
|
+ @click="toAddSourceDetail"
|
|
|
|
+ ></el-button>
|
|
<p class="tips-info">
|
|
<p class="tips-info">
|
|
说明:如果是综合类试题(套题)可以选择题型为阅卷理解进行录入操作。
|
|
说明:如果是综合类试题(套题)可以选择题型为阅卷理解进行录入操作。
|
|
</p>
|
|
</p>
|
|
@@ -52,6 +66,13 @@
|
|
></component>
|
|
></component>
|
|
</div>
|
|
</div>
|
|
<div slot="footer"></div>
|
|
<div slot="footer"></div>
|
|
|
|
+
|
|
|
|
+ <!-- ModifySourceDetail -->
|
|
|
|
+ <modify-source-detail
|
|
|
|
+ ref="ModifySourceDetail"
|
|
|
|
+ :instance="curSourceInfo"
|
|
|
|
+ @modified="sourceDetailAdded"
|
|
|
|
+ ></modify-source-detail>
|
|
</el-dialog>
|
|
</el-dialog>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -65,7 +86,16 @@ import TextAnswerQuestion from "./edit/TextAnswerQuestion.vue";
|
|
import NestedQuestion from "./edit/NestedQuestion.vue";
|
|
import NestedQuestion from "./edit/NestedQuestion.vue";
|
|
import BankedClozeQuestion from "./edit/BankedClozeQuestion.vue";
|
|
import BankedClozeQuestion from "./edit/BankedClozeQuestion.vue";
|
|
import { randomCode } from "@/plugins/utils";
|
|
import { randomCode } from "@/plugins/utils";
|
|
-import { updateQuestionApi } from "../api";
|
|
|
|
|
|
+import { updateQuestionApi, sourceDetailPageListApi } from "../api";
|
|
|
|
+import ModifySourceDetail from "./ModifySourceDetail.vue";
|
|
|
|
+
|
|
|
|
+const initQuestionModel = {
|
|
|
|
+ courseId: null,
|
|
|
|
+ courseCode: "",
|
|
|
|
+ courseName: "",
|
|
|
|
+ sourceDetailId: null,
|
|
|
|
+ questionType: "",
|
|
|
|
+};
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "QuestionEditDialog",
|
|
name: "QuestionEditDialog",
|
|
@@ -76,6 +106,7 @@ export default {
|
|
BooleanQuestion,
|
|
BooleanQuestion,
|
|
NestedQuestion,
|
|
NestedQuestion,
|
|
BankedClozeQuestion,
|
|
BankedClozeQuestion,
|
|
|
|
+ ModifySourceDetail,
|
|
},
|
|
},
|
|
props: {
|
|
props: {
|
|
question: {
|
|
question: {
|
|
@@ -88,7 +119,10 @@ export default {
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
modalIsShow: false,
|
|
modalIsShow: false,
|
|
- QUESTION_TYPES,
|
|
|
|
|
|
+ sourceDetailAllList: [],
|
|
|
|
+ sourceDetailList: [],
|
|
|
|
+ limitShowCount: 10,
|
|
|
|
+ showMore: false,
|
|
// curQuestionType: "PARAGRAPH_MATCHING",
|
|
// curQuestionType: "PARAGRAPH_MATCHING",
|
|
curQuestionType: "SINGLE_ANSWER_QUESTION",
|
|
curQuestionType: "SINGLE_ANSWER_QUESTION",
|
|
questionModel: {},
|
|
questionModel: {},
|
|
@@ -96,6 +130,7 @@ export default {
|
|
questionKey: "",
|
|
questionKey: "",
|
|
loading: false,
|
|
loading: false,
|
|
hasModifyQuestion: false,
|
|
hasModifyQuestion: false,
|
|
|
|
+ curSourceInfo: {},
|
|
};
|
|
};
|
|
},
|
|
},
|
|
computed: {
|
|
computed: {
|
|
@@ -110,17 +145,32 @@ export default {
|
|
},
|
|
},
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
- visibleChange() {
|
|
|
|
|
|
+ async visibleChange() {
|
|
|
|
+ await this.getSourceDetailList();
|
|
this.initData();
|
|
this.initData();
|
|
},
|
|
},
|
|
initData() {
|
|
initData() {
|
|
|
|
+ this.loading = false;
|
|
this.hasModifyQuestion = false;
|
|
this.hasModifyQuestion = false;
|
|
|
|
+
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ this.sourceDetailList = this.sourceDetailAllList;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (this.sourceDetailAllList.length > this.limitShowCount) {
|
|
|
|
+ this.sourceDetailList = this.sourceDetailAllList.slice(
|
|
|
|
+ 0,
|
|
|
|
+ this.limitShowCount
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
this.questionKey = randomCode();
|
|
this.questionKey = randomCode();
|
|
- this.curQuestionType = this.question.questionType || this.curQuestionType;
|
|
|
|
- this.questionModel = { ...this.question };
|
|
|
|
- if (!this.questionModel.questionType)
|
|
|
|
- this.questionModel.questionType = this.curQuestionType;
|
|
|
|
- this.loading = false;
|
|
|
|
|
|
+ this.questionModel = Object.assign({}, initQuestionModel, this.question);
|
|
|
|
+ if (!this.question.questionType) {
|
|
|
|
+ const curSourceDetail = this.sourceDetailList[0];
|
|
|
|
+ this.questionModel.questionType = curSourceDetail.questionType;
|
|
|
|
+ this.questionModel.sourceDetailId = curSourceDetail.id;
|
|
|
|
+ }
|
|
},
|
|
},
|
|
close() {
|
|
close() {
|
|
this.modalIsShow = false;
|
|
this.modalIsShow = false;
|
|
@@ -132,22 +182,70 @@ export default {
|
|
if (this.hasModifyQuestion) this.$emit("modified");
|
|
if (this.hasModifyQuestion) this.$emit("modified");
|
|
this.close();
|
|
this.close();
|
|
},
|
|
},
|
|
|
|
+ async getSourceDetailList() {
|
|
|
|
+ const res = await sourceDetailPageListApi({
|
|
|
|
+ pageNumber: 1,
|
|
|
|
+ pageSize: 100,
|
|
|
|
+ courseId: this.question.courseId,
|
|
|
|
+ rootOrgId: this.$store.state.user.rootOrgId,
|
|
|
|
+ });
|
|
|
|
+ this.sourceDetailAllList = res.data.content || [];
|
|
|
|
+ let questionTypeSerial = {};
|
|
|
|
+ QUESTION_TYPES.forEach((item, index) => {
|
|
|
|
+ questionTypeSerial[item.code] = index;
|
|
|
|
+ });
|
|
|
|
+ this.sourceDetailAllList.sort(
|
|
|
|
+ (a, b) =>
|
|
|
|
+ questionTypeSerial[a.questionType] -
|
|
|
|
+ questionTypeSerial[b.questionType]
|
|
|
|
+ );
|
|
|
|
+ },
|
|
|
|
+ switchMoreSourceDetail() {
|
|
|
|
+ if (this.showMore) {
|
|
|
|
+ this.sourceDetailList = this.sourceDetailAllList.slice(
|
|
|
|
+ 0,
|
|
|
|
+ this.limitShowCount
|
|
|
|
+ );
|
|
|
|
+ } else {
|
|
|
|
+ this.sourceDetailList = this.sourceDetailAllList;
|
|
|
|
+ }
|
|
|
|
+ this.showMore = !this.showMore;
|
|
|
|
+ },
|
|
|
|
+ toAddSourceDetail() {
|
|
|
|
+ this.curSourceInfo = {
|
|
|
|
+ courseId: this.question.courseId,
|
|
|
|
+ rootOrgId: this.$store.state.user.rootOrgId,
|
|
|
|
+ };
|
|
|
|
+ this.$refs.ModifySourceDetail.open();
|
|
|
|
+ },
|
|
|
|
+ async sourceDetailAdded() {
|
|
|
|
+ await this.getSourceDetailList();
|
|
|
|
+ if (this.isEdit) {
|
|
|
|
+ this.sourceDetailList = this.sourceDetailAllList;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ this.showMore = !this.showMore;
|
|
|
|
+ this.switchMoreSourceDetail();
|
|
|
|
+ },
|
|
async switchType(item) {
|
|
async switchType(item) {
|
|
if (this.isEdit) return;
|
|
if (this.isEdit) return;
|
|
- if (this.curQuestionType === item.code) return;
|
|
|
|
|
|
+ if (this.questionModel.sourceDetailId === item.id) return;
|
|
|
|
+ if (this.questionModel.questionType === item.questionType) {
|
|
|
|
+ this.questionModel.sourceDetailId = item.id;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
const confirm = await this.$confirm("确认更改题型吗?", "提示", {
|
|
const confirm = await this.$confirm("确认更改题型吗?", "提示", {
|
|
type: "warning",
|
|
type: "warning",
|
|
}).catch(() => {});
|
|
}).catch(() => {});
|
|
if (confirm !== "confirm") return;
|
|
if (confirm !== "confirm") return;
|
|
|
|
|
|
- this.curQuestionType = item.code;
|
|
|
|
this.questionKey = randomCode();
|
|
this.questionKey = randomCode();
|
|
- this.questionModel = {
|
|
|
|
- ...this.questionModel,
|
|
|
|
- questionType: this.curQuestionType,
|
|
|
|
- };
|
|
|
|
- this.loading = false;
|
|
|
|
|
|
+ this.questionModel = Object.assign({}, this.questionModel, {
|
|
|
|
+ questionType: item.questionType,
|
|
|
|
+ sourceDetailId: item.id,
|
|
|
|
+ });
|
|
},
|
|
},
|
|
async confirm() {
|
|
async confirm() {
|
|
const valid = await this.$refs.QuestionEditDetail.validate().catch(
|
|
const valid = await this.$refs.QuestionEditDetail.validate().catch(
|