人脸识别优化
This commit is contained in:
parent
ad60298cdd
commit
d2bb0079e6
|
|
@ -171,7 +171,8 @@ export default {
|
||||||
fileUrl: config.fileUrl,
|
fileUrl: config.fileUrl,
|
||||||
score: 0,
|
score: 0,
|
||||||
passScore: 0,
|
passScore: 0,
|
||||||
isHide: false
|
isHide: false,
|
||||||
|
failCount: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
|
|
@ -241,7 +242,7 @@ export default {
|
||||||
console.log('🚀 ~ getList ~ this.time:', this.time)
|
console.log('🚀 ~ getList ~ this.time:', this.time)
|
||||||
console.log('🚀 ~ getList ~ this.questionList:', this.questionList)
|
console.log('🚀 ~ getList ~ this.questionList:', this.questionList)
|
||||||
this.random1 = (data.answerTime / 3) * 60 + Math.ceil(Math.random() * 20) + 20
|
this.random1 = (data.answerTime / 3) * 60 + Math.ceil(Math.random() * 20) + 20
|
||||||
this.random2 = (data.answerTime / 2) * 60 + Math.ceil(Math.random() * 30) + 30
|
this.random2 = (data.answerTime / 1.5) * 60 + Math.ceil(Math.random() * 30) + 30
|
||||||
console.log('🚀 ~ getList ~ this.random1:', this.random1, this.random2)
|
console.log('🚀 ~ getList ~ this.random1:', this.random1, this.random2)
|
||||||
if (this.questionList.length > 0) {
|
if (this.questionList.length > 0) {
|
||||||
this.questionList.forEach((item, index) => {
|
this.questionList.forEach((item, index) => {
|
||||||
|
|
@ -468,6 +469,8 @@ export default {
|
||||||
// 拍照录入
|
// 拍照录入
|
||||||
openPhotograph() {
|
openPhotograph() {
|
||||||
this.isHide = true
|
this.isHide = true
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$refs.countDown.pause()
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
|
|
@ -487,6 +490,7 @@ export default {
|
||||||
console.log('🚀 ~ err:', err)
|
console.log('🚀 ~ err:', err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}, 10)
|
||||||
},
|
},
|
||||||
imgToBase64(data) {
|
imgToBase64(data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
@ -521,14 +525,28 @@ export default {
|
||||||
message: '人脸识别成功',
|
message: '人脸识别成功',
|
||||||
duration: 1000
|
duration: 1000
|
||||||
})
|
})
|
||||||
|
this.failCount = 3
|
||||||
|
// 继续计时
|
||||||
|
this.$refs.countDown.start()
|
||||||
} else {
|
} else {
|
||||||
|
this.failCount--
|
||||||
|
if (this.failCount == 0) {
|
||||||
this.$refs.uToast.show({
|
this.$refs.uToast.show({
|
||||||
message: '人脸识别失败, 即将结束考试',
|
message: '人脸识别失败, 即将结束考试',
|
||||||
duration: 1000
|
duration: 1500
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handleConfirmSubmit()
|
this.handleConfirmSubmit()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
this.$refs.uToast.show({
|
||||||
|
message: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openPhotograph()
|
||||||
|
}, 1700)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
|
|
@ -561,7 +579,7 @@ export default {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
onBackPress(options) {
|
onBackPress(options) {
|
||||||
console.log(options)
|
console.log(options)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,9 @@ export default {
|
||||||
isHide: false,
|
isHide: false,
|
||||||
oldTime: 0,
|
oldTime: 0,
|
||||||
random1: 0,
|
random1: 0,
|
||||||
random2: 0
|
random2: 0,
|
||||||
|
// 失败次数
|
||||||
|
failCount: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
|
|
@ -193,6 +195,7 @@ export default {
|
||||||
// 拍照录入
|
// 拍照录入
|
||||||
openPhotograph() {
|
openPhotograph() {
|
||||||
this.isHide = true
|
this.isHide = true
|
||||||
|
setTimeout(() => {
|
||||||
uni.chooseImage({
|
uni.chooseImage({
|
||||||
count: 1,
|
count: 1,
|
||||||
sizeType: ['compressed'],
|
sizeType: ['compressed'],
|
||||||
|
|
@ -217,6 +220,7 @@ export default {
|
||||||
}, 1000)
|
}, 1000)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
}, 100)
|
||||||
},
|
},
|
||||||
imgToBase64(data) {
|
imgToBase64(data) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
@ -250,18 +254,33 @@ export default {
|
||||||
// 提示
|
// 提示
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人脸识别成功',
|
title: '人脸识别成功',
|
||||||
icon: ''
|
icon: '',
|
||||||
|
duration: 1500
|
||||||
})
|
})
|
||||||
|
this.failCount = 3 // 重置次数
|
||||||
this.isHide = false
|
this.isHide = false
|
||||||
this.video.play()
|
this.video.play()
|
||||||
} else {
|
} else {
|
||||||
|
this.failCount--
|
||||||
|
if (this.failCount == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人脸识别失败',
|
title: '人脸识别失败, 即将结束学习',
|
||||||
icon: ''
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.handleEnd()
|
this.handleEnd()
|
||||||
}, 1000)
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openPhotograph()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ export default {
|
||||||
time: '',
|
time: '',
|
||||||
isHide: false,
|
isHide: false,
|
||||||
allStudyDuration: 0,
|
allStudyDuration: 0,
|
||||||
random: 0
|
random: 0,
|
||||||
|
// 失败次数
|
||||||
|
failCount: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
|
|
@ -248,13 +250,26 @@ export default {
|
||||||
this.isShow = true
|
this.isShow = true
|
||||||
this.countDown()
|
this.countDown()
|
||||||
} else {
|
} else {
|
||||||
|
this.failCount--
|
||||||
|
if (this.failCount == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人脸识别失败',
|
title: '人脸识别失败, 即将结束学习',
|
||||||
icon: ''
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updStudyDuration()
|
this.updStudyDuration()
|
||||||
}, 1000)
|
}, 1500)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openPhotograph()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,9 @@ export default {
|
||||||
isHide: false,
|
isHide: false,
|
||||||
allStudyDuration: 0,
|
allStudyDuration: 0,
|
||||||
random1: 0,
|
random1: 0,
|
||||||
random2: 0
|
random2: 0,
|
||||||
|
// 失败次数
|
||||||
|
failCount: 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoad(opt) {
|
onLoad(opt) {
|
||||||
|
|
@ -211,9 +213,9 @@ export default {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
// 提示
|
// 提示
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人脸识别成功',
|
title: '人脸识别成功'
|
||||||
icon: ''
|
|
||||||
})
|
})
|
||||||
|
this.failCount = 3
|
||||||
this.isHide = false
|
this.isHide = false
|
||||||
// 重新计算 this.surplusTime
|
// 重新计算 this.surplusTime
|
||||||
this.surplusTime = this.allStudyDuration
|
this.surplusTime = this.allStudyDuration
|
||||||
|
|
@ -225,13 +227,25 @@ export default {
|
||||||
this.isShow = true
|
this.isShow = true
|
||||||
this.countDown()
|
this.countDown()
|
||||||
} else {
|
} else {
|
||||||
|
this.failCount--
|
||||||
|
if (this.failCount == 0) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '人脸识别失败',
|
title: '人脸识别失败, 即将结束学习',
|
||||||
icon: ''
|
icon: 'none'
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.updStudyDuration()
|
this.updStudyDuration()
|
||||||
}, 1000)
|
}, 1000)
|
||||||
|
} else {
|
||||||
|
uni.showToast({
|
||||||
|
title: '人脸识别失败, 请重新录入, 剩余次数: ' + this.failCount + '次',
|
||||||
|
icon: 'none',
|
||||||
|
duration: 1500
|
||||||
|
})
|
||||||
|
setTimeout(() => {
|
||||||
|
this.openPhotograph()
|
||||||
|
}, 1500)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fail(err) {
|
fail(err) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue