|
@@ -192,470 +192,469 @@
|
|
|
<script>
|
|
<script>
|
|
|
import { shuffle, round } from 'lodash'
|
|
import { shuffle, round } from 'lodash'
|
|
|
export default {
|
|
export default {
|
|
|
- name: 'exam-pop',
|
|
|
|
|
- props: {
|
|
|
|
|
- show: {
|
|
|
|
|
- type: Boolean,
|
|
|
|
|
- default: false
|
|
|
|
|
- },
|
|
|
|
|
- bankId: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: ''
|
|
|
|
|
- },
|
|
|
|
|
- id: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: ''
|
|
|
|
|
- },
|
|
|
|
|
- listData: {
|
|
|
|
|
- type: Object,
|
|
|
|
|
- default: () => {}
|
|
|
|
|
- // default: {}
|
|
|
|
|
- },
|
|
|
|
|
- notStart: {
|
|
|
|
|
- type: String,
|
|
|
|
|
- default: ''
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ name: 'exam-pop',
|
|
|
|
|
+ props: {
|
|
|
|
|
+ show: {
|
|
|
|
|
+ type: Boolean,
|
|
|
|
|
+ default: false
|
|
|
},
|
|
},
|
|
|
- data() {
|
|
|
|
|
- const getUser = _ => {
|
|
|
|
|
- if (this.info && this.info.user.id) {
|
|
|
|
|
- return this.info.user.id || ''
|
|
|
|
|
- } else {
|
|
|
|
|
- return ''
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- return {
|
|
|
|
|
- show1: true,
|
|
|
|
|
- listDatas: this.listData,
|
|
|
|
|
- result: [],
|
|
|
|
|
- radio: 1,
|
|
|
|
|
- userInfo: getUser(),
|
|
|
|
|
- showPop: this.show,
|
|
|
|
|
- popList: [],
|
|
|
|
|
- questionsIndex: 0,
|
|
|
|
|
- preBtn: {
|
|
|
|
|
- width: '47%',
|
|
|
|
|
- height: '65%',
|
|
|
|
|
- margin: 0,
|
|
|
|
|
- // backgroundColor:'rgba(48, 194, 189,0.4)'
|
|
|
|
|
- backgroundColor: '#FF9900'
|
|
|
|
|
- },
|
|
|
|
|
- nextBtn: {
|
|
|
|
|
- width: '47%',
|
|
|
|
|
- height: '65%',
|
|
|
|
|
- margin: 0,
|
|
|
|
|
- backgroundColor: '#30c2bd'
|
|
|
|
|
- },
|
|
|
|
|
- preBtnC: {
|
|
|
|
|
- backgroundColor: '#f29100'
|
|
|
|
|
- },
|
|
|
|
|
- nextBtnC: {
|
|
|
|
|
- backgroundColor: '#71d5a1'
|
|
|
|
|
- },
|
|
|
|
|
- scrollWhere: 0,
|
|
|
|
|
- popListAnswer: [],
|
|
|
|
|
- showMask: false,
|
|
|
|
|
- maskNum: '',
|
|
|
|
|
- judgeOp: [{
|
|
|
|
|
- value: '√',
|
|
|
|
|
- label: '√'
|
|
|
|
|
- }, {
|
|
|
|
|
- value: '×',
|
|
|
|
|
- label: '×'
|
|
|
|
|
- }],
|
|
|
|
|
- schedule: 0,
|
|
|
|
|
- answerSheet: false,
|
|
|
|
|
- showConfirmationBox: false,
|
|
|
|
|
- noQuestionNumber: [],
|
|
|
|
|
- confirmationBoxT: {
|
|
|
|
|
- 'font-size': '35rpx',
|
|
|
|
|
- 'font-weight': 600
|
|
|
|
|
- },
|
|
|
|
|
- confirmationBoxC: {
|
|
|
|
|
- 'font-size': '28rpx'
|
|
|
|
|
- },
|
|
|
|
|
- confirmationBoxA: {
|
|
|
|
|
- 'font-size': '26rpx'
|
|
|
|
|
- },
|
|
|
|
|
- confirmationBoxO: {
|
|
|
|
|
- 'font-size': '26rpx',
|
|
|
|
|
- 'color': '#30c2bd'
|
|
|
|
|
- },
|
|
|
|
|
- endInd: true
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ bankId: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
},
|
|
},
|
|
|
- watch: {
|
|
|
|
|
- showPop: {
|
|
|
|
|
- handler: function(val, oldVal) {
|
|
|
|
|
- if (val === true) {
|
|
|
|
|
- // this.stopScroll()
|
|
|
|
|
- } else {
|
|
|
|
|
- // this.startScroll()
|
|
|
|
|
- }
|
|
|
|
|
- this.$emit('updataSet', val)
|
|
|
|
|
- },
|
|
|
|
|
- immediate: true
|
|
|
|
|
- },
|
|
|
|
|
- popListAnswer: {
|
|
|
|
|
- handler: function(val, oldVal) {
|
|
|
|
|
- // if(val!=null){
|
|
|
|
|
- let accomplish = 0
|
|
|
|
|
- this.noQuestionNumber.splice(0, this.noQuestionNumber.length)
|
|
|
|
|
- val.forEach((item, i) => {
|
|
|
|
|
- if (Array.isArray(item) && item.length !== 0) {
|
|
|
|
|
- accomplish += 1
|
|
|
|
|
- } else if (item !== ' ' && item != null && item.length !== 0) {
|
|
|
|
|
- accomplish += 1
|
|
|
|
|
- } else {
|
|
|
|
|
- this.noQuestionNumber.push(i + 1)
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- // console.log(accomplish,val.length,accomplish/val.length,(accomplish/val.length).toFixed(2),((accomplish/val.length)*100).toFixed(0))
|
|
|
|
|
- this.schedule = val.length > 0 ? ((accomplish / val.length) * 100).toFixed(0) * 1 : 0
|
|
|
|
|
- // }
|
|
|
|
|
- },
|
|
|
|
|
- immediate: true
|
|
|
|
|
|
|
+ id: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ },
|
|
|
|
|
+ listData: {
|
|
|
|
|
+ type: Object,
|
|
|
|
|
+ default: () => {}
|
|
|
|
|
+ // default: {}
|
|
|
|
|
+ },
|
|
|
|
|
+ notStart: {
|
|
|
|
|
+ type: String,
|
|
|
|
|
+ default: ''
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ data() {
|
|
|
|
|
+ const getUser = _ => {
|
|
|
|
|
+ if (this.info && this.info.user.id) {
|
|
|
|
|
+ return this.info.user.id || ''
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return ''
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return {
|
|
|
|
|
+ show1: true,
|
|
|
|
|
+ listDatas: this.listData,
|
|
|
|
|
+ result: [],
|
|
|
|
|
+ radio: 1,
|
|
|
|
|
+ userInfo: getUser(),
|
|
|
|
|
+ showPop: this.show,
|
|
|
|
|
+ popList: [],
|
|
|
|
|
+ questionsIndex: 0,
|
|
|
|
|
+ preBtn: {
|
|
|
|
|
+ width: '47%',
|
|
|
|
|
+ height: '65%',
|
|
|
|
|
+ margin: 0,
|
|
|
|
|
+ // backgroundColor:'rgba(48, 194, 189,0.4)'
|
|
|
|
|
+ backgroundColor: '#FF9900'
|
|
|
|
|
+ },
|
|
|
|
|
+ nextBtn: {
|
|
|
|
|
+ width: '47%',
|
|
|
|
|
+ height: '65%',
|
|
|
|
|
+ margin: 0,
|
|
|
|
|
+ backgroundColor: '#30c2bd'
|
|
|
|
|
+ },
|
|
|
|
|
+ preBtnC: {
|
|
|
|
|
+ backgroundColor: '#f29100'
|
|
|
|
|
+ },
|
|
|
|
|
+ nextBtnC: {
|
|
|
|
|
+ backgroundColor: '#71d5a1'
|
|
|
|
|
+ },
|
|
|
|
|
+ scrollWhere: 0,
|
|
|
|
|
+ popListAnswer: [],
|
|
|
|
|
+ showMask: false,
|
|
|
|
|
+ maskNum: '',
|
|
|
|
|
+ judgeOp: [{
|
|
|
|
|
+ value: '√',
|
|
|
|
|
+ label: '√'
|
|
|
|
|
+ }, {
|
|
|
|
|
+ value: '×',
|
|
|
|
|
+ label: '×'
|
|
|
|
|
+ }],
|
|
|
|
|
+ schedule: 0,
|
|
|
|
|
+ answerSheet: false,
|
|
|
|
|
+ showConfirmationBox: false,
|
|
|
|
|
+ noQuestionNumber: [],
|
|
|
|
|
+ confirmationBoxT: {
|
|
|
|
|
+ 'font-size': '35rpx',
|
|
|
|
|
+ 'font-weight': 600
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmationBoxC: {
|
|
|
|
|
+ 'font-size': '28rpx'
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmationBoxA: {
|
|
|
|
|
+ 'font-size': '26rpx'
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmationBoxO: {
|
|
|
|
|
+ 'font-size': '26rpx',
|
|
|
|
|
+ 'color': '#30c2bd'
|
|
|
|
|
+ },
|
|
|
|
|
+ endInd: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ watch: {
|
|
|
|
|
+ showPop: {
|
|
|
|
|
+ handler: function(val, oldVal) {
|
|
|
|
|
+ if (val === true) {
|
|
|
|
|
+ // this.stopScroll()
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // this.startScroll()
|
|
|
}
|
|
}
|
|
|
|
|
+ this.$emit('updataSet', val)
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true
|
|
|
},
|
|
},
|
|
|
- // created() {
|
|
|
|
|
- // },
|
|
|
|
|
|
|
+ popListAnswer: {
|
|
|
|
|
+ handler: function(val, oldVal) {
|
|
|
|
|
+ // if(val!=null){
|
|
|
|
|
+ let accomplish = 0
|
|
|
|
|
+ this.noQuestionNumber.splice(0, this.noQuestionNumber.length)
|
|
|
|
|
+ val.forEach((item, i) => {
|
|
|
|
|
+ if (Array.isArray(item) && item.length !== 0) {
|
|
|
|
|
+ accomplish += 1
|
|
|
|
|
+ } else if (item !== ' ' && item != null && item.length !== 0) {
|
|
|
|
|
+ accomplish += 1
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.noQuestionNumber.push(i + 1)
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ // console.log(accomplish,val.length,accomplish/val.length,(accomplish/val.length).toFixed(2),((accomplish/val.length)*100).toFixed(0))
|
|
|
|
|
+ this.schedule = val.length > 0 ? ((accomplish / val.length) * 100).toFixed(0) * 1 : 0
|
|
|
|
|
+ // }
|
|
|
|
|
+ },
|
|
|
|
|
+ immediate: true
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // created() {
|
|
|
|
|
+ // },
|
|
|
|
|
|
|
|
- async mounted() {
|
|
|
|
|
- const examId = this.listDatas.examId
|
|
|
|
|
- const bankId = this.bankId
|
|
|
|
|
- const examInfo = await this.getExamInfo(examId, bankId) || {}
|
|
|
|
|
- this.getInit()
|
|
|
|
|
- this.listDatas = { ...examInfo, examId, bankId }
|
|
|
|
|
|
|
+ async mounted() {
|
|
|
|
|
+ const examId = this.listDatas.examId
|
|
|
|
|
+ const bankId = this.bankId
|
|
|
|
|
+ const examInfo = await this.getExamInfo(examId, bankId) || {}
|
|
|
|
|
+ this.getInit()
|
|
|
|
|
+ this.listDatas = { ...examInfo, examId, bankId }
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
|
|
+ onChange(evnet) {
|
|
|
|
|
+ // console.log("evnet", evnet);
|
|
|
},
|
|
},
|
|
|
- methods: {
|
|
|
|
|
- onChange(evnet) {
|
|
|
|
|
- // console.log("evnet", evnet);
|
|
|
|
|
- },
|
|
|
|
|
- stopScroll() {
|
|
|
|
|
- const mid = this.scrollWhere
|
|
|
|
|
- // document.documentElement.style.overflow='hidden';
|
|
|
|
|
- // document.body.style.overflow="hidden";
|
|
|
|
|
- document.getElementsByClassName('tabulation')[0].style.overflow = 'hidden'
|
|
|
|
|
- // document.documentElement.style.position='fixed';
|
|
|
|
|
- document.getElementsByClassName('tabulation')[0].style.position = 'fixed'
|
|
|
|
|
- // document.documentElement.style.top=-mid+'px';
|
|
|
|
|
- document.getElementsByClassName('tabulation')[0].style.top = -mid + 'px'
|
|
|
|
|
- },
|
|
|
|
|
- // 启用页面滚动
|
|
|
|
|
- startScroll() {
|
|
|
|
|
- // document.documentElement.style.overflow='';
|
|
|
|
|
- document.getElementsByClassName('tabulation')[0].style.overflow = 'auto'
|
|
|
|
|
- document.getElementsByClassName('tabulation')[0].style.position = 'static'
|
|
|
|
|
- window.scrollTo(0, this.scrollWhere)
|
|
|
|
|
- this.scrollWhere = 0
|
|
|
|
|
- },
|
|
|
|
|
- // 获取题目信息
|
|
|
|
|
- getInit() {
|
|
|
|
|
- const sql = `select id_ as questionId, ti_gan_ as stem, ti_xing_ as questionType, fu_tu_ as img, xuan_xiang_lei_xi as optionType, da_an_ as options, xuan_xiang_shu_ as optionsLength, fen_zhi_ as score, ping_fen_fang_shi as rateType, ping_fen_ren_ as rater, zheng_que_da_an_ as rightKey, nan_du_ as questionLevel from t_questions where parent_id_ = '${this.bankId}' and zhuang_tai_ = '启用' order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
|
|
|
|
|
- if (this.bankId !== '') {
|
|
|
|
|
- this.$common.request('sql', sql).then(res => {
|
|
|
|
|
- let { data = [] } = res.variables || {}
|
|
|
|
|
- if (!data.length) {
|
|
|
|
|
- this.$message.error('获取题目信息失败!')
|
|
|
|
|
- this.closeDialog()
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // const sql = `slect * from t_examination where exam_id='${this.bankId}'`
|
|
|
|
|
- if (this.listDatas.isRand === '1') {
|
|
|
|
|
- data = this.getRandQuestionData(data)
|
|
|
|
|
- }
|
|
|
|
|
- // data.map((item, i) => {
|
|
|
|
|
- // item.answer = item.questionType === '多选题' ? [] : null
|
|
|
|
|
-
|
|
|
|
|
- // this.popListAnswer.push(item.answer)
|
|
|
|
|
-
|
|
|
|
|
- // })
|
|
|
|
|
- // this.popList = data
|
|
|
|
|
- data.map((item, i) => {
|
|
|
|
|
- if (item.options) {
|
|
|
|
|
- const temp = JSON.parse(item.options) || {}
|
|
|
|
|
- const o = []
|
|
|
|
|
- Object.keys(temp).forEach(key => {
|
|
|
|
|
- if (item.questionType === '多选题') {
|
|
|
|
|
- o.push({
|
|
|
|
|
- label: key,
|
|
|
|
|
- value: temp[key]
|
|
|
|
|
- // checked: false,
|
|
|
|
|
- // disabled: false
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- o.push({
|
|
|
|
|
- label: key,
|
|
|
|
|
- value: temp[key]
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- item.options = o
|
|
|
|
|
- } else {
|
|
|
|
|
- item.options = Array.from({ length: item.optionsLength }, (v, k) => {
|
|
|
|
|
- return { answer: null }
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- item.img = item.img ? JSON.parse(item.img) : ''
|
|
|
|
|
- item.answer = item.questionType === '多选题' ? [] : null
|
|
|
|
|
- this.popListAnswer.push(item.answer)
|
|
|
|
|
- if (item.img !== '' && item.img.length > 0) {
|
|
|
|
|
- let astr = ''
|
|
|
|
|
- for (let a = 0; a < item.img.length; a++) {
|
|
|
|
|
- if (a === 0) {
|
|
|
|
|
- astr = item.img[a].id
|
|
|
|
|
- } else {
|
|
|
|
|
- astr = astr + ',' + item.img[a].id
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // const sql1 = `select FILE_PATH_ from ibps_file_attachment WHERE id_ in (${astr})`
|
|
|
|
|
- // this.$common.request('sql', sql1).then(res => {
|
|
|
|
|
- // if (res.state === 200) {
|
|
|
|
|
- // const data = res.variables.data
|
|
|
|
|
- // if (data.length > 0) {
|
|
|
|
|
- // const pdfUrlA = []
|
|
|
|
|
- // for (let g = 0; g < data.length; g++) {
|
|
|
|
|
- // const dataItem = data[g]
|
|
|
|
|
- // const url = 'http://dev1.local/' + dataItem.FILE_PATH_
|
|
|
|
|
- // pdfUrlA.push(url)
|
|
|
|
|
- // }
|
|
|
|
|
- // this.$set(item, 'pdfUrl', pdfUrlA)
|
|
|
|
|
-
|
|
|
|
|
- // }
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
- } else {
|
|
|
|
|
- // this.popList = [...this.popList, item]
|
|
|
|
|
- // this.popList[i] = item
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- this.popList = data
|
|
|
|
|
- // this.loading = false
|
|
|
|
|
- // resolve(data)
|
|
|
|
|
- }).catch(error => {
|
|
|
|
|
- console.log(error)
|
|
|
|
|
- // this.loading = false
|
|
|
|
|
- // reject(error)
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- async getExamInfo(id, bankId) {
|
|
|
|
|
- const sql1 = `select qb.ti_ku_ming_cheng_ as bankName, qb.ti_shu_ as questionCount, qb.zong_fen_ as totalScore, ex.kao_shi_ming_chen as examName, ex.xian_kao_ci_shu_ as limitCount, ex.xian_kao_shi_jian as limitDate, ex.kao_shi_shi_chang as duration, ex.can_kao_ren_yuan_ as examinee, ex.da_biao_zhan_bi_ as qualifiedRadio, ex.ji_fen_fang_shi_ as scoringType, ex.yun_xu_bao_ming_ as allowRegist, ex.sui_ji_chou_ti_ as isRand,ex.chou_ti_fang_shi_ as randWay, ex.sui_ji_ti_shu_ as randNumber, ex.chou_ti_zong_fen_ as randScore, ex.ti_mu_zong_shu_ as randTotal from t_exams ex, t_question_bank qb where ex.ti_ku_id_ = qb.id_ and ex.id_ = '${id}'`
|
|
|
|
|
- const sql2 = `select qb.ti_ku_ming_cheng_ as bankName, qb.ti_shu_ as questionCount, qb.zong_fen_ as totalScore, qb.xian_kao_ci_shu_ as limitCount, qb.kao_shi_shi_chang as duration, qb.da_biao_zhan_bi_ as qualifiedRadio, qb.ji_fen_fang_shi_ as scoringType from t_question_bank qb where qb.id_ = '${bankId}'`
|
|
|
|
|
- const sql = id ? sql1 : sql2
|
|
|
|
|
- return new Promise((resolve, reject) => {
|
|
|
|
|
- this.$common.request('sql', sql).then(res => {
|
|
|
|
|
- const { data = [] } = res.variables || {}
|
|
|
|
|
- if (!data.length) {
|
|
|
|
|
- reject('数据异常')
|
|
|
|
|
- } else {
|
|
|
|
|
- if (data[0].isRand === '1') {
|
|
|
|
|
- data[0].questionCount = data[0].randTotal
|
|
|
|
|
- data[0].totalScore = data[0].randScore
|
|
|
|
|
- }
|
|
|
|
|
- resolve(data[0])
|
|
|
|
|
- }
|
|
|
|
|
- }).catch(error => {
|
|
|
|
|
- reject(error)
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- // 随机题目
|
|
|
|
|
- getRandQuestionData(data) {
|
|
|
|
|
- let temp = []
|
|
|
|
|
- data = shuffle(data)
|
|
|
|
|
- const type = ['单选题', '多选题', '判断题', '填空题', '简答题']
|
|
|
|
|
- this.listDatas.randNumber = this.listDatas.randNumber.split(',')
|
|
|
|
|
- for (let i = 0; i < this.listDatas.randNumber.length; i++) {
|
|
|
|
|
- let t = +this.listDatas.randNumber[i]
|
|
|
|
|
- if (t !== 0) {
|
|
|
|
|
- // 题型分类
|
|
|
|
|
- if (this.listDatas.randWay === '1') {
|
|
|
|
|
- for (let j = 0; j < data.length && t; j++) {
|
|
|
|
|
- const item = data[j]
|
|
|
|
|
- if (item.questionType === type[i]) {
|
|
|
|
|
- temp.push(item)
|
|
|
|
|
- t--
|
|
|
|
|
- }
|
|
|
|
|
- } // 难度分类
|
|
|
|
|
- } else if (this.listDatas.randWay === '2') {
|
|
|
|
|
- for (let j = 0; j < data.length && t; j++) {
|
|
|
|
|
- const item = data[j]
|
|
|
|
|
- if (item.questionLevel === i + '') {
|
|
|
|
|
- temp.push(item)
|
|
|
|
|
- t--
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- temp = shuffle(temp)
|
|
|
|
|
- temp.sort((a, b) => {
|
|
|
|
|
- return type.indexOf(a.questionType) - type.indexOf(b.questionType)
|
|
|
|
|
- })
|
|
|
|
|
- return temp
|
|
|
|
|
- },
|
|
|
|
|
- countDown(time) {
|
|
|
|
|
- this.endInd = false
|
|
|
|
|
- this.handInAnExaminationPaperBtn()
|
|
|
|
|
- },
|
|
|
|
|
- preQuestion() {
|
|
|
|
|
- if (this.questionsIndex - 1 >= 0) {
|
|
|
|
|
- this.questionsIndex = this.questionsIndex - 1
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- // 点击下一题
|
|
|
|
|
- nextQuestion() {
|
|
|
|
|
- if (this.questionsIndex + 1 < this.popList.length) {
|
|
|
|
|
- this.questionsIndex = this.questionsIndex + 1
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- showMaskPop(i) {
|
|
|
|
|
- this.showMask = true
|
|
|
|
|
- this.maskNum = i
|
|
|
|
|
- },
|
|
|
|
|
- radioGroupChange(n) {
|
|
|
|
|
- // 选中第几个
|
|
|
|
|
- // this.popList[this.questionsIndex].options.forEach((item, m) => {
|
|
|
|
|
- // if (item.value == n) {
|
|
|
|
|
- // this.$refs.radioOptions.$children[0].$children[m].$el.className = 'u-radio radioD radioX'
|
|
|
|
|
- // } else {
|
|
|
|
|
- // this.$refs.radioOptions.$children[0].$children[m].$el.className = 'u-radio radioD'
|
|
|
|
|
- // }
|
|
|
|
|
- // })
|
|
|
|
|
|
|
+ stopScroll() {
|
|
|
|
|
+ const mid = this.scrollWhere
|
|
|
|
|
+ // document.documentElement.style.overflow='hidden';
|
|
|
|
|
+ // document.body.style.overflow="hidden";
|
|
|
|
|
+ document.getElementsByClassName('tabulation')[0].style.overflow = 'hidden'
|
|
|
|
|
+ // document.documentElement.style.position='fixed';
|
|
|
|
|
+ document.getElementsByClassName('tabulation')[0].style.position = 'fixed'
|
|
|
|
|
+ // document.documentElement.style.top=-mid+'px';
|
|
|
|
|
+ document.getElementsByClassName('tabulation')[0].style.top = -mid + 'px'
|
|
|
|
|
+ },
|
|
|
|
|
+ // 启用页面滚动
|
|
|
|
|
+ startScroll() {
|
|
|
|
|
+ // document.documentElement.style.overflow='';
|
|
|
|
|
+ document.getElementsByClassName('tabulation')[0].style.overflow = 'auto'
|
|
|
|
|
+ document.getElementsByClassName('tabulation')[0].style.position = 'static'
|
|
|
|
|
+ window.scrollTo(0, this.scrollWhere)
|
|
|
|
|
+ this.scrollWhere = 0
|
|
|
|
|
+ },
|
|
|
|
|
+ // 获取题目信息
|
|
|
|
|
+ getInit() {
|
|
|
|
|
+ const sql = `select id_ as questionId, ti_gan_ as stem, ti_xing_ as questionType, fu_tu_ as img, xuan_xiang_lei_xi as optionType, da_an_ as options, xuan_xiang_shu_ as optionsLength, fen_zhi_ as score, ping_fen_fang_shi as rateType, ping_fen_ren_ as rater, zheng_que_da_an_ as rightKey, nan_du_ as questionLevel from t_questions where parent_id_ = '${this.bankId}' and zhuang_tai_ = '启用' order by field(ti_xing_, '单选题', '多选题', '判断题', '填空题', '简答题')`
|
|
|
|
|
+ if (this.bankId !== '') {
|
|
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
|
|
+ let { data = [] } = res.variables || {}
|
|
|
|
|
+ if (!data.length) {
|
|
|
|
|
+ this.$message.error('获取题目信息失败!')
|
|
|
|
|
+ this.closeDialog()
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ // const sql = `slect * from t_examination where exam_id='${this.bankId}'`
|
|
|
|
|
+ if (this.listDatas.isRand === '1') {
|
|
|
|
|
+ data = this.getRandQuestionData(data)
|
|
|
|
|
+ }
|
|
|
|
|
+ // data.map((item, i) => {
|
|
|
|
|
+ // item.answer = item.questionType === '多选题' ? [] : null
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- radioChange(t, i) { },
|
|
|
|
|
- checkboxGroupChange(n) {
|
|
|
|
|
|
|
+ // this.popListAnswer.push(item.answer)
|
|
|
|
|
|
|
|
- },
|
|
|
|
|
- checkboxChange(n) {
|
|
|
|
|
- this.popListAnswer[this.questionsIndex].splice(0, this.popListAnswer[this.questionsIndex].length)
|
|
|
|
|
- const index = this.popList[this.questionsIndex].options.findIndex(i => i.value === n.name)
|
|
|
|
|
- this.popList[this.questionsIndex].options[index].checked = n.value
|
|
|
|
|
- this.popList[this.questionsIndex].options.forEach((item, m) => {
|
|
|
|
|
- if (item.checked === true) {
|
|
|
|
|
- this.popListAnswer[this.questionsIndex].push(item.value)
|
|
|
|
|
- this.$refs.checkboxOptions.$children[0].$children[m].$el.className = 'u-checkbox radioD radioX'
|
|
|
|
|
|
|
+ // })
|
|
|
|
|
+ // this.popList = data
|
|
|
|
|
+ data.map((item, i) => {
|
|
|
|
|
+ if (item.options) {
|
|
|
|
|
+ const temp = JSON.parse(item.options) || {}
|
|
|
|
|
+ const o = []
|
|
|
|
|
+ Object.keys(temp).forEach(key => {
|
|
|
|
|
+ if (item.questionType === '多选题') {
|
|
|
|
|
+ o.push({
|
|
|
|
|
+ label: key,
|
|
|
|
|
+ value: temp[key]
|
|
|
|
|
+ // checked: false,
|
|
|
|
|
+ // disabled: false
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- this.$refs.checkboxOptions.$children[0].$children[m].$el.className = 'u-checkbox radioD'
|
|
|
|
|
|
|
+ o.push({
|
|
|
|
|
+ label: key,
|
|
|
|
|
+ value: temp[key]
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- judgeType(index) {
|
|
|
|
|
- if (Array.isArray(this.popListAnswer[index - 1]) && this.popListAnswer[index - 1].length !== 0) {
|
|
|
|
|
- return true
|
|
|
|
|
- } else if (this.popListAnswer[index - 1] !== '' && this.popListAnswer[index - 1] != null) {
|
|
|
|
|
- return true
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ item.options = o
|
|
|
} else {
|
|
} else {
|
|
|
- return false
|
|
|
|
|
|
|
+ item.options = Array.from({ length: item.optionsLength }, (v, k) => {
|
|
|
|
|
+ return { answer: null }
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- changQuesInd(ind) {
|
|
|
|
|
- this.questionsIndex = ind
|
|
|
|
|
- this.answerSheet = false
|
|
|
|
|
- },
|
|
|
|
|
- // 点击交卷触发的函数
|
|
|
|
|
- handInAnExaminationPaperBtn() {
|
|
|
|
|
- // this.showPop=false
|
|
|
|
|
- this.showConfirmationBox = true
|
|
|
|
|
- // this.handInAnExaminationPaperEvent()
|
|
|
|
|
- this.$emit('submit')
|
|
|
|
|
- },
|
|
|
|
|
- // 由父组件调用
|
|
|
|
|
- parentSubmit() {
|
|
|
|
|
- this.handInAnExaminationPaperBtn()
|
|
|
|
|
- },
|
|
|
|
|
- handInAnExaminationPaperEvent() {
|
|
|
|
|
- this.submitForm(this.dealFormData())
|
|
|
|
|
- },
|
|
|
|
|
- submitForm(data) {
|
|
|
|
|
- const that = this
|
|
|
|
|
- const addParams = {
|
|
|
|
|
- tableName: 't_examination_detail',
|
|
|
|
|
- paramWhere: data
|
|
|
|
|
- }
|
|
|
|
|
- const isAllReviewed = !data.some(i => i.shi_fou_yi_yue_ === '否')
|
|
|
|
|
- const updateParams = {
|
|
|
|
|
- tableName: 't_examination',
|
|
|
|
|
- updList: [
|
|
|
|
|
- {
|
|
|
|
|
- where: {
|
|
|
|
|
- id_: this.id
|
|
|
|
|
- },
|
|
|
|
|
- param: {
|
|
|
|
|
- jie_shu_shi_jian_: that.$common.getDateNow(19),
|
|
|
|
|
- ti_ku_zong_fen_: data.reduce((sum, item) => sum + parseFloat(item.fen_zhi_), 0),
|
|
|
|
|
- zhuang_tai_: isAllReviewed ? '已完成' : '已交卷',
|
|
|
|
|
- de_fen_: isAllReviewed ? data.reduce((sum, item) => sum + parseFloat(item.de_fen_), 0) : ''
|
|
|
|
|
|
|
+ item.img = item.img ? JSON.parse(item.img) : ''
|
|
|
|
|
+ item.answer = item.questionType === '多选题' ? [] : null
|
|
|
|
|
+ this.popListAnswer.push(item.answer)
|
|
|
|
|
+ if (item.img !== '' && item.img.length > 0) {
|
|
|
|
|
+ let astr = ''
|
|
|
|
|
+ for (let a = 0; a < item.img.length; a++) {
|
|
|
|
|
+ if (a === 0) {
|
|
|
|
|
+ astr = item.img[a].id
|
|
|
|
|
+ } else {
|
|
|
|
|
+ astr = astr + ',' + item.img[a].id
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ const sql1 = `select FILE_PATH_ from ibps_file_attachment WHERE id_ in (${astr})`
|
|
|
|
|
+ this.$common.request('sql', sql1).then(res => {
|
|
|
|
|
+ if (res.state === 200) {
|
|
|
|
|
+ const data = res.variables.data
|
|
|
|
|
+ if (data.length > 0) {
|
|
|
|
|
+ const pdfUrlA = []
|
|
|
|
|
+ for (let g = 0; g < data.length; g++) {
|
|
|
|
|
+ const dataItem = data[g]
|
|
|
|
|
+ const url = 'http://dev1.local/' + dataItem.FILE_PATH_
|
|
|
|
|
+ pdfUrlA.push(url)
|
|
|
}
|
|
}
|
|
|
- ]
|
|
|
|
|
- }
|
|
|
|
|
- that.$common.request('add', addParams).then(() => {
|
|
|
|
|
- that.$common.request('update', updateParams).then(() => {
|
|
|
|
|
- console.log('更新成功')
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- },
|
|
|
|
|
- dealFormData() {
|
|
|
|
|
- const that = this
|
|
|
|
|
- const submitData = []
|
|
|
|
|
- const time = that.$common.getDateNow(19)
|
|
|
|
|
- that.popList.forEach((item, index) => {
|
|
|
|
|
- item.answer = that.popListAnswer[index]
|
|
|
|
|
- const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
|
|
|
|
|
- const multipleType = ['多选题', '填空题'].includes(item.questionType)
|
|
|
|
|
- const selectType = ['多选题', '单选题'].includes(item.questionType)
|
|
|
|
|
- submitData.push({
|
|
|
|
|
- parent_id_: that.id, // t_examination的id
|
|
|
|
|
- ti_mu_id_: item.questionId,
|
|
|
|
|
- ti_gan_: item.stem,
|
|
|
|
|
- ti_xing_: item.questionType,
|
|
|
|
|
- fen_zhi_: item.score,
|
|
|
|
|
- fu_tu_: item.img ? JSON.stringify(item.img) : '',
|
|
|
|
|
- xuan_xiang_lei_xi: item.optionType,
|
|
|
|
|
- xuan_xiang_: selectType ? JSON.stringify(item.options) : '',
|
|
|
|
|
- can_kao_da_an_: item.rightKey,
|
|
|
|
|
- ping_fen_fang_shi: item.rateType,
|
|
|
|
|
- ping_fen_ren_: item.rater,
|
|
|
|
|
- hui_da_: multipleType && item.answer ? JSON.stringify(item.answer) : item.answer,
|
|
|
|
|
- shi_fou_yi_yue_: autoType ? '是' : '否',
|
|
|
|
|
- ping_yue_shi_jian: autoType ? time : '',
|
|
|
|
|
- de_fen_: autoType ? this.getScore(item) : '',
|
|
|
|
|
- jie_xi_: '',
|
|
|
|
|
- nan_du_: item.questionLevel || 0// 难度
|
|
|
|
|
- })
|
|
|
|
|
- })
|
|
|
|
|
- return submitData
|
|
|
|
|
- },
|
|
|
|
|
- getScore({ questionType, answer, rightKey, score }) {
|
|
|
|
|
- if (questionType === '多选题') {
|
|
|
|
|
- const temp = rightKey.split(',')
|
|
|
|
|
- return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
|
|
|
|
|
|
|
+ this.$set(item, 'pdfUrl', pdfUrlA)
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- return answer === rightKey ? score : 0
|
|
|
|
|
|
|
+ // this.popList = [...this.popList, item]
|
|
|
|
|
+ // this.popList[i] = item
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
- confirmationBoxContent(e) {
|
|
|
|
|
- const that = this
|
|
|
|
|
- const str = this.endInd === false ? `考试时间已到,即将自动交卷,请勿关闭页面防止数据丢失!` : this.noQuestionNumber.length ? `您还有第${this.noQuestionNumber.join('、')}题未作答,您确定要直接交卷吗?` : '您已完成作答,确定要交卷吗?'
|
|
|
|
|
- if (this.endInd === false) {
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- that.confirmEvent()
|
|
|
|
|
- }, 3000)
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ this.popList = data
|
|
|
|
|
+ // this.loading = false
|
|
|
|
|
+ // resolve(data)
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ console.log(error)
|
|
|
|
|
+ // this.loading = false
|
|
|
|
|
+ // reject(error)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ async getExamInfo(id, bankId) {
|
|
|
|
|
+ const sql1 = `select qb.ti_ku_ming_cheng_ as bankName, qb.ti_shu_ as questionCount, qb.zong_fen_ as totalScore, ex.kao_shi_ming_chen as examName, ex.xian_kao_ci_shu_ as limitCount, ex.xian_kao_shi_jian as limitDate, ex.kao_shi_shi_chang as duration, ex.can_kao_ren_yuan_ as examinee, ex.da_biao_zhan_bi_ as qualifiedRadio, ex.ji_fen_fang_shi_ as scoringType, ex.yun_xu_bao_ming_ as allowRegist, ex.sui_ji_chou_ti_ as isRand,ex.chou_ti_fang_shi_ as randWay, ex.sui_ji_ti_shu_ as randNumber, ex.chou_ti_zong_fen_ as randScore, ex.ti_mu_zong_shu_ as randTotal from t_exams ex, t_question_bank qb where ex.ti_ku_id_ = qb.id_ and ex.id_ = '${id}'`
|
|
|
|
|
+ const sql2 = `select qb.ti_ku_ming_cheng_ as bankName, qb.ti_shu_ as questionCount, qb.zong_fen_ as totalScore, qb.xian_kao_ci_shu_ as limitCount, qb.kao_shi_shi_chang as duration, qb.da_biao_zhan_bi_ as qualifiedRadio, qb.ji_fen_fang_shi_ as scoringType from t_question_bank qb where qb.id_ = '${bankId}'`
|
|
|
|
|
+ const sql = id ? sql1 : sql2
|
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
|
+ this.$common.request('sql', sql).then(res => {
|
|
|
|
|
+ const { data = [] } = res.variables || {}
|
|
|
|
|
+ if (!data.length) {
|
|
|
|
|
+ reject('数据异常')
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (data[0].isRand === '1') {
|
|
|
|
|
+ data[0].questionCount = data[0].randTotal
|
|
|
|
|
+ data[0].totalScore = data[0].randScore
|
|
|
}
|
|
}
|
|
|
- return str
|
|
|
|
|
- },
|
|
|
|
|
- // 点击提示是否交卷,确定交卷的按钮
|
|
|
|
|
- confirmEvent() {
|
|
|
|
|
- this.showPop = false
|
|
|
|
|
- this.handInAnExaminationPaperEvent()
|
|
|
|
|
|
|
+ resolve(data[0])
|
|
|
|
|
+ }
|
|
|
|
|
+ }).catch(error => {
|
|
|
|
|
+ reject(error)
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ // 随机题目
|
|
|
|
|
+ getRandQuestionData(data) {
|
|
|
|
|
+ let temp = []
|
|
|
|
|
+ data = shuffle(data)
|
|
|
|
|
+ const type = ['单选题', '多选题', '判断题', '填空题', '简答题']
|
|
|
|
|
+ this.listDatas.randNumber = this.listDatas.randNumber.split(',')
|
|
|
|
|
+ for (let i = 0; i < this.listDatas.randNumber.length; i++) {
|
|
|
|
|
+ let t = +this.listDatas.randNumber[i]
|
|
|
|
|
+ if (t !== 0) {
|
|
|
|
|
+ // 题型分类
|
|
|
|
|
+ if (this.listDatas.randWay === '1') {
|
|
|
|
|
+ for (let j = 0; j < data.length && t; j++) {
|
|
|
|
|
+ const item = data[j]
|
|
|
|
|
+ if (item.questionType === type[i]) {
|
|
|
|
|
+ temp.push(item)
|
|
|
|
|
+ t--
|
|
|
|
|
+ }
|
|
|
|
|
+ } // 难度分类
|
|
|
|
|
+ } else if (this.listDatas.randWay === '2') {
|
|
|
|
|
+ for (let j = 0; j < data.length && t; j++) {
|
|
|
|
|
+ const item = data[j]
|
|
|
|
|
+ if (item.questionLevel === i + '') {
|
|
|
|
|
+ temp.push(item)
|
|
|
|
|
+ t--
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
+ temp = shuffle(temp)
|
|
|
|
|
+ temp.sort((a, b) => {
|
|
|
|
|
+ return type.indexOf(a.questionType) - type.indexOf(b.questionType)
|
|
|
|
|
+ })
|
|
|
|
|
+ return temp
|
|
|
|
|
+ },
|
|
|
|
|
+ countDown(time) {
|
|
|
|
|
+ this.endInd = false
|
|
|
|
|
+ this.handInAnExaminationPaperBtn()
|
|
|
|
|
+ },
|
|
|
|
|
+ preQuestion() {
|
|
|
|
|
+ if (this.questionsIndex - 1 >= 0) {
|
|
|
|
|
+ this.questionsIndex = this.questionsIndex - 1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击下一题
|
|
|
|
|
+ nextQuestion() {
|
|
|
|
|
+ if (this.questionsIndex + 1 < this.popList.length) {
|
|
|
|
|
+ this.questionsIndex = this.questionsIndex + 1
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ showMaskPop(i) {
|
|
|
|
|
+ this.showMask = true
|
|
|
|
|
+ this.maskNum = i
|
|
|
|
|
+ },
|
|
|
|
|
+ radioGroupChange(n) {
|
|
|
|
|
+ // 选中第几个
|
|
|
|
|
+ // this.popList[this.questionsIndex].options.forEach((item, m) => {
|
|
|
|
|
+ // if (item.value == n) {
|
|
|
|
|
+ // this.$refs.radioOptions.$children[0].$children[m].$el.className = 'u-radio radioD radioX'
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // this.$refs.radioOptions.$children[0].$children[m].$el.className = 'u-radio radioD'
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ radioChange(t, i) { },
|
|
|
|
|
+ checkboxGroupChange(n) {
|
|
|
|
|
|
|
|
|
|
+ },
|
|
|
|
|
+ checkboxChange(n) {
|
|
|
|
|
+ this.popListAnswer[this.questionsIndex].splice(0, this.popListAnswer[this.questionsIndex].length)
|
|
|
|
|
+ const index = this.popList[this.questionsIndex].options.findIndex(i => i.value === n.name)
|
|
|
|
|
+ this.popList[this.questionsIndex].options[index].checked = n.value
|
|
|
|
|
+ this.popList[this.questionsIndex].options.forEach((item, m) => {
|
|
|
|
|
+ if (item.checked === true) {
|
|
|
|
|
+ this.popListAnswer[this.questionsIndex].push(item.value)
|
|
|
|
|
+ this.$refs.checkboxOptions.$children[0].$children[m].$el.className = 'u-checkbox radioD radioX'
|
|
|
|
|
+ } else {
|
|
|
|
|
+ this.$refs.checkboxOptions.$children[0].$children[m].$el.className = 'u-checkbox radioD'
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ judgeType(index) {
|
|
|
|
|
+ if (Array.isArray(this.popListAnswer[index - 1]) && this.popListAnswer[index - 1].length !== 0) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ } else if (this.popListAnswer[index - 1] !== '' && this.popListAnswer[index - 1] != null) {
|
|
|
|
|
+ return true
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ changQuesInd(ind) {
|
|
|
|
|
+ this.questionsIndex = ind
|
|
|
|
|
+ this.answerSheet = false
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击交卷触发的函数
|
|
|
|
|
+ handInAnExaminationPaperBtn() {
|
|
|
|
|
+ // this.showPop=false
|
|
|
|
|
+ this.showConfirmationBox = true
|
|
|
|
|
+ // this.handInAnExaminationPaperEvent()
|
|
|
|
|
+ this.$emit('submit')
|
|
|
|
|
+ },
|
|
|
|
|
+ // 由父组件调用
|
|
|
|
|
+ parentSubmit() {
|
|
|
|
|
+ this.handInAnExaminationPaperBtn()
|
|
|
|
|
+ },
|
|
|
|
|
+ handInAnExaminationPaperEvent() {
|
|
|
|
|
+ this.submitForm(this.dealFormData())
|
|
|
|
|
+ },
|
|
|
|
|
+ submitForm(data) {
|
|
|
|
|
+ const that = this
|
|
|
|
|
+ const addParams = {
|
|
|
|
|
+ tableName: 't_examination_detail',
|
|
|
|
|
+ paramWhere: data
|
|
|
|
|
+ }
|
|
|
|
|
+ const isAllReviewed = !data.some(i => i.shi_fou_yi_yue_ === '否')
|
|
|
|
|
+ const updateParams = {
|
|
|
|
|
+ tableName: 't_examination',
|
|
|
|
|
+ updList: [
|
|
|
|
|
+ {
|
|
|
|
|
+ where: {
|
|
|
|
|
+ id_: this.id
|
|
|
|
|
+ },
|
|
|
|
|
+ param: {
|
|
|
|
|
+ jie_shu_shi_jian_: that.$common.getDateNow(19),
|
|
|
|
|
+ ti_ku_zong_fen_: data.reduce((sum, item) => sum + parseFloat(item.fen_zhi_), 0),
|
|
|
|
|
+ zhuang_tai_: isAllReviewed ? '已完成' : '已交卷',
|
|
|
|
|
+ de_fen_: isAllReviewed ? data.reduce((sum, item) => sum + parseFloat(item.de_fen_), 0) : ''
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ ]
|
|
|
|
|
+ }
|
|
|
|
|
+ that.$common.request('add', addParams).then(() => {
|
|
|
|
|
+ that.$common.request('update', updateParams).then(() => {
|
|
|
|
|
+ console.log('更新成功')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+ dealFormData() {
|
|
|
|
|
+ const that = this
|
|
|
|
|
+ const submitData = []
|
|
|
|
|
+ const time = that.$common.getDateNow(19)
|
|
|
|
|
+ that.popList.forEach((item, index) => {
|
|
|
|
|
+ item.answer = that.popListAnswer[index]
|
|
|
|
|
+ const autoType = ['单选题', '多选题', '判断题'].includes(item.questionType)
|
|
|
|
|
+ const multipleType = ['多选题', '填空题'].includes(item.questionType)
|
|
|
|
|
+ const selectType = ['多选题', '单选题'].includes(item.questionType)
|
|
|
|
|
+ submitData.push({
|
|
|
|
|
+ parent_id_: that.id, // t_examination的id
|
|
|
|
|
+ ti_mu_id_: item.questionId,
|
|
|
|
|
+ ti_gan_: item.stem,
|
|
|
|
|
+ ti_xing_: item.questionType,
|
|
|
|
|
+ fen_zhi_: item.score,
|
|
|
|
|
+ fu_tu_: item.img ? JSON.stringify(item.img) : '',
|
|
|
|
|
+ xuan_xiang_lei_xi: item.optionType,
|
|
|
|
|
+ xuan_xiang_: selectType ? JSON.stringify(item.options) : '',
|
|
|
|
|
+ can_kao_da_an_: item.rightKey,
|
|
|
|
|
+ ping_fen_fang_shi: item.rateType,
|
|
|
|
|
+ ping_fen_ren_: item.rater,
|
|
|
|
|
+ hui_da_: multipleType && item.answer ? JSON.stringify(item.answer) : item.answer,
|
|
|
|
|
+ shi_fou_yi_yue_: autoType ? '是' : '否',
|
|
|
|
|
+ ping_yue_shi_jian: autoType ? time : '',
|
|
|
|
|
+ de_fen_: autoType ? this.getScore(item) : '',
|
|
|
|
|
+ jie_xi_: '',
|
|
|
|
|
+ nan_du_: item.questionLevel || 0// 难度
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ return submitData
|
|
|
|
|
+ },
|
|
|
|
|
+ getScore({ questionType, answer, rightKey, score }) {
|
|
|
|
|
+ if (questionType === '多选题') {
|
|
|
|
|
+ const temp = rightKey.split(',')
|
|
|
|
|
+ return answer.length === temp.length && answer.every(i => temp.includes(i)) ? score : 0
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return answer === rightKey ? score : 0
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ confirmationBoxContent(e) {
|
|
|
|
|
+ const that = this
|
|
|
|
|
+ const str = this.endInd === false ? `考试时间已到,即将自动交卷,请勿关闭页面防止数据丢失!` : this.noQuestionNumber.length ? `您还有第${this.noQuestionNumber.join('、')}题未作答,您确定要直接交卷吗?` : '您已完成作答,确定要交卷吗?'
|
|
|
|
|
+ if (this.endInd === false) {
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ that.confirmEvent()
|
|
|
|
|
+ }, 3000)
|
|
|
|
|
+ }
|
|
|
|
|
+ return str
|
|
|
|
|
+ },
|
|
|
|
|
+ // 点击提示是否交卷,确定交卷的按钮
|
|
|
|
|
+ confirmEvent() {
|
|
|
|
|
+ this.showPop = false
|
|
|
|
|
+ this.handInAnExaminationPaperEvent()
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
</script>
|
|
@@ -798,7 +797,14 @@ export default {
|
|
|
border-radius: 20%;
|
|
border-radius: 20%;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ .mackImg{
|
|
|
|
|
+ width: 90%;
|
|
|
|
|
+ max-height: 90%;
|
|
|
|
|
+ position: fixed;
|
|
|
|
|
+ top: 50%;
|
|
|
|
|
+ left: 50%;
|
|
|
|
|
+ transform: translate(-50%,-50%);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
</style>
|
|
</style>
|