This commit is contained in:
xiaozhiyong
2023-04-06 13:20:20 +08:00
parent a8249b5de8
commit 4eaf549bbe
5 changed files with 47 additions and 75 deletions

68
App.vue
View File

@@ -85,29 +85,32 @@
const pages = getCurrentPages() //获取加载的页面 const pages = getCurrentPages() //获取加载的页面
const view = pages[pages.length - 1] //获取当前页面的对象 const view = pages[pages.length - 1] //获取当前页面的对象
if (!view) return false //如果不存在页面对象 则返回 if (!view) return false //如果不存在页面对象 则返回
// 若想给个别页面做特殊处理 可以给特殊页面加isOverShare为true 就不会重写了
// const data = view.data
// if (!data.isOverShare) {
// data.isOverShare = true
view.onShareAppMessage = () => { //重写分享配置 view.onShareAppMessage = () => { //重写分享配置
return { return {
title: '一路油你,星油能源', title: '一路油你,星油能源',
path: "/pages/index/startPage/startPage", //若无path 默认跳转分享页 path: "/pages/index/startPage/startPage",
// imageUrl:'/image/onshowMessage.png' //若无imageUrl 截图当前页面
imageUrl: 'https://xoi-support.oss-cn-hangzhou.aliyuncs.com/星油admin小程序/xxxxx.png', imageUrl: 'https://xoi-support.oss-cn-hangzhou.aliyuncs.com/星油admin小程序/xxxxx.png',
} }
} }
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) {
const token = uni.getStorageSync('Authorization') let white = ['pages/index/startPage/startPage']
const openid = uni.getStorageSync('openid') if(view.route === 'BagStation/pages/stationDetail/stationDetail') {
if (token && openid) { uni.removeStorageSync('refuseLogin')
}
// // 是否跳过登陆
let isRefuseLogin = uni.getStorageSync('refuseLogin')
if(isRefuseLogin || white.includes(view.route) || view.route.includes('BagAuth')) return
this.getAmount() this.getAmount()
onlineTimer = setTimeout(() => { })
if (this.loginStatus == 'offline') { },
uni.clearStorageSync() // 是否token过期或ip更改
getAmount() {
// clearTimeout(loginTimer)
accountApi.getTotalOilCardInfo().then(res => {
if (res.code == 42011) {
uni.showModal({ uni.showModal({
title: '需要您重新登录', title: '需要您重新登录',
content: this.msg, content: res.msg,
duration: '3000', duration: '3000',
success: function(res) { success: function(res) {
if (res.confirm) { if (res.confirm) {
@@ -115,46 +118,9 @@
url: '/BagAuth/pages/login/login' url: '/BagAuth/pages/login/login'
}) })
} }
},
complete: () => {
clearTimeout(onlineTimer)
} }
}) })
} }
}, 1000)
} else {
// loginTimer = setTimeout(() => {
// uni.showModal({
// title: '请您登录',
// content: '您还没有登录,暂时查不到油站哦',
// duration: '3000',
// success: function(res) {
// if (res.confirm) {
// uni.redirectTo({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }, 1000)
}
}
// }
})
},
// 是否token过期或ip更改
getAmount() {
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
}
}) })
}, },
}, },

View File

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

View File

