|
@@ -47,14 +47,7 @@ const mixin = {
|
|
|
created() {
|
|
|
// 题目的子题目保存
|
|
|
if (this.isChild) {
|
|
|
- this.$bus.$on('saveQuestion', () => {
|
|
|
- SaveQuestion({
|
|
|
- question_id: this.questionId,
|
|
|
- type: this.data.type,
|
|
|
- additional_type: this.data.property.select_type || '',
|
|
|
- content: JSON.stringify(this.data),
|
|
|
- }).catch(() => {});
|
|
|
- });
|
|
|
+ this.$bus.$on('saveQuestion', this.saveChildQuestion);
|
|
|
|
|
|
if (this.isChange) return;
|
|
|
GetQuestionInfo({ question_id: this.questionId })
|
|
@@ -66,6 +59,11 @@ const mixin = {
|
|
|
.catch(() => {});
|
|
|
}
|
|
|
},
|
|
|
+ beforeDestroy() {
|
|
|
+ if (this.isChild) {
|
|
|
+ this.$bus.$off('saveQuestion', this.saveChildQuestion);
|
|
|
+ }
|
|
|
+ },
|
|
|
watch: {
|
|
|
'data.property.score'(val) {
|
|
|
if (val === undefined) return;
|
|
@@ -85,6 +83,14 @@ const mixin = {
|
|
|
},
|
|
|
},
|
|
|
methods: {
|
|
|
+ saveChildQuestion() {
|
|
|
+ SaveQuestion({
|
|
|
+ question_id: this.questionId,
|
|
|
+ type: this.data.type,
|
|
|
+ additional_type: this.data.property.select_type || '',
|
|
|
+ content: JSON.stringify(this.data),
|
|
|
+ }).catch(() => {});
|
|
|
+ },
|
|
|
upload(file_id) {
|
|
|
this.data.file_id_list.push(file_id);
|
|
|
},
|