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) + }) } } })