From 985dcddc71c3d957c76c7086525ecda519c7cf36 Mon Sep 17 00:00:00 2001 From: xuechunyuan <17853500702@163.com> Date: Fri, 17 Feb 2023 18:16:56 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E9=A2=84=E7=BA=A6=E4=B8=AD?= =?UTF-8?q?=E8=BD=AC=E6=8E=A5=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/aisdapp.js | 2 +- src/views/myExam.vue | 263 ++++++++++++++++++++++++++----------------- 2 files changed, 163 insertions(+), 102 deletions(-) diff --git a/src/utils/aisdapp.js b/src/utils/aisdapp.js index c5dff29..9158f9e 100644 --- a/src/utils/aisdapp.js +++ b/src/utils/aisdapp.js @@ -5,7 +5,7 @@ export const appword = "aKd20dbGdFvmuwrt" const appid = 'cgstjyyjzpzp'; -const appMode = false;//是否开启爱山东中控台接口调用方式 +const appMode = true;//是否开启爱山东中控台接口调用方式 export default { appid, diff --git a/src/views/myExam.vue b/src/views/myExam.vue index 2a9c91e..75620f2 100644 --- a/src/views/myExam.vue +++ b/src/views/myExam.vue @@ -26,11 +26,15 @@
{{ item1.project }}
- {{ item1.apmStatus == 1 ? '您的体检项目已取消' : item1.apmStatus == 3 ? '体检项目已完成' : (item1.apmStatus == 2 && item1.lastExamTime == 0) ? '您的体检已过期' : item1.limitTime }}
+ {{ + item1.apmStatus == 1 ? '您的体检项目已取消' : item1.apmStatus == 3 ? '体检项目已完成' : (item1.apmStatus == 2 && + item1.lastExamTime == 0) ? '您的体检已过期' : item1.limitTime + }}
{{ + :class="[item1.apmStatus == 3 ? 'finish' : item1.apmStatus == 1 || item1.limitCancelTime < 30 * 60 * 1000 ? 'cancel_item' : '',]"> + {{ item1.apmStatus == 1 ? '已取消' : item1.apmStatus == 2 ? '取消预约' : item1.apmStatus == 3 ? '已完成' : '取消预约' }}
@@ -52,12 +56,12 @@ export default { userInfo: null, systemTime: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'), setInterval: 0, - interVal:null, - starTime:'', - lastTime:'', - timeArr:[], - lastCanTime:'', - limitTime:1000 * 60 *30 + interVal: null, + starTime: '', + lastTime: '', + timeArr: [], + lastCanTime: '', + limitTime: 1000 * 60 * 30 } }, mounted() { @@ -68,9 +72,9 @@ export default { this.queryMyRecord(); } }, - computed:{ + computed: { }, - watch:{ + watch: { }, beforeDestroy() { if (this.setInterval) { @@ -80,9 +84,20 @@ export default { methods: { //系统时间 querySystemTime() { - getSystemTime().then(res => { - this.systemTime = res.data; - }) + if (this.GlobalConfig.appMode) { + vaildInterfacefn("cgstjyyjzpzp", "qdsgajjtjczhqxtsj", JSON.stringify({}), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway).then((value) => { + let retData = value; + if (retData.code == 200) { + this.systemTime = retData.data; + } + }, err => { + }) + } + else { + getSystemTime().then(res => { + this.systemTime = res.data; + }) + } }, //我的预约列表 queryMyRecord() { @@ -91,86 +106,120 @@ export default { duration: 0, }) try { - myRecord("", this.userInfo.papersnumber, this.current, this.size).then(res => { - this.$toast.clear(); - this.examArr = res.data.records; - console.log(this.examArr) - this.examArr.map(item1 =>{ - item1.details.map(item =>{ - console.log(item) - let systemTime = Date.parse(new Date(this.systemTime)); - item.starTime = systemTime - let latime = item1.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; - let lasCanTime = item1.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[0] + ':00'; - item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-','/'))) - item.lastTime = Date.parse(new Date(latime.replaceAll('-','/'))) - item.limitTime = this.intervalTime(item.starTime,item.lastTime) - item.lastExamTime = systemTime < item.lastTime ? item.lastTime - systemTime : 0 - item.limitCancelTime = systemTime < item.lastCanTime ? item.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 - // console.log(latime,item.lastTime,lasCanTime,item.lastCanTime,item.limitCancelTime) //670422000 - // this.$set( - // item,"limitTime",item.limitTime - // ); + if (this.GlobalConfig.appMode) { + vaildInterfacefn("cgstjyyjzpzp", "qdsgajjtjczdckwdyy", JSON.stringify({ createDept: "", cupCardNo: this.userInfo.papersnumber, current: this.current, size: this.size }), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway).then((value) => { + this.$toast.clear(); + let retData = JSON.parse(value); + // console.log(retData,'record') + if (retData.code == 200) { + this.examArr = retData.data.records; + console.log(this.examArr) + this.examArr.map(item1 => { + item1.details.map(item => { + console.log(item) + let systemTime = Date.parse(new Date(this.systemTime)); + item.starTime = systemTime + let latime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[1] + ':00'; + let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[0] + ':00'; + item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/'))) + item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/'))) + item.limitTime = this.intervalTime(item.starTime, item.lastTime) + item.lastExamTime = systemTime < item.lastTime ? item.lastTime - systemTime : 0 + item.limitCancelTime = systemTime < item.lastCanTime ? item.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 + // console.log(latime,item.lastTime,lasCanTime,item.lastCanTime,item.limitCancelTime) //670422000 + // this.$set( + // item,"limitTime",item.limitTime + // ); + }) + }) + this.timeList() + } + }, err => { + this.$toast.clear(); + }) + } + else { + myRecord("", this.userInfo.papersnumber, this.current, this.size).then(res => { + this.$toast.clear(); + this.examArr = res.data.records; + console.log(this.examArr) + this.examArr.map(item1 => { + item1.details.map(item => { + console.log(item) + let systemTime = Date.parse(new Date(this.systemTime)); + item.starTime = systemTime + let latime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[1] + ':00'; + let lasCanTime = item1.apmDay.substr(0, 10) + ' ' + item.timeFrame.split('-')[0] + ':00'; + item.lastCanTime = Date.parse(new Date(lasCanTime.replaceAll('-', '/'))) + item.lastTime = Date.parse(new Date(latime.replaceAll('-', '/'))) + item.limitTime = this.intervalTime(item.starTime, item.lastTime) + item.lastExamTime = systemTime < item.lastTime ? item.lastTime - systemTime : 0 + item.limitCancelTime = systemTime < item.lastCanTime ? item.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 + // console.log(latime,item.lastTime,lasCanTime,item.lastCanTime,item.limitCancelTime) //670422000 + // this.$set( + // item,"limitTime",item.limitTime + // ); + }) }) + this.timeList() + // this.examArr.map(item => { + // let systemTime = Date.parse(new Date(this.systemTime)); + // this.starTime = systemTime + // let latime = item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; + // let lasCanTime =item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[0] + ':00'; + // this.lastCanTime = Date.parse(new Date(lasCanTime)) + // this.lastTime = Date.parse(new Date(latime)) + // let time = item.timeFrame.split('-')[1].split(':'); + // let endTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time[0] < 10 ? '0' + time[0] : time[0]) + ':' + (time[1] < 10 ? '0' + time[1] : time[1]) + ':00')); + // let time2 = item.timeFrame.split('-')[0].split(':'); + // let startTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time2[0] < 10 ? '0' + time2[0] : time2[0]) + ':' + (time2[1] < 10 ? '0' + time2[1] : time2[1]) + ':00')); + // item.time = systemTime < endTime ? endTime - systemTime : 0; + // // item.limitTime = this.calcDateTimeStr(systemTime < endTime ? endTime - systemTime : 0);//距离体检时间剩余毫秒数 + // item.limitTime = this.intervalTime(this.starTime,this.lastTime) + // // console.log('time ===>',item.limitTime) + // item.limitCancelTime = systemTime < this.lastCanTime ? this.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 + // console.log(item.limitCancelTime) + // }) + // //开启倒计时 + // if (this.setInterval) { + // clearInterval(this.setInterval); + // } + // this.setInterval = setInterval(() => { + // // console.log(this.examArr) + // this.timeArr = this.examArr; + // this.timeArr.map(item => { + // this.starTime = this.starTime > 1000 ? this.starTime + 1000 : 0; + // item.limitTime = this.intervalTime(this.starTime,this.lastTime) + // // item.limitCancelTime = item.limitCancelTime > 1000 ? item.limitCancelTime - 1000 : 0; + // // item.limitCancelTime = this.intervalTime(this.starTime,Date.parse(new Date(this.lastCanTime))) + + // }) + // // console.log(this.timeArr) + + // }, 1000); + // this.examArr = arr + }, err => { + this.$toast.clear(); }) - this.timeList() - // this.examArr.map(item => { - // let systemTime = Date.parse(new Date(this.systemTime)); - // this.starTime = systemTime - // let latime = item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[1] + ':00'; - // let lasCanTime =item.apmDay.substr(0,10) + ' ' + item.timeFrame.split('-')[0] + ':00'; - // this.lastCanTime = Date.parse(new Date(lasCanTime)) - // this.lastTime = Date.parse(new Date(latime)) - // let time = item.timeFrame.split('-')[1].split(':'); - // let endTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time[0] < 10 ? '0' + time[0] : time[0]) + ':' + (time[1] < 10 ? '0' + time[1] : time[1]) + ':00')); - // let time2 = item.timeFrame.split('-')[0].split(':'); - // let startTime = Date.parse(new Date(this.doDateFormatter(item.apmDay) + ' ' + (time2[0] < 10 ? '0' + time2[0] : time2[0]) + ':' + (time2[1] < 10 ? '0' + time2[1] : time2[1]) + ':00')); - // item.time = systemTime < endTime ? endTime - systemTime : 0; - // // item.limitTime = this.calcDateTimeStr(systemTime < endTime ? endTime - systemTime : 0);//距离体检时间剩余毫秒数 - // item.limitTime = this.intervalTime(this.starTime,this.lastTime) - // // console.log('time ===>',item.limitTime) - // item.limitCancelTime = systemTime < this.lastCanTime ? this.lastCanTime - systemTime : 0;//距离取消预约剩余毫秒数 - // console.log(item.limitCancelTime) - // }) - // //开启倒计时 - // if (this.setInterval) { - // clearInterval(this.setInterval); - // } - // this.setInterval = setInterval(() => { - // // console.log(this.examArr) - // this.timeArr = this.examArr; - // this.timeArr.map(item => { - // this.starTime = this.starTime > 1000 ? this.starTime + 1000 : 0; - // item.limitTime = this.intervalTime(this.starTime,this.lastTime) - // // item.limitCancelTime = item.limitCancelTime > 1000 ? item.limitCancelTime - 1000 : 0; - // // item.limitCancelTime = this.intervalTime(this.starTime,Date.parse(new Date(this.lastCanTime))) - - // }) - // // console.log(this.timeArr) - - // }, 1000); - // this.examArr = arr - }, err => { - this.$toast.clear(); - }) + } } catch (error) { this.$toast.clear(); } }, - timeList(){ - if(this.setInterval){ + timeList() { + if (this.setInterval) { clearInterval(this.setInterval) } this.setInterval = setInterval(() => { let arr = [] this.examArr.forEach(item => { - item.details.map(item1 =>{ + item.details.map(item1 => { item1.starTime = item1.starTime > 1000 ? item1.starTime + 1000 : 0; - item1.limitTime = this.intervalTime(item1.starTime,item1.lastTime); + item1.limitTime = this.intervalTime(item1.starTime, item1.lastTime); item1.lastExamTime = item1.lastExamTime > 1000 ? item1.lastExamTime - 1000 : 0; item1.limitCancelTime = item1.limitCancelTime > 1000 ? item1.limitCancelTime - 1000 : 0 - this.$set(item.details,item1.limitTime,item1.limitTime) + this.$set(item.details, item1.limitTime, item1.limitTime) // this.$set(item.details,item1.limitCancelTime,item1.limitCancelTime) }) // console.log(this.examArr) @@ -180,22 +229,22 @@ export default { // 计算时间差 //计算两个时间之间的时间差 多少天时分秒 - intervalTime(startTime,endTime) { + intervalTime(startTime, endTime) { // var timestamp=new Date().getTime(); //计算当前时间戳 - var timestamp = (Date.parse(new Date()))/1000;//计算当前时间戳 (毫秒级) + var timestamp = (Date.parse(new Date())) / 1000;//计算当前时间戳 (毫秒级) var date1 = ""; //开始时间 - if(timestamp',time) + console.log('剩余 ===>', time) let ret = calcTime(time); - console.log('ret ===>',ret) + console.log('ret ===>', ret) return time > 0 ? `距离体检还有${ret.days}天${ret.hours}:${ret.minutes}:${(ret.seconds + '').substr(0, 2)}` : '' }, //取消预约 @@ -265,14 +314,26 @@ export default { success: (data) => { console.log(data) if (JSON.parse(data).buttonIndex == 1) { - console.log('ces') - recordCancel(row.id).then(res => { - console.log(res) - if (res.code == 200) { - this.$toast('操作成功'); - this.queryMyRecord(); - } - }) + // console.log('ces') + if (this.GlobalConfig.appMode) { + vaildInterfacefn("cgstjyyjzpzp", "qdsgajjtjczdqxtjyy", JSON.stringify({ id: row.id }), "2", "https://" + this.GlobalConfig.urlCreatesign, "https://" + this.GlobalConfig.urlGateway).then((value) => { + let retData = JSON.parse(value); + if (retData.code == 200) { + this.$toast('操作成功'); + this.queryMyRecord(); + } + }, err => { + }) + } + else { + recordCancel(row.id).then(res => { + console.log(res) + if (res.code == 200) { + this.$toast('操作成功'); + this.queryMyRecord(); + } + }) + } } }, fail: function (data) { //错误返回 @@ -446,9 +507,9 @@ export default { pointer-events: none; } - .limit{ + .limit { pointer-events: none; - background: #E5E5E5; + background: #E5E5E5; color: #999; }