From 0554adda71379f01f635dadcedde8322f44a1153 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Mon, 27 Nov 2023 14:46:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 172 ++----- BagAuth/pages/login/login.vue | 100 +--- BagAuth/pages/login/oldLogin.vue | 14 +- .../pages/components/price-select-tab.vue | 474 ++++++++++-------- BagStation/pages/components/price-tab.vue | 1 + BagStation/pages/makeOrder/makeOrder.vue | 62 ++- .../pages/stationDetail/stationDetail.vue | 292 ++++++----- components/site-item/site-item.vue | 4 +- 8 files changed, 546 insertions(+), 573 deletions(-) diff --git a/App.vue b/App.vue index d13addc..60b842b 100644 --- a/App.vue +++ b/App.vue @@ -37,8 +37,8 @@ }] } ], - loginStatus: 'online', - msg: '' + // loginStatus: 'online', + // msg: '' } }, onLaunch() { @@ -59,7 +59,7 @@ Vue.prototype.Custom = custom; Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight; // #endif - + // #ifdef MP-ALIPAY Vue.prototype.StatusBar = e.statusBarHeight; Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight; @@ -100,7 +100,7 @@ this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes) this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands) uni.setStorageSync('filterData', this.menuList) - console.log(uni.getStorageSync('filterData'),'pppppppppppppppppppppppp') + console.log(uni.getStorageSync('filterData'), 'pppppppppppppppppppppppp') // this.$refs.slFilter.resetMenuList(this.menuList) } }) @@ -112,7 +112,7 @@ // console.log('当前页面路由发生变化 触发该事件onShareAppMessage') const pages = getCurrentPages() //获取加载的页面 const view = pages[pages.length - 1] //获取当前页面的对象 - if (!view) return false //如果不存在页面对象 则返回 + if (!view) return false // 若想给个别页面做特殊处理 可以给特殊页面加isOverShare为true 就不会重写了 // const data = view.data // if (!data.isOverShare) { @@ -125,158 +125,78 @@ imageUrl: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/login-bg.png', } } - console.log(view.route) - clearTimeout(loginTimer) + clearTimeout(onlineTimer) - + if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { const token = uni.getStorageSync('Authorization') const openid = uni.getStorageSync('openid') - let jumpUrl = '/BagAuth/pages/login/login' let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath) - console.log('urlTarget',urlTarget) let target = {} - if(urlTarget.q) { - let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) - target = this.obtainUrlPathParameterTarget(originLink) - target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`) + if (urlTarget.q) { + try { + let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) + target = this.obtainUrlPathParameterTarget(originLink) + target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`) + } catch (e) {} } - // console.log('jumpUrl',jumpUrl) + // console.log('jumpUrl',jumpUrl) if (token && openid) { - this.getAmount() - // if(!white.includes(view.route) ){ - // this.getAmount() - // } - - // if(target.siteId || !white.includes(view.route) ){ - // this.getAmount() - // } - - onlineTimer = setTimeout(() => { - if (this.loginStatus == 'offline') { - uni.clearStorageSync() - uni.showModal({ - title: '需要您重新登录', - content: this.msg, - duration: '3000', - success: function(res) { - if (res.confirm) { - uni.redirectTo({ - url: jumpUrl - }) - } - }, - complete: () => { - clearTimeout(onlineTimer) - } - }) - }else{ - // if(!uni.getStorageSync('filterData')){ - // that.getFilterData() - // } - } - }, 500) - + this.getAmount(jumpUrl) } else { - target.siteId && uni.redirectTo({ - url: jumpUrl - }) - // loginTimer = setTimeout(() => { - // uni.showModal({ - // title: '请您登录', - // content: '您还没有登录,暂时查不到油站哦', - // duration: '3000', - // success: function(res) { - // if (res.confirm) { - // uni.redirectTo({ - // url: '/BagAuth/pages/login/login' - // }) - // } - // } - // }) - // }, 1000) + target.siteId && uni.redirectTo({ + url: jumpUrl + }) } - - } - // } + }) }, - + obtainUrlPathParameterTarget(url) { let target = {} - if(url.includes('?')) { + if (url.includes('?')) { let paramsText = url.split("?")[1] let paramsArr = paramsText.split("&") paramsArr.forEach(item => { target[item.split('=')[0]] = item.split('=')[1] }) } - console.log('11target',target) + // console.log('11target',target) return target }, - + // 是否token过期或ip更改 - getAmount() { - clearTimeout(loginTimer) + getAmount(jumpUrl) { accountApi.getTotalOilCardInfo().then(res => { - console.log('res.code',res.code) - console.log(555) - if (res.code == 20000) { - this.loginStatus = 'online' - } else if (res.code == 42011) { - this.loginStatus = 'offline' - this.msg = res.msg + if (res.code == 42011) { + uni.clearStorageSync() + uni.showModal({ + title: '需要您重新登录', + content: res.msg, + duration: '3000', + success: (res) => { + if (res.confirm) { + uni.redirectTo({ + url: jumpUrl + }) + } + } + }) } }) }, }, - onReady() { - - }, - - onShow: function() { - // uni.getLocation({ - // type: 'wgs84', - // success: function(res) { - // uni.setStorageSync('location', { - // longitude: res.longitude + '', - // latitude: res.latitude + '' - // }) - // } - // }); - console.log('onReady') - const token = uni.getStorageSync('Authorization') - const openid = uni.getStorageSync('openid') - let key = '' - if (token && openid) { - this.getAmount() - key = '真在线' - } else { - key = '离线' - } - if (key == '在线') { - - } - setTimeout(() => { - // console.log(key) - if (key == '在线') { - - } else { - // uni.redirectTo({ - // url: '/BagAuth/pages/login/login' - // }) - } - }, 2000) - // uni.showShareMenu() - // console.log('App Show') - - }, - onHide: function() { - // console.log('App Hide') - } + // onShow: function() { + // const token = uni.getStorageSync('Authorization') + // const openid = uni.getStorageSync('openid') + // if (token && openid) { + // this.getAmount() + // // key = '真在线' + // } + // } } diff --git a/BagAuth/pages/login/login.vue b/BagAuth/pages/login/login.vue index 87f859c..dd1545f 100644 --- a/BagAuth/pages/login/login.vue +++ b/BagAuth/pages/login/login.vue @@ -1,79 +1,30 @@