jug
This commit is contained in:
@@ -86,9 +86,8 @@ layout("/mobile/platform.html"){
|
||||
|
||||
.page-control {
|
||||
padding: 20px;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
grid-gap: 20px;
|
||||
display: flex;
|
||||
column-gap: 20px;
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
@@ -175,6 +174,9 @@ layout("/mobile/platform.html"){
|
||||
<div class="score" v-if="finishAnswer && ( currentScore || currentScore===0 )">
|
||||
{{questionData.calcScoreMode==1?'今日最高成绩':'得分'}}{{currentScore}}
|
||||
</div>
|
||||
<div class="timer" v-if="questionData.enableTimer">
|
||||
<span>剩余时间:{{remainder}}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="survey-head">
|
||||
<div class="title">
|
||||
@@ -194,8 +196,8 @@ layout("/mobile/platform.html"){
|
||||
{{issue.iisdx?'单选':'多选'}}
|
||||
</van-tag>
|
||||
</template>
|
||||
<!-- <van-tag v-if="issue.fraction" type="primary" size="large">{{issue.fraction}}分-->
|
||||
<!-- </van-tag>-->
|
||||
<!-- <van-tag v-if="issue.fraction" type="primary" size="large">{{issue.fraction}}分-->
|
||||
<!-- </van-tag>-->
|
||||
</div>
|
||||
<h2 class="question-title">
|
||||
<span class="question-seq">
|
||||
@@ -243,10 +245,12 @@ layout("/mobile/platform.html"){
|
||||
</section>
|
||||
</div>
|
||||
<div class="page-control" v-if="!finishAnswer">
|
||||
<van-button type="info" block @click="save()">保存</van-button>
|
||||
<!--非计时模式才能保存 否则没意义了-->
|
||||
<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') === vue.currentDate">
|
||||
<div class="page-control" style="grid-template-columns: auto"
|
||||
v-if="canAnswerAgain && finishAnswer && moment().format('YYYY-MM-DD') === vue.currentDate">
|
||||
<van-button type="info" block @click="answerAgain">
|
||||
再答一次
|
||||
</van-button>
|
||||
@@ -299,7 +303,14 @@ layout("/mobile/platform.html"){
|
||||
currentScore: null,
|
||||
|
||||
//获取用户已回答的轮数 针对单天随机
|
||||
userHasAnswerRandomNum: 0
|
||||
userHasAnswerRandomNum: 0,
|
||||
|
||||
//倒计时计时器
|
||||
timerInterval: null,
|
||||
//答题时间(使用秒)
|
||||
countDownSeconds: 0,
|
||||
//剩余时间
|
||||
remainder: null
|
||||
|
||||
}
|
||||
},
|
||||
@@ -461,33 +472,69 @@ layout("/mobile/platform.html"){
|
||||
const msg = '一旦提交不可修改,您确定要提交吗?'
|
||||
|
||||
this.$modal.confirm(msg).then(async () => {
|
||||
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()
|
||||
}
|
||||
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, {
|
||||
@@ -559,16 +606,58 @@ layout("/mobile/platform.html"){
|
||||
currentDate: this.currentDate
|
||||
})
|
||||
this.currentScore = resp.data
|
||||
}
|
||||
},
|
||||
checkTimer() {
|
||||
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.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
|
||||
}
|
||||
})
|
||||
@@ -590,4 +679,4 @@ layout("/mobile/platform.html"){
|
||||
|
||||
<!--#
|
||||
}
|
||||
#-->
|
||||
#-->
|
||||
|
||||
Reference in New Issue
Block a user