715 lines
28 KiB
HTML
715 lines
28 KiB
HTML
<!--#
|
|
layout("/mobile/platform.html"){
|
|
#-->
|
|
|
|
<style>
|
|
@font-face {
|
|
font-family: 'Indie Flower';
|
|
font-style: normal;
|
|
font-weight: 400;
|
|
src: url(/assets/platform/fonts/m8JVjfNVeKWVnh3QMuKkFcZVaUuH.woff2) format('woff2');
|
|
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
|
|
}
|
|
|
|
.page-survey {
|
|
background-color: rgba(242, 242, 242, 1);
|
|
}
|
|
|
|
.page-survey .survey-container {
|
|
height: 100%;
|
|
overflow: visible;
|
|
padding-top: 0;
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.survey-container .question-list {
|
|
flex: auto;
|
|
padding-bottom: 84px;
|
|
}
|
|
|
|
.question {
|
|
position: relative;
|
|
margin-bottom: 20px;
|
|
background: rgba(255, 255, 255, 1);
|
|
}
|
|
|
|
.question-head {
|
|
overflow: hidden;
|
|
position: relative;
|
|
padding: 20px;
|
|
background: rgba(255, 255, 255, 1);
|
|
}
|
|
|
|
.question-tags {
|
|
position: absolute;
|
|
top: -2px;
|
|
}
|
|
|
|
.question-title {
|
|
position: relative;
|
|
font-size: 1.125em;
|
|
font-weight: normal;
|
|
word-wrap: break-word;
|
|
word-break: break-word;
|
|
outline: 0;
|
|
}
|
|
|
|
.question-seq {
|
|
display: block;
|
|
margin-right: 8px;
|
|
font-size: 18px;
|
|
float: left;
|
|
}
|
|
|
|
.question-title .text {
|
|
margin-right: 4px;
|
|
}
|
|
|
|
.question-body {
|
|
background-color: rgba(255, 255, 255, 1);
|
|
user-select: none;
|
|
}
|
|
|
|
.question-footer {
|
|
padding: 16px;
|
|
}
|
|
|
|
.van-checkbox {
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.van-cell__title {
|
|
font-size: 16px;
|
|
color: rgba(0, 0, 0, 1);
|
|
}
|
|
|
|
.page-control {
|
|
padding: 20px;
|
|
display: flex;
|
|
column-gap: 20px;
|
|
position: fixed;
|
|
bottom: 0;
|
|
left: 0;
|
|
right: 0;
|
|
background: #fff;
|
|
}
|
|
|
|
.survey-head-top {
|
|
padding: 20px;
|
|
background: #fff;
|
|
margin-bottom: 10px;
|
|
position: relative;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.survey-head-top .randomCount {
|
|
font-family: 'Arial', sans-serif;
|
|
font-size: 16px;
|
|
font-weight: bold;
|
|
text-align: center;
|
|
line-height: 1.5;
|
|
color: #000000;
|
|
background-color: #f0f0f0;
|
|
border: 1px solid #000000;
|
|
border-radius: 5px;
|
|
padding: 5px 20px;
|
|
}
|
|
|
|
.survey-head-top .score {
|
|
/*font-family: 'Comic Sans MS', cursive;*/
|
|
/*font-family: 'Indie Flower', cursive;*/
|
|
font-size: 20px;
|
|
font-weight: bold;
|
|
color: red;
|
|
margin-left: auto;
|
|
}
|
|
|
|
|
|
.survey-head {
|
|
padding: 20px;
|
|
background: #fff;
|
|
margin-bottom: 10px;
|
|
position: relative;
|
|
}
|
|
|
|
.survey-head .title {
|
|
font-size: 22px;
|
|
font-weight: 600;
|
|
text-align: center;
|
|
}
|
|
|
|
.survey-head .desc {
|
|
padding: 10px;
|
|
font-size: 14px;
|
|
}
|
|
|
|
</style>
|
|
|
|
<div id="app" v-cloak>
|
|
<div class="root">
|
|
<m-page-loading v-if="mLoading"></m-page-loading>
|
|
<van-nav-bar title="知识竞答" left-arrow placeholder fixed
|
|
@click-left="history.go(-1)"></van-nav-bar>
|
|
<template v-if="!mLoading">
|
|
<div class="page-survey" style="touch-action: manipulation;min-height: 100vh;">
|
|
<div class="survey-container">
|
|
<!-- v-if="questionData.qlx==2 && (questionData.ctMode==1 || questionData.ctMode==2)"-->
|
|
<div class="survey-head-top">
|
|
<template>
|
|
<div v-if="questionData.qlx==2 && questionData.ctMode==2 && isSameDay && randomCount > 0"
|
|
class="randomCount"
|
|
@click="openRandomCount">
|
|
第<span>{{randomCount}}</span>轮
|
|
</div>
|
|
<div v-if="questionData.qlx==2 && (questionData.ctMode==1 || (questionData.ctMode==2 && !isSameDay))"
|
|
class="randomCount"
|
|
@click="openRandomCount">
|
|
<!--定时定题 可切换时间查看以前的题目-->
|
|
<span>{{currentDate}}</span>
|
|
</div>
|
|
</template>
|
|
<div class="score" v-if="finishAnswer && ( currentScore || currentScore===0 )">
|
|
{{questionData.calcScoreMode==1?'今日最高成绩':'得分'}}{{currentScore}}
|
|
</div>
|
|
<div class="timer" v-if="questionData.enableTimer && !finishAnswer">
|
|
<span>剩余时间:{{remainder}}</span>
|
|
</div>
|
|
</div>
|
|
<div class="survey-head">
|
|
<div class="title">
|
|
{{questionData.qtitle}}
|
|
</div>
|
|
<!-- <div class="desc">-->
|
|
<!-- {{titleMsg}}-->
|
|
<!-- </div>-->
|
|
</div>
|
|
<div class="question-list">
|
|
<section v-for="(issue,issueIdx) in issueList" :key="issue.iid" class="question"
|
|
:id="'issue'+issue.iid">
|
|
<div class="question-head">
|
|
<div class="question-tags">
|
|
<template v-if="issue.itx===1">
|
|
<van-tag :type="issue.iisdx?'primary':'warning'" size="large">
|
|
{{issue.iisdx?'单选':'多选'}}
|
|
</van-tag>
|
|
</template>
|
|
<!-- <van-tag v-if="issue.fraction" type="primary" size="large">{{issue.fraction}}分-->
|
|
<!-- </van-tag>-->
|
|
</div>
|
|
<h2 class="question-title">
|
|
<span class="question-seq">
|
|
<b>
|
|
{{issueIdx+1}}.
|
|
</b>
|
|
</span>
|
|
<div class="text" v-html="issue.iname"></div>
|
|
</h2>
|
|
|
|
</div>
|
|
<div class="question-body">
|
|
<van-checkbox-group v-model="issue.userSelect" :ref="'checkboxGroup'+issue.iid">
|
|
<van-cell-group>
|
|
<van-cell
|
|
v-for="(item,index) in issue.wors"
|
|
clickable
|
|
:key="item"
|
|
:title="item.wtxt"
|
|
@click="cellToggle(issue,item.wid)"
|
|
>
|
|
<template #label v-if="finishAnswer || finishAllAnswer">
|
|
<div>
|
|
{{item.correct?'正确答案':''}}
|
|
</div>
|
|
</template>
|
|
<template #icon>
|
|
<van-checkbox :name="item.wid" :ref="'checkboxes'+item.wid"
|
|
:disabled="finishAnswer || finishAllAnswer"
|
|
:shape="issue.iisdx?'round':'square'"></van-checkbox>
|
|
</template>
|
|
</van-cell>
|
|
</van-cell-group>
|
|
</van-checkbox-group>
|
|
|
|
</div>
|
|
<div class="question-footer" v-if="finishAnswer || finishAllAnswer">
|
|
<div>
|
|
<div style="display: flex;align-items: center;"
|
|
:style="{color:(issue.isEqual?'#15db81':'red')}">
|
|
{{issue.isEqual?'回答正确':'回答错误'}}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
<div class="page-control" v-if="!finishAnswer">
|
|
<!--非计时模式才能保存 否则没意义了-->
|
|
<van-button type="info" block @click="save()" v-if="!questionData.enableTimer">保存</van-button>
|
|
<van-button type="info" block @click="submit()">提交</van-button>
|
|
</div>
|
|
<div class="page-control" style="grid-template-columns: auto"
|
|
v-if="canAnswerAgain && finishAnswer && moment().format('YYYY-MM-DD') === currentDate">
|
|
<van-button type="info" block @click="answerAgain">
|
|
再答一次
|
|
</van-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<van-action-sheet
|
|
v-model="randomCountSheetShow"
|
|
:actions="randomActions"
|
|
@select="randomCountSelect"
|
|
cancel-text="取消"
|
|
close-on-click-action
|
|
></van-action-sheet>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const BASE_URL = '/mobile/question/h5'
|
|
const vue = new Vue({
|
|
el: '#app',
|
|
data() {
|
|
return {
|
|
questionData: {
|
|
issues: []
|
|
},
|
|
currentIssueIndex: 0,
|
|
replyInfo: [],
|
|
finishAnswer: false,
|
|
finishAllAnswer: false,
|
|
mLoading: true,
|
|
|
|
//用户已答题总轮数
|
|
randomCount: null,
|
|
currentRandomCountScore: 0,
|
|
sumScore: 0,
|
|
randomCountSheetShow: false,
|
|
randomActions: [],
|
|
currentRandomCount: null,
|
|
|
|
//能否再次答题
|
|
canAnswerAgain: false,
|
|
|
|
//当前的时间(针对定时定题)
|
|
currentDate: moment().format('YYYY-MM-DD'),
|
|
|
|
//当前分数
|
|
currentScore: null,
|
|
|
|
//获取用户已回答的轮数 针对单天随机
|
|
userHasAnswerRandomNum: 0,
|
|
|
|
//倒计时计时器
|
|
timerInterval: null,
|
|
//答题时间(使用秒)
|
|
countDownSeconds: 0,
|
|
//剩余时间
|
|
remainder: null
|
|
|
|
}
|
|
},
|
|
computed: {
|
|
issueList() {
|
|
return this.questionData.issues
|
|
},
|
|
titleMsg() {
|
|
const radios = this.issueList.filter(v => v.itx === 1 && v.iisdx)
|
|
const checkBoxes = this.issueList.filter(v => v.itx === 1 && !v.iisdx)
|
|
|
|
const radioScore = radios && radios.length > 0 ? radios[0].fraction : 0
|
|
const checkBoxesScore = checkBoxes && checkBoxes.length > 0 ? checkBoxes[0].fraction : 0
|
|
|
|
const radioScoreSum = radios.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
|
const checkBoxesScoreSum = checkBoxes.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b, 0)
|
|
|
|
const sumScore = radioScoreSum + checkBoxesScoreSum
|
|
|
|
let radiosText = ''
|
|
let checkBoxesText = ''
|
|
|
|
if (radios && radios.length > 0) {
|
|
radiosText = "单选题" + radios.length + "题,每题" + radioScore + "分,合计" + radioScoreSum + "分;"
|
|
}
|
|
if (checkBoxes && checkBoxes.length > 0) {
|
|
checkBoxesText = "多选题" + checkBoxes.length + "题,每题" + checkBoxesScore + "分,合计" + checkBoxesScoreSum + "分;总分" + sumScore + "分。"
|
|
}
|
|
return "说明:" + radiosText + checkBoxesText
|
|
},
|
|
|
|
fullScore() {
|
|
return this.issueList.map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
|
},
|
|
radioNum() {
|
|
return this.issueList.filter(v => v.idx === 1 && v.iisdx).map(v => v.fraction ? v.fraction : 0).reduce((a, b) => a + b)
|
|
},
|
|
checkBoxNum() {
|
|
|
|
},
|
|
|
|
//判断是否为同一天
|
|
isSameDay() {
|
|
if (this.questionData.startTime && this.questionData.endTime) {
|
|
return moment(this.questionData.startTime).isSame(moment(this.questionData.endTime), 'day')
|
|
}
|
|
return false
|
|
}
|
|
},
|
|
|
|
methods: {
|
|
openRandomCount() {
|
|
this.randomCountSheetShow = true
|
|
this.randomActions = []
|
|
|
|
if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && this.isSameDay) {
|
|
for (let i = 0; i < this.userHasAnswerRandomNum; i++) {
|
|
this.randomActions.push({
|
|
name: '第' + (i + 1) + '轮',
|
|
val: i + 1
|
|
})
|
|
}
|
|
} else if (this.questionData.qlx == 2 && (this.questionData.ctMode == 1 || (this.questionData.ctMode == 2 && !this.isSameDay))) {
|
|
const {startTime, endTime} = this.questionData
|
|
const startMoment = moment(startTime)
|
|
const endMoment = moment(endTime)
|
|
const now = moment()
|
|
// 计算两个日期之间相差的天数
|
|
const daysDifference = endMoment.diff(startMoment, 'days')
|
|
for (let i = 0; i <= daysDifference; i++) {
|
|
this.randomActions.push({
|
|
name: startMoment.clone().add(i, 'days').format('YYYY-MM-DD'),
|
|
val: startMoment.clone().add(i, 'days').format('YYYY-MM-DD'),
|
|
disabled: moment(startMoment.clone().add(i, 'days').format('YYYY-MM-DD')).isAfter(now)
|
|
})
|
|
}
|
|
}
|
|
},
|
|
async randomCountSelect(val) {
|
|
if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && this.isSameDay) {
|
|
this.randomCount = val.val
|
|
} else if (this.questionData.qlx == 2 && this.questionData.ctMode == 2 && !this.isSameDay) {
|
|
this.currentDate = val.val
|
|
} else if (this.questionData.qlx == 2 && this.questionData.ctMode == 1) {
|
|
this.currentDate = val.val
|
|
}
|
|
await this.getQuestionData()
|
|
await this.checkUserFinishAnswer()
|
|
await this.checkCanAnswerAgain()
|
|
await this.getScore()
|
|
},
|
|
|
|
async getQuestionData() {
|
|
const resp = await $.get(BASE_URL + '/questionInfo/' + this.id, {
|
|
currentDate: this.currentDate,
|
|
randomCount: this.randomCount
|
|
})
|
|
this.questionData = resp.data
|
|
},
|
|
cellToggle(issue, worId) {
|
|
if (this.finishAnswer || this.finishAllAnswer) {
|
|
return
|
|
}
|
|
this.toggle(issue, worId)
|
|
},
|
|
|
|
toggle(issue, worId) {
|
|
//单选
|
|
if (issue.iisdx) {
|
|
vue.$refs['checkboxGroup' + issue.iid][0].toggleAll(false)
|
|
} else {
|
|
|
|
}
|
|
console.log(issue.userSelect)
|
|
this.$refs['checkboxes' + worId][0].toggle()
|
|
setTimeout(() => {
|
|
console.log(issue.userSelect)
|
|
})
|
|
},
|
|
|
|
save() {
|
|
this.$modal.confirm('保存后下次可继续做答,您确定要保存吗?').then(async () => {
|
|
const replies = this.questionData.issues.map(v => {
|
|
return {
|
|
qid: v.iid,
|
|
issueId: v.iid,
|
|
userSelect: v.userSelect,
|
|
}
|
|
})
|
|
|
|
const {code} = await $.post(BASE_URL + '/saveAnswer', {
|
|
replies: JSON.stringify(replies),
|
|
questionId: this.questionData.qid,
|
|
isSave: true,
|
|
randomCount: this.randomCount
|
|
})
|
|
this.$modal.closeLoading()
|
|
if (code === 0) {
|
|
this.$modal.msg('保存成功')
|
|
} else {
|
|
this.$modal.msg('保存失败')
|
|
}
|
|
})
|
|
},
|
|
|
|
submit() {
|
|
const iids = this.questionData.issues.filter(v => !v.userSelect).map(v => v.iid)
|
|
|
|
if (iids.length > 0) {
|
|
this.$toast('您还有' + iids.length + '题未作答,请答完后再提交!')
|
|
document.getElementById('issue' + iids[0]).scrollIntoView({
|
|
behavior: 'smooth',
|
|
block: 'center',
|
|
'inline': 'start'
|
|
});
|
|
return
|
|
}
|
|
|
|
const msg = '一旦提交不可修改,您确定要提交吗?'
|
|
|
|
this.$modal.confirm(msg).then(async () => {
|
|
this.autoSubmit()
|
|
// const replies = this.questionData.issues.map(v => {
|
|
// return {
|
|
// qid: this.id,
|
|
// issueId: v.iid,
|
|
// userSelect: v.userSelect,
|
|
// }
|
|
// })
|
|
//
|
|
// const {code} = await $.post(BASE_URL + '/saveAnswer', {
|
|
// replies: JSON.stringify(replies),
|
|
// questionId: this.questionData.qid,
|
|
// isSave: false,
|
|
// randomCount: this.randomCount
|
|
// })
|
|
// this.$modal.closeLoading()
|
|
// if (code === 0) {
|
|
// this.$modal.msg('提交成功')
|
|
// await this.getUserHasAnswerRandomNum()
|
|
// await this.checkUserFinishAnswer()
|
|
// await this.getReply()
|
|
// await this.assignmentAnswer()
|
|
// await this.checkUserFinishAnswer()
|
|
// await this.checkCanAnswerAgain()
|
|
// await this.getScore()
|
|
// }
|
|
})
|
|
},
|
|
|
|
async autoSubmit() {
|
|
const replies = this.questionData.issues.map(v => {
|
|
return {
|
|
qid: this.id,
|
|
issueId: v.iid,
|
|
userSelect: v.userSelect,
|
|
}
|
|
})
|
|
|
|
let takeTime = null
|
|
if (this.questionData.enableTimer) {
|
|
takeTime = this.questionData.timerMinute * 60 - this.countDownSeconds
|
|
}
|
|
|
|
const {code} = await $.post(BASE_URL + '/saveAnswer', {
|
|
replies: JSON.stringify(replies),
|
|
questionId: this.questionData.qid,
|
|
isSave: false,
|
|
randomCount: this.randomCount,
|
|
takeTime: takeTime
|
|
})
|
|
this.$modal.closeLoading()
|
|
if (code === 0) {
|
|
this.$modal.msg('提交成功')
|
|
await this.getUserHasAnswerRandomNum()
|
|
await this.checkUserFinishAnswer()
|
|
await this.getReply()
|
|
await this.assignmentAnswer()
|
|
await this.checkUserFinishAnswer()
|
|
await this.checkCanAnswerAgain()
|
|
await this.getScore()
|
|
}
|
|
},
|
|
|
|
//获取回答信息
|
|
async getReply() {
|
|
const resp = await $.get(BASE_URL + '/answerInfo/' + this.id, {
|
|
randomCount: this.randomCount,
|
|
currentDate: this.currentDate
|
|
})
|
|
this.replyInfo = resp.data
|
|
},
|
|
//用户是否全部答完提交
|
|
async checkUserFinishAnswer() {
|
|
this.mLoading = true
|
|
const resp = await $.get(BASE_URL + '/checkUserFinishAnswer', {
|
|
questionId: this.id,
|
|
randomCount: this.randomCount,
|
|
currentDate: this.currentDate
|
|
})
|
|
this.mLoading = false
|
|
this.finishAnswer = resp.data
|
|
await this.getReply()
|
|
await this.assignmentAnswer()
|
|
},
|
|
|
|
//答案赋值
|
|
assignmentAnswer() {
|
|
this.questionData.issues.forEach(issue => {
|
|
const rwids = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
|
rwids.forEach(rwid => {
|
|
this.toggle(issue, rwid)
|
|
})
|
|
const wids = issue.wors.filter(v => v.correct).map(v => v.wid)
|
|
const userSelects = this.replyInfo.filter(v => v.issueId === issue.iid).map(v => v.rwid)
|
|
const isEqual = wids.length === userSelects.length && wids.every(value => userSelects.includes(value))
|
|
issue.isEqual = isEqual
|
|
})
|
|
},
|
|
|
|
answerAgain() {
|
|
if(this.questionData.ctMode===3){
|
|
$.post(BASE_URL + '/answerAgainCommon', {id: this.id}).then(resp => {
|
|
if (resp.code === 0) {
|
|
this.questionData = resp.data
|
|
this.finishAnswer = false
|
|
setTimeout(() => {
|
|
this.questionData.issues.forEach(issue => {
|
|
issue.wors.forEach(wor => {
|
|
this.$refs['checkboxes' + wor.wid][0].toggle(false)
|
|
})
|
|
})
|
|
}, 0)
|
|
this.checkTimer()
|
|
}
|
|
})
|
|
|
|
// location.reload()
|
|
// this.finishAnswer = false
|
|
// setTimeout(() => {
|
|
// this.questionData.issues.forEach(issue => {
|
|
// issue.wors.forEach(wor => {
|
|
// this.$refs['checkboxes' + wor.wid][0].toggle(false)
|
|
// })
|
|
// })
|
|
// }, 0)
|
|
// this.checkTimer()
|
|
}else{
|
|
this.finishAnswer = false
|
|
setTimeout(() => {
|
|
this.questionData.issues.forEach(issue => {
|
|
issue.wors.forEach(wor => {
|
|
this.$refs['checkboxes' + wor.wid][0].toggle(false)
|
|
})
|
|
})
|
|
}, 0)
|
|
this.checkTimer()
|
|
}
|
|
},
|
|
|
|
async getUserHasAnswerRandomNum() {
|
|
const resp = await $.get(BASE_URL + '/getUserHasAnswerRandomNum', {
|
|
questionId: this.id
|
|
})
|
|
this.userHasAnswerRandomNum = resp.data
|
|
this.randomCount = this.userHasAnswerRandomNum
|
|
},
|
|
|
|
async checkCanAnswerAgain() {
|
|
const resp = await $.get(BASE_URL + '/checkCanAnswerAgain', {
|
|
questionId: this.id,
|
|
randomCount: this.randomCount,
|
|
currentDate: this.currentDate
|
|
})
|
|
this.canAnswerAgain = resp.data
|
|
},
|
|
|
|
async getScore() {
|
|
const resp = await $.get(BASE_URL + '/getScore/', {
|
|
questionId: this.id,
|
|
randomCount: this.randomCount,
|
|
currentDate: this.currentDate
|
|
})
|
|
this.currentScore = resp.data
|
|
},
|
|
checkTimer() {
|
|
if(this.questionData.enableTimer){
|
|
if (this.timerInterval) {
|
|
clearInterval(this.timerInterval)
|
|
}
|
|
if (!this.finishAnswer) {
|
|
this.$dialog.alert({
|
|
title: '提示',
|
|
message: '本次答题时间' + this.questionData.timerMinute + '分钟,请尽快完成!'
|
|
}).then(() => {
|
|
this.countDownSeconds = this.questionData.timerMinute * 60
|
|
this.updateCountdown()
|
|
this.timerInterval = setInterval(() => {
|
|
this.updateCountdown()
|
|
}, 1000)
|
|
});
|
|
}
|
|
}
|
|
},
|
|
|
|
updateCountdown() {
|
|
// 计算剩余的分钟和秒数
|
|
let mins = Math.floor(this.countDownSeconds / 60)
|
|
let secs = this.countDownSeconds % 60
|
|
// 格式化时间,确保分钟和秒数始终是两位数
|
|
mins = mins < 10 ? '0' + mins : mins;
|
|
secs = secs < 10 ? '0' + secs : secs;
|
|
this.remainder = mins + ':' + secs
|
|
// 如果倒计时结束,显示结束信息
|
|
if (this.countDownSeconds <= 0) {
|
|
this.remainder = '时间到'
|
|
clearInterval(this.timerInterval)
|
|
this.$dialog.alert({
|
|
title: '提示',
|
|
message: '答题时间到,请点击确认提交答案!'
|
|
}).then(() => {
|
|
this.autoSubmit()
|
|
})
|
|
} else {
|
|
this.countDownSeconds = this.countDownSeconds - 1
|
|
}
|
|
}
|
|
},
|
|
async created() {
|
|
if (this.timerInterval) {
|
|
clearInterval(this.timerInterval)
|
|
}
|
|
this.id = GetQueryString("id")
|
|
await this.getQuestionData()
|
|
await this.checkCanAnswerAgain()
|
|
await this.getUserHasAnswerRandomNum()
|
|
await this.checkUserFinishAnswer()
|
|
await this.getScore()
|
|
await this.checkTimer()
|
|
this.mLoading = false
|
|
}
|
|
})
|
|
|
|
window.addEventListener('pageshow', async e => {
|
|
if (e.persisted || (window.performance && window.performance.navigation.type === 2)) {
|
|
vue.id = GetQueryString("id")
|
|
await vue.getQuestionData()
|
|
// await vue.getRanDomModeNum()
|
|
// await vue.getSumScore()
|
|
// await vue.checkUserFinishAnswer()
|
|
// await vue.getCurrentRandomCountScore()
|
|
this.mLoading = false
|
|
}
|
|
})
|
|
|
|
</script>
|
|
|
|
|
|
<!--#
|
|
}
|
|
#-->
|