| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- <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-page="el.pageUrl" :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: {
- async 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){
- if(url.indexOf('${salesno}')!=-1){
- // 如果打开的分享的销售员微页
- if(req.getStorage('shareId')){
- url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('shareId'))
- }else{
- // 如果自己是销售员
- if(req.getStorage('userInfo').saleNo){
- url = url.replace(/\${salesno}/g,'salesno='+req.getStorage('userInfo').saleNo)
- }else{
- //当前绑定的微页或推荐的微页
- let salesno = await new Promise((r,j)=>{
- req.getLocation(res => {
- const to = {
- latitude: res.latitude,
- longitude: res.longitude
- };
- req.getRequest('/api/visiting/card/recommendCardInfo', to, res => {
- r(res.jobNumber?res.jobNumber:'')
- })
- });
- })
- url = url.replace(/\${salesno}/g,'salesno='+salesno)
- }
- }
- }
- app.globalData.openPage('pages/web/web?url='+encodeURIComponent(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 if (dt.type * 1 == 1 && dt.content != "") {
- console.log('dt.content',dt.content)
- uni.navigateToMiniProgram({
- appId: dt.content, // 目标小程序appid
- path: dt.page?dt.page:'', // 目标路径,例如‘pages/billManage/index’
- extraData: {}, // 跳转传参,例如'orderNo': 'xxx......'
- success(res) {
- uni.showToast({
- title: '跳转成功'
- })
- }
- })
- } 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>
|