|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div class="doTask">
|
|
|
<!-- <div class="dt_back" @click.stop="back()">返回</div> -->
|
|
|
- <bar :num="1" @cutPage="back()">
|
|
|
+ <bar :num="1" @cutPage="back(1)">
|
|
|
<template v-slot:title>
|
|
|
<div class="dt_time" v-if="!isSubmit">
|
|
|
<div class="dt_t_title">
|
|
@@ -974,6 +974,20 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
|
+
|
|
|
+ <van-popup v-model="disabledShow2" round :close-on-click-overlay="false">
|
|
|
+ <div class="disabledShowBox">
|
|
|
+ <div class="dsb_top">
|
|
|
+ <div class="dsb_top_title">提示</div>
|
|
|
+ <div class="dsb_top_content">當前答題結果未保存,是否確認返回</div>
|
|
|
+ </div>
|
|
|
+ <div class="dsb_bottom2">
|
|
|
+ <span @click.stop="disabledShow2 = false">取消</span>
|
|
|
+ <span @click.stop="back(2)">确认</span>
|
|
|
+ <span @click.stop="saveAndBack()">保存并返回</span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </van-popup>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -989,6 +1003,8 @@ export default {
|
|
|
data() {
|
|
|
return {
|
|
|
disabledShow: false,
|
|
|
+ disabledShow2: false,
|
|
|
+ isDoTaskCanShowDialog: false,
|
|
|
showTaskIndex: 0,
|
|
|
time: 0,
|
|
|
time2: 0,
|
|
@@ -1028,7 +1044,7 @@ export default {
|
|
|
'Y',
|
|
|
'Z'
|
|
|
],
|
|
|
- taskList: [ ],
|
|
|
+ taskList: [],
|
|
|
taskMessage: {
|
|
|
chapter: '第一章',
|
|
|
grade: '小八',
|
|
@@ -1416,29 +1432,32 @@ export default {
|
|
|
console.log('不结束练习')
|
|
|
})
|
|
|
},
|
|
|
- saveTask() {
|
|
|
- let _params = {
|
|
|
- type: this.type,
|
|
|
- userId: this.userId,
|
|
|
- taskList: this.taskList,
|
|
|
- showTaskIndex: this.showTaskIndex,
|
|
|
- time: this.time + this.time2,
|
|
|
- isSubmit: false
|
|
|
- }
|
|
|
-
|
|
|
- let _local = window.localStorage.getItem('pocTask') || JSON.stringify([])
|
|
|
+ saveTask(type=1) {
|
|
|
+ return new Promise(resolve => {
|
|
|
+ let _params = {
|
|
|
+ type: this.type,
|
|
|
+ userId: this.userId,
|
|
|
+ taskList: this.taskList,
|
|
|
+ showTaskIndex: this.showTaskIndex,
|
|
|
+ time: this.time + this.time2,
|
|
|
+ isSubmit: false
|
|
|
+ }
|
|
|
|
|
|
- let _data = JSON.parse(_local)
|
|
|
+ let _local = window.localStorage.getItem('pocTask') || JSON.stringify([])
|
|
|
|
|
|
- let _index = _data.findIndex(item => item.type == this.type && item.userId == this.userId)
|
|
|
- if (_index != -1) {
|
|
|
- _data[_index] = _params
|
|
|
- } else {
|
|
|
- _data.push(_params)
|
|
|
- }
|
|
|
+ let _data = JSON.parse(_local)
|
|
|
|
|
|
- window.localStorage.setItem('pocTask', JSON.stringify(_data))
|
|
|
- this.$toast.success('保存成功')
|
|
|
+ let _index = _data.findIndex(item => item.type == this.type && item.userId == this.userId)
|
|
|
+ if (_index != -1) {
|
|
|
+ _data[_index] = _params
|
|
|
+ } else {
|
|
|
+ _data.push(_params)
|
|
|
+ }
|
|
|
+ this.isDoTaskCanShowDialog = false
|
|
|
+ window.localStorage.setItem('pocTask', JSON.stringify(_data))
|
|
|
+ if(type==1)this.$toast.success('保存成功')
|
|
|
+ resolve();
|
|
|
+ })
|
|
|
},
|
|
|
submitTask(type = 0) {
|
|
|
if (!this.isDoAllTask && type == 0) {
|
|
@@ -1454,6 +1473,7 @@ export default {
|
|
|
})
|
|
|
} else {
|
|
|
clearInterval(this.timer)
|
|
|
+ this.isDoTaskCanShowDialog = false //是否可以显示提交弹窗
|
|
|
let _params = {
|
|
|
type: this.type,
|
|
|
userId: this.userId,
|
|
@@ -1478,10 +1498,18 @@ export default {
|
|
|
this.sortTaskList()
|
|
|
}
|
|
|
},
|
|
|
- back() {
|
|
|
+ back(type = 1) {
|
|
|
+ if (this.isDoTaskCanShowDialog && type == 1) {
|
|
|
+ return (this.disabledShow2 = true)
|
|
|
+ }
|
|
|
this.$router.go(-1)
|
|
|
// this.$router.push(`/pocAiClassroom`)
|
|
|
},
|
|
|
+ saveAndBack() {
|
|
|
+ this.saveTask(2).then(_=>{
|
|
|
+ this.$router.go(-1)
|
|
|
+ })
|
|
|
+ },
|
|
|
choseAnswer(_index) {
|
|
|
const _type = typeof this.taskList[this.showTaskIndex].answer == 'object' ? 1 : 0
|
|
|
if (_type == 0) {
|
|
@@ -1499,6 +1527,7 @@ export default {
|
|
|
this.taskList[this.showTaskIndex].answer2.push(_index)
|
|
|
}
|
|
|
}
|
|
|
+ this.isDoTaskCanShowDialog = true
|
|
|
},
|
|
|
sortTaskList() {
|
|
|
this.taskList.forEach(i => {
|
|
@@ -3413,6 +3442,38 @@ ${taskMsg}
|
|
|
color: #fff !important;
|
|
|
}
|
|
|
|
|
|
+.dsb_bottom2 {
|
|
|
+ width: 100%;
|
|
|
+ height: 60px;
|
|
|
+ display: flex;
|
|
|
+ align-items: center;
|
|
|
+ justify-content: space-between;
|
|
|
+ box-sizing: border-box;
|
|
|
+ padding: 10px 20px;
|
|
|
+}
|
|
|
+
|
|
|
+.dsb_bottom2 > span {
|
|
|
+ flex: 1;
|
|
|
+ height: 90%;
|
|
|
+ border-radius: 8px;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ font-size: 14px;
|
|
|
+ font-weight: bold;
|
|
|
+ background-color: #f0f2f5;
|
|
|
+ color: #3681fc;
|
|
|
+}
|
|
|
+
|
|
|
+.dsb_bottom2 > span:nth-child(2) {
|
|
|
+ margin: 0 10px;
|
|
|
+}
|
|
|
+
|
|
|
+.dsb_bottom2 > span:nth-child(3) {
|
|
|
+ background-color: #3681fc;
|
|
|
+ color: #fff !important;
|
|
|
+}
|
|
|
+
|
|
|
.dt_is_top {
|
|
|
width: 100%;
|
|
|
height: calc(100% - 60px);
|