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