| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div style="display: flex;flex-direction: column;margin: 0 30px" > |
| | | <div v-if="state.easyList && state.easyList.length >0"> |
| | | <span style="font-size: 18px;font-weight: 600">简答</span> |
| | | <div v-for="(item,index) in state.easyList" :key="index" style="margin-left: 15px;margin-top: 10px"> |
| | | <div style="display: flex;flex-direction: column;"> |
| | | <div style="margin-top: 10px;display: flex"> |
| | | <span style="font-size: 15px">题目{{index+1}}:</span> |
| | | <span style="margin-left: 10px;font-size: 16px">{{item.title}}</span> |
| | | </div> |
| | | <el-divider /> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </el-card> |
| | | </el-dialog> |
| | | </div> |
| | |
| | | <script setup> |
| | | import {reactive, ref, toRefs} from 'vue' |
| | | import {ElMessage} from "element-plus"; |
| | | import {getPaper} from "@/api/onlineEducation/exam"; |
| | | const dialogVisible = ref(false); |
| | | const title = ref(""); |
| | | const busRef = ref(); |
| | |
| | | questionList: [], |
| | | singleList:[], |
| | | judgeList: [], |
| | | multiList:[] |
| | | multiList:[], |
| | | easyList: [] |
| | | }) |
| | | |
| | | const openDialog = async (value) => { |
| | | console.log('111',value) |
| | | console.log('111',value) |
| | | dialogVisible.value = true; |
| | | let result = value.questions.reduce((a, b) => { |
| | | if (a[b.questionType]) { |
| | | a[b.questionType].push(b); |
| | | } else { |
| | | a[b.questionType] = [b]; |
| | | } |
| | | return a; |
| | | }, {}); |
| | | for (const resultKey in result) { |
| | | if(resultKey == 1){ |
| | | state.singleList.push(result[resultKey]) |
| | | const res = await getPaper(value.id) |
| | | if(res.code == 200){ |
| | | let result = res.data.questions.reduce((a, b) => { |
| | | if (a[b.questionType]) { |
| | | a[b.questionType].push(b); |
| | | } else { |
| | | a[b.questionType] = [b]; |
| | | } |
| | | return a; |
| | | }, {}); |
| | | for (const resultKey in result) { |
| | | if(resultKey == 1){ |
| | | state.singleList.push(result[resultKey]) |
| | | |
| | | }else if(resultKey == 2){ |
| | | state.multiList.push(result[resultKey]) |
| | | }else { |
| | | state.judgeList.push(result[resultKey]) |
| | | }else if(resultKey == 2){ |
| | | state.multiList.push(result[resultKey]) |
| | | }else if(resultKey == 3){ |
| | | state.judgeList.push(result[resultKey]) |
| | | }else { |
| | | state.easyList.push(result[resultKey]) |
| | | } |
| | | } |
| | | if(state.singleList && state.singleList.length>0){ |
| | | state.singleList = JSON.parse(JSON.stringify(state.singleList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | } |
| | | if(state.judgeList && state.judgeList.length>0){ |
| | | state.judgeList = JSON.parse(JSON.stringify(state.judgeList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | } |
| | | if(state.multiList && state.multiList.length>0){ |
| | | state.multiList = JSON.parse(JSON.stringify(state.multiList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | } |
| | | if(state.easyList && state.easyList.length>0){ |
| | | state.easyList = JSON.parse(JSON.stringify(state.easyList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | } |
| | | }else{ |
| | | ElMessage.warning(res.message) |
| | | } |
| | | state.singleList = JSON.parse(JSON.stringify(state.singleList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | state.judgeList = JSON.parse(JSON.stringify(state.judgeList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | state.multiList = JSON.parse(JSON.stringify(state.multiList[0])).map(item => { |
| | | return { |
| | | ...item, |
| | | content: JSON.parse(item.content) |
| | | } |
| | | }) |
| | | console.log('state.singleList',state.singleList) |
| | | |
| | | console.log('state.singleList',state.multiList) |
| | | } |
| | | |
| | | const handleClose = () => { |
| | | state.singleList = []; |
| | | state.multiList = []; |
| | | state.judgeList = []; |
| | | state.easyList = []; |
| | | dialogVisible.value = false; |
| | | emit("getList") |
| | | |