From 698f4cfc0bcd7cfdaf0aa2e3c74b78f89f3641fc Mon Sep 17 00:00:00 2001 From: X_Rian <904416525@qq.com> Date: Tue, 23 Jul 2024 15:53:49 +0800 Subject: [PATCH] =?UTF-8?q?flx=EF=BC=9A=E6=8F=90=E4=BA=A4=E5=AE=89?= =?UTF-8?q?=E5=85=A8=E8=80=83=E8=AF=95=E7=B3=BB=E7=BB=9Fbug=20=E8=B5=84?= =?UTF-8?q?=E6=96=99=E5=8F=AA=E9=9C=80=E8=A6=81=E5=AD=A6=E4=B9=A0=E4=B8=80?= =?UTF-8?q?=E9=81=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exam/studydetails/studydetails.vue | 68 +++++++++++-------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/pages/personLocation/exam/studydetails/studydetails.vue b/pages/personLocation/exam/studydetails/studydetails.vue index 1e75eb3c..cfa19c5e 100644 --- a/pages/personLocation/exam/studydetails/studydetails.vue +++ b/pages/personLocation/exam/studydetails/studydetails.vue @@ -44,7 +44,7 @@ - @@ -63,6 +63,7 @@ userInfo: "", responseData: {}, isPageLength: 0, + startFlag: true, // isStartExam: false } }, @@ -71,6 +72,26 @@ const videoEvery = this.videoList.every(item => item.isVideoOver && item.controlsBool); const dataEvery = this.dataList.every(item => item.isFileOver); console.log('计算属性执行了', this.videoList, this.dataList, videoEvery, dataEvery) + if(this.startFlag){ + this.videoStartTime = this.$formatDates(new Date().getTime(), 'yyyy-MM-dd HH:mm:ss'); + this.startFlag = false; + } + console.log(dataEvery && videoEvery && (this.videoList.length > 0 || this.dataList > 0)) + if(dataEvery && videoEvery && (this.videoList.length > 0 || this.dataList > 0)){ + let requestData = { + workerId: this.userInfo.id, + trainId: this.pageData.trainId, + beginTime: this.videoStartTime, + endTime: this.$formatDates(new Date().getTime(), 'yyyy-MM-dd HH:mm:ss') + } + this.sendRequest({ + url: "xmgl/workerExam/submitStudy", + data: requestData, + method: 'post', + success(res) {} + }) + } + return !(videoEvery && dataEvery); } }, @@ -84,7 +105,6 @@ this.pageData = JSON.parse(options.transportData) console.log(this.pageData) this.getDataFn(); - this.trainRecordId(); }, onShow() { // 刷新页面 @@ -160,7 +180,7 @@ }) }, videoStart(index) { - this.videoStartTime = this.$formatDates(new Date().getTime(), 'yyyy-MM-dd HH:mm:ss'); + }, videoEnd(index) { var that = this @@ -183,18 +203,7 @@ // } else { // that.isStartExam = false; // } - let requestData = { - workerId: this.userInfo.id, - trainId: this.pageData.trainId, - beginTime: this.videoStartTime, - endTime: this.$formatDates(new Date().getTime(), 'yyyy-MM-dd HH:mm:ss') - } - this.sendRequest({ - url: "xmgl/workerExam/submitStudy", - data: requestData, - method: 'post', - success(res) {} - }) + }, getDataFn() { var that = this @@ -217,17 +226,11 @@ console.log(result, that.videoList, that.dataList); // that.videoList // dataList - that.dataList.map(item => { - that.$set(item,'isFileOver',false) - }) - that.videoList.map(item => { - that.$set(item,'isVideoOver',false) - that.$set(item,'controlsBool',false) - }) // if (that.videoList.length) { // that.isStartExam = true; // that.videoUrl = that.videoList[0].url // } + that.trainRecordId(); console.log(that.src) } } @@ -241,13 +244,14 @@ }, trainRecordId() { var that = this - console.log(uni.getStorageSync('devInfoList').projectSn) + const devInfoList = uni.getStorageSync('devInfoList') let requestData = { pageNo: 1, - pageSize: 1, + pageSize: 10, number: 1, - trainId: this.pageData.trainRecordId, - projectSn: uni.getStorageSync('devInfoList').projectSn, + trainId: this.pageData.trainId, + workerCard: devInfoList.idCard, + projectSn: devInfoList.projectSn, } this.sendRequest({ url: "exam/courseRecord/page", @@ -255,8 +259,16 @@ method: 'post', success(res) { if (res.code == 200) { - console.log(22222, res); - that.isPageLength = res.result.length; + that.isPageLength = res.result.records instanceof Array ? res.result.records.length : 0; + console.log(22222, res, that.isPageLength); + const isPageFlag = that.isPageLength > 0 ? true : false; + that.dataList.map(item => { + that.$set(item,'isFileOver',isPageFlag) + }) + that.videoList.map(item => { + that.$set(item,'isVideoOver',isPageFlag) + that.$set(item,'controlsBool',isPageFlag) + }) } } })