更新
This commit is contained in:
44
App.vue
44
App.vue
@@ -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) {
|
||||||
|
|||||||
@@ -188,20 +188,20 @@
|
|||||||
|
|
||||||
|
|
||||||
onLoad(option) {
|
onLoad(option) {
|
||||||
console.log(6667)
|
// console.log('option',option)
|
||||||
let userInfo = uni.getStorageSync('user')
|
// let userInfo = uni.getStorageSync('user')
|
||||||
if(!userInfo && option.q) {
|
// if(!userInfo && option.q) {
|
||||||
uni.redirectTo({
|
// uni.redirectTo({
|
||||||
url: `/BagAuth/pages/login/login?scanningParams=${option.q}`
|
// url: `/BagAuth/pages/login/login?scanningParams=${option.q}`
|
||||||
})
|
// })
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
if(option.q) {
|
if(option.q) {
|
||||||
let originLink = decodeURIComponent(option.q)
|
let originLink = decodeURIComponent(option.q)
|
||||||
let target = this.obtainUrlPathParameterTarget(originLink)
|
let target = this.obtainUrlPathParameterTarget(originLink)
|
||||||
console.log('target',target)
|
console.log('target',target)
|
||||||
if(target.siteId) {
|
if(userInfo && target.siteId) {
|
||||||
this.siteId = target.siteId
|
this.siteId = target.siteId
|
||||||
this.getSiteInfo(target.siteId)
|
this.getSiteInfo(target.siteId)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import utils from '@/utils/encode'
|
|||||||
|
|
||||||
// const env = process.env.NODE_ENV
|
// const env = process.env.NODE_ENV
|
||||||
// const env = 'production'/* */
|
// const env = 'production'/* */
|
||||||
const env = 'test'
|
const env = 'product'
|
||||||
const testUrl = 'http://192.168.110.230:38080'
|
const testUrl = 'http://192.168.110.230:38080'
|
||||||
// const productUrl = 'http://121.196.213.68/adminapi' //预生产
|
// const productUrl = 'http://121.196.213.68/adminapi' //预生产
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user