<template>
|
<el-dialog
|
v-model="examination.dialogVisible"
|
:title="
|
props.type == 'option' ? '附加题' : props.type == 'errorQuestion' ? '我的错题' : '我的收藏'
|
"
|
:align-center="true"
|
width="1200"
|
:show-close="false"
|
@open="openDialog"
|
class="examination-dialog"
|
>
|
<template #header>
|
<div class="dialog-header">
|
<span>
|
{{
|
props.type == 'option'
|
? '附加题'
|
: props.type == 'errorQuestion'
|
? '我的错题'
|
: '我的收藏'
|
}}
|
</span>
|
|
<svg
|
style="position: absolute; right: 10px; cursor: pointer"
|
@click="closeDialog"
|
t="1718596022986"
|
class="icon"
|
viewBox="0 0 1024 1024"
|
version="1.1"
|
xmlns="http://www.w3.org/2000/svg"
|
p-id="4252"
|
width="20"
|
height="20"
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
>
|
<path
|
d="M176.661601 817.172881C168.472798 825.644055 168.701706 839.149636 177.172881 847.338438 185.644056 855.527241 199.149636 855.298332 207.338438 846.827157L826.005105 206.827157C834.193907 198.355983 833.964998 184.850403 825.493824 176.661601 817.02265 168.472798 803.517069 168.701706 795.328267 177.172881L176.661601 817.172881Z"
|
fill="#979797"
|
p-id="4253"
|
></path>
|
<path
|
d="M795.328267 846.827157C803.517069 855.298332 817.02265 855.527241 825.493824 847.338438 833.964998 839.149636 834.193907 825.644055 826.005105 817.172881L207.338438 177.172881C199.149636 168.701706 185.644056 168.472798 177.172881 176.661601 168.701706 184.850403 168.472798 198.355983 176.661601 206.827157L795.328267 846.827157Z"
|
fill="#979797"
|
p-id="4254"
|
></path>
|
</svg>
|
</div>
|
</template>
|
<div v-loading="examination.loading">
|
<ul class="examintaion-box" v-if="!examination.noData">
|
<li>
|
<sheet
|
:cardList="examination.cardList"
|
:submitStatus="examination.submitStatus"
|
:answerType="props.type"
|
@saveData="saveData"
|
/>
|
</li>
|
<li>
|
<div class="examintaion-top-btn">
|
<div
|
v-if="
|
(type == 'option' && examination.submitStatus) ||
|
type == 'collectQuestion' ||
|
type == 'errorQuestion'
|
"
|
>
|
<div class="resolving-btn" @click="showCollaspe()" v-if="!examination.isCollapse">
|
【查看解析】
|
</div>
|
|
<div class="resolving-btn" @click="showCollaspe('noshow')" v-else>【收起解析】</div>
|
</div>
|
<!-- <div @click="clearCollect">清空收藏</div> -->
|
<!-- <div @click="clearError">清空错题</div> -->
|
<div class="redo-btn" @click="restart">
|
<img src="@/assets/images/examination/chongzuo.png" alt="" />
|
<span>重做</span>
|
</div>
|
</div>
|
<div class="examintaion-box-list">
|
<list
|
:cardList="examination.cardList"
|
@setCollect="setCollect"
|
@onChangeRadio="onChangeRadio"
|
/>
|
</div>
|
</li>
|
</ul>
|
<el-empty description="暂无数据" v-else class="empty" />
|
</div>
|
</el-dialog>
|
</template>
|
|
<script setup lang="ts">
|
import { ref, reactive, defineExpose, defineProps, inject } from 'vue'
|
import axios from 'axios'
|
import { getPublicImage } from '@/assets/js/middleGround/tool.js'
|
import { requestCtx } from '@/assets/js/config.js'
|
import { ElMessageBox } from 'element-plus'
|
import list from './components/list.vue'
|
import sheet from './components/sheet.vue'
|
const MG: any = inject('MG')
|
const examination = reactive({
|
dialogVisible: false,
|
loading: false,
|
noData: false,
|
cardList: [],
|
allCollect: [
|
{
|
type: 'bits',
|
collectList: []
|
},
|
{
|
type: 'json',
|
collectList: []
|
}
|
],
|
collectList: [], // 收藏id列表
|
allError: [
|
{
|
type: 'bits',
|
errorList: []
|
},
|
{
|
type: 'json',
|
errorList: []
|
}
|
],
|
errorList: [], // 错题id列表
|
submitStatus: false, // 是否提交
|
isCollapse: false // 是否展开所有解析
|
})
|
const props = defineProps<{
|
type: String
|
info: Object
|
activeBook: Object
|
infoType: String
|
}>()
|
// 弹窗打开前的回调
|
const openDialog = () => {
|
init()
|
}
|
// 弹窗弹窗按钮
|
const closeDialog = () => {
|
if (props.type == 'option') {
|
if (!examination.submitStatus) {
|
ElMessageBox.confirm('未提交,是否退出答题', '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
autofocus: false,
|
type: 'warning'
|
}).then(() => {
|
examination.dialogVisible = false
|
saveAnswerData()
|
examination.cardList = []
|
})
|
} else {
|
examination.dialogVisible = false
|
examination.cardList = []
|
}
|
} else {
|
examination.dialogVisible = false
|
// handleQuestion()
|
if(props.type == 'errorQuestion') {
|
handleQuestion()
|
}
|
examination.cardList = []
|
}
|
}
|
// 开关弹窗方法
|
const handleExaminationDialog = (type: boolean) => {
|
examination.dialogVisible = type
|
}
|
// 单选触发查看解析, 单个题目查看解析
|
const onChangeRadio = (num: number, number: number) => {
|
if (props.type == 'collectQuestion' || props.type == 'errorQuestion') correctQuestion(num, number)
|
}
|
|
// 初始化函数
|
const init = async () => {
|
examination.loading = true
|
examination.submitStatus = false
|
examination.noData = false
|
if (props.type == 'option') {
|
// 附加题
|
getCollectIdList()
|
getErrorList()
|
} else if (props.type == 'collectQuestion') {
|
examination.submitStatus = true
|
await getcollectId() // 获取收藏题目
|
// 收藏夹
|
} else if (props.type == 'errorQuestion') {
|
examination.submitStatus = true
|
await getErrorIdList()
|
getCollectIdList()
|
}
|
}
|
// 重做
|
const restart = () => {
|
ElMessageBox.confirm('确认要重新开始答题吗', '提示', {
|
confirmButtonText: '确认',
|
cancelButtonText: '取消',
|
autofocus: false,
|
type: 'warning'
|
})
|
.then(async () => {
|
examination.loading = true
|
examination.submitStatus = false
|
examination.cardList = []
|
examination.collectList = []
|
examination.errorList = []
|
goTop()
|
if (props.type == 'option') {
|
deleteAnswerInfo(async () => {
|
examination.cardList = (await getQuestionList([])) as any
|
})
|
} else {
|
init()
|
}
|
})
|
.catch(() => {})
|
}
|
|
// 返回顶部
|
const goTop = () => {
|
const layout = document.querySelector('examintaion-box-list')
|
if (layout) layout.scrollTo(0, 0)
|
}
|
// 判断单个题目是否正确
|
const correctQuestion = (num: number, number: number) => {
|
const item = examination.cardList[num].infoList[number]
|
item.isComplete = true
|
if (item.questionType == 'multipleChoice') {
|
if (item.answer.length == item.userAnswer.length) {
|
const sortedArr1 = item.answer.slice().sort()
|
const sortedArr2 = item.userAnswer.slice().sort()
|
item.isRight = sortedArr1.every((value: string, index: number) => value === sortedArr2[index])
|
} else {
|
item.isRight = false
|
}
|
} else if (item.questionType == 'singleChoice' || item.questionType == 'judge') {
|
// 单选 判断
|
item.isRight = item.answer == item.userAnswer
|
} else if (item.questionType == 'shortAnswer') {
|
// 简答 翻译
|
item.isRight = null
|
} else if (item.questionType == 'completion') {
|
// 填空
|
if (typeof item.answer == 'string') {
|
item.isRight = item.answer == item.userAnswer[0]
|
} else {
|
if (item.answer.length != item.userAnswer.length) {
|
item.isRight = false
|
} else {
|
item.isRight = item.answer.every(
|
(value: unknown, index: number) => value === item.userAnswer[index]
|
)
|
}
|
}
|
}
|
console.log(examination.cardList[num].infoList[number])
|
}
|
// 展开所有解析的折叠面板
|
const showCollaspe = (type?: string) => {
|
for (let index = 0; index < examination.cardList.length; index++) {
|
const item = examination.cardList[index]
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex]
|
console.log(citem)
|
|
if (type == 'noshow') {
|
citem.isUnfold = ''
|
examination.isCollapse = false
|
} else {
|
citem.questionType == 'shortAnswer' ? (citem.isUnfold = true) : (citem.isUnfold = citem.id)
|
examination.isCollapse = true
|
}
|
}
|
}
|
}
|
// 提交按钮
|
const saveData = () => {
|
if (props.type == 'option') {
|
handleQuestion()
|
}
|
examination.submitStatus = true
|
}
|
// 题目收藏按钮,收藏和取消同一接口,取消数组减去该项id
|
const setCollect = (num: number, number: number) => {
|
const item = examination.cardList[num].infoList[number]
|
item.isCollect = !item.isCollect
|
if (item.isJson) {
|
// json题目收藏取消
|
let jsonCollectID = examination.allCollect[1].collectList
|
if (jsonCollectID.length == 0) {
|
jsonCollectID.push(item.id)
|
} else {
|
const isShow = jsonCollectID.findIndex((citem) => citem == item.id)
|
if (isShow == -1) {
|
jsonCollectID.push(item.id)
|
} else {
|
jsonCollectID = jsonCollectID.filter((citem) => citem != item.id)
|
}
|
}
|
for (let index = 0; index < examination.allCollect.length; index++) {
|
const item = examination.allCollect[index]
|
if (item.type == 'json') item.collectList = jsonCollectID
|
}
|
} else {
|
// bits题目收藏/取消
|
if (examination.collectList.length == 0) {
|
examination.collectList.push(item.id)
|
} else {
|
const isShow = examination.collectList.findIndex((citem) => citem == item.id)
|
if (isShow == -1) {
|
examination.collectList.push(item.id)
|
} else {
|
examination.collectList = examination.collectList.filter((citem) => citem != item.id)
|
}
|
}
|
for (let index = 0; index < examination.allCollect.length; index++) {
|
const item = examination.allCollect[index]
|
if (item.type == 'bits') item.collectList = examination.collectList
|
}
|
}
|
console.log('收藏还是取消', examination.allCollect)
|
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'collectData',
|
key: props.activeBook.bookId,
|
value: JSON.stringify(examination.allCollect)
|
}
|
]
|
})
|
.then((res) => {
|
console.log('收藏/取消成功')
|
})
|
}
|
// 练习模式获取收藏id
|
const getCollectIdList = () => {
|
MG.identity
|
.getUserKey({
|
domain: 'collectData',
|
keys: [props.activeBook.bookId]
|
})
|
.then((res:any) => {
|
console.log('收藏数据', res)
|
try {
|
const collect = JSON.parse(res[0].value)
|
if (collect.length) {
|
examination.collectList = collect.find((citem:any) => citem.type == 'bits').collectList
|
examination.allCollect[0].collectList = collect.find(
|
(citem:any) => citem.type == 'bits'
|
).collectList
|
examination.allCollect[1].collectList = collect.find(
|
(citem:any) => citem.type == 'json'
|
).collectList
|
}
|
} catch (error) {
|
console.log('暂无数据')
|
}
|
if (props.type == 'option') {
|
getAnswerInfo(async (res:any) => {
|
if (res.length) {
|
// 有记录,不能答题,状态设为已提交
|
examination.submitStatus = true
|
let value = JSON.parse(res[0].value)
|
if (value) {
|
// 有答题记录,携带旧数据获取题目
|
examination.cardList = (await getQuestionList(value)) as any
|
}
|
} else {
|
const userAnswerList = await getUserAnswer()
|
if(userAnswerList) {
|
examination.cardList = (await getQuestionList(userAnswerList)) as any
|
} else {
|
examination.cardList = (await getQuestionList([])) as any
|
}
|
}
|
})
|
}
|
})
|
}
|
// 获取错题id列表
|
const getErrorList = () => {
|
MG.identity
|
.getUserKey({
|
domain: 'errorData',
|
keys: [props.activeBook.bookId]
|
})
|
.then((res) => {
|
try {
|
const error = JSON.parse(res[0].value)
|
if (error.length) {
|
examination.errorList = error.find((citem) => citem.type == 'bits').errorList
|
examination.allCollect[0].collectList = error.find(
|
(citem) => citem.type == 'bits'
|
).errorList
|
examination.allCollect[1].collectList = error.find(
|
(citem) => citem.type == 'json'
|
).errorList
|
}
|
} catch (error) {}
|
})
|
}
|
// 获取附加题题目列表
|
const getQuestionList = async (oldAnswer: any) => {
|
if (!props.info.ids.length) {
|
examination.loading = false
|
examination.noData = true
|
return false
|
}
|
// 开始请求
|
let oldList = oldAnswer
|
let cardList = [
|
{
|
catalogName: '单选题',
|
infoList: []
|
},
|
{
|
catalogName: '判断题',
|
infoList: []
|
},
|
{
|
catalogName: '多选题',
|
infoList: []
|
},
|
{
|
catalogName: '填空题',
|
infoList: []
|
},
|
{
|
catalogName: '简答题',
|
infoList: []
|
}
|
]
|
let singleChoiceArr = [] // 单选
|
let judgeArr = [] // 判断
|
let shortArr = [] // 简答
|
let multipleChoiceArr = [] // 多选
|
let completionArr = [] // 填空
|
// 11
|
for (let qindex = 0; qindex < props.info.ids.length; qindex++) {
|
const qitem = props.info.ids[qindex]
|
let query = {
|
storeInfo: props.activeBook.storeRefcode,
|
path: '*',
|
cmsPath: props.activeBook.rootCmsItemId,
|
cmsType: '*',
|
productId: props.activeBook.bookId,
|
queryType: '*',
|
itemIds: qitem + '',
|
itemFields: {
|
Embedded_QuestionBank_Stem: [],
|
Embedded_QuestionBank_AnalysisCon: [],
|
Embedded_QuestionBank_Answer: [],
|
Embedded_QuestionBank_Option: [],
|
Embedded_QuestionBank_QuestionType: [],
|
Embedded_QuestionBank_StemStyle: [],
|
Embedded_QuestionBank_OptionStyle: [],
|
Embedded_QuestionBank_KnowledgePoint: [],
|
Embedded_QuestionBank_Difficulty: []
|
}
|
}
|
const res = await MG.store.getProductDetail(query)
|
if (!res.datas) return false
|
res.datas.cmsDatas[0].datas.forEach((item, index) => {
|
let oldObj = {}
|
if (oldList) {
|
oldObj = oldList.find((item) => item.id == qitem)
|
}
|
const questionObj = {
|
number: index + 1, // 题号
|
id: item.id,
|
stem:
|
item.Embedded_QuestionBank_QuestionType == 'completion'
|
? JSON.parse(item.Embedded_QuestionBank_Stem)
|
.stemTxt.replaceAll('<vacancy>', ',input,')
|
.split(',')
|
: JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
|
answer: item.Embedded_QuestionBank_Answer, // 答案
|
option: item.Embedded_QuestionBank_Option
|
? JSON.parse(item.Embedded_QuestionBank_Option)
|
: '', // 选择题选项
|
analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
|
questionType: item.Embedded_QuestionBank_QuestionType, // 题型
|
optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
|
stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
|
difficulty: item.Embedded_QuestionBank_Difficulty
|
? 4 - item.Embedded_QuestionBank_Difficulty
|
: 0, // 难度等级
|
userAnswer: oldObj
|
? oldObj.userAnswer
|
: item.Embedded_QuestionBank_QuestionType == 'completion' ||
|
item.Embedded_QuestionBank_QuestionType == 'multipleChoice'
|
? []
|
: '',
|
isSubmit: false, // 查看解析
|
isRight: oldObj ? oldObj.isRight : null, // 是否正确
|
isComplete: examination.submitStatus,
|
isCollect: examination.collectList.indexOf(item.id) > -1 ? true : false,
|
isUnfold: ''
|
}
|
// 多选和填空答案肯为数组,要转换JSON格式
|
if (
|
questionObj.questionType == 'completion' ||
|
questionObj.questionType == 'multipleChoice'
|
) {
|
try {
|
questionObj.answer = JSON.parse(questionObj.answer).toString()
|
} catch (error) {
|
questionObj.answer = item.Embedded_QuestionBank_Answer
|
}
|
}
|
// 填空题改造
|
if (questionObj.questionType == 'completion') {
|
let index = 0
|
for (let i = 0; i < questionObj.stem.length; i++) {
|
const item = questionObj.stem[i]
|
if (item == 'input') {
|
questionObj.stem[i] = {
|
num: index,
|
data: 'input'
|
}
|
questionObj.userAnswer[index] = ''
|
index++
|
}
|
}
|
}
|
// 获取图片
|
if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
|
questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
|
}
|
if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
|
questionObj.option.forEach((optionItem) => {
|
if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
|
})
|
}
|
// 题干富文本处理
|
if (questionObj.stemStyle == 'RichText') {
|
// questionObj.option.txt = ''
|
questionObj.stem.stemTxt = questionObj.stem.stemTxt
|
.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replaceAll('../file', requestCtx + '/file')
|
}
|
// 选项富文本处理
|
if (
|
questionObj.optionStyle == 'RichText' &&
|
(questionObj.questionType == 'singleChoice' ||
|
questionObj.questionType == 'judge' ||
|
questionObj.questionType == 'multipleChoice')
|
) {
|
questionObj.option.forEach((item) => {
|
if (item.txt)
|
item.txt = item.txt
|
.replace(/\<img/gi, '<img class="option-rich-img"')
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replace('../file', requestCtx + '/file')
|
})
|
}
|
// 解析富文本处理
|
if (questionObj.analysisCon && typeof questionObj.analysisCon == 'string') {
|
questionObj.analysisCon = questionObj.analysisCon.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
}
|
// 听力题修改
|
// if (questionObj.questionType == 'singleChoice') {
|
// const src = this.extractSourceSrc(questionObj.stem.stemTxt)
|
// if (src) {
|
// questionObj.src = src
|
// questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
|
// }
|
// }
|
if (item.Embedded_QuestionBank_QuestionType == 'judge') {
|
questionObj.type = '判断题'
|
judgeArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') {
|
questionObj.type = '单选题'
|
singleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') {
|
questionObj.type = '多选题'
|
multipleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
|
questionObj.type = '填空题'
|
completionArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
|
questionObj.type = '简答题'
|
shortArr.push(questionObj)
|
}
|
})
|
}
|
// 22
|
cardList[0].infoList = singleChoiceArr
|
cardList[1].infoList = judgeArr
|
cardList[2].infoList = multipleChoiceArr
|
cardList[3].infoList = completionArr
|
cardList[4].infoList = shortArr
|
for (let index = 0; index < cardList.length; index++) {
|
const item = cardList[index]
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex]
|
citem.number = cindex + 1
|
}
|
}
|
examination.loading = false
|
return cardList.filter((item) => item.infoList.length > 0)
|
}
|
// 我的收藏获取收藏id
|
const getcollectId = async () => {
|
MG.identity
|
.getUserKey({
|
domain: 'collectData',
|
keys: [props.activeBook.bookId]
|
})
|
.then(async (res:any) => {
|
try {
|
const collect = JSON.parse(res[0].value)
|
if (collect.length) {
|
examination.collectList = collect.find((citem:any) => citem.type == 'bits').collectList
|
examination.allCollect[0].collectList = collect.find(
|
(citem:any) => citem.type == 'bits'
|
).collectList
|
examination.allCollect[1].collectList = collect.find(
|
(citem:any) => citem.type == 'json'
|
).collectList
|
}
|
} catch (error) {}
|
if (
|
examination.allCollect[0].collectList.length ||
|
examination.allCollect[1].collectList.length
|
) {
|
examination.cardList = (await getCollectDataList()) as any
|
await getJsonCollect()
|
} else {
|
examination.loading = false
|
examination.noData = true
|
ElMessageBox.confirm('收藏夹暂无数据!', '提示', {
|
confirmButtonText: '确定',
|
showCancelButton: false,
|
type: 'warning'
|
})
|
.then(() => {
|
examination.submitStatus = true
|
examination.dialogVisible = false
|
})
|
.catch(() => {
|
examination.dialogVisible = false
|
})
|
}
|
})
|
}
|
// 获取收藏夹
|
const getCollectDataList = async () => {
|
// 开始请求
|
let oldData = null
|
let oldList:any = []
|
let cardList = [
|
{
|
catalogName: '单选题',
|
infoList: []
|
},
|
{
|
catalogName: '判断题',
|
infoList: []
|
},
|
{
|
catalogName: '多选题',
|
infoList: []
|
},
|
{
|
catalogName: '填空题',
|
infoList: []
|
},
|
{
|
catalogName: '简答题',
|
infoList: []
|
}
|
]
|
let singleChoiceArr:any = [] // 单选
|
let judgeArr:any = [] // 判断
|
let shortArr:any = [] // 简答
|
let multipleChoiceArr:any = [] // 多选
|
let completionArr:any = [] // 填空
|
// 11
|
for (let qindex = 0; qindex < examination.collectList.length; qindex++) {
|
const qitem = examination.collectList[qindex]
|
let query = {
|
storeInfo: props.activeBook.storeRefcode,
|
path: '*',
|
cmsPath: props.activeBook.rootCmsItemId,
|
cmsType: '*',
|
productId: props.activeBook.bookId,
|
queryType: '*',
|
itemIds: qitem + '',
|
itemFields: {
|
Embedded_QuestionBank_Stem: [],
|
Embedded_QuestionBank_AnalysisCon: [],
|
Embedded_QuestionBank_Answer: [],
|
Embedded_QuestionBank_Option: [],
|
Embedded_QuestionBank_QuestionType: [],
|
Embedded_QuestionBank_StemStyle: [],
|
Embedded_QuestionBank_OptionStyle: [],
|
Embedded_QuestionBank_KnowledgePoint: [],
|
Embedded_QuestionBank_Difficulty: []
|
}
|
}
|
const res = await MG.store.getProductDetail(query)
|
if (!res.datas) return false
|
res.datas.cmsDatas[0].datas.forEach((item, index) => {
|
let oldObj = {}
|
if (oldList) {
|
oldObj = oldList.find((item) => item.id == qitem)
|
}
|
const questionObj = {
|
number: index + 1, // 题号
|
id: item.id,
|
stem:
|
item.Embedded_QuestionBank_QuestionType == 'completion'
|
? JSON.parse(item.Embedded_QuestionBank_Stem)
|
.stemTxt.replaceAll('<vacancy>', ',input,')
|
.split(',')
|
: JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
|
answer: item.Embedded_QuestionBank_Answer, // 答案
|
option: item.Embedded_QuestionBank_Option
|
? JSON.parse(item.Embedded_QuestionBank_Option)
|
: '', // 选择题选项
|
analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
|
questionType: item.Embedded_QuestionBank_QuestionType, // 题型
|
optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
|
stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
|
difficulty: item.Embedded_QuestionBank_Difficulty
|
? 4 - item.Embedded_QuestionBank_Difficulty
|
: 0, // 难度等级
|
userAnswer: oldObj
|
? oldObj.userAnswer
|
: item.Embedded_QuestionBank_QuestionType == 'completion' ||
|
item.Embedded_QuestionBank_QuestionType == 'multipleChoice'
|
? []
|
: '',
|
isSubmit: false, // 查看解析
|
isRight: null, // 是否正确
|
isComplete: false,
|
isCollect: examination.collectList.indexOf(item.id) > -1 ? true : false,
|
isUnfold: ''
|
}
|
// 多选和填空答案肯为数组,要转换JSON格式
|
if (
|
questionObj.questionType == 'completion' ||
|
questionObj.questionType == 'multipleChoice'
|
) {
|
try {
|
questionObj.answer = JSON.parse(questionObj.answer).toString()
|
} catch (error) {
|
questionObj.answer = item.Embedded_QuestionBank_Answer
|
}
|
}
|
// 填空题改造
|
if (questionObj.questionType == 'completion') {
|
let index = 0
|
for (let i = 0; i < questionObj.stem.length; i++) {
|
const item = questionObj.stem[i]
|
if (item == 'input') {
|
questionObj.stem[i] = {
|
num: index,
|
data: 'input'
|
}
|
questionObj.userAnswer[index] = ''
|
index++
|
}
|
}
|
}
|
// 获取图片
|
if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
|
questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
|
}
|
if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
|
questionObj.option.forEach((optionItem:any) => {
|
if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
|
})
|
}
|
// 题干富文本处理
|
if (questionObj.stemStyle == 'RichText') {
|
// questionObj.option.txt = ''
|
questionObj.stem.stemTxt = questionObj.stem.stemTxt
|
.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replace('../file', requestCtx + '/file')
|
}
|
// 选项富文本处理
|
if (
|
questionObj.optionStyle == 'RichText' &&
|
(questionObj.questionType == 'singleChoice' ||
|
questionObj.questionType == 'judge' ||
|
questionObj.questionType == 'multipleChoice')
|
) {
|
questionObj.option.forEach((item:any) => {
|
if (item.txt)
|
item.txt = item.txt
|
.replace(/\<img/gi, '<img class="option-rich-img"')
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replace('../file', requestCtx + '/file')
|
})
|
}
|
// 解析富文本处理
|
if (questionObj.analysisCon && typeof questionObj.analysisCon == 'string') {
|
questionObj.analysisCon = questionObj.analysisCon.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
}
|
// 听力题修改
|
// if (questionObj.questionType == 'singleChoice') {
|
// const src = this.extractSourceSrc(questionObj.stem.stemTxt)
|
// if (src) {
|
// questionObj.src = src
|
// questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
|
// }
|
// }
|
if (item.Embedded_QuestionBank_QuestionType == 'judge') {
|
questionObj.type = '判断题'
|
judgeArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') {
|
questionObj.type = '单选题'
|
singleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') {
|
questionObj.type = '多选题'
|
multipleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
|
questionObj.type = '填空题'
|
completionArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
|
questionObj.type = '简答题'
|
shortArr.push(questionObj)
|
}
|
})
|
}
|
// 22
|
cardList[0].infoList = singleChoiceArr
|
cardList[1].infoList = judgeArr
|
cardList[2].infoList = multipleChoiceArr
|
cardList[3].infoList = completionArr
|
cardList[4].infoList = shortArr
|
for (let index = 0; index < cardList.length; index++) {
|
const item = cardList[index]
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex]
|
citem.number = cindex + 1
|
}
|
}
|
examination.loading = false
|
return cardList
|
}
|
// 我的收藏模式下,获取收藏的假题(json)
|
const getJsonCollect = async () => {
|
if (!props.activeBook.jsonQUestion) {
|
examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
|
return false
|
}
|
let questionArr = []
|
let jsonCollectList = []
|
for (let index = 0; index < props.activeBook.jsonQUestion.length; index++) {
|
const item = props.activeBook.jsonQUestion[index]
|
const res = await axios.get(props.activeBook.resourceUrl + '/question-' + item + '.json')
|
questionArr.push(...res.data.data)
|
}
|
for (let index = 0; index < questionArr.length; index++) {
|
const item = questionArr[index]
|
for (let cindex = 0; cindex < examination.allCollect[1].collectList.length; cindex++) {
|
const citem = examination.allCollect[1].collectList[cindex]
|
if (item.id == citem) {
|
item.isCollect = true
|
item.isJson = true
|
jsonCollectList.push(item)
|
}
|
}
|
}
|
|
for (let index = 0; index < jsonCollectList.length; index++) {
|
const item = jsonCollectList[index]
|
if (item.questionType == 'singleChoice') {
|
examination.cardList[0].infoList.push(item)
|
} else if (item.questionType == 'judge') {
|
examination.cardList[1].infoList.push(item)
|
} else if (item.questionType == 'multipleChoice') {
|
examination.cardList[2].infoList.push(item)
|
} else if (item.questionType == 'completion') {
|
examination.cardList[3].infoList.push(item)
|
} else if (item.questionType == 'shortAnswer') {
|
examination.cardList[4].infoList.push(item)
|
} else if (item.type && item.type == 'material') {
|
examination.cardList[examination.cardList.length] = item
|
}
|
}
|
examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
|
console.log('拼接题', examination.cardList)
|
}
|
// 我的错题模式下获取错题id列表
|
const getErrorIdList = async () => {
|
await MG.identity
|
.getUserKey({
|
domain: 'errorData',
|
keys: [props.activeBook.bookId]
|
})
|
.then(async (res:any) => {
|
try {
|
const error = JSON.parse(res[0].value)
|
if (error.length) {
|
console.log('有吗', error)
|
examination.errorList = error.find((citem:any) => citem.type == 'bits').errorList
|
examination.allError[0].errorList = error.find((citem:any) => citem.type == 'bits').errorList
|
examination.allError[1].errorList = error.find((citem:any) => citem.type == 'json').errorList
|
}
|
} catch (error) {}
|
if (examination.allError[0].errorList || examination.allError[1].errorList) {
|
examination.cardList = (await getErrorDataList()) as any
|
await getJsonError()
|
} else {
|
examination.noData = true
|
examination.loading = false
|
ElMessageBox.confirm('错题集暂无数据!', '提示', {
|
confirmButtonText: '确定',
|
showCancelButton: false,
|
type: 'warning'
|
})
|
.then(() => {
|
examination.submitStatus = true
|
examination.dialogVisible = false
|
})
|
.catch(() => {
|
examination.dialogVisible = false
|
})
|
}
|
})
|
}
|
// 获取错题集
|
const getErrorDataList = async () => {
|
let oldData = null
|
let oldList:any = []
|
let cardList = [
|
{
|
catalogName: '单选题',
|
infoList: []
|
},
|
{
|
catalogName: '判断题',
|
infoList: []
|
},
|
{
|
catalogName: '多选题',
|
infoList: []
|
},
|
{
|
catalogName: '填空题',
|
infoList: []
|
},
|
{
|
catalogName: '简答题',
|
infoList: []
|
}
|
]
|
let singleChoiceArr:any = [] // 单选
|
let judgeArr:any = [] // 判断
|
let shortArr:any = [] // 简答
|
let multipleChoiceArr:any = [] // 多选
|
let completionArr:any = [] // 填空
|
// 11
|
for (let qindex = 0; qindex < examination.errorList.length; qindex++) {
|
const qitem = examination.errorList[qindex]
|
let query = {
|
storeInfo: props.activeBook.storeRefcode,
|
path: '*',
|
cmsPath: props.activeBook.rootCmsItemId,
|
cmsType: '*',
|
productId: props.activeBook.bookId,
|
queryType: '*',
|
itemIds: qitem + '',
|
itemFields: {
|
Embedded_QuestionBank_Stem: [],
|
Embedded_QuestionBank_AnalysisCon: [],
|
Embedded_QuestionBank_Answer: [],
|
Embedded_QuestionBank_Option: [],
|
Embedded_QuestionBank_QuestionType: [],
|
Embedded_QuestionBank_StemStyle: [],
|
Embedded_QuestionBank_OptionStyle: [],
|
Embedded_QuestionBank_KnowledgePoint: [],
|
Embedded_QuestionBank_Difficulty: []
|
}
|
}
|
const res = await MG.store.getProductDetail(query)
|
if (!res.datas) return false
|
res.datas.cmsDatas[0].datas.forEach((item:any, index:number) => {
|
let oldObj = {}
|
if (oldList) {
|
oldObj = oldList.find((item:any) => item.id == qitem)
|
}
|
const questionObj = {
|
number: index + 1, // 题号
|
id: item.id,
|
stem:
|
item.Embedded_QuestionBank_QuestionType == 'completion'
|
? JSON.parse(item.Embedded_QuestionBank_Stem)
|
.stemTxt.replaceAll('<vacancy>', ',input,')
|
.split(',')
|
: JSON.parse(item.Embedded_QuestionBank_Stem), // 题干
|
answer: item.Embedded_QuestionBank_Answer, // 答案
|
option: item.Embedded_QuestionBank_Option
|
? JSON.parse(item.Embedded_QuestionBank_Option)
|
: '', // 选择题选项
|
analysisCon: item.Embedded_QuestionBank_AnalysisCon, // 解析
|
questionType: item.Embedded_QuestionBank_QuestionType, // 题型
|
optionStyle: item.Embedded_QuestionBank_OptionStyle, // 选项显示类型
|
stemStyle: item.Embedded_QuestionBank_StemStyle, // 题干显示类型
|
difficulty: item.Embedded_QuestionBank_Difficulty
|
? 4 - item.Embedded_QuestionBank_Difficulty
|
: 0, // 难度等级
|
userAnswer: oldObj
|
? oldObj.userAnswer
|
: item.Embedded_QuestionBank_QuestionType == 'completion' ||
|
item.Embedded_QuestionBank_QuestionType == 'multipleChoice'
|
? []
|
: '',
|
isSubmit: false, // 查看解析
|
isRight: null, // 是否正确
|
isComplete: false,
|
isCollect: examination.collectList.indexOf(item.id) > -1 ? true : false,
|
isUnfold: ''
|
}
|
// 多选和填空答案肯为数组,要转换JSON格式
|
if (
|
questionObj.questionType == 'completion' ||
|
questionObj.questionType == 'multipleChoice'
|
) {
|
try {
|
questionObj.answer = JSON.parse(questionObj.answer).toString()
|
} catch (error) {
|
questionObj.answer = item.Embedded_QuestionBank_Answer
|
}
|
}
|
// 填空题改造
|
if (questionObj.questionType == 'completion') {
|
let index = 0
|
for (let i = 0; i < questionObj.stem.length; i++) {
|
const item = questionObj.stem[i]
|
if (item == 'input') {
|
questionObj.stem[i] = {
|
num: index,
|
data: 'input'
|
}
|
questionObj.userAnswer[index] = ''
|
index++
|
}
|
}
|
}
|
// 获取图片
|
if (questionObj.stemStyle == 'Image' || questionObj.stemStyle == 'TxtAndImage') {
|
questionObj.stem.stemImage = getPublicImage(questionObj.stem.stemImage, 150)
|
}
|
if (questionObj.optionStyle == 'Image' || questionObj.optionStyle == 'TxtAndImage') {
|
questionObj.option.forEach((optionItem:any) => {
|
if (optionItem.img) optionItem.img = getPublicImage(optionItem.img, 150)
|
})
|
}
|
// 题干富文本处理
|
if (questionObj.stemStyle == 'RichText') {
|
// questionObj.option.txt = ''
|
questionObj.stem.stemTxt = questionObj.stem.stemTxt
|
.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replace('../file', requestCtx + '/file')
|
}
|
// 选项富文本处理
|
if (
|
questionObj.optionStyle == 'RichText' &&
|
(questionObj.questionType == 'singleChoice' ||
|
questionObj.questionType == 'judge' ||
|
questionObj.questionType == 'multipleChoice')
|
) {
|
questionObj.option.forEach((item:any) => {
|
if (item.txt)
|
item.txt = item.txt
|
.replace(/\<img/gi, '<img class="option-rich-img"')
|
.replace(/\<p/gi, '<p class="stem-rich-p"')
|
.replace('../file', requestCtx + '/file')
|
})
|
}
|
// 解析富文本处理
|
if (questionObj.analysisCon && typeof questionObj.analysisCon == 'string') {
|
questionObj.analysisCon = questionObj.analysisCon.replace(
|
/\<img/gi,
|
'<img style="max-width: 300rpx !important;object-fit: contain;" class="stem-rich-img" '
|
)
|
}
|
// 听力题修改
|
// if (questionObj.questionType == 'singleChoice') {
|
// const src = this.extractSourceSrc(questionObj.stem.stemTxt)
|
// if (src) {
|
// questionObj.src = src
|
// questionObj.stem.stemTxt = this.removeVideoAndAudioTags(questionObj.stem.stemTxt)
|
// }
|
// }
|
if (item.Embedded_QuestionBank_QuestionType == 'judge') {
|
questionObj.type = '判断题'
|
judgeArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'singleChoice') {
|
questionObj.type = '单选题'
|
singleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'multipleChoice') {
|
questionObj.type = '多选题'
|
multipleChoiceArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'completion') {
|
questionObj.type = '填空题'
|
completionArr.push(questionObj)
|
} else if (item.Embedded_QuestionBank_QuestionType == 'shortAnswer') {
|
questionObj.type = '简答题'
|
shortArr.push(questionObj)
|
}
|
})
|
}
|
// 22
|
cardList[0].infoList = singleChoiceArr
|
cardList[1].infoList = judgeArr
|
cardList[2].infoList = multipleChoiceArr
|
cardList[3].infoList = completionArr
|
cardList[4].infoList = shortArr
|
for (let index = 0; index < cardList.length; index++) {
|
const item = cardList[index]
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex]
|
citem.number = cindex + 1
|
}
|
}
|
examination.loading = false
|
return cardList
|
}
|
// 错题集模式下,获取假的错题(json)
|
const getJsonError = async () => {
|
if (!props.activeBook.jsonQUestion) {
|
examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
|
return false
|
}
|
let questionArr = []
|
let jsonCollectList = []
|
for (let index = 0; index < props.activeBook.jsonQUestion.length; index++) {
|
const item = props.activeBook.jsonQUestion[index]
|
const res = await axios.get(props.activeBook.resourceUrl + '/question-' + item + '.json')
|
questionArr.push(...res.data.data)
|
}
|
for (let index = 0; index < questionArr.length; index++) {
|
const item = questionArr[index]
|
for (let cindex = 0; cindex < examination.allError[1].errorList.length; cindex++) {
|
const citem = examination.allError[1].errorList[cindex]
|
if (item.id == citem) {
|
item.isCollect = examination.allCollect[1].collectList.indexOf(item.id) > -1 ? true :false
|
item.isJson = true
|
jsonCollectList.push(item)
|
}
|
}
|
}
|
|
for (let index = 0; index < jsonCollectList.length; index++) {
|
const item = jsonCollectList[index]
|
if (item.questionType == 'singleChoice') {
|
examination.cardList[0].infoList.push(item)
|
} else if (item.questionType == 'judge') {
|
examination.cardList[1].infoList.push(item)
|
} else if (item.questionType == 'multipleChoice') {
|
examination.cardList[2].infoList.push(item)
|
} else if (item.questionType == 'completion') {
|
examination.cardList[3].infoList.push(item)
|
} else if (item.questionType == 'shortAnswer') {
|
examination.cardList[4].infoList.push(item)
|
} else if (item.type && item.type == 'material') {
|
examination.cardList[examination.cardList.length] = item
|
}
|
}
|
examination.cardList = examination.cardList.filter((item) => item.infoList.length > 0)
|
}
|
// 批改题目 (练习,我的做题,我的收藏模式下)
|
const handleQuestion = () => {
|
for (let index = 0; index < examination.cardList.length; index++) {
|
const item = examination.cardList[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.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])
|
}
|
}
|
}
|
if (!citem.isRight && citem.questionType != 'shortAnswer') {
|
|
// 客观题回答错误 记录错题
|
if (citem.isJson) {
|
if (
|
examination.allError[1].errorList.findIndex((erroritem) => erroritem == citem.id) == -1
|
) {
|
examination.allError[1].errorList.push(citem.id)
|
}
|
} else {
|
if (examination.errorList.findIndex((errorItem) => errorItem == citem.id) == -1) {
|
examination.errorList.push(citem.id)
|
}
|
}
|
} else {
|
if (props.type == 'errorQuestion' || props.type == 'option') {
|
// 从错题集中移除
|
if (citem.isJson) {
|
let index = examination.allError[1].errorList.findIndex(
|
(erroritem) => erroritem == citem.id
|
)
|
if (index > -1) {
|
examination.allError[1].errorList.splice(index, 1)
|
}
|
} else {
|
let index = examination.errorList.findIndex((erroritem) => erroritem == citem.id)
|
if (index > -1) {
|
examination.errorList.splice(index, 1)
|
}
|
}
|
}
|
}
|
}
|
}
|
// 错题已经拿到,需要记录错题id
|
examination.allError[0].errorList = examination.errorList
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'errorData',
|
key: props.activeBook.bookId,
|
value: JSON.stringify(examination.allError)
|
}
|
]
|
})
|
.then((res:any) => {
|
console.log('错题已保存', examination.allError)
|
})
|
if (props.type == 'option') {
|
recordAnswerData()
|
}
|
console.log('提交错题',examination.errorList,examination.allError);
|
|
}
|
// 处理答题数据
|
const recordAnswerData = () => {
|
const infoData: any[] = []
|
for (let index = 0; index < examination.cardList.length; index++) {
|
const item = examination.cardList[index]
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex]
|
infoData.push({
|
id: citem.id,
|
userAnswer: citem.userAnswer,
|
isRight: citem.isRight
|
})
|
}
|
}
|
console.log('保存的数据', infoData)
|
setAnswerInfo(infoData)
|
}
|
// 未提交保存答案方法
|
const saveAnswerData = () => {
|
let arr = []
|
for (let index = 0; index < examination.cardList.length; index++) {
|
const item = examination.cardList[index];
|
for (let cindex = 0; cindex < item.infoList.length; cindex++) {
|
const citem = item.infoList[cindex];
|
if(citem.userAnswer && citem.userAnswer.length) {
|
arr.push({
|
id:citem.id,
|
userAnswer:citem.userAnswer
|
})
|
}
|
}
|
}
|
console.log('用户答案',arr);
|
setUserAnswer(arr)
|
}
|
// 未提交退出答题,保存用户答案
|
const setUserAnswer = (data:any) => {
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'beforeAnswerData',
|
key: props.info.id,
|
value: JSON.stringify(data)
|
}
|
]
|
})
|
.then((res:any) => {
|
console.log('提交用户答题数据成功')
|
})
|
}
|
// 获取未提交退出答题的用户答案
|
const getUserAnswer = async() => {
|
let data
|
await MG.identity
|
.getUserKey({
|
domain: 'beforeAnswerData',
|
keys: [props.info.id]
|
})
|
.then((res:any) => {
|
if(res.length) {
|
data = JSON.parse(res[0].value)
|
}
|
})
|
return data
|
}
|
// 获取用户旧答题数据(提交后)
|
const getAnswerInfo = (callback:any) => {
|
MG.identity
|
.getUserKey({
|
domain: 'answerData',
|
keys: [props.info.id]
|
})
|
.then((res:any) => {
|
if (callback) callback(res)
|
})
|
}
|
// 提交用户答题数据
|
const setAnswerInfo = (data: any) => {
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'answerData',
|
key: props.info.id,
|
value: JSON.stringify(data)
|
}
|
]
|
})
|
.then((res:any) => {
|
console.log('提交用户答题数据成功')
|
})
|
}
|
// 删除用户答题数据
|
const deleteAnswerInfo = (callback:any) => {
|
MG.identity
|
.delUserKey({
|
domain: 'answerData',
|
keys: [props.info.id]
|
})
|
.then((res:any) => {
|
if (callback) callback()
|
})
|
}
|
const clearCollect = () => {
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'collectData',
|
key: props.activeBook.bookId,
|
value: JSON.stringify([])
|
}
|
]
|
})
|
.then((res:any) => {
|
console.log('收藏/取消成功')
|
})
|
}
|
const clearError = () => {
|
MG.identity
|
.setUserKey({
|
setKeyRequests: [
|
{
|
domain: 'errorData',
|
key: props.activeBook.bookId,
|
value: JSON.stringify([])
|
}
|
]
|
})
|
.then((res:any) => {
|
console.log('错题已清空')
|
})
|
}
|
defineExpose({ handleExaminationDialog })
|
</script>
|
|
<style lang="less" scoped>
|
.examintaion-box {
|
display: flex;
|
justify-content: space-between;
|
.examintaion-box-list {
|
padding-right: 10px;
|
height: 850px;
|
overflow: auto;
|
}
|
}
|
.dialog-header {
|
text-align: center;
|
font-size: 16px;
|
color: #333;
|
}
|
.examination-dialog {
|
.empty {
|
margin: 250px 0;
|
}
|
}
|
.examintaion-top-btn {
|
display: flex;
|
padding: 0 20px;
|
justify-content: flex-end;
|
align-items: center;
|
height: 40px;
|
color: #3b93fe;
|
font-size: 14px;
|
.resolving-btn {
|
margin-right: 20px;
|
cursor: pointer;
|
}
|
.redo-btn {
|
cursor: pointer;
|
display: flex;
|
align-items: center;
|
img {
|
margin-right: 4px;
|
}
|
}
|
}
|
</style>
|