更新
This commit is contained in:
110
App.vue
110
App.vue
@@ -37,7 +37,6 @@
|
||||
}]
|
||||
}
|
||||
],
|
||||
loginStatus: 'online',
|
||||
msg: ''
|
||||
}
|
||||
},
|
||||
@@ -100,7 +99,6 @@
|
||||
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)
|
||||
// this.$refs.slFilter.resetMenuList(this.menuList)
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -119,47 +117,11 @@
|
||||
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.includes('BagAuth')) return
|
||||
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('openid')
|
||||
|
||||
console.log('token',token)
|
||||
console.log('openid',openid)
|
||||
|
||||
if (token && openid) {
|
||||
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: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
clearTimeout(onlineTimer)
|
||||
}
|
||||
})
|
||||
}else{
|
||||
|
||||
}
|
||||
}, 500)
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
// 是否跳过登陆
|
||||
let isRefuseLogin = uni.getStorageSync('refuseLogin')
|
||||
console.log('isRefuseLogin',isRefuseLogin,typeof isRefuseLogin)
|
||||
if(isRefuseLogin || view.route === 'pages/index/startPage/startPage' || view.route.includes('BagAuth')) return
|
||||
this.getAmount()
|
||||
})
|
||||
},
|
||||
|
||||
@@ -177,14 +139,20 @@
|
||||
|
||||
// 是否token过期或ip更改
|
||||
getAmount() {
|
||||
console.log('执行')
|
||||
clearTimeout(loginTimer)
|
||||
accountApi.getTotalOilCardInfo().then(res => {
|
||||
if (res.code == 20000) {
|
||||
this.loginStatus = 'online'
|
||||
} else if (res.code == 42011) {
|
||||
this.loginStatus = 'offline'
|
||||
this.msg = res.msg
|
||||
if (res.code == 42011) {
|
||||
uni.showModal({
|
||||
title: '需要您重新登录',
|
||||
content: res.msg,
|
||||
duration: '3000',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
uni.redirectTo({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -204,29 +172,29 @@
|
||||
})
|
||||
}
|
||||
});
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('openid')
|
||||
let key = ''
|
||||
if (token && openid) {
|
||||
this.getAmount()
|
||||
key = '真在线'
|
||||
} else {
|
||||
key = '离线'
|
||||
}
|
||||
if (key == '在线') {
|
||||
// const token = uni.getStorageSync('Authorization')
|
||||
// const openid = uni.getStorageSync('openid')
|
||||
// let key = ''
|
||||
// if (token && openid) {
|
||||
// this.getAmount()
|
||||
// key = '真在线'
|
||||
// } else {
|
||||
// key = '离线'
|
||||
// }
|
||||
// if (key == '在线') {
|
||||
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (key == '在线') {
|
||||
// }
|
||||
// setTimeout(() => {
|
||||
// if (key == '在线') {
|
||||
|
||||
} else {
|
||||
// uni.redirectTo({
|
||||
// url: '/BagAuth/pages/login/login'
|
||||
// })
|
||||
}
|
||||
}, 2000)
|
||||
// uni.showShareMenu()
|
||||
// console.log('App Show')
|
||||
// } else {
|
||||
// // uni.redirectTo({
|
||||
// // url: '/BagAuth/pages/login/login'
|
||||
// // })
|
||||
// }
|
||||
// }, 2000)
|
||||
// // uni.showShareMenu()
|
||||
// // console.log('App Show')
|
||||
|
||||
},
|
||||
onHide: function() {
|
||||
|
||||
@@ -202,6 +202,7 @@
|
||||
},
|
||||
methods: {
|
||||
refuseLogin() {
|
||||
uni.setStorageSync('refuseLogin',true)
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user