| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <template>
- <view>
- <!--components/popAd/popAd.wxml-->
- <template name="home_pop_up_ads">
- <block v-if="!first&&!iscouponAd&&!storeShow&&isAppLayerAd">
- <view class="layer" v-if="popAdTemplate&&popAdTemplate.state==0&&isLayerAd&&popAdList.pic">
- <image lazy-load="true" :src="popAdList.pic" mode="aspectFit" @tap="getUrl2" :data-type="popAdList.type" :data-content="popAdList.content"></image>
- <image class="close" src="/static/pages/images/ad_close_w.png" @tap="hideAd"></image>
- </view>
- </block>
- </template>
- </view>
- </template>
- <script>
- const req = require("../../utils/request");
- const utils = require("../../utils/util");
- const app = getApp();
- export default {
- data() {
- return {
- isAppLayerAd:app.globalData.isLayerAd
- };
- },
- components: {},
- props: {
- first:Boolean,
- popAdTemplate:Object,
- isLayerAd:Boolean,
- popAdList:Object,
- iscouponAd:Boolean,
- storeShow:Boolean
- },
- options: {
- addGlobalClass: true
- },
- // created(){
- // console.log(this.data.merchant)
- // req.getRequest('/api/merchant/getMerchantList',{}, res => {
- // res = res.filter(it=>it.isDefault==1)
- // this.setData({merchant:res[0]})
- // })
- // },
- mounted() {
- // console.log(this.iscouponAd,this.first,this.storeShow)
- },
- methods: {
- getUrl2(e) {
- console.log(e)
- var dt = e.currentTarget.dataset;
- var url = "";
- var id = "";
- var acid = "";
-
- if (dt.content != "") {
- let conunt = dt.content.split("_");
- id = conunt[1];
- acid = conunt[0];
- }
-
- if (dt.type * 1 == 2 && dt.content != "") {
- url = "product/detail/detail?id=" + dt.content;
- } else if (dt.type * 1 == 3) {
- url = dt.content;
- console.log('urlgetUrl2===',url)
- if(!url){
- req.msg('功能待接入')
- return false
- }
- if(url=='pages/index/index'||url=='pages/matchList/index'||url=='pages/interactive/index'||url=='pages/found/found'||url=='pages/user/user'){
- app.globalData.switchTab(url)
- return false
- }else{
- if(url.indexOf('http')!=-1){
- app.globalData.openPage('pages/web/web?url='+url);
- return false
- }
- }
- } else if (dt.type * 1 == 4) {
- url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 5) {
- url = "product/coupon/coupon";
- } else if (dt.type * 1 == 6) {
- url = "pages/live/live";
- } else if (dt.type * 1 == 7) {
- url = "product/groupList/groupList" + dt.merchant;
- } else if (dt.type * 1 == 9 && dt.content != "") {
- url = "product/list/list?id=" + dt.content + '&title=' + dt.title + this.web;
- } else if (dt.type * 1 == 10) {
- url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
- // console.log(
- // url); // url=`plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=${dt.content}`
- } else if (dt.type * 1 == 11) {
- url = "activity/group/index/index" + dt.merchant;
- } else if (dt.type * 1 == 12) {
- url = "activity/seckill/seckill" + dt.merchant;
- } else if (dt.type * 1 == 13) {
- url = "activity/bargain/index/index" + dt.merchant;
- } else if (dt.type * 1 == 14) {
- url = "activity/newbornZone/newbornZone" + dt.merchant;
- } else if (dt.type * 1 == 15 && dt.content != "") {
- url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 16 && dt.content != "") {
- url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 17 && dt.content != "") {
- url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 18 && dt.content != "") {
- url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
- } else if (dt.type * 1 == 19 && dt.content != "") {//文章内容
- url = "topic/content/content?id=" + dt.content + "&type=" + 1;//1为普通文章内容
- } else if (dt.type * 1 == 21 && dt.content != "") {//专题类型
- url = "pages/topic/topic?id=" + dt.content;
- } else if (dt.type * 1 == 27 && dt.content != "") {
- url = "match/activityDetail/activityDetail?id=" + dt.content;
- } else{
- url = "";
- }
-
- if (dt.type * 1 == 6) app.globalData.switchTab(url);
- else app.globalData.openPage(url);
- this.hideAd();
- },
-
- hideAd() {
- //关闭广告
- // if(this.data.first==false){
- this.setData({
- isLayerAd: false
- }); // }
- },
- }
- };
- </script>
- <style>
- @import "./popAd.css";
- </style>
|