From cc232247648ea4cd6b4d3909bb71caea61e388e1 Mon Sep 17 00:00:00 2001 From: 闫增涛 <1829501689@qq.com> Date: 星期三, 15 五月 2024 23:10:06 +0800 Subject: [PATCH] 第二本书 --- src/components/examinations/index.vue | 133 ++++++++++++++++++++++++-------------------- 1 files changed, 72 insertions(+), 61 deletions(-) diff --git a/src/components/examinations/index.vue b/src/components/examinations/index.vue index 8337923..f864104 100644 --- a/src/components/examinations/index.vue +++ b/src/components/examinations/index.vue @@ -1,6 +1,11 @@ <template> <div class="examination" v-loading="loading"> - <div v-for="(item, nindex) in cardList" :key="nindex" class="border-box" v-show="item.infoList.length"> + <div + v-for="(item, nindex) in cardList" + :key="nindex" + class="border-box" + v-show="item.infoList.length" + > <p class="catalogName"> <span v-if="nindex == 0">涓�銆�</span> <span v-if="nindex == 1">浜屻��</span> @@ -23,8 +28,8 @@ :style="{ marginTop: value.questionType == 'completion' ? '12px' : '0', }" - >{{ index + 1 }}. </span - > + >{{ index + 1 }}. + </span> <!-- 鍚姏杩涘害鏉� --> <!-- <answerAudioPlayer :audioUrl="value.src" v-show="item.name == '鍚姏棰�'" /> --> <!-- 棰樺共 --> @@ -63,7 +68,7 @@ v-for="(itemText, indexText) in value.stem" :key="indexText" > - <span v-if="typeof itemText == 'string'" >{{ itemText }}</span> + <span v-if="typeof itemText == 'string'">{{ itemText }}</span> <!-- --> <el-input v-else @@ -207,7 +212,7 @@ ></TEditorVue> --> <el-input :disabled="value.isComplete" - style="width: 90%; margin: 0 auto" + style="width: 94%; margin: 0 auto" v-else-if="value.questionType == 'shortAnswer'" type="textarea" :rows="6" @@ -276,11 +281,11 @@ <div class="headerConent sitgBox"> <p v-if="!value.isUnfold"> <span class="analysisColor">鏌ョ湅瑙f瀽</span - ><el-image /> + ><el-image /> </p> <p v-else> <span class="analysisColor">鏀惰捣瑙f瀽</span - ><el-image /> + ><el-image /> </p> </div> </div> @@ -313,8 +318,8 @@ <span class="analysisColor" >{{ value.isUnfold ? "鏀惰捣绛旀鍜岃В鏋�" : "鏌ョ湅绛旀涓庤В鏋�" - }} </span - > + }} + </span> </p> </div> <!-- :class="['analysisDetailBox', value.isUnfold ? 'open' : 'close'].join(' ') --> @@ -360,18 +365,27 @@ </div> <div class="bottom-btn" v-if="!loading"> - <el-button style="height: 34px; padding: 4px 10px">淇濆瓨</el-button> + <el-button style="height: 30px; width: 78px; padding: 4px 10px" + >淇濆瓨</el-button + > <el-button @click="handleQuestion" - style="border-color: #1eb9ee; height: 34px; padding: 4px 10px" + style=" + border-color: #1eb9ee; + height: 30px; + width: 78px; + padding: 4px 10px; + " >鎻愪氦</el-button > - <el-button @click="redo" style="height: 34px; padding: 4px 10px" + <el-button + @click="redo" + style="height: 30px; width: 78px; padding: 4px 10px" >閲嶅仛</el-button > <el-button @click="openAnswers" - style="border-color: #1eb9ee; height: 34px; padding: 4px 10px" + style="border-color: #1eb9ee; height: 30px; padding: 4px 10px" >鏌ョ湅绛旀</el-button > </div> @@ -386,12 +400,10 @@ data() { return { type: "option", - cardList: [], loading: false, }; }, - mounted() { - }, + mounted() {}, methods: { // 鏁扮粍杞负瀛楃涓叉柟娉� arrayToString(data) { @@ -451,8 +463,6 @@ this.$data.loading = false; }, watchParsing(data) { - debugger - data.isUnfold = !data.isUnfold; }, // // 鑾峰彇璇曞嵎涓嬮鐩被鍨� @@ -700,54 +710,52 @@ // }, // 鎵规敼棰樼洰 (缁冧範,鎴戠殑鍋氶,鎴戠殑鏀惰棌妯″紡涓�) handleQuestion() { - const list = this.$props.cardList + const list = this.$props.cardList; for (let index = 0; index < list.length; index++) { const item = list[index]; for (let cindex = 0; cindex < item.infoList.length; cindex++) { const citem = item.infoList[cindex]; citem.isComplete = true; - // 淇敼棰樼洰鐘舵�佷负瀹屾垚 - citem.isComplete = true; - // 鎵规敼棰樼洰 - if (citem.questionType == "multipleChoice") { - // 澶氶�夐 - if (citem.answer.length == citem.userAnswer.length) { - const sortedArr1 = citem.answer.slice().sort(); - const sortedArr2 = citem.userAnswer.slice().sort(); - citem.isRight = sortedArr1.every( - (value, index) => value === sortedArr2[index] - ); - } else { + // 淇敼棰樼洰鐘舵�佷负瀹屾垚 + citem.isComplete = true; + // 鎵规敼棰樼洰 + if (citem.questionType == "multipleChoice") { + // 澶氶�夐 + if (citem.answer.length == citem.userAnswer.length) { + const sortedArr1 = citem.answer.slice().sort(); + const sortedArr2 = citem.userAnswer.slice().sort(); + citem.isRight = sortedArr1.every( + (value, index) => value === sortedArr2[index] + ); + } else { + citem.isRight = false; + } + } else if ( + citem.questionType == "singleChoice" || + citem.questionType == "judge" + ) { + if (citem.id == "63825") console.log("i", item); + citem.isRight = citem.answer == citem.userAnswer; + } else if (citem.questionType == "shortAnswer") { + // 绠�绛� 缈昏瘧 + citem.isRight = null; + } else if (citem.questionType == "completion") { + // 濉┖ + if (typeof citem.answer == "string") { + citem.isRight = citem.answer == citem.userAnswer[0]; + } else { + if (citem.answer.length != citem.userAnswer.length) { citem.isRight = false; - } - } else if ( - citem.questionType == "singleChoice" || - citem.questionType == "judge" - ) { - if(citem.id == '63825') console.log('i',item); - citem.isRight = citem.answer == citem.userAnswer; - } else if (citem.questionType == "shortAnswer") { - // 绠�绛� 缈昏瘧 - citem.isRight = null; - } else if (citem.questionType == "completion") { - // 濉┖ - if (typeof citem.answer == "string") { - citem.isRight = citem.answer == citem.userAnswer[0]; } else { - if (citem.answer.length != citem.userAnswer.length) { - citem.isRight = false; - } else { - citem.isRight = citem.answer.every( - (value, index) => - value === citem.userAnswer[index] - ); - } + citem.isRight = citem.answer.every( + (value, index) => value === citem.userAnswer[index] + ); } } + } } - } - this.$props.cardList = list + this.$props.cardList = list; console.log(this.$props.cardList); }, }, @@ -769,15 +777,16 @@ } .border-box { padding-top: 20px; - border: 2px solid #e9e9e9; -} -.border-box:first-child { - border-top:2px solid #e9e9e9 ; + // border: 2px solid #e9e9e9; } .questionContent { // display: flex; // justify-content: center; + text-indent: 0em !important; margin-left: 20px; + /deep/ .el-textarea__inner:focus { + border-color: #15c0f2; + } } .input { /deep/ .el-input__inner { @@ -853,6 +862,8 @@ display: flex; align-items: flex-start; .questionNum { + text-indent: 0 !important; + margin-right: 5px; height: 32px; line-height: 32px; text-align: center; @@ -881,7 +892,7 @@ border-top: 0; } /deep/ .el-textarea.is-disabled .el-textarea__inner { - background-color: #fff ; + background-color: #fff; } /deep/.el-input__wrapper { border-top: 0 !important; @@ -943,7 +954,7 @@ } .analysis { margin: 20px 0; - width:550px; + width: 94%; // margin-left: 12px; } .el-collapse { -- Gitblit v1.9.1