You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
197 lines
4.8 KiB
197 lines
4.8 KiB
<template> |
|
<view class="page-content"> |
|
<image :src="yellowURL+'start.png'" width="" mode="widthFix"></image> |
|
</view> |
|
</template> |
|
|
|
<script> |
|
import oilSiteApi from '@/api/oil-site.js' |
|
import wxCode from '@/api/wxcode.js' |
|
export default { |
|
data() { |
|
return { |
|
imgURL: this.global.imgURL + 'start/', |
|
yellowURL: this.global.yellowURL + 'xq-ad/', |
|
menuList: [{ |
|
title: '渠道', |
|
isMutiple: false, |
|
key: 'channelCode', |
|
detailList: [{ |
|
title: "全部", |
|
value: "" |
|
}] |
|
}, |
|
{ |
|
title: '0#轻柴油', |
|
key: 'oilProductCode', |
|
isMutiple: false, |
|
detailList: [{ |
|
title: "全部", |
|
value: "" |
|
}] |
|
}, |
|
{ |
|
title: '品牌', |
|
key: 'siteBrand', |
|
isSort: true, |
|
isMutiple: false, |
|
detailList: [{ |
|
title: "全部", |
|
value: "" |
|
}] |
|
} |
|
], |
|
|
|
} |
|
}, |
|
onLoad(option) { |
|
console.log(option,'启动页'); |
|
console.log(`%c 二维码进入 ${option.scene}`, 'color:red;font-size:50px') |
|
|
|
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() |
|
} |
|
} |
|
if (option.scene) { |
|
this.Interceptor(option.scene); |
|
}else{ |
|
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' |
|
url:'/BagAuth/pages/login/oldLogin' |
|
}) |
|
} |
|
}, 2000) |
|
} |
|
|
|
}, |
|
onReady(option) { |
|
const updateManager = uni.getUpdateManager(); |
|
|
|
updateManager.onCheckForUpdate(function(res) { |
|
// 请求完新版本信息的回调 |
|
console.log('请求完新版本信息的回调', res.hasUpdate); |
|
}); |
|
|
|
updateManager.onUpdateReady(function(res) { |
|
uni.showModal({ |
|
title: '更新提示', |
|
content: '新版本已经准备好,是否重启应用?', |
|
success(res) { |
|
if (res.confirm) { |
|
console.log(res.confirm,'res.confirm版本信息') |
|
// 新的版本已经下载好,调用 applyUpdate 应用新版本并重启 |
|
updateManager.applyUpdate(); |
|
} |
|
} |
|
}); |
|
}); |
|
|
|
updateManager.onUpdateFailed(function(res) { |
|
// 新的版本下载失败 |
|
}); |
|
|
|
}, |
|
methods: { |
|
Interceptor(id) { |
|
let taht = this |
|
console.log(`%c 检测到参数拦截器启动`, 'color:red;font-size:50px'); |
|
// this.tools.overallInterceptor((opentype) => { |
|
// uni.removeInterceptor(opentype); |
|
// wxCode.getQrCodeType({ |
|
// qrCode: id |
|
// }).then(res => { |
|
// if (res.code == 20000) { |
|
// uni.redirectTo({ |
|
// url: '/AppletCode/pages/index/index?details=' + JSON.stringify({...res.data,qrCode: id}), |
|
// fail(e) { |
|
// console.log(e,'跳转失败') |
|
// } |
|
// }) |
|
// } |
|
// }) |
|
// }) |
|
wxCode.getQrCodeType({ |
|
qrCode: id |
|
}).then(res => { |
|
if (res.code == 20000) { |
|
uni.redirectTo({ |
|
url: '/AppletCode/pages/index/index?details=' + JSON.stringify({...res.data,qrCode: id}), |
|
fail(e) { |
|
console.log(e,'跳转失败') |
|
} |
|
}) |
|
} |
|
}) |
|
}, |
|
getFilterData() { |
|
console.log('wodefenzhi') |
|
oilSiteApi.getCheckInfo().then(res => { |
|
if (res.code == 20000) { |
|
|
|
let channelCodes = [] |
|
res.data.channelCodes.map(item => { |
|
channelCodes.push({ |
|
title: item.name, |
|
value: item.id |
|
}) |
|
}) |
|
let productCodes = [] |
|
res.data.productCodes.map(item => { |
|
productCodes.push({ |
|
title: item.name, |
|
value: item.id |
|
}) |
|
}) |
|
let siteBrands = [] |
|
res.data.siteBrands.map(item => { |
|
siteBrands.push({ |
|
title: item.name, |
|
value: item.id |
|
}) |
|
}) |
|
console.log(channelCodes, productCodes, siteBrands) |
|
this.menuList[0].detailList = this.menuList[0].detailList.concat(channelCodes) |
|
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) |
|
uni.setStorageSync('productCodeList', res.data.productCodeList) |
|
console.log(res,'%c 这里是启动页调用的菜单列表','font-size:36px;color:red;') |
|
// this.$refs.slFilter.resetMenuList(this.menuList) |
|
} |
|
}) |
|
}, |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped> |
|
.page-content { |
|
height: 100%; |
|
overflow: hidden; |
|
} |
|
|
|
.page-content image { |
|
width: 750upx; |
|
} |
|
</style>
|
|
|