From 2993016ca5e4d32408cc22582c3c1e7d69ee41f8 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 26 三月 2025 11:21:06 +0800 Subject: [PATCH] 口语交际 --- src/components/examinations/index.vue | 80 ++++++++++++++++++++++++++++------------ 1 files changed, 56 insertions(+), 24 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index b7623ff..95c9fe5 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> @@ -41,7 +41,11 @@ <span class="questionNum" :style="{ - marginTop: value.questionType == 'completion' ? '12px' : '0', + marginTop: + value.questionType == 'completion' || + value.questionType == 'mathField' + ? '12px' + : '0', }" >{{ index + 1 }}. </span> @@ -53,7 +57,8 @@ v-if=" value.stemStyle == 'Txt' && value.questionType != 'completion' && - value.questionType != 'dropdown' + value.questionType != 'dropdown' && + value.questionType != 'mathField' " :id="value.id" v-html="value.stem.stemTxt" @@ -78,7 +83,13 @@ ></el-image> </p> <!-- 濉┖棰橀骞� --> - <p class="titleText" v-if="value.questionType == 'completion'"> + <p + class="titleText" + v-if=" + value.questionType == 'completion' || + value.questionType == 'mathField' + " + > <span v-for="(itemText, indexText) in value.stem" :key="indexText + 'questionType'" @@ -88,21 +99,27 @@ v-html="itemText" class="input-txt" ></span> - <!-- <input - v-else + <input + v-if=" + typeof itemText != 'string' && + value.questionType == 'completion' + " type="text" class="input" v-model.trim="value.userAnswer[itemText.num]" :disabled="value.isComplete" :style="{ backgroundColor: inputBc }" - /> --> + /> <math-field - v-else + v-if=" + typeof itemText != 'string' && + value.questionType == 'mathField' + " 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> @@ -284,7 +301,8 @@ type != 'mock' && (value.questionType == 'shortAnswer' || value.questionType == 'multipleChoice' || - value.questionType == 'completion') + value.questionType == 'completion' || + value.questionType == 'mathField') " > <el-button @click="checkPares(value)" style="margin-top: 10px" @@ -668,7 +686,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; } } @@ -719,7 +748,10 @@ } else if (citem.questionType == "shortAnswer") { // 绠�绛� 缈昏瘧 citem.isRight = null; - } else if (citem.questionType == "completion") { + } else if ( + citem.questionType == "completion" || + citem.questionType == "mathField" + ) { // 濉┖ if (typeof citem.answer == "string") { citem.isRight = citem.answer == citem.userAnswer[0]; @@ -826,15 +858,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 +883,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 +910,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 +957,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; }, }, }; @@ -936,11 +967,12 @@ <style lang="less"> .titleText img { max-width: 80%; + min-width: 220px; } </style> <style lang="less" scoped> -.catalogName { +.catalogName { display: flex; text-indent: 1em !important; font-size: 16px; @@ -1122,7 +1154,7 @@ height: 24px; border: 0; outline: none; - border-bottom: 1px solid #15c0f2; + border-bottom: 1px solid #000; } /deep/ .el-textarea.is-disabled .el-textarea__inner { -- Gitblit v1.9.1