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.
113 lines
1.6 KiB
113 lines
1.6 KiB
2 weeks ago
|
<template>
|
||
|
<view class="bg" @click="goIndex()">
|
||
|
<image :src="showImg(screenPng)"></image>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
export default {
|
||
|
components: {
|
||
|
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
topBanner: [],
|
||
|
screenPng: null,
|
||
|
}
|
||
|
},
|
||
|
onLoad() {
|
||
|
this.getAlertAdv()
|
||
|
},
|
||
|
|
||
|
onUnload() {
|
||
|
// 清定时器 跳转
|
||
|
},
|
||
|
onReady() {
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
methods: {
|
||
|
// 广告跳转
|
||
|
gotoBannerDetail(item) {
|
||
|
|
||
|
|
||
|
if (this.SHFlag) { return }
|
||
|
// 1产品详情 2功能模块 3外部链接 4外部小程序
|
||
|
switch (item.jump_type){
|
||
|
case 1:
|
||
|
this.gotoDetailByType(item.product_model)
|
||
|
break;
|
||
|
case 2:
|
||
|
this.gotoPath(item.front_model.inside)
|
||
|
break;
|
||
|
case 3:
|
||
|
this.gotoWebUrl(item.tdata.url)
|
||
|
break;
|
||
|
case 4:
|
||
|
// #ifdef MP-WEIXIN
|
||
|
uni.navigateToMiniProgram({
|
||
|
shortLink: item.tdata.url
|
||
|
})
|
||
|
// #endif
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
},
|
||
|
|
||
|
getAlertAdv () {
|
||
|
this.Post({position: 2,type_id: 3},"/api/adv/getAdv",).then(res => {
|
||
|
if (res.data.length > 0) {
|
||
|
this.topBanner = res.data || []
|
||
|
if (this.topBanner.length<=0) {
|
||
|
uni.switchTab({
|
||
|
url:"/pages/index/index"
|
||
|
})
|
||
|
} else {
|
||
|
let num = Math.floor(Math.random() * length);
|
||
|
this.screenPng =this.topBanner[num].head_img
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
},
|
||
|
goIndex () {
|
||
|
uni.switchTab({
|
||
|
url:"/pages/index/index"
|
||
|
})
|
||
|
},
|
||
|
|
||
|
|
||
|
},
|
||
|
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss" scoped>
|
||
|
.bg {
|
||
|
width: 100%;
|
||
|
height: 100vh;
|
||
|
}
|
||
|
|
||
|
image {
|
||
|
display: block;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</style>
|