|
|
@ -132,10 +132,26 @@ |
|
|
|
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { |
|
|
|
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { |
|
|
|
const token = uni.getStorageSync('Authorization') |
|
|
|
const token = uni.getStorageSync('Authorization') |
|
|
|
const openid = uni.getStorageSync('openid') |
|
|
|
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 (token && openid) { |
|
|
|
if(!white.includes(view.route)){ |
|
|
|
// if(!white.includes(view.route) ){ |
|
|
|
this.getAmount() |
|
|
|
// this.getAmount() |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if(target.siteId || !white.includes(view.route) ){ |
|
|
|
|
|
|
|
// this.getAmount() |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
onlineTimer = setTimeout(() => { |
|
|
|
onlineTimer = setTimeout(() => { |
|
|
|
if (this.loginStatus == 'offline') { |
|
|
|
if (this.loginStatus == 'offline') { |
|
|
|
uni.clearStorageSync() |
|
|
|
uni.clearStorageSync() |
|
|
@ -146,7 +162,7 @@ |
|
|
|
success: function(res) { |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
if (res.confirm) { |
|
|
|
uni.redirectTo({ |
|
|
|
uni.redirectTo({ |
|
|
|
url: '/BagAuth/pages/login/login' |
|
|
|
url: jumpUrl |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -162,6 +178,9 @@ |
|
|
|
}, 500) |
|
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
target.siteId && uni.redirectTo({ |
|
|
|
|
|
|
|
url: jumpUrl |
|
|
|
|
|
|
|
}) |
|
|
|
// loginTimer = setTimeout(() => { |
|
|
|
// loginTimer = setTimeout(() => { |
|
|
|
// uni.showModal({ |
|
|
|
// uni.showModal({ |
|
|
|
// title: '请您登录', |
|
|
|
// 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更改 |
|
|
|
// 是否token过期或ip更改 |
|
|
|
getAmount() { |
|
|
|
getAmount() { |
|
|
|
clearTimeout(loginTimer) |
|
|
|
clearTimeout(loginTimer) |
|
|
|
accountApi.getTotalOilCardInfo().then(res => { |
|
|
|
accountApi.getTotalOilCardInfo().then(res => { |
|
|
|
|
|
|
|
console.log('res.code',res.code) |
|
|
|
|
|
|
|
console.log(555) |
|
|
|
if (res.code == 20000) { |
|
|
|
if (res.code == 20000) { |
|
|
|
this.loginStatus = 'online' |
|
|
|
this.loginStatus = 'online' |
|
|
|
} else if (res.code == 42011) { |
|
|
|
} else if (res.code == 42011) { |
|
|
@ -202,6 +237,7 @@ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
onShow: function() { |
|
|
|
onShow: function() { |
|
|
|
|
|
|
|
console.log(12388) |
|
|
|
uni.getLocation({ |
|
|
|
uni.getLocation({ |
|
|
|
type: 'wgs84', |
|
|
|
type: 'wgs84', |
|
|
|
success: function(res) { |
|
|
|
success: function(res) { |
|
|
|