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: '' msg: ''
} }
}, },
@ -100,7 +99,6 @@
this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes) this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes)
this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands) this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands)
uni.setStorageSync('filterData', this.menuList) 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', imageUrl: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/login-bg.png',
} }
} }
// console.log(view.route) //
clearTimeout(loginTimer) let isRefuseLogin = uni.getStorageSync('refuseLogin')
clearTimeout(onlineTimer) console.log('isRefuseLogin',isRefuseLogin,typeof isRefuseLogin)
if(isRefuseLogin || view.route === 'pages/index/startPage/startPage' || view.route.includes('BagAuth')) return
if(view.route === 'pages/index/startPage/startPage' || view.route.includes('BagAuth')) return this.getAmount()
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 {
}
}) })
}, },
@ -177,14 +139,20 @@
// tokenip // tokenip
getAmount() { getAmount() {
console.log('执行')
clearTimeout(loginTimer)
accountApi.getTotalOilCardInfo().then(res => { accountApi.getTotalOilCardInfo().then(res => {
if (res.code == 20000) { if (res.code == 42011) {
this.loginStatus = 'online' uni.showModal({
} else if (res.code == 42011) { title: '需要您重新登录',
this.loginStatus = 'offline' content: res.msg,
this.msg = 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 token = uni.getStorageSync('Authorization')
const openid = uni.getStorageSync('openid') // const openid = uni.getStorageSync('openid')
let key = '' // let key = ''
if (token && openid) { // if (token && openid) {
this.getAmount() // this.getAmount()
key = '真在线' // key = '线'
} else { // } else {
key = '离线' // key = '线'
} // }
if (key == '在线') { // if (key == '线') {
} // }
setTimeout(() => { // setTimeout(() => {
if (key == '在线') { // if (key == '线') {
} else { // } else {
// uni.redirectTo({ // // uni.redirectTo({
// url: '/BagAuth/pages/login/login' // // url: '/BagAuth/pages/login/login'
// }) // // })
} // }
}, 2000) // }, 2000)
// uni.showShareMenu() // // uni.showShareMenu()
// console.log('App Show') // // console.log('App Show')
}, },
onHide: function() { onHide: function() {

@ -202,6 +202,7 @@
}, },
methods: { methods: {
refuseLogin() { refuseLogin() {
uni.setStorageSync('refuseLogin',true)
uni.switchTab({ uni.switchTab({
url: '/pages/tabbar/home/home' url: '/pages/tabbar/home/home'
}) })

Loading…
Cancel
Save