|
|
|
@ -132,10 +132,26 @@ |
|
|
|
|
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)}`) |
|
|
|
|
} |
|
|
|
|
// console.log('jumpUrl',jumpUrl) |
|
|
|
|
if (token && openid) { |
|
|
|
|
if(!white.includes(view.route)){ |
|
|
|
|
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() |
|
|
|
@ -146,7 +162,7 @@ |
|
|
|
|
success: function(res) { |
|
|
|
|
if (res.confirm) { |
|
|
|
|
uni.redirectTo({ |
|
|
|
|
url: '/BagAuth/pages/login/login' |
|
|
|
|
url: jumpUrl |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
@ -162,6 +178,9 @@ |
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
target.siteId && uni.redirectTo({ |
|
|
|
|
url: jumpUrl |
|
|
|
|
}) |
|
|
|
|
// loginTimer = setTimeout(() => { |
|
|
|
|
// uni.showModal({ |
|
|
|
|
// title: '请您登录', |
|
|
|
@ -183,10 +202,26 @@ |
|
|
|
|
// } |
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
obtainUrlPathParameterTarget(url) { |
|
|
|
|
let target = {} |
|
|
|
|
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) |
|
|
|
|
return target |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 是否token过期或ip更改 |
|
|
|
|
getAmount() { |
|
|
|
|
getAmount() { |
|
|
|
|
clearTimeout(loginTimer) |
|
|
|
|
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) { |
|
|
|
@ -202,6 +237,7 @@ |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onShow: function() { |
|
|
|
|
console.log(12388) |
|
|
|
|
uni.getLocation({ |
|
|
|
|
type: 'wgs84', |
|
|
|
|
success: function(res) { |
|
|
|
|