1212
This commit is contained in:
@@ -44,81 +44,14 @@
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('openid')
|
||||
let key = ''
|
||||
if (token && openid) {
|
||||
key = '在线'
|
||||
} else {
|
||||
key = '离线'
|
||||
}
|
||||
if (key == '在线') {
|
||||
// if (!uni.getStorageSync('filterData')) {
|
||||
// this.getFilterData()
|
||||
// } else if (uni.getStorageSync('filterData')[0].detailList.length < 2) {
|
||||
// this.getFilterData()
|
||||
// }
|
||||
}
|
||||
// 在页面中定义插屏广告
|
||||
let interstitialAd = null
|
||||
|
||||
// 在页面onLoad回调事件中创建插屏广告实例
|
||||
if (wx.createInterstitialAd) {
|
||||
interstitialAd = wx.createInterstitialAd({
|
||||
adUnitId: 'adunit-a7faf57adeed211f'
|
||||
})
|
||||
}
|
||||
interstitialAd.onLoad((err) => {
|
||||
console.log('onLoad event emit', err)
|
||||
})
|
||||
interstitialAd.onError((err) => {
|
||||
setTimeout(() => {
|
||||
if (key == '在线') {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
// url:'/BagStation/orderDetail/orderDetail'
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
}, 2000)
|
||||
console.log('onError event emit', err)
|
||||
})
|
||||
// 在适合的场景显示插屏广告
|
||||
if (interstitialAd) {
|
||||
interstitialAd.show().catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
interstitialAd.onClose(res => {
|
||||
setTimeout(() => {
|
||||
if (key == '在线') {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
// url:'/BagStation/orderDetail/orderDetail'
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
}, 2000)
|
||||
})
|
||||
},
|
||||
onReady(option) {
|
||||
let taht = this
|
||||
const updateManager = uni.getUpdateManager();
|
||||
|
||||
updateManager.onCheckForUpdate(function(res) {
|
||||
// 请求完新版本信息的回调
|
||||
console.log('请求完新版本信息的回调', res.hasUpdate);
|
||||
if (!res.hasUpdate) {
|
||||
taht.initFn(option)
|
||||
}
|
||||
});
|
||||
|
||||
updateManager.onUpdateReady(function(res) {
|
||||
@@ -127,20 +60,86 @@
|
||||
content: '新版本已经准备好,是否重启应用?',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log(res.confirm, 'res.confirm版本信息')
|
||||
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
||||
updateManager.applyUpdate();
|
||||
} else {
|
||||
taht.initFn(option)
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
updateManager.onUpdateFailed(function(res) {
|
||||
console.log('新的版本下载失败')
|
||||
// 新的版本下载失败
|
||||
});
|
||||
|
||||
},
|
||||
onReady(option) {},
|
||||
methods: {
|
||||
initFn(option) {
|
||||
const token = uni.getStorageSync('Authorization')
|
||||
const openid = uni.getStorageSync('openid')
|
||||
let key = ''
|
||||
if (token && openid) {
|
||||
key = '在线'
|
||||
} else {
|
||||
key = '离线'
|
||||
}
|
||||
// 在页面中定义插屏广告
|
||||
let interstitialAd = null
|
||||
|
||||
// 在页面onLoad回调事件中创建插屏广告实例
|
||||
if (wx.createInterstitialAd) {
|
||||
interstitialAd = wx.createInterstitialAd({
|
||||
adUnitId: 'adunit-a7faf57adeed211f'
|
||||
})
|
||||
}
|
||||
interstitialAd.onLoad((err) => {
|
||||
console.log('onLoad event emit', err)
|
||||
})
|
||||
interstitialAd.onError((err) => {
|
||||
setTimeout(() => {
|
||||
if (key == '在线') {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
// url:'/BagStation/orderDetail/orderDetail'
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
}, 2000)
|
||||
console.log('onError event emit', err)
|
||||
})
|
||||
// 在适合的场景显示插屏广告
|
||||
if (interstitialAd) {
|
||||
interstitialAd.show().catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
interstitialAd.onClose(res => {
|
||||
setTimeout(() => {
|
||||
if (key == '在线') {
|
||||
uni.switchTab({
|
||||
url: '/pages/tabbar/home/home',
|
||||
fail: (err) => {
|
||||
console.log(err)
|
||||
}
|
||||
// url:'/BagStation/orderDetail/orderDetail'
|
||||
})
|
||||
} else {
|
||||
uni.redirectTo({
|
||||
url: '/BagAuth/pages/login/login'
|
||||
})
|
||||
}
|
||||
}, 2000)
|
||||
})
|
||||
},
|
||||
getFilterData() {
|
||||
console.log('在线')
|
||||
oilSiteApi.getCheckInfo().then(res => {
|
||||
@@ -172,7 +171,7 @@
|
||||
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('存入',this.menuList)
|
||||
console.log('存入', this.menuList)
|
||||
// this.$refs.slFilter.resetMenuList(this.menuList)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user