From 3465a4b37d56e4a737309ebb7f2965dfcb2090a0 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 29 五月 2024 21:21:01 +0800 Subject: [PATCH] 英语优化 --- src/components/examinations/index.vue | 44 ++++++++++++++++++-------------------------- 1 files changed, 18 insertions(+), 26 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index 6b36a86..753822b 100644 --- a/src/components/examinations/index.vue +++ b/src/components/examinations/index.vue @@ -1,7 +1,7 @@ <template> - <div class="examination" v-loading="!cardList.length"> + <div class="examination" v-loading="!cardData.length"> <div - v-for="(item, nindex) in cardList" + v-for="(item, nindex) in cardData" :key="nindex" class="border-box" v-show="item.infoList.length" @@ -211,7 +211,6 @@ " ></TEditorVue> --> <el-input - @input="textChange($event,nindex,value.id)" :disabled="value.isComplete" style="width: 94%; margin: 0 auto" v-else-if="value.questionType == 'shortAnswer'" @@ -427,7 +426,6 @@ props: { cardList: { type: Array, - default: [], }, primaryColor: { type: String, @@ -444,14 +442,13 @@ return { type: "option", loading: false, + cardData:[] }; }, - inject:['changeQuestionData'], - mounted() {}, - computed:{ - cardLists() { - return this.props.cardList - } + mounted() { + this.cardData = this.cardList + console.log('this.cardList',this.cardList); + console.log('this.cardData',this.cardData); }, methods: { // 鏁扮粍杞负瀛楃涓叉柟娉� @@ -486,20 +483,19 @@ } }, redo() { - for (let index = 0; index < this.cardList.length; index++) { - const item = this.cardList[index]; + for (let index = 0; index < this.cardData.length; index++) { + const item = this.cardData[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; citem.userAnswer = ""; citem.isComplete = false; } } - console.log('閲嶅仛',this.cardList); }, openAnswers() { this.$data.loading = true; - for (let index = 0; index < this.cardList.length; index++) { - const item = this.cardList[index]; + for (let index = 0; index < this.cardData.length; index++) { + const item = this.cardData[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; citem.isComplete = true; @@ -512,7 +508,7 @@ }, // 鎵规敼棰樼洰 (缁冧範,鎴戠殑鍋氶,鎴戠殑鏀惰棌妯″紡涓�) handleQuestion() { - const list = this.$props.cardList; + const list = this.cardData; for (let index = 0; index < list.length; index++) { const item = list[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { @@ -557,8 +553,8 @@ } } } - this.$props.cardList = list; - console.log(this.$props.cardList); + this.cardData = list; + console.log(this.cardData); }, getParentWithClass(element, className) { while (element.parentElement) { @@ -582,8 +578,8 @@ ); let oldData = oldAnswerData ? JSON.parse(oldAnswerData) : {}; const asnwerList = []; - for (let index = 0; index < this.$props.cardList.length; index++) { - const item = this.$props.cardList[index]; + for (let index = 0; index < this.cardData.length; index++) { + const item = this.cardData[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; asnwerList.push({ @@ -593,7 +589,8 @@ } } if(oldData[pageNum]) { - oldData[pageNum].push(asnwerList) + oldData[pageNum] = oldData[pageNum].filter(citem => asnwerList.findIndex(ditem => ditem.id == citem.id) == -1 ) + oldData[pageNum].push(...asnwerList) } else { oldData[pageNum] = asnwerList } @@ -609,11 +606,6 @@ // console.log(oldData); }, - textChange(value,a,b) { - console.log('杈撳叆',value,a,b); - console.log(this.cardList); - this.changeQuestionData(9,this.cardList) - } }, }; </script> -- Gitblit v1.9.1