diff --git a/package-lock.json b/package-lock.json index de0bb9a..c70d2b9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "3.4.5", "license": "MIT", "dependencies": { + "crypto-js": "^4.2.0", "image-tools": "^1.4.0", "luch-request": "^3.1.1" } @@ -18,6 +19,11 @@ "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", @@ -38,6 +44,11 @@ "resolved": "https://registry.npmjs.org/@dcloudio/types/-/types-2.6.12.tgz", "integrity": "sha512-mrCMwcINy1IFjU9VUqLeWBkj404yWs5paLDttBcA+eqUjanuUQbBcTVPqlrGgkyzLXDcV2oDDZRSNxNpXi4kMQ==" }, + "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==" + }, "image-tools": { "version": "1.4.0", "resolved": "https://registry.npmmirror.com/image-tools/-/image-tools-1.4.0.tgz", diff --git a/package.json b/package.json index 0bbe15b..1452229 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "homepage": "https://github.com/dcloudio/hello-uniapp#readme", "dependencies": { + "crypto-js": "^4.2.0", "image-tools": "^1.4.0", "luch-request": "^3.1.1" }, diff --git a/pages.json b/pages.json index 3ba06e9..92acebe 100644 --- a/pages.json +++ b/pages.json @@ -241,6 +241,13 @@ { "navigationBarTitleText" : "图片学习" } + }, + { + "path" : "pages/HealthExaminationApp/myAppointment/bookSuccessfully", + "style" : + { + "navigationBarTitleText" : "体检预约" + } } ], "globalStyle": { diff --git a/pages/HealthExaminationApp/appointment/appointment.vue b/pages/HealthExaminationApp/appointment/appointment.vue index 5b11614..2512f06 100644 --- a/pages/HealthExaminationApp/appointment/appointment.vue +++ b/pages/HealthExaminationApp/appointment/appointment.vue @@ -1,19 +1,507 @@ diff --git a/pages/HealthExaminationApp/index/index.vue b/pages/HealthExaminationApp/index/index.vue index b8bf5c4..9f5c90e 100644 --- a/pages/HealthExaminationApp/index/index.vue +++ b/pages/HealthExaminationApp/index/index.vue @@ -33,10 +33,14 @@ + + diff --git a/pages/HealthExaminationApp/myAppointment/myAppointment.vue b/pages/HealthExaminationApp/myAppointment/myAppointment.vue index a75ba8d..a5a662f 100644 --- a/pages/HealthExaminationApp/myAppointment/myAppointment.vue +++ b/pages/HealthExaminationApp/myAppointment/myAppointment.vue @@ -1,19 +1,20 @@ + \ No newline at end of file diff --git a/pages/YNEduApp/exam/beforeExam.vue b/pages/YNEduApp/exam/beforeExam.vue index 811a783..917118c 100644 --- a/pages/YNEduApp/exam/beforeExam.vue +++ b/pages/YNEduApp/exam/beforeExam.vue @@ -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..cdf9ef9 100644 --- a/pages/YNEduApp/exam/exam.vue +++ b/pages/YNEduApp/exam/exam.vue @@ -95,11 +95,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 +123,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 +166,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 fa7477e..06280ed 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 }}
+
+
@@ -391,7 +400,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, @@ -626,27 +635,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..120946e 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 = '' diff --git a/pages/YNEduApp/index/index.vue b/pages/YNEduApp/index/index.vue index 1cdaded..b59a2c3 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 }}%
diff --git a/pages/YNEduApp/learn/learn.vue b/pages/YNEduApp/learn/learn.vue index 2826801..02fec65 100644 --- a/pages/YNEduApp/learn/learn.vue +++ b/pages/YNEduApp/learn/learn.vue @@ -53,7 +53,8 @@ export default { // 当前播放时间 currentTime: 0, showModal: false, // 是否显示弹窗 - content: '是否确认结束学习?' + content: '是否确认结束学习?', + isEnd: false } }, onLoad(opt) { @@ -69,11 +70,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 +103,12 @@ export default { }, // 结束学习 handleEnd() { + if (this.isEnd) { + uni.reLaunch({ + url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId + }) + return + } // 手动暂停视频 const video = uni.createVideoContext('myVideo') video.pause() @@ -96,7 +116,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 = { @@ -127,7 +150,7 @@ export default { success: res => { console.log('🚀 ~ handleEnd ~ res:', res) this.showModal = false - uni.navigateTo({ + uni.reLaunch({ url: '/pages/YNEduApp/learnProj/learnProjDetail?id=' + this.studyId }) }, diff --git a/pages/YNEduApp/learnProj/learnProjDetail.vue b/pages/YNEduApp/learnProj/learnProjDetail.vue index 9a6fbef..d638c59 100644 --- a/pages/YNEduApp/learnProj/learnProjDetail.vue +++ b/pages/YNEduApp/learnProj/learnProjDetail.vue @@ -276,7 +276,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) diff --git a/pages/YNEduApp/prac/exercises.vue b/pages/YNEduApp/prac/exercises.vue index 40422b0..d09304a 100644 --- a/pages/YNEduApp/prac/exercises.vue +++ b/pages/YNEduApp/prac/exercises.vue @@ -376,6 +376,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 (item.optionIdent === this.questionList[0].correctGrade) { + 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) diff --git a/pages/gzt/index.vue b/pages/gzt/index.vue index f97353e..6211a52 100644 --- a/pages/gzt/index.vue +++ b/pages/gzt/index.vue @@ -197,7 +197,7 @@ jwtToken: uni.getStorageSync('App-Token') } const tjparams = { - username: '13908860263', + username: '13708411772', password: 'YNsbd@123456' } console.log('🚀 ~ gotoYy ~ tjparams:', tjparams) @@ -251,7 +251,10 @@ console.log('🚀 ~ gotoYy ~ res:', res,) console.log('🚀 ~ gotoYy ~ res:', res.data.token) if (res.statusCode == 200) { + uni.removeStorageSync('tjToken') + uni.removeStorageSync('tjPhone') uni.setStorageSync('tjToken', res.data.token) + uni.setStorageSync('tjPhone', tjparams.username) setTimeout(() => { uni.reLaunch({ url: '/pages/HealthExaminationApp/index/index' 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/utils/aescbc.js b/utils/aescbc.js new file mode 100644 index 0000000..d70893c --- /dev/null +++ b/utils/aescbc.js @@ -0,0 +1,35 @@ + +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 +} diff --git a/utils/request.js b/utils/request.js index 76f9e29..a5ca193 100644 --- a/utils/request.js +++ b/utils/request.js @@ -16,13 +16,7 @@ const request = config => { 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) + uni.reLaunch({ url: '/pages/login' }) } // get请求映射params参数 if (config.params) {