|
@@ -232,9 +232,9 @@ export default {
|
|
|
courseId: null,
|
|
|
courseLevel: "",
|
|
|
publicity: "",
|
|
|
- coursePropertyId: "",
|
|
|
- firstPropertyId: "",
|
|
|
- secondPropertyId: "",
|
|
|
+ coursePropertyId: null,
|
|
|
+ firstPropertyId: null,
|
|
|
+ secondPropertyId: null,
|
|
|
},
|
|
|
courseList: [], //课程list
|
|
|
levelList: LEVEL_TYPE, //层次list
|
|
@@ -413,16 +413,8 @@ export default {
|
|
|
this.currentPage = 1;
|
|
|
this.searchQues();
|
|
|
},
|
|
|
- getCourseName(courseId) {
|
|
|
- for (let course of this.courseList) {
|
|
|
- if (course.courseId == courseId) {
|
|
|
- this.formSearch.courseName = course.name;
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
//修改
|
|
|
updateRow(row) {
|
|
|
- this.getCourseName(this.formSearch.courseId);
|
|
|
//选择题:单选、多选
|
|
|
if (
|
|
|
row.questionType === "SINGLE_ANSWER_QUESTION" ||
|
|
@@ -486,27 +478,34 @@ export default {
|
|
|
this.disposeSelectAnswer();
|
|
|
this.$refs.QuestionPreview.open();
|
|
|
},
|
|
|
+ getCourseById(cid) {
|
|
|
+ this.$http.get(QUESTION_API + "/course/" + cid).then((response) => {
|
|
|
+ this.courseList.push(response.data);
|
|
|
+ if (this.formSearch.coursePropertyId) {
|
|
|
+ this.$http
|
|
|
+ .get(
|
|
|
+ QUESTION_API +
|
|
|
+ "/courseProperty/find?id=" +
|
|
|
+ this.formSearch.coursePropertyId
|
|
|
+ )
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data) {
|
|
|
+ this.coursePropertyList.push(response.data);
|
|
|
+ this.getFirst();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
//查询所有课程
|
|
|
getCourses(query) {
|
|
|
this.$http
|
|
|
.get(QUESTION_API + "/course/query?name=" + query + "&enable=true")
|
|
|
.then((response) => {
|
|
|
this.courseList = response.data;
|
|
|
- if (this.formSearch.courseId) {
|
|
|
- this.$http
|
|
|
- .get(
|
|
|
- QUESTION_API +
|
|
|
- "/courseProperty/enable?courseId=" +
|
|
|
- this.formSearch.courseId
|
|
|
- )
|
|
|
- .then((response) => {
|
|
|
- this.coursePropertyList = response.data;
|
|
|
- //查询一级属性
|
|
|
- this.getFirst();
|
|
|
- });
|
|
|
- } else {
|
|
|
- this.coursePropertyList = [];
|
|
|
- }
|
|
|
+ this.coursePropertyList = [];
|
|
|
+ this.firstPropertyList = [];
|
|
|
+ this.secondPropertyList = [];
|
|
|
});
|
|
|
},
|
|
|
//重置查询表单
|
|
@@ -589,26 +588,30 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
getFirst() {
|
|
|
- if (this.formSearch.coursePropertyId) {
|
|
|
+ if (this.formSearch.firstPropertyId) {
|
|
|
this.$http
|
|
|
.get(
|
|
|
- QUESTION_API + "/property/first/" + this.formSearch.coursePropertyId
|
|
|
+ QUESTION_API +
|
|
|
+ "/property/find?id=" +
|
|
|
+ this.formSearch.firstPropertyId
|
|
|
)
|
|
|
.then((response) => {
|
|
|
- this.firstPropertyList = response.data;
|
|
|
+ this.firstPropertyList.push(response.data);
|
|
|
//查询二级
|
|
|
this.getSecond();
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
getSecond() {
|
|
|
- if (this.formSearch.firstPropertyId) {
|
|
|
+ if (this.formSearch.secondPropertyId) {
|
|
|
this.$http
|
|
|
.get(
|
|
|
- QUESTION_API + "/property/second/" + this.formSearch.firstPropertyId
|
|
|
+ QUESTION_API +
|
|
|
+ "/property/find?id=" +
|
|
|
+ this.formSearch.secondPropertyId
|
|
|
)
|
|
|
.then((response) => {
|
|
|
- this.secondPropertyList = response.data;
|
|
|
+ this.secondPropertyList.push(response.data);
|
|
|
});
|
|
|
}
|
|
|
},
|
|
@@ -632,19 +635,9 @@ export default {
|
|
|
this.currentPage = parseInt(
|
|
|
sessionStorage.getItem("question_currentPage")
|
|
|
);
|
|
|
- }
|
|
|
- if (this.formSearch && this.formSearch.courseName) {
|
|
|
- this.getCourses(this.formSearch.courseName);
|
|
|
- } else {
|
|
|
- this.formSearch = {
|
|
|
- questionType: "",
|
|
|
- courseId: "",
|
|
|
- courseLevel: "",
|
|
|
- publicity: "",
|
|
|
- coursePropertyId: "",
|
|
|
- firstPropertyId: "",
|
|
|
- secondPropertyId: "",
|
|
|
- };
|
|
|
+ if (this.formSearch && this.formSearch.courseId) {
|
|
|
+ this.getCourseById(this.formSearch.courseId);
|
|
|
+ }
|
|
|
}
|
|
|
this.searchQues();
|
|
|
},
|