diff --git a/App.vue b/App.vue index 3142677c..91f3468c 100644 --- a/App.vue +++ b/App.vue @@ -210,7 +210,7 @@ // background-color: #f3f5fd; color: $uni-text-color; } - + .bgLightBlue { background-color: #f3f5fd; } diff --git a/main.js b/main.js index f1b57a17..dfe20678 100644 --- a/main.js +++ b/main.js @@ -38,11 +38,11 @@ if (process.env.NODE_ENV === 'development') { // Vue.prototype.url_config = 'http://47.93.215.234:9809/' // 鞍钢正式地址(弃用) // Vue.prototype.url_config = 'http://42.180.188.17:9809/' // 鞍钢正式地址 // Vue.prototype.url_config = 'http://42.180.188.17:11211/' // 鞍钢测试地址 - Vue.prototype.url_config = 'http://182.90.224.237:51234/' //雄哥内网穿透地址 + // Vue.prototype.url_config = 'http://182.90.224.237:51234/' //雄哥内网穿透地址 // Vue.prototype.url_config = 'http://jxj.zhgdyun.com:61212/' //杰哥内网穿透地址 // Vue.prototype.url_config = ' http://192.168.34.221:28888/' //郭圣雄本地 // Vue.prototype.url_config = 'http://192.168.34.221:9111/' //郭圣雄本地 - // Vue.prototype.url_config = 'http://192.168.34.155:19111/' //彭洁本地 + Vue.prototype.url_config = 'http://192.168.34.155:19111/' //彭洁本地 // Vue.prototype.work_url = 'http://47.93.215.234:19997' // 工作流线上地址(弃用) // Vue.prototype.work_url = 'http://42.180.188.17:19997' // 工作流线上地址 // Vue.prototype.work_url = 'http://42.180.188.17:19097' // 工作流测试地址 diff --git a/pages.json b/pages.json index f14610d0..74c2f082 100644 --- a/pages.json +++ b/pages.json @@ -2522,13 +2522,7 @@ { "path": "pages/personLocation/exam/index/index", "style": { - "app-plus": { - "titleNView": { - "titleColor": "#ffffff", - "autoBackButton": false - } - }, - "navigationBarTitleText": "教育培训" + "navigationBarTitleText": "" } }, { @@ -2641,7 +2635,8 @@ "path" : "pages/projectEnd/trainPlan/searchTeam/personList", "style" : { - "navigationBarTitleText" : "" + "navigationBarTitleText" : "", + "onReachBottomDistance": 100 } }, { diff --git a/pages/login/login.vue b/pages/login/login.vue index 6dc924b2..5e278b3b 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -1,22 +1,22 @@ @@ -29,6 +44,8 @@ export default { data() { return { + totalTime: 10, // 假设考试总时长为60分钟 + timer: null, // 计时器 percent: 0, stIndex: 0, stList: [], @@ -40,8 +57,82 @@ }, onLoad(options) { this.pageData = JSON.parse(options.transportData) + console.log(this.pageData.examDuration) + this.totalTime = +this.pageData.examDuration * 60; + }, + onShow() { + this.startTimer(); + }, + onHide() { + this.stopTimer(); + }, + computed: { + timeLeft() { + let hours = Math.floor(this.totalTime / 3600); + let minutes = Math.floor((this.totalTime % 3600) / 60); + let seconds = this.totalTime % 60; + + hours = hours < 10 ? '0' + hours : hours; + minutes = minutes < 10 ? '0' + minutes : minutes; + seconds = seconds < 10 ? '0' + seconds : seconds; + + return `${hours}:${minutes}:${seconds}`; + }, }, methods: { + // 自动交卷 + autoSubmit() { + var that = this + uni.showModal({ + title: '提示', + showCancel: false, + content: '考试时间已到,正在交卷...', + success: function(res) { + if (res.confirm) { + let requestData = { + examAnswerQuestionList: that.stList + } + that.sendRequest({ + url: "xmgl/workerExam/submit", + data: that.stList, + method: 'post', + success(res) { + uni.showToast({ + title: "提交成功", + icon: "none" + }) + let responseData = res.result; + let transportData = { + ...that.pageData, + ...responseData + } + uni.redirectTo({ + url: `/pages/personLocation/exam/examresult/examresult?examData=` + + JSON.stringify(transportData) + }); + } + }) + } else if (res.cancel) { + console.log('用户点击取消'); + } + } + }); + }, + startTimer() { + this.timer = setInterval(() => { + if (this.totalTime > 0) { + this.totalTime -= 1; + } else { + this.stopTimer(); + this.autoSubmit(); + // 考虑考试时间到,需要做的操作,比如提示考试结束 + } + }, 1000); + }, + stopTimer() { + clearInterval(this.timer); + this.timer = null; + }, getDataFn() { var that = this let requestData = { @@ -53,7 +144,7 @@ method: 'post', success(res) { console.log('试题信息', res) - if (res.result) { + if (res.result && res.result.length > 0) { that.stList = res.result; var tab = document.querySelector('.uni-progress-inner-bar'); var p = document.createElement('p'); @@ -75,19 +166,46 @@ if (that.stIndex == that.stList.length - 1) { return; } - uni.showLoading() - setTimeout(function() { - that.stIndex++; - var progressTip = document.querySelector('.uni-progress-info'); - progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' - uni.hideLoading() - }, 500) + // uni.showLoading() + // setTimeout(function() { + // that.stIndex++; + // var progressTip = document.querySelector('.uni-progress-info'); + // progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' + // uni.hideLoading() + // }, 500) + }, + checkChange(evt) { + console.log(evt) + this.stList[this.stIndex].answer = evt.detail.value.join('') + let that = this; + // 当到达最后一题时 + if (that.stIndex == that.stList.length - 1) { + return; + } + // uni.showLoading() + // setTimeout(function() { + // that.stIndex++; + // var progressTip = document.querySelector('.uni-progress-info'); + // progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' + // uni.hideLoading() + // }, 500) }, // 去上一题 goFront(index) { - this.stIndex--; + let that = this; + that.stIndex--; + var progressTip = document.querySelector('.uni-progress-info'); + progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' }, - goHiidden(item) { + // 去下一题 + goNext(index) { + let that = this; + that.stIndex++; + var progressTip = document.querySelector('.uni-progress-info'); + progressTip.innerText = (((that.stIndex + 1) * 100) / that.stList.length).toFixed(0) + '%' + // uni.hideLoading() + }, + goHiidden() { var that = this uni.showModal({ title: '提示', @@ -107,9 +225,13 @@ icon: "none" }) let responseData = res.result; + let transportData = { + ...that.pageData, + ...responseData + } uni.redirectTo({ url: `/pages/personLocation/exam/examresult/examresult?examData=` + - JSON.stringify(responseData) + JSON.stringify(transportData) }); } }) @@ -129,9 +251,22 @@ .beginexam { padding: 26.92rpx 32.69rpx; - .text { - font-size: 34.62rpx; - color: #272D45; + .questionTitle { + width: 100%; + position: relative; + + .text { + width: 61%; + display: inline-block; + font-size: 34.62rpx; + color: #272D45; + } + + .rest-time { + position: absolute; + top: 7rpx; + right: 20rpx; + } } .radio-content { @@ -143,6 +278,15 @@ .radio-boxs>label { padding: 20rpx 0; } + + .check-boxs { + display: flex; + flex-direction: column; + } + + .check-boxs>label { + padding: 20rpx 0; + } } } @@ -150,21 +294,39 @@ padding: 26.92rpx 32.69rpx; } - .btn { + .step-btn { + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; width: calc(100% - 80.76rpx); + height: auto; position: absolute; bottom: 180.77rpx; left: 50%; transform: translateX(-50%); + + button { + width: 100%; + margin-bottom: 20rpx; + } } - .btn-front { - width: calc(100% - 80.76rpx); - position: absolute; - bottom: 290rpx; - left: 50%; - transform: translateX(-50%); - } + // .btn { + // width: calc(100% - 80.76rpx); + // position: absolute; + // bottom: 180.77rpx; + // left: 50%; + // transform: translateX(-50%); + // } + + // .btn-front { + // width: calc(100% - 80.76rpx); + // position: absolute; + // bottom: 290rpx; + // left: 50%; + // transform: translateX(-50%); + // } } diff --git a/pages/personLocation/exam/examresult/examresult.vue b/pages/personLocation/exam/examresult/examresult.vue index 26025b62..5dc2efd8 100644 --- a/pages/personLocation/exam/examresult/examresult.vue +++ b/pages/personLocation/exam/examresult/examresult.vue @@ -17,13 +17,13 @@ 对于成绩不满意可再次考试 + @click="examAgain('/personLocation/exam/beginexam/beginexam')">再考一次 - 80 + {{pageData.score}} @@ -32,7 +32,7 @@ 恭喜您通过考试 + @click="goHiidden('/personLocation/exam/index/index')">返回 @@ -46,14 +46,20 @@ } }, created() { - document.querySelector('.uni-page-head-hd').style.display = 'none' + // document.querySelector('.uni-page-head-hd').style.display = 'none' }, onLoad(options) { this.pageData = JSON.parse(options.examData) }, methods: { + examAgain(url){ + uni.redirectTo({ + url: `/pages${url}?transportData=` + JSON.stringify(this + .pageData) + }); + }, goHiidden(url) { - uni.navigateTo({ + uni.redirectTo({ url: `/pages${url}` }); }, diff --git a/pages/personLocation/exam/index/index.vue b/pages/personLocation/exam/index/index.vue index 49a9845d..11ebcebf 100644 --- a/pages/personLocation/exam/index/index.vue +++ b/pages/personLocation/exam/index/index.vue @@ -50,6 +50,8 @@ }, onLoad() { this.userInfo = JSON.parse(uni.getStorageSync("userInfo")) + }, + onShow() { this.getDataList(); }, methods: { @@ -80,7 +82,8 @@ courseId: item.courseId, examPaperId: item.examPaperId, trainRecordId: item.id, - trainId: item.trainId + trainId: item.trainId, + examDuration: item.examDuration } uni.navigateTo({ url: `/pages/personLocation/exam/studydetails/studydetails?transportData=` + JSON.stringify(transportData) @@ -92,6 +95,9 @@