pull/3/head
xiaozhiyong 2 years ago
parent 4176a82927
commit 176e09a530
  1. 110
      App.vue
  2. 1
      BagAuth/pages/login/login.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 @@
// tokenip
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'
})

Loading…
Cancel
Save