import { logicStatus, courseTypes, courseStatus } from "../../model/enum"; import Route from "../../model/route"; import Api from "../../model/api"; import { toast } from "../../utils/utils"; Page({ data: { eInfo: {}, isPre: logicStatus.NO, logicStatusEnum: logicStatus, }, onLoad: function (options) { const { isPre, detail } = options; let eInfo = JSON.parse(detail); this.setData({ isPre, eInfo }) }, toCertificate(e) { let detail = JSON.stringify(this.data.eInfo); Route.toCertificate(detail, this.data.isPre, { get: () => { this.setData({ 'eInfo.graduateType': 1 }); const eventChannel = this.getOpenerEventChannel() eventChannel.emit('refresh'); }, refresh: () => { console.log('refresh data!'); const eventChannel = this.getOpenerEventChannel() eventChannel.emit('refresh'); } }) }, toQuestion(e) { //调查 let eInfo = this.data.eInfo; if (eInfo.isQuestionnaire == logicStatus.NO) { Route.toQuestionDetail(eInfo.questionnaireId, eInfo.teamId, "", "", eInfo.eduStuId, { answer: () => { this.setData({ 'eInfo.isQuestionnaire': 1 }) const eventChannel = this.getOpenerEventChannel() eventChannel.emit('refresh'); } }); } else { // toast("已完成问卷") Route.toQuestionResult(eInfo.questionnaireId, eInfo.eduStuId); } }, toQuestion2(e) { //综合 let eInfo = this.data.eInfo; if (eInfo.isComprehensive == logicStatus.NO) { Route.toQuestionDetail(eInfo.comprehensiveId, eInfo.teamId, "", "", eInfo.eduStuId, { answer: () => { this.setData({ 'eInfo.isComprehensive': 1 }) const eventChannel = this.getOpenerEventChannel() eventChannel.emit('refresh'); } }); } else { // toast("已完成问卷") Route.toQuestionResult(eInfo.comprehensiveId, eInfo.eduStuId); } }, async toExam(e) { //期末 let eInfo = this.data.eInfo; if (eInfo.isExam == logicStatus.NO) { let { teamId, eduStuId: studentId } = this.data.eInfo; let res = await Api.checkFinalExam({ teamId, studentId }, (code, msg, data) => { wx.hideToast(); if (!data) { toast(msg); return false; } this.handleCheckFail(data); return false; }); if (!res) { return; } Route.toExamDetail(eInfo.paperId, eInfo.examId, eInfo.eduStuId, { answer: () => { this.setData({ 'eInfo.isExam': 1 }) const eventChannel = this.getOpenerEventChannel() eventChannel.emit('refresh'); } }); } else { // toast("已完成试卷"); Route.toExamResult(eInfo.examId, eInfo.eduStuId); } }, handleCheckFail(data) { let courseName = data.courseName; let courseStartTime = new Date(data.courseStart.replaceAll('-', '/')).getTime(); //解决ios兼容问题 let nowTime = Date.now(); const JUMP_TYPES = { COURSE: '1', EXAM: '2', EVALUATE: '3' }; if (data.courseProcess == courseStatus.NO_START && courseStartTime > nowTime) { toast(`课程《${courseName}》尚未开始,暂不能参加毕业考试`); return false; } let unPassCheck = {}; if (data.courseProcess == courseStatus.NO_START) { //去学习 // type=3&id=21&detail=%7B%22teamName%22%3A%22%E7%BB%93%E4%B8%9A%E8%AF%81%E9%A2%86%E5%8F%96%E6%B5%8B%E8%AF%95%E7%8F%AD%22%2C%22eduStuName%22%3A%22%E6%AE%B7%E4%B8%B9%22%2C%22idCard%22%3A%22220421199410204926%22%2C%22isReport%22%3A1%2C%22isOnline%22%3Atrue%2C%22graduateType%22%3A0%2C%22questionnaireId%22%3A%2219%22%2C%22teamEnd%22%3A%222022-06-06%22%2C%22isExam%22%3A0%2C%22picUrl%22%3A%22http%3A%2F%2Fcollege-file-1302740389.cos.ap-beijing.myqcloud.com%2F2i0L5Ls63zSod1574457f7c9bac883c7d5e9f7f58c37.jpg%22%2C%22itemName%22%3A%22%E9%A2%86%E5%8F%96%E7%BB%93%E4%B8%9A%E8%AF%81%E6%B5%8B%E8%AF%95%22%2C%22isCheckin%22%3A0%2C%22teamStart%22%3A%222022-06-01%22%2C%22paperId%22%3A0%2C%22isComprehensive%22%3A0%2C%22teamState%22%3A1%2C%22itemEnd%22%3A%222022-06-06%22%2C%22comprehensiveId%22%3A%2221%22%2C%22eduStuId%22%3A13%2C%22groupName%22%3A%22%E4%B8%80%E7%BB%84%22%2C%22teamId%22%3A2%2C%22itemStart%22%3A%222022-06-01%22%2C%22examId%22%3A0%2C%22isQuestionnaire%22%3A0%2C%22isRegister%22%3A1%7D&plan=%7B%22searchValue%22%3Anull%2C%22createBy%22%3Anull%2C%22createTime%22%3A%222022-06-04%2009%3A00%3A06%22%2C%22updateBy%22%3Anull%2C%22updateTime%22%3Anull%2C%22remark%22%3Anull%2C%22params%22%3A%7B%7D%2C%22id%22%3A21%2C%22courseId%22%3A151%2C%22courseName%22%3A%22%E5%BA%86%E7%A5%9D%E4%B8%AD%E5%9B%BD%E5%85%B1%E4%BA%A7%E5%85%9A%E6%88%90%E7%AB%8B100%E5%91%A8%E5%B9%B4%22%2C%22courseThumbnailUrl%22%3A%22https%3A%2F%2Fcollege-file-1254259530.cos.ap-beijing.myqcloud.com%2Fresource%2Fcourse%2Ff6ea43c4-e00d-47d4-935c-24bfc77c2527%2F%25E5%25BE%25AE%25E4%25BF%25A1%25E5%259B%25BE%25E7%2589%2587_20210421164805.jpg%22%2C%22partIds%22%3Anull%2C%22partIdsRemark%22%3Anull%2C%22partNames%22%3Anull%2C%22arrangeId%22%3A5%2C%22courseStart%22%3A%222022-06-01%2000%3A00%3A00%22%2C%22courseEnd%22%3A%222022-06-06%2000%3A00%3A00%22%2C%22comperes%22%3Anull%2C%22comperesRemark%22%3Anull%2C%22comperesDept%22%3Anull%2C%22comperesDeptId%22%3Anull%2C%22comperesName%22%3Anull%2C%22classroomId%22%3Anull%2C%22baseId%22%3Anull%2C%22baseName%22%3Anull%2C%22classroomName%22%3Anull%2C%22enclosureUrl%22%3A%22%5B%7B%5C%22url%5C%22%3A%5C%22https%3A%2F%2F1254259530.vod2.myqcloud.com%2Fe55e0a06vodcq1254259530%2F4de367ce3701925919887166250%2FOk1e6me3wnQA.mp4%5C%22%2C%5C%22name%5C%22%3A%5C%22%E5%BA%86%E7%A5%9D%E4%B8%AD%E5%9B%BD%E5%85%B1%E4%BA%A7%E5%85%9A%E6%88%90%E7%AB%8B100%E5%91%A8%E5%B9%B4.mp4%5C%22%2C%5C%22fileId%5C%22%3A%5C%223701925919887166250%5C%22%2C%5C%22duration%5C%22%3A116%2C%5C%22verifyInterval%5C%22%3A0%7D%5D%22%2C%22groupIds%22%3A%223%22%2C%22groupId%22%3Anull%2C%22groupName%22%3A%22%E4%B8%80%E7%BB%84%22%2C%22teamId%22%3A2%2C%22teacherId%22%3A133%2C%22teacherName%22%3A%22%E8%B7%AF%E4%BA%9A%E5%85%B0%22%2C%22photoUrl%22%3A%22https%3A%2F%2Fcollege-file-1254259530.cos.ap-beijing.myqcloud.com%2Fresource%2Fteacher%2Fzp%2Fzp_2.png%22%2C%22itemId%22%3A2%2C%22itemName%22%3A%22%E9%A2%86%E5%8F%96%E7%BB%93%E4%B8%9A%E8%AF%81%E6%B5%8B%E8%AF%95%22%2C%22teamName%22%3A%22%E7%BB%93%E4%B8%9A%E8%AF%81%E9%A2%86%E5%8F%96%E6%B5%8B%E8%AF%95%E7%8F%AD%22%2C%22treeIds%22%3Anull%2C%22ceremonyContent%22%3Anull%2C%22ceremonyId%22%3Anull%2C%22ceremonyName%22%3Anull%2C%22seatMap%22%3Anull%2C%22status%22%3A0%2C%22courseStatus%22%3Anull%2C%22liveStatus%22%3Anull%2C%22videoPlaybackUrl%22%3Anull%2C%22courseType%22%3A3%2C%22isLive%22%3A0%2C%22isReplay%22%3A0%2C%22isExam%22%3A0%2C%22examId%22%3Anull%2C%22paperId%22%3Anull%2C%22suitangUpper%22%3A%2220%22%2C%22suitangLower%22%3Anull%2C%22performanceId%22%3Anull%2C%22studentId%22%3Anull%2C%22signStatus%22%3Anull%2C%22isDone%22%3A0%2C%22examDone%22%3A2%2C%22questionDone%22%3A2%2C%22courseSynopsis%22%3A%22%E5%BA%86%E7%A5%9D%E4%B8%AD%E5%9B%BD%E5%85%B1%E4%BA%A7%E5%85%9A%E6%88%90%E7%AB%8B100%E5%91%A8%E5%B9%B4%22%2C%22ceremonyCategory%22%3Anull%2C%22isEvaluate%22%3A0%2C%22courseProcess%22%3A0%2C%22ranks%22%3A%22%E5%9B%BD%E5%AE%B6%E8%8D%A3%E8%AA%89%22%2C%22courseModule%22%3A%22%E6%A5%B7%E6%A8%A1%E5%88%86%E4%BA%AB%22%2C%22isQuestion%22%3Anull%7D&isPre=0 console.log('去学习'); unPassCheck.confirmText = '去学习'; unPassCheck.content = `未学完课程《${courseName}》`; unPassCheck.jumpType = JUMP_TYPES.COURSE; } else if (!data.examDone) { //去考试 // id=36&examId=5&stuId=13 console.log('去考试'); unPassCheck.confirmText = '去考试'; unPassCheck.content = `未参加《${courseName}》的随堂考试`; unPassCheck.jumpType = JUMP_TYPES.EXAM; } else if (!data.questionDone) { //去评价 // id=20&teamId=2&courseId=228&scheduleId=20&eduStuId=13 console.log('去评价'); unPassCheck.confirmText = '去评价'; unPassCheck.content = `未参加《${courseName}》的随堂问卷`; unPassCheck.jumpType = JUMP_TYPES.EVALUATE; } wx.showModal({ title: '不能参加毕业考试', content: `${unPassCheck.content}`, confirmText: unPassCheck.confirmText, success: res => { if (!res.confirm) { return; } let { eduStuId, teamId } = this.data.eInfo; let jumpType = unPassCheck.jumpType; switch (jumpType) { case JUMP_TYPES.COURSE: let isPre = logicStatus.NO; let plan = JSON.stringify(data); let detail = JSON.stringify(this.data.eInfo); //start let type = ""; if (data.courseType == courseTypes.RECORD) { type = courseTypes.RECORD; } // if (item.isReplay && item.isLive && item.liveStatus == liveStatus.LIVEEND && type == "") { // type = courseTypes.PLAYBACK; // } if (data.isLive && type == "") { type = courseTypes.LIVE; } if (type == "") { type = courseTypes.OFFLINE; } //end Route.toCourseDetail(type, data.id, detail, plan, isPre, { refresh: () => { // const eventChannel = this.getOpenerEventChannel() // eventChannel.emit('refresh'); this.emitRefresh(); } }); break; case JUMP_TYPES.EXAM: // id=36&examId=5&stuId=13 Route.toExamDetail(data.paperId, data.examId, eduStuId, { answer: () => { // const eventChannel = this.getOpenerEventChannel() // eventChannel.emit('refresh'); this.emitRefresh(); } }); break; case JUMP_TYPES.EVALUATE: let qid = ""; if (this.data.eInfo.isOnline) { qid = data.suitangUpper; } else { qid = data.suitangLower; } Route.toQuestionDetail(qid, teamId, data.courseId, data.id, eduStuId, { answer: () => { // this.triggerEvent("refresh") // const eventChannel = this.getOpenerEventChannel() // eventChannel.emit('refresh'); this.emitRefresh(); } }); break; } } // showCancel: false }); }, emitRefresh() { const eventChannel = this.getOpenerEventChannel(); eventChannel.emit('refresh'); } })