This commit is contained in:
2023-09-17 13:18:59 +08:00
parent bf05f771f7
commit 9e871e4079
23 changed files with 1086 additions and 606 deletions

View File

@@ -346,7 +346,7 @@
},
timeCount() {
const time = this.subject == '1' ? 60 * 60 * 1000 : 45 * 60 * 1000
const time = 45 * 60 * 1000
return time
}
},
@@ -504,21 +504,27 @@
toSubmit() {
const restTime = this.time.hours * 60 * 60 + this.time.minutes * 60 + this.time.seconds
const score = (this.rightList.length / this.questionList.length * 100).toFixed(0)
submitTest({
"carTypeId": storage.get('carType') || '1001',
"score": score,
"testTime": 60 * 60 - restTime,
subject: this.subject
}).then(resp => {
const doNotNum = this.questionList.length - this.rightList.length - this.wrongList.length
const list = JSON.stringify(this.wrongList)
if (resp.code === '0000') {
uni.navigateTo({
url: "/pages/questionBank/examResult?doNotNum=" + doNotNum + "&wrongList=" + list + "&score=" +
score + "&subject=" + this.subject + "&navTitle=" + this.navTitle
})
}
})
if(this.rightList.length+this.wrongList.length==0){
uni.navigateBack({
delta:1
})
}else{
submitTest({
"carTypeId": storage.get('carType') || '1001',
"score": score,
"testTime": 45 * 60 - restTime,
subject: this.subject
}).then(resp => {
const doNotNum = this.questionList.length - this.rightList.length - this.wrongList.length
const list = JSON.stringify(this.wrongList)
if (resp.code === '0000') {
uni.navigateTo({
url: "/pages/questionBank/examResult?doNotNum=" + doNotNum + "&wrongList=" + list + "&score=" +
score + "&subject=" + this.subject + "&navTitle=" + this.navTitle
})
}
})
}
},
//查看考试结果
toResult() {

View File

@@ -96,6 +96,7 @@
label: "庐江考场",
value: 6
}],
driveType:'',
videoType: '',
popupShow: false,
videoList: [{
@@ -128,6 +129,10 @@
}
},
onLoad(op) {
if(op.driveType){
this.driveType=op.driveType
this.param.driveType=op.driveType
}
if (op.type) {
this.videoType = op.type
}
@@ -139,6 +144,7 @@
}
if (op.type) {
this.param.type = op.type
this.getVideoList()
}
if (op.type == '1') {
if (this.param.subject == '2') {
@@ -149,10 +155,7 @@
} else {
this.title = '基础操作讲解'
}
if (op.videoList) {
this.videoList = JSON.parse(op.videoList)
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
}
},
computed: {
getScrollLeft() {
@@ -161,6 +164,46 @@
}
},
methods: {
formateTime(time) {
const h = parseInt(time / 3600)
const minute = parseInt(time / 60 % 60)
const second = Math.ceil(time % 60)
const hours = h < 10 ? '0' + h : h
const formatSecond = second > 59 ? 59 : second
return `${hours > 0 ? `${hours}:` : ''}${minute < 10 ? '0' + minute : minute}:${formatSecond < 10 ? '0' + formatSecond : formatSecond}`
},
getVideoList() {
queryProjectList({
"carTypeId": storage.get('carType') || '1001',
...this.param,
}).then(resp => {
if(resp.code==='0000'){
let arr=[]
if(this.param.type=='1'){
arr = JSON.parse(JSON.stringify(resp.data))
arr = arr.map(item => {
return {
...item,
videoUrl: item.videoList[0]?.videoUrl,
videoTime: this.formateTime(item.videoList[0]?.videoTime)
}
})
}else{
arr = JSON.parse(JSON.stringify(resp.data[0].videoList))
arr = arr.map(item => {
return {
...item,
projectId: item.videoId,
subDesc: resp.data[0].description,
videoTime: this.formateTime(item.videoTime)
}
})
}
this.videoList = arr
this.currentIndex = this.videoList.findIndex(item => item.projectId == this.projectId)
}
})
},
checkTest(val) {
this.videoIndex = val
},