xiaozy_优化 #4
108
App.vue
108
App.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
|
|
||||||
|
|
||||||
const token = uni.getStorageSync('Authorization')
|
|
||||||
const openid = uni.getStorageSync('openid')
|
|
||||||
|
|
||||||
console.log('token',token)
|
|
||||||
console.log('openid',openid)
|
|
||||||
|
|
||||||
if (token && openid) {
|
|
||||||
this.getAmount()
|
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 @@
|
|||||||
|
|
||||||
// 是否token过期或ip更改
|
// 是否token过期或ip更改
|
||||||
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'
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user