|
|
|
@ -100,7 +100,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) |
|
|
|
|
console.log(uni.getStorageSync('filterData'),'pppppppppppppppppppppppp') |
|
|
|
|
// this.$refs.slFilter.resetMenuList(this.menuList) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
@ -108,15 +107,10 @@ |
|
|
|
|
onShareAppMessage() { |
|
|
|
|
let that = this |
|
|
|
|
wx.onAppRoute(() => { |
|
|
|
|
let white = ['BagStation/pages/stationDetail/stationDetail'] |
|
|
|
|
// console.log('当前页面路由发生变化 触发该事件onShareAppMessage') |
|
|
|
|
const pages = getCurrentPages() //获取加载的页面 |
|
|
|
|
const view = pages[pages.length - 1] //获取当前页面的对象 |
|
|
|
|
if (!view) return false //如果不存在页面对象 则返回 |
|
|
|
|
// 若想给个别页面做特殊处理 可以给特殊页面加isOverShare为true 就不会重写了 |
|
|
|
|
// const data = view.data |
|
|
|
|
// if (!data.isOverShare) { |
|
|
|
|
// data.isOverShare = true |
|
|
|
|
if (!view) return false |
|
|
|
|
|
|
|
|
|
view.onShareAppMessage = () => { //重写分享配置 |
|
|
|
|
return { |
|
|
|
|
title: '中品加油', |
|
|
|
@ -125,85 +119,47 @@ |
|
|
|
|
imageUrl: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/login-bg.png', |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
console.log(view.route) |
|
|
|
|
// console.log(view.route) |
|
|
|
|
clearTimeout(loginTimer) |
|
|
|
|
clearTimeout(onlineTimer) |
|
|
|
|
|
|
|
|
|
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { |
|
|
|
|
const token = uni.getStorageSync('Authorization') |
|
|
|
|
const openid = uni.getStorageSync('openid') |
|
|
|
|
|
|
|
|
|
let jumpUrl = '/BagAuth/pages/login/login' |
|
|
|
|
let target = {} |
|
|
|
|
|
|
|
|
|
// if(view.route === 'BagStation/pages/stationDetail/stationDetail') { |
|
|
|
|
// let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath) |
|
|
|
|
// if(urlTarget.q) { |
|
|
|
|
// let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) |
|
|
|
|
// target = this.obtainUrlPathParameterTarget(originLink) |
|
|
|
|
// target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
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) |
|
|
|
|
|
|
|
|
|
// console.log('jumpUrl',jumpUrl) |
|
|
|
|
if (token && openid) { |
|
|
|
|
this.getAmount() |
|
|
|
|
// if(!white.includes(view.route) ){ |
|
|
|
|
// this.getAmount() |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
// if(target.siteId || !white.includes(view.route) ){ |
|
|
|
|
// this.getAmount() |
|
|
|
|
// } |
|
|
|
|
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: jumpUrl |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
complete: () => { |
|
|
|
|
clearTimeout(onlineTimer) |
|
|
|
|
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' |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
}else{ |
|
|
|
|
// if(!uni.getStorageSync('filterData')){ |
|
|
|
|
// that.getFilterData() |
|
|
|
|
// } |
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
target.siteId && uni.redirectTo({ |
|
|
|
|
url: jumpUrl |
|
|
|
|
}, |
|
|
|
|
complete: () => { |
|
|
|
|
clearTimeout(onlineTimer) |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
// loginTimer = setTimeout(() => { |
|
|
|
|
// uni.showModal({ |
|
|
|
|
// title: '请您登录', |
|
|
|
|
// content: '您还没有登录,暂时查不到油站哦', |
|
|
|
|
// duration: '3000', |
|
|
|
|
// success: function(res) { |
|
|
|
|
// if (res.confirm) { |
|
|
|
|
// uni.redirectTo({ |
|
|
|
|
// url: '/BagAuth/pages/login/login' |
|
|
|
|
// }) |
|
|
|
|
// } |
|
|
|
|
// } |
|
|
|
|
// }) |
|
|
|
|
// }, 1000) |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
}, 500) |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
} |
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
}) |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -216,16 +172,14 @@ |
|
|
|
|
target[item.split('=')[0]] = item.split('=')[1] |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
console.log('11target',target) |
|
|
|
|
return target |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
// 是否token过期或ip更改 |
|
|
|
|
getAmount() { |
|
|
|
|
console.log('执行') |
|
|
|
|
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) { |
|
|
|
@ -241,7 +195,6 @@ |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
onShow: function() { |
|
|
|
|
console.log(12388) |
|
|
|
|
uni.getLocation({ |
|
|
|
|
type: 'wgs84', |
|
|
|
|
success: function(res) { |
|
|
|
@ -251,7 +204,6 @@ |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
console.log('onReady') |
|
|
|
|
const token = uni.getStorageSync('Authorization') |
|
|
|
|
const openid = uni.getStorageSync('openid') |
|
|
|
|
let key = '' |
|
|
|
@ -265,7 +217,6 @@ |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
setTimeout(() => { |
|
|
|
|
console.log(key) |
|
|
|
|
if (key == '在线') { |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|