From 42da4490315ccd7e5fea68dcf3552d2df7737d0b Mon Sep 17 00:00:00 2001 From: "@fawn-nine" <1271023382@qq.com> Date: Mon, 14 Oct 2024 17:06:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 7 + pages/certificate/certificate.vue | 7 +- pages/course/courseDetail.vue | 343 +++++++++++- pages/miniClass/continueTest.vue | 49 +- pages/miniClass/paperBack.vue | 4 +- pages/miniClass/test.vue | 10 +- pages/peanut/home.vue | 7 +- pages/selfStudy/selfStudy.vue | 875 ++++++++++++++++++++++++++++++ pages/user/login.vue | 5 +- 9 files changed, 1275 insertions(+), 32 deletions(-) create mode 100644 pages/selfStudy/selfStudy.vue diff --git a/pages.json b/pages.json index 411f79d..d2d9c7d 100644 --- a/pages.json +++ b/pages.json @@ -741,6 +741,13 @@ { "navigationBarTitleText" : "我的证书" } + }, + { + "path" : "pages/selfStudy/selfStudy", + "style" : + { + "navigationBarTitleText" : "自考考试" + } } ], "globalStyle": { diff --git a/pages/certificate/certificate.vue b/pages/certificate/certificate.vue index 6d562d8..d1703f8 100644 --- a/pages/certificate/certificate.vue +++ b/pages/certificate/certificate.vue @@ -10,7 +10,7 @@

编号:{{item.certificateNo}}

- + 获得时间:{{item.createTime.substring(0, 10)}}
- - + + + - + + 课程学习进度大于等于70%时,您可以参与本门课程的自考考试,考试成绩大于60分即可获得本门课程的B级证书,如您想获得本门课程的A级证书可参加小班教学 + + + + 第{{index + 1}}次自考成绩 + {{item.score}}分 + + + 查看试卷 + + + + {{zhedieTestRecode ? '收起' : '展开'}} + + + + 恭喜!您已通过自考考试获得本门课程的B级证书,如您想获得本门课程的A级证书可参加小班教学 + + + + + + + + + - + - + - 加入班级开始更加系统的学习 + 加入班级开始更加系统的学习 + + + 暂无可加入的小班 - + 前往查看 >> @@ -418,7 +475,8 @@ } from "vuex"; export default { data() { - return { + return { + zhedieTestRecode:false, // 是否折叠自考的记录 goodsList: [], currentCateIndex: 0, protocolShow: false, @@ -526,7 +584,16 @@ isAndorid: true, oprateOsName:'', linkClassList:[], // 可加入关联班级数组 - classInfo:[] // 所在班级信息 + classInfo:[], // 所在班级信息 + selfStudyCertificate:[], // 自考证书 + classCertificate:[], // 小班学习证书 + testingPaper:{}, // 当前课程正在考试信息 + timeDif: {}, + showCountDown: false, + showSecondTestBtn:false, // 先否显示二次考试按钮 + selfStudyPaperList:[], ///自考考试记录 + showNextTestDate:undefined, + canJoinTestTime:false, //时间上是否可以参加自考考试 }; }, //第一次加载 @@ -542,8 +609,6 @@ // await this.getData(e.id); this.getSayList(); this.getOS() - - }, onPageScroll(e) { this.scrollTop = e.scrollTop; @@ -567,6 +632,62 @@ plus.screen.lockOrientation("portrait-primary"); // #endif this.getLinkClassList() + var newCertificate = await this.getCertificateInfo() + console.log('5555555证书资料', newCertificate); + this.selfStudyCertificate = [] + this.classCertificate = [] + if(newCertificate && newCertificate.length > 0){ + newCertificate.forEach(item => { + if(item.classId!= '' && item.classId > 0){ + this.classCertificate.push(item) + }else{ + this.selfStudyCertificate.push(item) + } + }) + } + var historyPaper = await this.getingPaper() + console.log('historyPaper正在考试的信息',historyPaper); + if(historyPaper && historyPaper.id && historyPaper.type == '2' && historyPaper.relationId == this.courseId){ + this.testingPaper = historyPaper + var paperEndTime = historyPaper.planEndTime + var severNowTime = await this.getServerTime() + if (severNowTime > -1 && paperEndTime - severNowTime > 0) { + var secondTimeDif = paperEndTime - severNowTime + this.timeDif.hour = parseInt((secondTimeDif % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)) + this.timeDif.minutes = parseInt((secondTimeDif % (1000 * 60 * 60)) / (1000 * 60)); + this.timeDif.second = (secondTimeDif % (1000 * 60)) / 1000 + this.showCountDown = true + console.log('时间符合吗?', this.showCountDown, secondTimeDif); + } else { + this.showCountDown = false + } + } + var selfStudyPaperList = await this.getSelfStudyPaperList() + this.selfStudyPaperList = selfStudyPaperList + console.log('selfStudyPaperList',selfStudyPaperList); + if(selfStudyPaperList && selfStudyPaperList.length > 0 && selfStudyPaperList.length < 2){ + this.canJoinTestTime = true + } + if(selfStudyPaperList && selfStudyPaperList.length > 0){ + selfStudyPaperList.forEach((item, index) => { + if(item.score < 60 && index < 2){ + this.showSecondTestBtn = true + }else{ + this.showSecondTestBtn = false + } + }) + } + if(selfStudyPaperList.length >= 2 && this.selfStudyCertificate.length == 0){ + this.showNextTestDate = await this.getNextTestDate() + console.log('下次考试时间',this.showNextTestDate); + var now = new Date() + if(this.showNextTestDate.nextLongTime < now){ + this.canJoinTestTime = true + }else{ + this.canJoinTestTime = false + } + } + }, onUnload() { this.selectGoodsData = {}; @@ -599,6 +720,145 @@ }, //方法 methods: { + // 查询下次可以考试的时间 + async getNextTestDate(){ + var time = { + nextLongTime:0, + nextZKTime:'' + } + await $http.request({ + url: "common/classExam/getNextZKTime", + method: "POST", + data: { + "courseId": parseInt(this.courseId) + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(async (res) => { + if(res.code != 0) { + uni.showToast({ + title:res.errMsg, + icon:'none' + }) + return + } + if (res.code == 0) { + console.log('res',res); + time.nextZKTime = res.nextZKTime + time.nextLongTime = res.nextLongTime + } + }).catch(e => { + uni.showToast({ + title:e.errMsg, + icon:'none' + }) + }); + return time + }, + seePaper(val) { + // console.log('点击了'); + uni.navigateTo({ + url: `/pages/miniClass/paperBack?id=${val}`, + }); + }, + async timeup() { + this.showCountDown = false + setTimeout(async ()=>{ + var selfStudyPaperList = await this.getSelfStudyPaperList() + this.selfStudyPaperList = selfStudyPaperList + console.log('selfStudyPaperList',selfStudyPaperList); + if(selfStudyPaperList && selfStudyPaperList.length > 0){ + selfStudyPaperList.forEach((item, index) => { + if(item.score < 60 && index < 2){ + this.showSecondTestBtn = true + }else{ + this.showSecondTestBtn = false + } + }) + } + },3000) + }, + // 获取自考试卷列表 + async getSelfStudyPaperList(){ + var list = undefined + await $http.request({ + url: "common/classExam/getZKExamPaperList", + method: "POST", + data: { + "courseId": parseInt(this.courseId) + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(async (res) => { + if(res.code != 0) { + uni.showToast({ + title:res.errMsg, + icon:'none' + }) + return + } + if (res.code == 0) { + console.log('res',res); + list = res.ZKExamUserList + } + }).catch(e => { + uni.showToast({ + title:e.errMsg, + icon:'none' + }) + }); + return list + }, + // 获取服务器时间 + async getServerTime() { + var time = 0 + await $http.request({ + url: "common/classExam/getServerTime", + method: "POST", + data: {}, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(async (res) => { + if (res.code == 0) { + time = res.serverTime + } else { + time = -1 + } + }).catch(e => { + time = -1 + }); + return time + }, + // 获取进行中的考试 + async getingPaper(){ + var obj = undefined + await $http.request({ + url: "common/classExam/examingPaper", + method: "POST", + data: {}, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(async (res) => { + console.log('考试中',res); + if (res.code == 0 && res.classExamUser != null) { + obj = {...res.classExamUser, planEndTime:res.planEndTime} + }else{ + obj = undefined + } + }).catch(e => { + obj = undefined + }); + return obj + + }, // 获得课程关联的班级 getLinkClassList(){ this.$http @@ -1449,7 +1709,6 @@ }) .then(async (res) => { if (res.code == 0 && res.chapterList.length > 0) { - list = res.chapterList; // console.log("方法里面得到的章节列表:", list); } else { @@ -1466,6 +1725,47 @@ url: `${url}?id=${id}`, }); }, + // 查询证书情况 + async getCertificateInfo(){ + var list = undefined + await $http.request({ + url: "common/userCertificate/getUserCertificateList", + method: "POST", // POST、GET、PUT、DELETE,具体说明查看官方文档 + data: { + "type":'', //证书类型A a证 B b证 ZK自考 + "courseId": this.courseId //课程id + }, + header: { //默认 无 说明:请求头 + 'Content-Type': 'application/json' + }, + }) + .then(res => { + if(res.code != 0) { + uni.showToast({ + title: res.errMsg, + icon: 'none' + }) + return + } + if (res.code == 0) { + res.certificateList.forEach(item => { + item.certificateUrl && item.certificateUrl != '' ? item.certificateUrlList = item.certificateUrl.split(',') : item.certificateUrlList = [] + }) + list = res.certificateList + } + console.log('证书接口请求结果', res); + uni.hideLoading() + }).catch(e => { + uni.hideLoading() + console.log(e, '数据报错') + // this.status = 3 + uni.showToast({ + title: e.errMsg, + icon: 'none' + }) + }); + return list + }, goClassLIst(url, id,title){ uni.navigateTo({ url: `${url}?courseId=${id}&courseTitle=${title}`, @@ -1476,7 +1776,7 @@ \ No newline at end of file diff --git a/pages/miniClass/continueTest.vue b/pages/miniClass/continueTest.vue index 8733ec4..b42299b 100644 --- a/pages/miniClass/continueTest.vue +++ b/pages/miniClass/continueTest.vue @@ -12,7 +12,8 @@ 本次考试卷面成绩为:{{exameResult.score}} 分 - + + @@ -86,10 +87,15 @@

考试说明

- + ①、每位学员共有两次考试的机会,考试成绩以两次成绩的最高分作为最终的卷面成绩,请认真对待每次考试;
②、请在倒计时结束前完成答题,倒计时结束后将自动交卷。
+ + ①、每位学员共有两次考试的机会,如第一次考试成绩达标则不用进行第二次的考试,请认真对待每次考试;
+ ②、请在倒计时结束前完成答题,倒计时结束后将自动交卷;
+ ③、考试时间为 45 分钟。
+
@@ -125,6 +131,7 @@ showPopup: false, code: 0, // 英文code classId: undefined, + courseId:undefined, testPaper: {}, curQuestion: { answerIds: [] @@ -150,12 +157,12 @@ questionList:[], answerIdsList:[], wantSubmit:false, // 想要提交 - + flag : false, } }, async onLoad(e) { console.log('收到得值',e); - this.classId = e.classId + // this.classId = e.classId this.examId = e.id this.wantSubmit = false this.getTestPage() @@ -278,7 +285,13 @@ timeup() { this.isOvertime = true this.sumbitPaper() - let that = this + let that = this + var urll = '' + if(that.testPaper.type == '1'){ + urll = `/pages/miniClass/classInfo?id=${that.classId}` + }else if(that.testPaper.type == '2'){ + urll = `/pages/course/courseDetail?id=${that.courseId}` + } uni.showModal({ title: '提示', content: "考试结束,系统已为您自动交卷,点击按钮返回所在班级", @@ -287,7 +300,7 @@ success: (res) => { if (res.confirm) { uni.navigateTo({ - url: `/pages/miniClass/classInfo?id=${that.classId}` + url: urll }) } } @@ -325,22 +338,27 @@ }, // q请求提交试卷 sumbitPaper(ids) { + let that = this + if(that.flag){ + return + } + that.flag = true uni.showLoading({ title:'正在交卷' - }) - let that = this + }) $http.request({ url: "common/classExam/submitExamPaper", method: "POST", data: { id: that.examId }, - header: { //默认 无 说明:请求头 + header: { //默认 无 说明:请求头1 'Content-Type': 'application/json' }, }) .then(res => { uni.hideLoading() + if (res.code == 0) { console.log('交卷结果',res); uni.showToast({ @@ -367,6 +385,7 @@ },300) }else{ + that.flag = false uni.showToast({ title: e.errMsg, icon: 'error' @@ -374,6 +393,7 @@ } }).catch(e => { + that.flag = true uni.hideLoading() console.log(e, '数据报错') // this.status = 3 @@ -493,6 +513,11 @@ this.haveAnswerList = this.gethaveAnswerList() // console.log('this.answerIdsList', this.answerIdsList); this.testPaper = res.examPaper + if(this.testPaper.type == '1'){ // 班级考试 + this.classId = this.testPaper.relationId + }else if(this.testPaper.type == '2'){ + this.courseId = this.testPaper.relationId + } // var planEndTimeDate = new Date(res.planEndTime) // this.endTime = planEndTimeDate.getTime(); this.endTime = res.planEndTime @@ -569,6 +594,12 @@ url: `/pages/miniClass/classInfo?id=${this.classId}` }) }, + goToCourse(){ + uni.navigateTo({ + // url: `/pages/miniClass/classInfo?id=${this.classId}` + url: `/pages/course/courseDetail?id=${this.courseId}` + }) + }, hidePopup() { this.showPopup = false this.showQuestIndex = false diff --git a/pages/miniClass/paperBack.vue b/pages/miniClass/paperBack.vue index 5276cdd..e02d525 100644 --- a/pages/miniClass/paperBack.vue +++ b/pages/miniClass/paperBack.vue @@ -2,8 +2,8 @@ - 考试说明 +