From e6a3acf38930a8caffa3b1b19e9dc08526a70c71 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 27 十一月 2024 14:43:35 +0800 Subject: [PATCH] 答题器重做优化 --- src/components/examinations/index.vue | 39 ++++++++++++++++++++++++++------------- 1 files changed, 26 insertions(+), 13 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index 35925bb..653a3a7 100644 --- a/src/components/examinations/index.vue +++ b/src/components/examinations/index.vue @@ -7,7 +7,7 @@ v-show="item.infoList.length" > <p class="catalogName" :style="{ color: primaryColor }"> - <span class="catalogName-box" > + <span class="catalogName-box"> <span v-if="nindex == 0">涓�銆�</span> <span v-if="nindex == 1">浜屻��</span> <span v-if="nindex == 2">涓夈��</span> @@ -100,9 +100,9 @@ v-else class="mathField" :menuItems="[]" - @input="onChangeInput($event,nindex,index,itemText.num)" + @input="onChangeInput($event, nindex, index, itemText.num)" > - {{ value.userAnswer[itemText.num] }} + {{ value.userAnswer[itemText.num] }} </math-field> </span> </p> @@ -668,7 +668,18 @@ const item = this.cardData[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; - citem.userAnswer = ""; + if (typeof citem.userAnswer == "string") { + citem.userAnswer = ""; + } else { + if (citem.questionType == "multipleChoice") { + citem.userAnswer = []; + } else { + // 濉┖棰� + for (let dindex = 0; dindex < citem.userAnswer.length; dindex++) { + citem.userAnswer[dindex] = ''; + } + } + } citem.isComplete = false; } } @@ -826,15 +837,14 @@ }, // 棰樼洰鏀惰棌鎸夐挳,鏀惰棌鍜屽彇娑堝悓涓�鎺ュ彛锛屽彇娑堟暟缁勫噺鍘昏椤筰d setCollect(num, number) { - let item = null - if(number) { + let item = null; + if (number) { item = this.cardData[num].infoList[number]; - } else { - item = this.cardData[num] + item = this.cardData[num]; } item.isCollect = !item.isCollect; - console.log(111,item); + console.log(111, item); if (this.cardData.length == 0) { this.collectList.push(item.id); } else { @@ -852,7 +862,7 @@ const item = this.allCollect[index]; if (item.type == this.sourceType) item.collectList = this.collectList; } - console.log('鐐瑰嚮鏀惰棌鎸夐挳',this.allCollect) + console.log("鐐瑰嚮鏀惰棌鎸夐挳", this.allCollect); this.MG.identity .setUserKey({ setKeyRequests: [ @@ -879,7 +889,7 @@ .then((res) => { try { const collect = JSON.parse(res[0].value); - console.log('鍏ㄩ儴鏀惰棌id',collect); + console.log("鍏ㄩ儴鏀惰棌id", collect); if (collect.length) { this.collectList = collect.find( (citem) => citem.type == this.sourceType @@ -926,8 +936,8 @@ }) .catch(() => {}); }, - onChangeInput(e,index,cindex,num) { - this.cardData[index].infoList[cindex].userAnswer[num] = e.target.value + onChangeInput(e, index, cindex, num) { + this.cardData[index].infoList[cindex].userAnswer[num] = e.target.value; }, }, }; @@ -1093,6 +1103,9 @@ flex-wrap: wrap; } .titleText { + display: flex; + flex-wrap: wrap; + align-items: center; text-align: left; min-width: 90%; font-size: 16px; -- Gitblit v1.9.1