4 changed files with 163 additions and 3 deletions
@ -0,0 +1,112 @@ |
|||
<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> |
Loading…
Reference in new issue