diff --git a/config.js b/config.js index 3541cc9..9a33dee 100644 --- a/config.js +++ b/config.js @@ -36,13 +36,14 @@ module.exports = { uploadUrl: 'http://192.168.0.14:19999/exam-file/file/uploadBase64', bmwUrl: 'http://192.168.0.14:19999/exam-bmw', // 体检-基础路径 - tjBaseUrl: 'http://192.168.0.14:20000/AppPeaManager', + // tjBaseUrl: 'http://192.168.0.14:20000/AppPeaManager', + tjBaseUrl: 'http://192.168.2.147:20000/AppPeaManager', + tjFile: 'http://112.29.103.165:1616/medicalDocumentation/statics/', + //实名制移动端-登录接口 realLoginUrl:'http://192.168.0.14:9200/', //实名制移动端-移动 realAppUrl:'http://192.168.0.14:1913/app', - - // 应用信息 appInfo: { // 应用名称 diff --git a/main.js b/main.js index bfd88d8..f5ef3a8 100644 --- a/main.js +++ b/main.js @@ -7,11 +7,11 @@ import Vue from 'vue' Vue.config.productionTip = false // Vue.prototype.$api = $api Vue.prototype.$store = store -Vue.prototype.$adpid = "1111111111" +Vue.prototype.$adpid = '1111111111' Vue.prototype.$backgroundAudioData = { - playing: false, - playTime: 0, - formatedPlayTime: '00:00:00' + playing: false, + playTime: 0, + formatedPlayTime: '00:00:00' } import uView from '@/uni_modules/uview-ui' @@ -24,29 +24,56 @@ Vue.use(uView) // const vconsole = require('vconsole') // Vue.prototype.$vconsole = new vconsole() // 使用vconsole +Vue.prototype.$verificationToken = function () { + console.log('验证Token-->') + uni.request({ + url: 'http://192.168.0.14:19999/exam-bmw/users/current', + method: 'get', + header: { + Authorization: uni.getStorageSync('access_token') + }, + success: (res) => { + console.log('🚀 ~ res:', res) + let data = res.data + console.log('🚀 ~ res.data:', data) + if (data === '' || data === undefined) { + uni.showToast({ + title: '已在其他设备登录,请重新登录', + icon: 'none' + }) + uni.reLaunch({ + url: '/pages/login' + }) + } + }, + fail: (err) => { + console.log('🚀 ~ err:', err) + } + }) +} + App.mpType = 'app' const app = new Vue({ - store, - ...App + store, + ...App }) app.$mount() // #endif // #ifdef VUE3 -import { - createSSRApp -} from 'vue' +import { createSSRApp } from 'vue' +import { data } from 'uview-ui/libs/mixin/mixin'; export function createApp() { - const app = createSSRApp(App) - app.use(store) - app.config.globalProperties.$adpid = "1111111111" - app.config.globalProperties.$backgroundAudioData = { - playing: false, - playTime: 0, - formatedPlayTime: '00:00:00' - } - return { - app - } + const app = createSSRApp(App) + app.use(store) + app.config.globalProperties.$adpid = '1111111111' + app.config.globalProperties.$backgroundAudioData = { + playing: false, + playTime: 0, + formatedPlayTime: '00:00:00' + } + return { + app + } } // #endif diff --git a/package-lock.json b/package-lock.json index 452d3bb..4ddc616 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,6 +3,41 @@ "version": "3.4.5", "lockfileVersion": 1, "requires": true, + "packages": { + "": { + "name": "hello-uniapp", + "version": "3.4.5", + "license": "MIT", + "dependencies": { + "crypto-js": "^4.2.0", + "image-tools": "^1.4.0", + "luch-request": "^3.1.1" + } + }, + "node_modules/@dcloudio/types": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz", + "integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==" + }, + "node_modules/crypto-js": { + "version": "4.2.0", + "resolved": "https://registry.npmmirror.com/crypto-js/-/crypto-js-4.2.0.tgz", + "integrity": "sha512-KALDyEYgpY+Rlob/iriUtjV6d5Eq+Y191A5g4UqLAi8CyGP9N1+FdVbkc1SxKc2r4YAYqG8JzO2KGL+AizD70Q==" + }, + "node_modules/image-tools": { + "version": "1.4.0", + "resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz", + "integrity": "sha512-TKtvJ6iUwM0mfaD4keMnk1ENHFC470QEjBfA3IlvKdEOufzvWbjbaoNcoyYq6HlViF8+d5tOS1ooE6j7CHf1lQ==" + }, + "node_modules/luch-request": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/luch-request/-/luch-request-3.1.1.tgz", + "integrity": "sha512-p7+mlcEtgRcd0OfXC4XZbyiwSr1XgCeqNT7LlVUjnk7InYl/8d5Rk7BUqAYNA2WRafI1wRIUQWRWZRpeUwWR0w==", + "dependencies": { + "@dcloudio/types": "^2.0.16" + } + } + }, "dependencies": { "@dcloudio/types": { "version": "2.6.12", diff --git a/pages.json b/pages.json index 51896f3..85d0763 100644 --- a/pages.json +++ b/pages.json @@ -199,7 +199,43 @@ } }, { - "path" : "pages/HealthExaminationApp/index/index", + "path": "pages/HealthExaminationApp/index/index", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/HealthExaminationApp/appointment/appointment", + "style": { + "navigationBarTitleText": "体检预约" + } + }, + { + "path": "pages/HealthExaminationApp/report/report", + "style": { + "navigationBarTitleText": "体检报告" + } + }, + { + "path": "pages/HealthExaminationApp/report/pdfView", + "style": { + "navigationBarTitleText": "体检报告" + } + }, + { + "path": "pages/HealthExaminationApp/myAppointment/myAppointment", + "style": { + "navigationStyle": "custom" + } + }, + { + "path": "pages/HealthExaminationApp/jobAppointment/jobAppointment", + "style": { + "navigationBarTitleText": "职业预约" + } + }, + { + "path" : "pages/YNEduApp/index/notices", "style" : { "navigationStyle": "custom" @@ -280,11 +316,7 @@ "navigationStyle": "custom" } }, - - - - - {//考勤 + {//考勤 "path": "pages/realName/workAttendance/index", "style": { "navigationStyle": "custom" @@ -295,7 +327,46 @@ "style": { "navigationStyle": "custom" } - } + }, + + + + + { + "path" : "pages/YNEduApp/learnProj/imageStudy", + "style" : + { + "navigationBarTitleText" : "图片学习" + } + }, + { + "path" : "pages/HealthExaminationApp/myAppointment/bookSuccessfully", + "style" : + { + "navigationBarTitleText" : "体检预约" + } + }, + { + "path" : "pages/HealthExaminationApp/myAppointment/healthExamDetails", + "style" : + { + "navigationBarTitleText" : "体检预约单" + } + }, + { + "path" : "pages/HealthExaminationApp/index/userInfo", + "style" : + { + "navigationBarTitleText" : "个人信息" + } + }, + { + "path" : "pages/HealthExaminationApp/index/message", + "style" : + { + "navigationBarTitleText" : "消息通知" + } + } ], "globalStyle": { "fontFamily": "Helvetica, Arial, sans-serif", diff --git a/pages/HealthExaminationApp/appointment/appointment.vue b/pages/HealthExaminationApp/appointment/appointment.vue index 5b11614..e2d6907 100644 --- a/pages/HealthExaminationApp/appointment/appointment.vue +++ b/pages/HealthExaminationApp/appointment/appointment.vue @@ -1,19 +1,508 @@ diff --git a/pages/HealthExaminationApp/index/index.vue b/pages/HealthExaminationApp/index/index.vue index b8bf5c4..a0cc650 100644 --- a/pages/HealthExaminationApp/index/index.vue +++ b/pages/HealthExaminationApp/index/index.vue @@ -1,6 +1,5 @@ + + diff --git a/pages/HealthExaminationApp/index/userInfo.vue b/pages/HealthExaminationApp/index/userInfo.vue new file mode 100644 index 0000000..5590933 --- /dev/null +++ b/pages/HealthExaminationApp/index/userInfo.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue b/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue index 8dd0490..fbf2e4b 100644 --- a/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue +++ b/pages/HealthExaminationApp/jobAppointment/jobAppointment.vue @@ -1,19 +1,413 @@ diff --git a/pages/HealthExaminationApp/myAppointment/bookSuccessfully.vue b/pages/HealthExaminationApp/myAppointment/bookSuccessfully.vue new file mode 100644 index 0000000..0cc8d2d --- /dev/null +++ b/pages/HealthExaminationApp/myAppointment/bookSuccessfully.vue @@ -0,0 +1,51 @@ + + + + + diff --git a/pages/HealthExaminationApp/myAppointment/healthExamDetails.vue b/pages/HealthExaminationApp/myAppointment/healthExamDetails.vue new file mode 100644 index 0000000..bb29a8c --- /dev/null +++ b/pages/HealthExaminationApp/myAppointment/healthExamDetails.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/pages/HealthExaminationApp/myAppointment/myAppointment.vue b/pages/HealthExaminationApp/myAppointment/myAppointment.vue index a75ba8d..355fe41 100644 --- a/pages/HealthExaminationApp/myAppointment/myAppointment.vue +++ b/pages/HealthExaminationApp/myAppointment/myAppointment.vue @@ -1,19 +1,278 @@ diff --git a/pages/HealthExaminationApp/report/pdfView.vue b/pages/HealthExaminationApp/report/pdfView.vue new file mode 100644 index 0000000..41088f8 --- /dev/null +++ b/pages/HealthExaminationApp/report/pdfView.vue @@ -0,0 +1,104 @@ + + + + + diff --git a/pages/HealthExaminationApp/report/report.vue b/pages/HealthExaminationApp/report/report.vue index 748742a..c6f9034 100644 --- a/pages/HealthExaminationApp/report/report.vue +++ b/pages/HealthExaminationApp/report/report.vue @@ -1,19 +1,231 @@ diff --git a/pages/YNEduApp/exam/beforeExam.vue b/pages/YNEduApp/exam/beforeExam.vue index 811a783..76afde3 100644 --- a/pages/YNEduApp/exam/beforeExam.vue +++ b/pages/YNEduApp/exam/beforeExam.vue @@ -21,7 +21,7 @@ -
*进入考试后,计时结束将自动交卷,退出后将会继续计时
+
*进入考试后,计时结束将自动交卷,退出后将会继续计时,考试期间请勿登录其他设备,否则成绩作废
@@ -62,7 +62,7 @@ export default { content: '是否确认进入考试?', examId: '', examNum: 0, // 考试次数 - examCount: 1, // 1: 不限次 2: 及格终止 3: 自定义 + examCount: '', // 1: 不限次 2: 及格终止 3: 自定义 examCustom: 0, // 自定义次数 score: 0, passScore: 0 @@ -75,6 +75,10 @@ export default { this.title = opt.name this.subtitle = opt.validityDate this.duration = opt.responseTime + this.examNum = opt.examNum + this.count = opt.examCount === 1 ? '不限次' : opt.examCount === 2 ? '及格终止' : opt.examCustom + this.examCount = opt.examCount + this.examCustom = opt.examCustom this.switchCount = opt.cutNum.includes('null') || opt.cutNum.includes('undefined') ? '不限次' : opt.cutNum this.studyId = opt.studyId this.score = opt.score diff --git a/pages/YNEduApp/exam/exam.vue b/pages/YNEduApp/exam/exam.vue index 1e1a987..29496f6 100644 --- a/pages/YNEduApp/exam/exam.vue +++ b/pages/YNEduApp/exam/exam.vue @@ -85,6 +85,7 @@ export default { // this.allList = this.list = res.data // this.waitList = res.data.filter(item => item.status === 1) // this.alreadyList = res.data.filter(item => item.status === 2) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudentExamList', method: 'post', @@ -95,11 +96,13 @@ export default { }, success: res => { console.log('🚀 ~ getList ~ res:', res) + this.activeIndex = 0 res = res.data this.list = this.allList this.allList = this.list = res.data this.waitList = res.data.filter(item => item.status === 1) this.alreadyList = res.data.filter(item => item.status === 2) + this.absentList = res.data.filter(item => item.status === 3 && item.examNum === 0) }, fail: err => { console.log(err) @@ -121,6 +124,19 @@ export default { // 开始考试 handleExamination(item) { console.log('🚀 ~ handleExamination ~ item:', item) + // 获取当前考试限制时间 item.validityDate 2021-09-01~2021-09-30 如果今天不在这个范围内, 不能考试 + const date = new Date() + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` + if (today < item.validityDate.split('~')[0] || today > item.validityDate.split('~')[1]) { + uni.showToast({ + title: '当前时间不在考试时间范围内', + icon: 'none' + }) + return + } if (item.examEquipment == 2) { uni.showToast({ title: '请在电脑端进行考试', @@ -151,7 +167,7 @@ export default { examNum: item.examNum, // 考试次数 examCount: item.examCount, // 考试次数类型 examCustom: item.examCustom, // 自定义考试次数 - score: item.score, // 总分 + score: item.score, // 总 passScore: item.passScore // 及格分数 } uni.navigateTo({ diff --git a/pages/YNEduApp/exam/examination.vue b/pages/YNEduApp/exam/examination.vue index c3f03c4..cd4d528 100644 --- a/pages/YNEduApp/exam/examination.vue +++ b/pages/YNEduApp/exam/examination.vue @@ -66,15 +66,24 @@ @click="clickImg(fileUrl + item.examTopicUrl)" />
-
-
{{ option.optionIdent }}.
-
{{ option.optionContent }}
+
+
+
{{ option.optionIdent }}.
+
{{ option.optionContent }}
+
+
@@ -130,6 +139,7 @@ import config from '@/config' export default { data() { return { + isLoading: false, // 考试id examId: '', // 考试记录id @@ -144,7 +154,6 @@ export default { examTime: 0, random1: 0, random2: 0, - hasScanned: false, // 答题时间 answerTime: 0, currentIndex: 0, @@ -192,16 +201,14 @@ export default { onHide() { // this.screenCount++ // console.log('🚀 ~ onHide ~ this.screenCount:', this.screenCount) - if (!this.isHide) { - this.handleConfirmSubmit() - } + setTimeout(() => { + if (!this.isHide) { + this.handleConfirmSubmit() + } + }, 500) }, mounted() { this.getList() - this.random1 = Math.ceil(Math.random() * 100000) + 420000 // random1 在 7-13分钟之间 - // this.random1 = 10000 - this.random2 = Math.ceil(Math.random() * 100000) + 900000 // random2 在 15-19分钟之间 - console.log('🚀 ~ mounted ~ this.random1:', this.random1, this.random2) }, // onUnload() { // console.log('🚀 ~ onUnload ~ 页面关闭') @@ -214,14 +221,7 @@ export default { const params = { examId: this.examId } - // const res = await getExamQuestionList(params) - // const data = res.data - // this.questionList = data.examPaperData - // this.recordId = data.recordId - // this.examTime = data.answerTime - // this.time = Number(data.answerTime) * 60 * 1000 - // console.log('🚀 ~ getList ~ this.time:', this.time) - // console.log('🚀 ~ getList ~ res考试题:', res) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/getExamQuestionList', method: 'post', @@ -240,6 +240,9 @@ export default { this.time = Number(data.answerTime) * 60 * 1000 console.log('🚀 ~ getList ~ this.time:', this.time) console.log('🚀 ~ getList ~ this.questionList:', this.questionList) + this.random1 = (data.answerTime / 3) * 60 + Math.ceil(Math.random() * 20) + 20 + this.random2 = (data.answerTime / 2) * 60 + Math.ceil(Math.random() * 30) + 30 + console.log('🚀 ~ getList ~ this.random1:', this.random1, this.random2) if (this.questionList.length > 0) { this.questionList.forEach((item, index) => { this.$set(item, 'isShow', index < 7) @@ -267,20 +270,27 @@ export default { changeCountDown(time) { // console.log('🚀 ~ changeCountDown ~ time:', time) // 等时间赋值后再开始计时 - if (this.time == 0) return + if (this.time == 0 && !this.isLoading) return this.answerTime = this.time - (time.days * 24 * 60 * 60 + time.hours * 60 * 60 + time.minutes * 60 + time.seconds) * 1000 // console.log('🚀 ~ changeCountDown ~ this.answerTime:', this.answerTime) - if (this.answerTime > this.random1 && this.answerTime < this.random2 && !this.hasScanned) { - this.openFaceScan() // Android 人脸识别 - // this.openPhotograph() // IOS 拍照识别 - this.hasScanned = true - } else if (this.answerTime > this.random2 && this.hasScanned) { - this.openFaceScan() - // this.openPhotograph() - this.hasScanned = false - } - if (this.answerTime == this.time) { + console.log( + '🚀 ~ changeCountDown ~ this.answerTime:', + this.time, + this.answerTime / 1000, + this.random1, + this.random2 + ) + console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random1) + console.log('🚀 ~ changeCountDown ~:', this.answerTime / 1000 == this.random2) + if (this.answerTime / 1000 == this.random1) { + console.log('🚀 ~ changeCountDown ~ 人脸识别') + // this.openFaceScan() // Android 人脸识别 + this.openPhotograph() // IOS 拍照识别 + } else if (this.answerTime / 1000 == this.random2) { + // this.openFaceScan() + this.openPhotograph() + } else if (this.answerTime == this.time) { // 提示: 时间结束, 自动提交 this.$refs.uToast.show({ message: '考试时间结束, 系统将自动提交', @@ -336,8 +346,12 @@ export default { questionId: item.id, selectAnswer } + if (item.examType == 3) { + params.selectAnswer = selectAnswer == 'A' ? '对' : '错' + } console.log('🚀 ~ handleSelectOption ~ params:', params) // insertQuestionAnswerById(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/insertQuestionAnswerById', method: 'post', @@ -345,6 +359,9 @@ export default { header: { 'Content-Type': 'application/x-www-form-urlencoded', Authorization: uni.getStorageSync('access_token') + }, + success: res => { + console.log('🚀 ~ handleSelectOption ~ res:', res) } }) }, @@ -354,6 +371,15 @@ export default { }, // 确认提交 handleConfirmSubmit() { + console.log('🚀 ~ 提交-->', this.isLoading) + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true // 停止计时 this.$refs.countDown.pause() const params = { @@ -364,6 +390,7 @@ export default { answerTime: Math.ceil(this.answerTime / 60000) } // const res = await commitExamByRecordId(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/commitExamByRecordId', method: 'post', @@ -375,7 +402,6 @@ export default { success: res => { console.log('🚀 ~ handleConfirmSubmit ~ res:', res) res = res.data - this.showConfirmModal = false const params2 = { examId: this.examId, examGrade: res.examGrade, @@ -385,7 +411,7 @@ export default { examTime: this.examTime, questionCount: this.questionList.length, switchCount: this.switchCount, - examNum: this.examNum, + examNum: this.examNum + 1, examCount: this.examCount, examCustom: this.examCustom, results: res.examResult, @@ -396,6 +422,9 @@ export default { uni.navigateTo({ url: `/pages/YNEduApp/exam/examinationDetails?params=${JSON.stringify(params2)}` }) + setTimeout(() => { + this.showConfirmModal = false + }, 1000) } }) if (this.studyId) { @@ -424,18 +453,18 @@ export default { // }) }, // 人脸识别 - async openFaceScan() { - face.open(['a'], e => { - console.log('🚀 ~ e-人脸识别:', e) - face.close() - let params = { - userId: uni.getStorageSync('userId'), - img: e - } - params = JSON.stringify(params) - this.getFaceRecognition(params) - }) - }, + // async openFaceScan() { + // face.open(['a'], e => { + // console.log('🚀 ~ e-人脸识别:', e) + // face.close() + // let params = { + // userId: uni.getStorageSync('userId'), + // img: e + // } + // params = JSON.stringify(params) + // this.getFaceRecognition(params) + // }) + // }, // 拍照录入 openPhotograph() { this.isHide = true @@ -450,7 +479,7 @@ export default { this.imgToBase64(res.tempFilePaths[0]).then(base64 => { url = base64 console.log('🚀 ~ this.imgToBase64 ~ base64:', url) - this.getFaceRecognition(url) + this.getFaceRecognition({ userId: uni.getStorageSync('userId'), img: url }) }) }, fail: err => { @@ -473,6 +502,8 @@ export default { }, // 发送请求 getFaceRecognition(params) { + console.log('🚀 ~ getFaceRecognition ~ params:', params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getFaceRecognition', method: 'POST', @@ -482,8 +513,9 @@ export default { }, data: params, success: res => { + console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res) res = res.data - console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res, res.code) + console.log('🚀 ~ openFaceScan ~ res-人脸识别:', res.code) if (res.code == 200) { this.$refs.uToast.show({ message: '人脸识别成功', @@ -501,6 +533,10 @@ export default { }, fail(err) { console.log('🚀 ~ openFaceScan ~ 人脸识别失败', err) + this.$refs.uToast.show({ + message: err.errMsg, + duration: 1000 + }) } }) }, @@ -512,6 +548,7 @@ export default { // this.screenCount-- }, updStudyDurationExamPractice(params) { + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/student/updStudyDurationExamPractice', method: 'post', @@ -620,27 +657,32 @@ export default { } .options { margin-top: 10px; - .option { - display: flex; - justify-content: flex-start; - align-items: center; - margin-top: 10px; - background: #f4f9fe; - border-radius: 5px; - &.isActive { - background: #8cbff1; - color: #fff; - } - .option-item { - width: 33px; - height: 33px; - line-height: 33px; - text-align: center; - color: #333; - } - .option-content { - margin-left: 10px; - color: #333; + margin-bottom: 30px; + .option-wrapper { + max-height: 500px; + overflow: auto; + .option { + display: flex; + justify-content: flex-start; + align-items: center; + margin-top: 10px; + background: #f4f9fe; + border-radius: 5px; + &.isActive { + background: #8cbff1; + color: #fff; + } + .option-item { + width: 33px; + height: 33px; + line-height: 33px; + text-align: center; + color: #333; + } + .option-content { + margin-left: 10px; + color: #333; + } } } } diff --git a/pages/YNEduApp/exam/examinationDetails.vue b/pages/YNEduApp/exam/examinationDetails.vue index 84dba6b..ae62313 100644 --- a/pages/YNEduApp/exam/examinationDetails.vue +++ b/pages/YNEduApp/exam/examinationDetails.vue @@ -94,7 +94,7 @@ export default { questionCount: 0, // 考试次数 examNum: 0, - examCount: 1, // 考试次数 1: 不限次 2: 及格终止 3: 自定义 + examCount: '', // 考试次数 1: 不限次 2: 及格终止 3: 自定义 examCustom: 0, // 自定义次数 results: 0, // 考试结果 studyId: '', @@ -138,7 +138,7 @@ export default { } else { from = '/pages/YNEduApp/exam/exam' } - + // examCount 1: 不限次 2: 及格终止 3: 自定义 if (this.examCount == 2 && this.results == 1) { uni.showToast({ @@ -146,7 +146,7 @@ export default { icon: 'none' }) setTimeout(() => { - uni.navigateTo({ + uni.reLaunch({ url: from }) }, 1000) @@ -156,23 +156,24 @@ export default { icon: 'none' }) setTimeout(() => { - uni.navigateTo({ + uni.reLaunch({ url: from }) }, 1000) + } else { + const params = { + examId: this.examId, + examNum: this.examNum, + examCount: this.examCount, + examCustom: this.examCustom, + switchCount: this.switchCount, + studyId: this.studyId + } + console.log('🚀 ~ handleResetExamination ~ params:', params) + uni.navigateTo({ + url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}` + }) } - const params = { - examId: this.examId, - examNum: this.examNum, - examCount: this.examCount, - examCustom: this.examCustom, - switchCount: this.switchCount, - studyId: this.studyId - } - console.log('🚀 ~ handleResetExamination ~ params:', params) - uni.navigateTo({ - url: `/pages/YNEduApp/exam/examination?params=${JSON.stringify(params)}` - }) }, handleArrow() { let from = '' @@ -193,6 +194,7 @@ export default { } // const res = await getExamRankById(params) // this.rankList = res.data + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/getExamRankById', method: 'post', diff --git a/pages/YNEduApp/exam/examinationList.vue b/pages/YNEduApp/exam/examinationList.vue index f256bec..002a4a3 100644 --- a/pages/YNEduApp/exam/examinationList.vue +++ b/pages/YNEduApp/exam/examinationList.vue @@ -18,7 +18,7 @@
得分/总分: - {{ item.score }}/{{ item.examGrade }} + {{ item.examGrade }}/{{ item.score }}
得分率: @@ -66,6 +66,7 @@ export default { // const res = await getExamRecordById(params) // console.log('🚀 ~ getList ~ res:', res) // this.list = res.data + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/getExamRecordById', method: 'get', diff --git a/pages/YNEduApp/exam/examinationResultDetails.vue b/pages/YNEduApp/exam/examinationResultDetails.vue index 41b1a4a..96e806b 100644 --- a/pages/YNEduApp/exam/examinationResultDetails.vue +++ b/pages/YNEduApp/exam/examinationResultDetails.vue @@ -95,9 +95,9 @@
-
+ {{ grade }}{{ gradeIndex + 1 == item.selectAnswer.split('').length ? '' : ', ' }} -
+
@@ -115,7 +115,7 @@
-
+
@@ -481,6 +481,7 @@ export default { } // const res = await getExamRecordAnswer(params) // this.questionList = res.data.examPaperData + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentExam/getExamRecordAnswer', method: 'post', diff --git a/pages/YNEduApp/index/index.vue b/pages/YNEduApp/index/index.vue index 1cdaded..8ff47cd 100644 --- a/pages/YNEduApp/index/index.vue +++ b/pages/YNEduApp/index/index.vue @@ -45,7 +45,7 @@ height="8" activeColor="#579AF8" /> -
{{ item.trainPercentage }}%
+
{{ item.trainPercentage || 0 }}%
@@ -99,9 +99,13 @@ export default { console.log('🚀 ~ mounted ~ mounted-index:') this.getList() this.getMsgList() + setTimeout(() => { + this.$verificationToken() + + }, 1000) }, methods: { - async getList() { + getList() { this.taskList = [] let params = { userId: this.userId, @@ -111,6 +115,7 @@ export default { // console.log('🚀 ~ getList ~ res:', res) // this.taskList = res.data console.log('🚀 ~ toggleSearch ~ params:', params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudentStudyWorkList', method: 'post', @@ -137,6 +142,7 @@ export default { } // const res = await getStudentStudyWorkList(params) // this.taskList = res.data + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudentStudyWorkList', method: 'post', @@ -154,6 +160,7 @@ export default { }, // 获取消息列表 getMsgList() { + this.$verificationToken() uni.request({ url: config.bmwUrl + '/studentUsers/getNoticeList', method: 'post', diff --git a/pages/YNEduApp/index/notices.vue b/pages/YNEduApp/index/notices.vue index 662254d..8d733b8 100644 --- a/pages/YNEduApp/index/notices.vue +++ b/pages/YNEduApp/index/notices.vue @@ -24,7 +24,8 @@ export default { }, methods: { // 获取消息列表 - async getMsgList() { + getMsgList() { + this.$verificationToken() uni.request({ url: config.bmwUrl + '/studentUsers/getNoticeList', method: 'post', diff --git a/pages/YNEduApp/learn/learn.vue b/pages/YNEduApp/learn/learn.vue index 2826801..3ea4dff 100644 --- a/pages/YNEduApp/learn/learn.vue +++ b/pages/YNEduApp/learn/learn.vue @@ -40,6 +40,7 @@ export default { }, data() { return { + isLoading: false, studyId: '', // 学习id stageId: '', // 阶段id stageContentId: '', // 阶段内容id @@ -53,7 +54,8 @@ export default { // 当前播放时间 currentTime: 0, showModal: false, // 是否显示弹窗 - content: '是否确认结束学习?' + content: '是否确认结束学习?', + isEnd: false } }, onLoad(opt) { @@ -69,11 +71,24 @@ export default { console.log('🚀 ~ onLoad ~ this.path:', this.path) this.studyDuration = this.currentTime = Number(opt.studyDuration) this.allStudyDuration = Number(opt.allStudyDuration) + this.isEnd = opt.isEnd + if (opt.isEnd) { + this.studyDuration = 0 + } + }, + onHide() { + console.log('🚀 ~ onHide ~ 页面隐藏') + if (!this.isEnd) { + // 关闭页面时,修改项目进度 + this.handleEnd() + } }, onUnload() { console.log('🚀 ~ onUnload ~ 页面关闭') - // 关闭页面时,修改项目进度 - this.handleEnd() + if (!this.isEnd) { + // 关闭页面时,修改项目进度 + this.handleEnd() + } }, methods: { videoErrorCallback(e) { @@ -89,6 +104,20 @@ export default { }, // 结束学习 handleEnd() { + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true + if (this.isEnd) { + uni.reLaunch({ + url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId + }) + return + } // 手动暂停视频 const video = uni.createVideoContext('myVideo') video.pause() @@ -96,7 +125,10 @@ export default { console.log('当前播放时间:', this.currentTime, this.allStudyDuration) this.studyDuration = this.currentTime // 计算学习进度 - this.studyPercentage = Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2) + this.studyPercentage = + Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2) > 100 + ? 100 + : Math.ceil((this.studyDuration / this.allStudyDuration) * 100).toFixed(2) console.log('🚀 ~ handleEnd ~ this.studyPercentage:', this.studyPercentage) const params = { @@ -116,6 +148,7 @@ export default { // this.showModal = false // uni.navigateBack() // }) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/student/updStudyDuration', method: 'post', @@ -126,10 +159,13 @@ export default { }, success: res => { console.log('🚀 ~ handleEnd ~ res:', res) - this.showModal = false - uni.navigateTo({ + uni.reLaunch({ url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId }) + setTimeout(() => { + this.isLoading = false + this.showModal = false + }, 1000) }, fail: err => { console.log('🚀 ~ handleEnd ~ err:', err) diff --git a/pages/YNEduApp/learnProj/components/PdfView.vue b/pages/YNEduApp/learnProj/components/PdfView.vue index fa163ca..c5e9e50 100644 --- a/pages/YNEduApp/learnProj/components/PdfView.vue +++ b/pages/YNEduApp/learnProj/components/PdfView.vue @@ -80,7 +80,7 @@ export default { handlePostMessage(data) { let arr = data.detail.data.pop() this.totalPage = arr[0].totalPage //总页数 - this.currentReadPage = arr[1].page + 1 //当前页数 + this.currentReadPage = arr[1].page //当前页数 console.log('app:', this.totalPage, this.currentReadPage) }, //h5 监听 diff --git a/pages/YNEduApp/learnProj/imageStudy.vue b/pages/YNEduApp/learnProj/imageStudy.vue new file mode 100644 index 0000000..39f81c2 --- /dev/null +++ b/pages/YNEduApp/learnProj/imageStudy.vue @@ -0,0 +1,154 @@ + + + + + diff --git a/pages/YNEduApp/learnProj/learnProj.vue b/pages/YNEduApp/learnProj/learnProj.vue index d78e696..85c479a 100644 --- a/pages/YNEduApp/learnProj/learnProj.vue +++ b/pages/YNEduApp/learnProj/learnProj.vue @@ -229,6 +229,7 @@ export default { }) }, getStudentStudyWorkList(params) { + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudentStudyWorkList', method: 'post', diff --git a/pages/YNEduApp/learnProj/learnProjDetail.vue b/pages/YNEduApp/learnProj/learnProjDetail.vue index 5d43504..4fcba7a 100644 --- a/pages/YNEduApp/learnProj/learnProjDetail.vue +++ b/pages/YNEduApp/learnProj/learnProjDetail.vue @@ -243,6 +243,7 @@ export default { // 获取学习项目详情 async getStudyWorkAll() { let params = { userId: uni.getStorageSync('userId'), id: this.projId, type: '1' } + this.$verificationToken() uni.request({ method: 'post', url: config.bmwUrl + '/studyWork/StudyWorkAll', @@ -276,7 +277,8 @@ export default { sourceId: item.id, // 素材id path: item.path, // 视频路径 studyDuration: item.studyDuration || 0, // 学习时长 - allStudyDuration: item.allStudyDuration // 总时长 + allStudyDuration: item.allStudyDuration, // 总时长 + isEnd: item.studyPercentage >= 100 ? true : false } console.log('🚀 ~ toggleTheoryLearn ~ params:', params) console.log('🚀 ~ toggleTheoryLearn ~ item:', item.path) @@ -286,6 +288,8 @@ export default { url = '/pages/YNEduApp/learn/learn' } else if (item.path.includes('.pdf')) { url = '/pages/YNEduApp/learnProj/pdfStudy' + } else { + url = '/pages/YNEduApp/learnProj/imageStudy' } uni.navigateTo({ @@ -314,6 +318,18 @@ export default { // 跳转考试 toggleTheoryExam(item) { console.log('🚀 ~ toggleTheoryExam ~ item:', item, item.examMsg.examEquipment) + const date = new Date() + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const today = `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}` + if (today < item.examMsg.validityDate.split('~')[0] || today > item.examMsg.validityDate.split('~')[1]) { + uni.showToast({ + title: '当前时间不在考试时间范围内', + icon: 'none' + }) + return + } if (item.examMsg.examEquipment == 2) { uni.showToast({ title: '请在电脑端进行考试', @@ -321,6 +337,20 @@ export default { }) return } + // examCount 1: 不限次 2: 及格终止 3: 自定义 + if (item.examMsg.examCount == 2 && item.examMsg.results == 1) { + uni.showToast({ + title: '此考试及格终止, 考试以及格, 无需再次考试', + icon: 'none' + }) + return + } else if (item.examMsg.examCount == 3 && item.examMsg.examNum >= item.examMsg.examCustom) { + uni.showToast({ + title: '此考试有次数限制, 考试次数已达上限, 无法再考试了', + icon: 'none' + }) + return + } const params = { id: item.examMsg.id, // 考试id cutNum: item.examMsg.isCut, // 切屏次数 diff --git a/pages/YNEduApp/learnProj/pdfStudy.vue b/pages/YNEduApp/learnProj/pdfStudy.vue index 8725906..3d321ff 100644 --- a/pages/YNEduApp/learnProj/pdfStudy.vue +++ b/pages/YNEduApp/learnProj/pdfStudy.vue @@ -1,7 +1,7 @@ @@ -26,55 +26,60 @@ export default { this.params = JSON.parse(JSON.stringify(opt)) this.params.studyDuration = Number(opt.studyDuration) this.params.allStudyDuration = Number(opt.allStudyDuration) - // this.path = - // config.fileUrl + opt.path + `&studyDuration=${opt.studyDuration}&allStudyDuration=${opt.allStudyDuration}` - this.path = opt.path + // 如果路径中带有http或者https则直接使用路径,否则拼接路径 + if (opt.path.indexOf('http') !== -1) { + this.path = opt.path + } else { + this.path = config.fileUrl + opt.path + } console.log('🚀 ~ onLoad ~ this.params:', this.path) console.log('🚀 ~ onLoad ~ this.params:', Number(opt.studyDuration), Number(opt.allStudyDuration)) - - // if (Number(opt.studyDuration) <= Number(opt.allStudyDuration)) { - // setTimeout(() => { - // this.countDown() - // }, 1000) - // } else { - // // 提示-学习时长已满 - // uni.showToast({ - // title: '学习时长已满, 随时可以结束学习', - // icon: 'none' - // }) - // } + if (Number(opt.studyDuration) < Number(opt.allStudyDuration)) { + setTimeout(() => { + this.countDown() + }, 1000) + } else { + // 提示-学习时长已满 + uni.showToast({ + title: '学习时长已满, 随时可以结束学习', + icon: 'none' + }) + } + }, + onHide() { + clearInterval(this.timer) + // 关闭页面时,修改项目进度 + this.updStudyDuration() }, // 卸载 onUnload() { console.log('🚀 ~ onUnload ~ 页面关闭') clearInterval(this.timer) // 关闭页面时,修改项目进度 - // this.updStudyDuration() + this.updStudyDuration() }, methods: { // 根据allStudyDuration 倒计时 countDown() { let allStudyDuration = Number(this.params.allStudyDuration) - Number(this.params.studyDuration) - // let studyDuration = Number(this.params.studyDuration) this.timer = setInterval(() => { allStudyDuration-- - // studyDuration++ - this.params.studyDuration++ - // this.$set(this.params, 'studyDuration', studyDuration) - console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) + this.params.studyDuration++ + console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) if (allStudyDuration <= 0) { + this.params.studyDuration = this.params.allStudyDuration clearInterval(this.timer) - // 提示-学习时长已满 - uni.showToast({ - title: '学习时长已满', - icon: 'none' - }) setTimeout(() => { this.updStudyDuration() + // 提示-学习时长已满 + uni.showToast({ + title: '学习时长已满', + icon: 'none' + }) }, 1000) } console.log('🚀 ~ countDown ~ 剩余时间-->:', allStudyDuration) - console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) + console.log('🚀 ~ countDown ~ this.params.studyDuration:', this.params.studyDuration) }, 1000) }, // 修改项目进度 @@ -88,11 +93,13 @@ export default { studyCourseId: this.params.studyCourseId, sourceId: this.params.sourceId, studyDuration: this.params.studyDuration, - studyPercentage: Math.ceil( - (Number(this.params.studyDuration) / Number(this.params.allStudyDuration)) * 100 - ).toFixed(2) + studyPercentage: + Math.ceil((Number(this.params.studyDuration) / Number(this.params.allStudyDuration)) * 100).toFixed(2) > 100 + ? 100 + : Math.ceil((Number(this.params.studyDuration) / Number(this.params.allStudyDuration)) * 100).toFixed(2) } console.log('🚀 ~ updStudyDuration ~ params:', params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/student/updStudyDuration', method: 'post', @@ -104,7 +111,7 @@ export default { success: res => { console.log('🚀 ~ handleEnd ~ res:', res) this.isShow = false - uni.navigateTo({ + uni.reLaunch({ url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.params.studyId }) }, diff --git a/pages/YNEduApp/prac/exercises.vue b/pages/YNEduApp/prac/exercises.vue index 062c463..d763f3f 100644 --- a/pages/YNEduApp/prac/exercises.vue +++ b/pages/YNEduApp/prac/exercises.vue @@ -17,7 +17,7 @@
-
+
{{ nowNum }}.{{ item.paperTopic }}{{ item.examType == 1 ? '(单选题)' : '(判断题)' }}
-
{{ option.optionIdent }}.{{ option.optionContent }}
+
+
+
{{ option.optionIdent }}.
+
{{ option.optionContent }}
+
+ +
@@ -46,15 +60,15 @@
正确答案:{{ item.correctGrade }}
你的答案:{{ item.select }}
-
+
答案解析:
{{ item.answerAnaly }}
-
-
{{ index + 1 }}. {{ item.paperTopic }}(多选题)
+
+
{{ nowNum }}. {{ item.paperTopic }}(多选题)
-
+
{{ option.optionIdent }}.
{{ option.optionContent }}
@@ -80,11 +94,11 @@
@@ -189,7 +203,7 @@ v-for="(item, index) in questionListSelect" :key="index" class="topic-wrapper" - :class="{ correct: item.isCorrect, error: item.isError }" + :class="{ correct: item.isTrue == 1, error: item.isTrue == 0 }" @click="handleJump('jump', item.index)" >
*
@@ -218,18 +232,20 @@ import config from '@/config' export default { data() { return { + isLoading: false, practiceId: '', // 练习id recordId: '', // 记录id isNew: 1, // 是否新练习 isOutOfOrder: 1, // 是否乱序 isError: false, // 是否错题消除 - nowNum: 0, // 当前题目索引 + nowNum: '', // 当前题目索引 showModal: false, showModalSelect: false, // 正确率 correctRate: '0', // 已用时间 - 计时器 - 用于显示已用时间 格式 00:00:00 usedTime: '00:00:00', + serviceTime: 0, // 正确题数 trueNum: 0, // 错误题数 @@ -271,19 +287,14 @@ export default { }, methods: { // 获取题目-上方数量 - async getPracticeItData() { + getPracticeItData() { const params = { practiceId: this.practiceId, recordId: this.recordId, isNew: this.isNew || '', isMiss: this.isError ? '1' : '' } - // const res = await getPracticeItData(params) - // this.trueNum = res.data.trueNum - // this.falseNum = res.data.falseNum - // this.allNum = res.data.allNum - // this.nowNum = res.data.nowNum - // console.log('🚀 ~ getPracticeItData ~ res:', res) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/getPracticeItData', method: 'post', @@ -306,7 +317,7 @@ export default { }) }, // 获取题目 - async getPracticeQuestion() { + getPracticeQuestion() { this.questionList = [] const params = { practiceId: this.practiceId, @@ -320,6 +331,7 @@ export default { // this.questionList.push(res.data) // console.log('🚀 ~ getPracticeQuestion ~ res:', res) // console.log('🚀 ~ getPracticeQuestion ~ this.questionList:', this.questionList) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestion', method: 'post', @@ -331,8 +343,43 @@ export default { success: res => { console.log('🚀 ~ getPracticeQuestion ~ res:', res) res = res.data - this.recordId = res.data.recordId ? res.data.recordId : this.recordId this.questionList.push(res.data) + console.log('🚀 ~ getPracticeQuestion ~ :', this.questionList[0]) + this.recordId = res.data.recordId ? res.data.recordId : this.recordId + if (res.data.selectAnswer) { + console.log('执行了--') + if (this.questionList[0].examType == 2) { + this.questionList[0].select = res.data.selectAnswer.split('') + this.questionList[0].isSelect = true + // 给selectAnswer选项如果正确添加正确标记, 错误添加错误标记并给正确选项添加标记 + this.questionList[0].listOption.forEach(item => { + if (res.data.selectAnswer.includes(item.optionIdent)) { + item.isSelect = true + } + if (res.data.correctGrade.includes(item.optionIdent)) { + item.isCorrect = true + } + if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) { + item.isError = true + } + }) + } else { + this.questionList[0].select = res.data.selectAnswer + this.questionList[0].isSelect = true + // 给selectAnswer选项如果正确添加正确标记, 错误添加错误标记并给正确选项添加标记 + this.questionList[0].listOption.forEach(item => { + if (res.data.selectAnswer === item.optionIdent) { + item.isSelect = true + } + if (item.optionIdent === this.questionList[0].correctGrade) { + item.isCorrect = true + } + if (item.isSelect && item.optionIdent !== this.questionList[0].correctGrade) { + item.isError = true + } + }) + } + } }, fail: err => { console.log(err) @@ -340,15 +387,16 @@ export default { }) }, // 跳题 - async handleJump(item, index) { + handleJump(item, index) { console.log('🚀 ~ handleJump ~ item:', item, this.recordId) if (item === 'prev') { - this.nowNum -= 1 + this.nowNum-- } else if (item === 'next') { - this.nowNum += 1 + this.nowNum++ } else if (item === 'jump') { this.nowNum = index } + console.log('🚀 ~ handleJump ~ this.nowNum:', this.nowNum) this.currentIndex = index this.questionList = [] @@ -363,6 +411,7 @@ export default { // const res = await changeQuestion(params) // this.questionList.push(res.data) // console.log('🚀 ~ handleJump ~ res:', res) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/changeQuestion', method: 'post', @@ -375,6 +424,39 @@ export default { console.log('🚀 ~ handleJump ~ res:', res) res = res.data this.questionList.push(res.data) + if (res.data.selectAnswer) { + if (this.questionList[0].examType == 2) { + this.questionList[0].select = res.data.selectAnswer.split('') + this.questionList[0].isSelect = true + // 给selectAnswer选项如果正确添加正确标记, 错误添加错误标记并给正确选项添加标记 + this.questionList[0].listOption.forEach(item => { + if (res.data.selectAnswer.includes(item.optionIdent)) { + item.isSelect = true + } + if (res.data.correctGrade.includes(item.optionIdent)) { + item.isCorrect = true + } + if (item.isSelect && !this.questionList[0].correctGrade.includes(item.optionIdent)) { + item.isError = true + } + }) + } else { + this.questionList[0].select = res.data.selectAnswer + this.questionList[0].isSelect = true + // 给selectAnswer选项如果正确添加正确标记, 错误添加错误标记并给正确选项添加标记 + this.questionList[0].listOption.forEach(item => { + if (res.data.selectAnswer === item.optionIdent) { + item.isSelect = true + } + if (item.optionIdent === this.questionList[0].correctGrade) { + item.isCorrect = true + } + if (item.isSelect && item.optionIdent !== this.questionList[0].correctGrade) { + item.isError = true + } + }) + } + } }, fail: err => { console.log(err) @@ -382,7 +464,7 @@ export default { }) }, // 获取题目列表-弹框 - async getPracticeQuestionList() { + getPracticeQuestionList() { const params = { recordId: this.recordId, practiceId: this.practiceId, @@ -391,6 +473,7 @@ export default { // const res = await getPracticeQuestionList(params) // console.log('🚀 ~ getPracticeQuestionList ~ res:', res) // this.questionListSelect = res.data + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionList', method: 'post', @@ -412,24 +495,36 @@ export default { // 开始计时 - 实时更新已用时间 startTimer() { this.intervalId = setInterval(() => { - const time = this.usedTime.split(':') - let hours = parseInt(time[0]) - let minutes = parseInt(time[1]) - let seconds = parseInt(time[2]) - seconds++ - if (seconds === 60) { - seconds = 0 - minutes++ - if (minutes === 60) { - minutes = 0 - hours++ - } - } - this.usedTime = `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}:${ - seconds < 10 ? '0' + seconds : seconds - }` + this.serviceTime++ + this.handleTime() + // const time = this.usedTime.split(':') + // let hours = parseInt(time[0]) + // let minutes = parseInt(time[1]) + // let seconds = parseInt(time[2]) + // seconds++ + // if (seconds === 60) { + // seconds = 0 + // minutes++ + // if (minutes === 60) { + // minutes = 0 + // hours++ + // } + // } + // this.usedTime = `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}:${ + // seconds < 10 ? '0' + seconds : seconds + // }` }, 1000) }, + // 处理时间 + handleTime() { + // this.serviceTime 是秒数 + let hours = parseInt(this.serviceTime / 3600) + let minutes = parseInt((this.serviceTime % 3600) / 60) + let seconds = parseInt(this.serviceTime % 60) + this.usedTime = `${hours < 10 ? '0' + hours : hours}:${minutes < 10 ? '0' + minutes : minutes}:${ + seconds < 10 ? '0' + seconds : seconds + }` + }, clickImg(url) { console.log('🚀 ~ clickImg ~ url:', url) uni.previewImage({ @@ -482,6 +577,7 @@ export default { console.log('🚀 ~ handleOption ~ params:', params) // 提交答案 // insertPracticeAnswerById(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/insertPracticeAnswerById', method: 'post', @@ -560,10 +656,12 @@ export default { recordId: this.recordId, questionId: this.questionList[0].questionId, selectAnswer: select.join(''), - isTrue: isCorrect ? 1 : 0 + isTrue: isCorrect ? 1 : 0, + isMiss: this.isError ? '1' : '' } console.log('🚀 ~ handleOk ~ params-多选:', params) // insertPracticeAnswerById(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/insertPracticeAnswerById', method: 'post', @@ -579,7 +677,9 @@ export default { } }, // 提交 - async handleSubmit() { + handleSubmit() { + // 暂停时间 + clearInterval(this.intervalId) console.log('提交') this.answerNum = this.trueNum + this.falseNum let rate = ((Number(this.trueNum) / Number(this.answerNum)) * 100).toFixed(2) @@ -609,30 +709,32 @@ export default { handleConfirm() { console.log('确认') this.showModal = false + // 继续计时 + this.startTimer() }, // 结束答题 handleClose() { + if (this.isLoading) { + uni.showToast({ + title: '正在提交中, 请稍后', + icon: 'none' + }) + return + } + this.isLoading = true this.isEnd = true // 停止计时 - clearInterval() - console.log('结束', this.usedTime) + clearInterval(this.intervalId) + console.log('结束', this.usedTime, this.serviceTime) // 保存练习时长 - // savePracticeDuration({ - // id: this.practiceId, - // practiceDuration: Math.ceil(this.usedTime.split(':')[0] * 60 + this.usedTime.split(':')[1] / 60) - // }) - // 将this.usedTime 00:00:00 转换为分钟 - let time = this.usedTime.split(':').reduce((acc, cur, index) => { - return acc + cur * Math.pow(60, 2 - index) - }, 0) - // 再将秒数转换为分钟, 不足一分钟算一分钟 - time = Math.ceil(time / 60) + let time = Math.ceil(this.serviceTime / 60) console.log('🚀 ~ handleClose ~ time:', time) const params = { id: this.recordId, practiceDuration: time } console.log('🚀 ~ handleClose ~ params:', params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/savePracticeDuration', method: 'post', @@ -650,6 +752,7 @@ export default { // updateRemoveRecordData({ // practiceId: this.practiceId // }) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/updateRemoveRecordData', method: 'post', @@ -671,6 +774,7 @@ export default { studyId: this.studyId } // updStudyDurationExamPractice(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/student/updStudyDurationExamPractice', method: 'post', @@ -693,10 +797,13 @@ export default { url: '/pages/YNEduApp/prac/prac' }) } - this.showModal = false + setTimeout(() => { + this.isLoading = false + this.showModal = false + }, 500) }, // 打开题目选择弹框 - async openSelect() { + openSelect() { this.showModalSelect = true // const res = await this.getPracticeQuestionList() // console.log('🚀 ~ openSelect ~ res:', res) @@ -706,6 +813,7 @@ export default { practiceId: this.practiceId, isMiss: this.isError ? 1 : '' } + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionList', method: 'post', @@ -828,6 +936,8 @@ export default { } .question-wrapper { + max-height: 500px; + overflow: auto; padding: 30px; color: #08428d; @@ -847,11 +957,15 @@ export default { background: #ffffff; border-radius: 8px; overflow: auto; - .label { - display: flex; - align-items: center; - justify-content: flex-start; - text-align: left; + .label-wrapper { + max-height: 100px; + overflow: auto; + .label { + display: flex; + align-items: center; + justify-content: flex-start; + text-align: left; + } } } .active { diff --git a/pages/YNEduApp/prac/prac.vue b/pages/YNEduApp/prac/prac.vue index f893e5a..5476f50 100644 --- a/pages/YNEduApp/prac/prac.vue +++ b/pages/YNEduApp/prac/prac.vue @@ -70,6 +70,7 @@ export default { // this.waitList = res.data.filter(item => item.alreadyNum === 0) // this.alreadyList = res.data.filter(item => item.alreadyNum > 0) // console.log('🚀 ~ getList ~ res:', res) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudentPracticeList', method: 'post', diff --git a/pages/YNEduApp/prac/pracDetail.vue b/pages/YNEduApp/prac/pracDetail.vue index 8129041..ec66d50 100644 --- a/pages/YNEduApp/prac/pracDetail.vue +++ b/pages/YNEduApp/prac/pracDetail.vue @@ -128,6 +128,7 @@ export default { const params = { id: this.practiceId } + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/studentPractice/getPracticeQuestionRate', method: 'post', diff --git a/pages/YNEduApp/user/faceScan.vue b/pages/YNEduApp/user/faceScan.vue index f7c17c8..c72a346 100644 --- a/pages/YNEduApp/user/faceScan.vue +++ b/pages/YNEduApp/user/faceScan.vue @@ -22,8 +22,8 @@
- - + +
@@ -36,8 +36,8 @@
收集您的信息,以实现在考试中检测是否是您本人操作,请务必录入您本人的面部信息
- - + +
@@ -106,6 +106,7 @@ export default { img: this.url } params = JSON.stringify(params) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/uploadFaceRecognition', method: 'POST', diff --git a/pages/YNEduApp/user/myMsg.vue b/pages/YNEduApp/user/myMsg.vue index e915402..34afce7 100644 --- a/pages/YNEduApp/user/myMsg.vue +++ b/pages/YNEduApp/user/myMsg.vue @@ -48,6 +48,7 @@ export default { methods: { // 获取消息列表 getMsgList() { + this.$verificationToken() uni.request({ url: config.bmwUrl + '/users/getMsgInform', method: 'get', @@ -85,6 +86,7 @@ export default { markRead(item) { const ids = [item.id] console.log('🚀 ~ markRead ~ ids:', ids) + this.$verificationToken() uni.request({ url: config.bmwUrl + '/users/markAsRead', method: 'post', @@ -102,6 +104,7 @@ export default { deleteMsg(item) { const ids = [item.id] console.log('🚀 ~ deleteMsg ~ ids:', ids) + this.$verificationToken() uni.request({ url: config.bmwUrl + '/users/batchDelete', method: 'post', diff --git a/pages/YNEduApp/user/user.vue b/pages/YNEduApp/user/user.vue index 48ef853..193b9d9 100644 --- a/pages/YNEduApp/user/user.vue +++ b/pages/YNEduApp/user/user.vue @@ -81,6 +81,7 @@ export default { // 获取自学-学时-证书 getLearnStats() { console.log('🚀 ~ getLearnStats ~ this.token:',uni.getStorageSync('access_token')) + this.$verificationToken() uni.request({ url: config.baseUrl + '/exam-student/personalCenter/getStudyAndCer', // url: 'http://192.168.0.137:2900' + '/exam-student/personalCenter/getStudyAndCer', diff --git a/pages/gzt/index.vue b/pages/gzt/index.vue index 52e47c3..bce941b 100644 --- a/pages/gzt/index.vue +++ b/pages/gzt/index.vue @@ -97,6 +97,7 @@ import TabbarConfig from '@/totalTabbar.js' import AES from "@/utils/realNameAes.js"; import config from '@/config' + import Crypoto from '@/utils/aescbc' import { getDayNoticeAnnoByUserId, @@ -193,13 +194,16 @@ }) }, gotoYy(name) { + const cry = new Crypoto() const params = { username: uni.getStorageSync('userPhone'), jwtToken: uni.getStorageSync('App-Token') } const tjparams = { - username: '13908860263', - password: 'YNsbd@123456' + // username: '17681010134', // 15912575796 + // password: 'YNsbd@123456' + telephone: cry.encrypt(uni.getStorageSync('userPhone')), + jwtToken: uni.getStorageSync('App-Token') } const realParams = { username: AES.encrypt(uni.getStorageSync('userPhone')), @@ -283,7 +287,7 @@ } else if( name == '健康体检移动端') { uni.request({ - url: config.tjBaseUrl + '/login', + url: config.tjBaseUrl + '/app/loginNoPassword', method: 'POST', data: tjparams, header: { @@ -291,9 +295,12 @@ }, success: res => { console.log('🚀 ~ gotoYy ~ res:', res,) - console.log('🚀 ~ gotoYy ~ res:', res.data.token) + console.log('🚀 ~ gotoYy ~ res:', res.data.obj) if (res.statusCode == 200) { - uni.setStorageSync('tjToken', res.data.token) + uni.removeStorageSync('tjToken') + uni.removeStorageSync('tjPhone') + uni.setStorageSync('tjToken', res.data.obj) + uni.setStorageSync('tjPhone', tjparams.telephone) setTimeout(() => { uni.reLaunch({ url: '/pages/HealthExaminationApp/index/index' @@ -301,7 +308,7 @@ }, 500) } else { uni.showToast({ - title: req.message, + title: res.data.message, icon: 'none' }) } diff --git a/pages/login.vue b/pages/login.vue index e345287..4ba60ed 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -165,7 +165,7 @@ // globalConfig: getApp().globalData.config, selectTab: 1, loginForm: { - phone: '18700000001', // 18955734761 18700000001 + phone: '18700000002', // 18955734761 18700000001 pd: 'YNsbd@123456',//YNsbd@123456 }, loginForm0: { diff --git a/static/images-tijian/isCanceled.png b/static/images-tijian/isCanceled.png new file mode 100644 index 0000000..06bc797 Binary files /dev/null and b/static/images-tijian/isCanceled.png differ diff --git a/static/images-tijian/isExamed.png b/static/images-tijian/isExamed.png new file mode 100644 index 0000000..61d17e0 Binary files /dev/null and b/static/images-tijian/isExamed.png differ diff --git a/static/images-tijian/logout.png b/static/images-tijian/logout.png new file mode 100644 index 0000000..edc9fce Binary files /dev/null and b/static/images-tijian/logout.png differ diff --git a/static/images-tijian/message.png b/static/images-tijian/message.png new file mode 100644 index 0000000..e28af0c Binary files /dev/null and b/static/images-tijian/message.png differ diff --git a/static/images-tijian/readyExam.png b/static/images-tijian/readyExam.png new file mode 100644 index 0000000..a30ba70 Binary files /dev/null and b/static/images-tijian/readyExam.png differ diff --git a/static/images-tijian/success.png b/static/images-tijian/success.png new file mode 100644 index 0000000..811e331 Binary files /dev/null and b/static/images-tijian/success.png differ diff --git a/static/images-tijian/userInfo.png b/static/images-tijian/userInfo.png new file mode 100644 index 0000000..3c1dccd Binary files /dev/null and b/static/images-tijian/userInfo.png differ diff --git a/utils/aescbc.js b/utils/aescbc.js new file mode 100644 index 0000000..8db60f8 --- /dev/null +++ b/utils/aescbc.js @@ -0,0 +1,54 @@ + +import CryptoJS from 'crypto-js' + +export default class Crypoto { + key = CryptoJS.enc.Utf8.parse('zhgd@bonus@zhgd@bonus@1234567890') // 这里找后端要; + iv = CryptoJS.enc.Utf8.parse('1234567812345678') + + /* 加密 */ + encrypt(word) { + let aqEnnable = true + if (!aqEnnable) { + return word + } + var srcs = CryptoJS.enc.Utf8.parse(word) + var encrypted = CryptoJS.AES.encrypt(srcs, this.key, { + iv: this.iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return encrypted.toString() + } + + encrypts(word) { + const srcs = CryptoJS.enc.Utf8.parse(word) + const encrypted = CryptoJS.AES.encrypt(srcs, this.key, { + iv: this.iv, + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + const ciphertext = encrypted.ciphertext.toString(CryptoJS.enc.Base64url) // 将加密结果转换为 Base64URL 格式 确认后端要的是Base64URL 还是Base64 这两种编码格式不一样 + return ciphertext + } + + decrypt +} + +const jie_mi=true; + +/** + * 解密 + * @param word + * @returns {*} + */ +export const decryptCBC = function(word) { + if(!jie_mi){ + return word; + } + const encrypted = CryptoJS.AES.decrypt(word, CryptoJS.enc.Utf8.parse('zhgd@bonus@zhgd@bonus@1234567890'), { + iv: CryptoJS.enc.Utf8.parse('1234567812345678'), + mode: CryptoJS.mode.CBC, + padding: CryptoJS.pad.Pkcs7 + }) + return encrypted.toString(CryptoJS.enc.Utf8) +} diff --git a/utils/request.js b/utils/request.js index 76f9e29..13c9f63 100644 --- a/utils/request.js +++ b/utils/request.js @@ -14,15 +14,6 @@ const request = config => { config.header = config.header || {} if (getToken() && !isToken) { config.header['Authorization'] = 'Bearer ' + getToken() - } else { - // 没有token - 去登录 - // store.dispatch('LogOut').then(() => { - // uni.reLaunch({ url: '/pages/login' }) - // }) - // const token = 'eyJhbGciOiJIUzUxMiJ9.eyJ1c2VyX2lkIjozMSwidXNlcl9rZXkiOiJiZmJmOGEzZC1hYTc1LTQ4MzQtOGM3NC0yZmQzOTEwZDllYzAiLCJ1c2VybmFtZSI6IuaWueS6riJ9.kv1WmthbgTrqapbsGLvevk-nwbWbYJMniyjj8DC3BSnQjCwm8csQ5GaNpfsLFFFYIHBYa8CrN_sBxXhDKOfR_A' - // const userId = 31 - // setUserId(userId) - // setToken(token) } // get请求映射params参数 if (config.params) {