@@ -483,18 +483,19 @@
oilSite = uni.getStorageSync(''), oilSite = uni.getStorageSync(''),
otherUser = uni.getStorageSync('otherUserInfo') otherUser = uni.getStorageSync('otherUserInfo')
if(otherUser){ if(otherUser){
console.log('这里是卡里') // console.log('这里是卡里')
this.isOtherUser = true this.isOtherUser = true
}else{ }else{
console.log('这里是非卡力') // console.log('这里是非卡力')
} }
console.log('oilItem',oilItem)
this.showtitles = oilItem.listTag; this.showtitles = oilItem.listTag;
this.init() this.init()
}, },
watch: { watch: {
activeChannelCode: { activeChannelCode: {
handler(newval) { handler(newval) {
console.log('activeChannelCode') // console.log('activeChannelCode')
this.oilBar = '' this.oilBar = ''
setTimeout(async() => { setTimeout(async() => {
this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar() this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar()
@@ -503,7 +504,7 @@
}, },
priceId: { priceId: {
handler(newval) { handler(newval) {
console.log('priceId') // console.log('priceId')
this.oilBar = '' this.oilBar = ''
setTimeout(async() => { setTimeout(async() => {
this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar() this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar()
@@ -540,12 +541,12 @@
totalMoney() { totalMoney() {
// // console.log('this.oilSitePriceDetailsVo[this.radio]', this.oilSitePriceDetailsVo[this.radio]) // // console.log('this.oilSitePriceDetailsVo[this.radio]', this.oilSitePriceDetailsVo[this.radio])
if (this.vol > 0 && this.oilSitePriceDetailsVo[this.radio]) { if (this.vol > 0 && this.oilSitePriceDetailsVo[this.radio]) {
console.log('+++++++++++') // console.log('+++++++++++')
console.log(this.vol) // console.log(this.vol)
console.log(this.oilSitePriceDetailsVo[this.radio]) // console.log(this.oilSitePriceDetailsVo[this.radio])
console.log('+++++++++++') // console.log('+++++++++++')
let numb = this.vol * this.oilSitePriceDetailsVo[this.radio].oilSitePrice let numb = this.vol * this.oilSitePriceDetailsVo[this.radio].oilSitePrice
console.log('++++++',numb) // console.log('++++++',numb)
return this.vol * this.oilSitePriceDetailsVo[this.radio].oilSitePrice return this.vol * this.oilSitePriceDetailsVo[this.radio].oilSitePrice
} }
}, },

View File

@@ -184,11 +184,11 @@
priceTab priceTab
}, },
onHide() { onHide() {
console.log('这里是hiden') // console.log('这里是hiden')
this.innerAudioContext.stop() this.innerAudioContext.stop()
}, },
onUnload() { onUnload() {
console.log('这里是卸载页面') // console.log('这里是卸载页面')
this.innerAudioContext.stop() this.innerAudioContext.stop()
}, },
data() { data() {
@@ -217,14 +217,19 @@
this.innerAudioContext.stop() this.innerAudioContext.stop()
}, },
onLoad(option) { onLoad(option) {
console.log(option) if(option.siteId) {
this.siteId = option.siteId
this.getSiteInfo(option.siteId)
return
}
// console.log(option)
if(option.channerCode == 'TY'){ if(option.channerCode == 'TY'){
var oilItem = uni.getStorageSync('OtherSiteInfo') var oilItem = uni.getStorageSync('OtherSiteInfo')
console.log(oilItem) // console.log(oilItem)
}else{ }else{
let obj = option.item, let obj = option.item,
jss= JSON.parse(obj) jss= JSON.parse(obj)
console.log( '+++++++++',obj,jss,'----------') // console.log( '+++++++++',obj,jss,'----------')
var oilItem = JSON.parse(option.item) var oilItem = JSON.parse(option.item)
} }
uni.setStorageSync('oilItem',oilItem) uni.setStorageSync('oilItem',oilItem)
@@ -270,8 +275,7 @@
console.log('开始播放'); console.log('开始播放');
}); });
this.innerAudioContext.onError((res) => { this.innerAudioContext.onError((res) => {
console.log(res.errMsg); console.log(res)
console.log(res.errCode);
}); });
}, },
hidendialog(){ hidendialog(){

View File

@@ -12,7 +12,7 @@ const productUrl = 'http://uat.xingoil.com/adminapi'
// const productUrl = 'http://192.168.0.191:38080' // const productUrl = 'http://192.168.0.191:38080'
// const productUrl = 'http://121.196.213.68/adminapi' // const productUrl = 'http://121.196.213.68/adminapi'
const service = axios.create({ const service = axios.create({
baseURL: env == 'production' ? productUrl : testUrl,, baseURL: env == 'production' ? productUrl : testUrl,
// baseURL: testUrl, // baseURL: testUrl,
timeout: 5000 timeout: 5000
}) })