src/assets/js/middleGround/tool.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/components/formula.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/examination/components/list.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/views/examination/index.vue | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/assets/js/middleGround/tool.js
@@ -417,6 +417,7 @@ // 获取不受保护的图片 export function getPublicImage(md5, width, height,storeInfo) { if(md5 && md5.includes('http')) return md5 + `?md5=${md5}` let src = null; if (md5) { src = requestCtx + `/file/GetPreViewImage?md5=${md5}`; src/views/components/formula.vue
@@ -48,7 +48,7 @@ <style lang="less"> .mathField { width: 500px; // width: 500px; margin-top: 10px; } src/views/examination/components/list.vue
@@ -7,12 +7,21 @@ v-show="item.infoList.length" > <p class="catalogName" :style="{ color: primaryColor }"> <span class="catalogName-box" > <span v-if="nindex == 0">一、</span> <span v-if="nindex == 1">二、</span> <span v-if="nindex == 2">三、</span> <span v-if="nindex == 3">四、</span> <span v-if="nindex == 4">五、</span> <span>{{ item.catalogName }}</span> </span> <img :src="item.isCollect ? isHeart : heart" alt="" class="collect-png" @click="handleCollect(nindex)" v-if="item.type == 'material'" /> </p> <ul> <li v-for="(value, index) in item.infoList" :key="value.id" :id="'listItem-' + value.id"> @@ -46,7 +55,7 @@ ></el-image> <!-- 文字加图片 --> <p class="stemTxtAndImage titleText" v-else-if="value.stemStyle == 'TxtAndImage'"> <span> {{ value.stem.stemTxt }}</span> <span v-html="value.stem.stemTxt" ></span> <el-image :src="getPublicImage(value.stem.stemImage, 150)" :preview-src-list="[getPublicImage(value.stem.stemImage)]" @@ -56,16 +65,20 @@ <!-- 填空题题干 --> <p class="titleText" v-if="value.questionType == 'completion'"> <span v-for="(itemText, indexText) in value.stem" :key="indexText"> <span v-if="typeof itemText == 'string'" v-html="itemText"></span> <span style="display: flex;align-items: center;" v-if="typeof itemText == 'string'" v-html="itemText"></span> <!-- --> <input <!-- <input v-else type="text" class="input" v-model.trim="value.userAnswer[itemText.num]" :disabled="value.isComplete" :style="{ backgroundColor: inputBc }" /> /> --> <math-field v-else @input="onChangeInput($event,nindex,index,indexText)" class="mathField" :menuItems="[]"> {{ value.userAnswer[itemText.num] }} </math-field > <!-- --> </span> </p> @@ -77,14 +90,14 @@ v-cloak ></p> </div> <!-- 收藏 --> <img :src="value.isCollect ? isHeart : heart" alt="" class="collect-png" @click="handleCollect(nindex, index)" v-if="!(hideCollect && value.questionType == 'shortAnswer')" v-if="item.type != 'material'" /> <!-- 收藏 --> </div> <div class="questionContent"> <!-- 单选 --> @@ -202,7 +215,7 @@ <el-input :disabled="value.isComplete" style="width: 94%; margin: 0 auto" v-else-if="value.questionType == 'shortAnswer'" v-else-if="value.questionType == 'shortAnswer' ||value.questionType =='formula'" type="textarea" :rows="6" placeholder="请输入内容" @@ -217,7 +230,9 @@ value.questionType == 'completion') " > <el-button @click="onChangeRadio(nindex,index)" style="margin-top: 10px">查看解析</el-button> <el-button @click="onChangeRadio(nindex, index)" style="margin-top: 10px" >查看解析</el-button > </div> <!-- 提交后解析 --> <div class="analysis" v-if="value.isComplete"> @@ -241,7 +256,6 @@ <span class="errorBox" >{{ arrayToString(value.userAnswer) ? arrayToString(value.userAnswer) : '-' }}</span> </p> </li> <li> @@ -269,11 +283,11 @@ <div class="headerConent sitgBox"> <p v-if="!value.isUnfold" class="al-cn"> <span class="analysisColor">展开解析</span> <img :src="openIcon" alt="" class="analysis-icon"> <img :src="openIcon" alt="" class="analysis-icon" /> </p> <p v-else> <span class="analysisColor">收起解析</span> <img :src="closeIcon" alt="" class="analysis-icon"> <img :src="closeIcon" alt="" class="analysis-icon" /> </p> </div> </div> @@ -290,11 +304,11 @@ <div class="headerBox"> <p v-if="!value.isUnfold" class="al-cn"> <span class="analysisColor">展开答案与解析</span> <img :src="openIcon" alt="" class="analysis-icon"> <img :src="openIcon" alt="" class="analysis-icon" /> </p> <p v-else class="al-cn"> <span class="analysisColor">收起答案与解析</span> <img :src="closeIcon" alt="" class="analysis-icon"> <img :src="closeIcon" alt="" class="analysis-icon" /> </p> </div> </template> @@ -334,7 +348,7 @@ import openIcon from '@/assets/images/examination/open.png' import closeIcon from '@/assets/images/examination/close.png' const props = defineProps({ cardList: Array, collectList: Array }) const emits = defineEmits([ 'onChangeRadio','setCollect']) const emits = defineEmits(['onChangeRadio', 'setCollect','onChangeInput']) // const presentId = ref<Number>(props.collectList[0]) onMounted(() => { // if (props.collectList) presentId.value = props.collectList[0] @@ -378,11 +392,18 @@ const onChangeRadio = (num:number,number:number) => { emits('onChangeRadio', num,number) } const onChangeInput = (event: any,index:number,cindex:number,dindex:number) => { emits('onChangeInput',event.target.value,index,cindex,dindex) } </script> <style lang="less" scoped> .catalogName { display: flex; margin-top: 40px; .catalogName-box { width: 94%; } } .collect-png { cursor: pointer; @@ -454,7 +475,6 @@ display: flex; align-items: flex-start; span { height: 24px; line-height: 24px; text-align: center; font-size: 16px; @@ -462,6 +482,9 @@ font-weight: bold; } .titleText { display: flex; flex-wrap: wrap; align-items: center; padding: 0 10px 10px 10px; min-width: 90%; font-size: 14px; @@ -542,8 +565,8 @@ width: 100%; padding: 0 20px; font-size: 14px; background-color: #E0F2FF ; color: #3B93FE; background-color: #e0f2ff; color: #3b93fe; .checkAnalysis { cursor: pointer; height: 100%; @@ -554,7 +577,7 @@ /deep/ .el-collapse-item__content { width: 100%; padding: 0 20px; background-color: #E0F2FF; background-color: #e0f2ff; font-size: 14px; color: #333; } @@ -595,7 +618,8 @@ .mark { font-size: 14px; color: #fff; .mark-error,.mark-correct { .mark-error, .mark-correct { white-space: nowrap; min-height: 20px; line-height: 18px; @@ -606,7 +630,7 @@ background-color: #1fbc1f; } .mark-error { background-color: #FF5E5E; background-color: #ff5e5e; } } .headerConent { @@ -618,7 +642,7 @@ height: 9px; } .correct { color: #70B503; color: #70b503; width: 200px; text-align: left; } @@ -626,7 +650,7 @@ text-align: left; margin-left: 40px; width: 200px; color: #FF5E5E; color: #ff5e5e; } } .difficulty { @@ -648,6 +672,11 @@ background-color: red; } .primary-text-color { color: #3B93FE; color: #3b93fe; } .mathField { min-width: 200px; max-width: 518px; margin-top: 10px; } </style> src/views/examination/index.vue
@@ -85,6 +85,7 @@ :cardList="examination.cardList" @setCollect="setCollect" @onChangeRadio="onChangeRadio" @onChangeInput="onChangeInput" /> </div> </li> @@ -190,7 +191,7 @@ getErrorList() } else if (props.type == 'collectQuestion') { examination.submitStatus = true await getcollectId() // 获取收藏题目 await getcollectId() // 获取收藏题目id // 收藏夹 } else if (props.type == 'errorQuestion') { examination.submitStatus = true @@ -244,7 +245,7 @@ } else if (item.questionType == 'singleChoice' || item.questionType == 'judge') { // 单选 判断 item.isRight = item.answer == item.userAnswer } else if (item.questionType == 'shortAnswer') { } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') { // 简答 翻译 item.isRight = null } else if (item.questionType == 'completion') { @@ -275,7 +276,7 @@ citem.isUnfold = '' examination.isCollapse = false } else { citem.questionType == 'shortAnswer' ? (citem.isUnfold = true) : (citem.isUnfold = citem.id) citem.questionType == 'shortAnswer' || citem.questionType == 'formula' ? (citem.isUnfold = true) : (citem.isUnfold = citem.id) examination.isCollapse = true } } @@ -289,8 +290,13 @@ examination.submitStatus = true } // 题目收藏按钮,收藏和取消同一接口,取消数组减去该项id const setCollect = (num: number, number: number) => { const item = examination.cardList[num].infoList[number] const setCollect = (num: number, number?: number) => { let item = null if(number) { item = examination.cardList[num].infoList[number] } else { item = examination.cardList[num] } item.isCollect = !item.isCollect if (item.isJson) { // json题目收藏取消 @@ -663,6 +669,7 @@ } // 获取收藏夹 const getCollectDataList = async () => { console.log('收藏id',examination.allCollect) // 开始请求 let oldData = null let oldList:any = [] @@ -752,7 +759,7 @@ isSubmit: false, // 查看解析 isRight: null, // 是否正确 isComplete: false, isCollect: examination.collectList.indexOf(item.id) > -1 ? true : false, isCollect: true, isUnfold: '' } // 多选和填空答案肯为数组,要转换JSON格式 @@ -889,7 +896,7 @@ } } } console.log('收藏json',jsonCollectList); for (let index = 0; index < jsonCollectList.length; index++) { const item = jsonCollectList[index] if (item.questionType == 'singleChoice') { @@ -900,7 +907,7 @@ examination.cardList[2].infoList.push(item) } else if (item.questionType == 'completion') { examination.cardList[3].infoList.push(item) } else if (item.questionType == 'shortAnswer') { } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') { examination.cardList[4].infoList.push(item) } else if (item.type && item.type == 'material') { examination.cardList[examination.cardList.length] = item @@ -1185,7 +1192,7 @@ examination.cardList[2].infoList.push(item) } else if (item.questionType == 'completion') { examination.cardList[3].infoList.push(item) } else if (item.questionType == 'shortAnswer') { } else if (item.questionType == 'shortAnswer' || item.questionType == 'formula') { examination.cardList[4].infoList.push(item) } else if (item.type && item.type == 'material') { examination.cardList[examination.cardList.length] = item @@ -1215,7 +1222,7 @@ } 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') { } else if (citem.questionType == 'shortAnswer' || item.questionType == 'formula') { // 简答 翻译 citem.isRight = null } else if (citem.questionType == 'completion') { @@ -1230,7 +1237,7 @@ } } } if (!citem.isRight && citem.questionType != 'shortAnswer') { if (!citem.isRight && citem.questionType != 'shortAnswer' && citem.questionType != 'formula') { // 客观题回答错误 记录错题 if (citem.isJson) { @@ -1419,6 +1426,9 @@ console.log('错题已清空') }) } const onChangeInput = (value:any,index:number,cindex:number,dindex:number) => { examination.cardList[index].infoList[cindex].userAnswer[dindex] = value } defineExpose({ handleExaminationDialog }) </script>