popAd.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view>
  3. <!--components/popAd/popAd.wxml-->
  4. <template name="home_pop_up_ads">
  5. <block v-if="!first&&!iscouponAd&&!storeShow&&isAppLayerAd">
  6. <view class="layer" v-if="popAdTemplate&&popAdTemplate.state==0&&isLayerAd&&popAdList.pic">
  7. <image lazy-load="true" :src="popAdList.pic" mode="aspectFit" @tap="getUrl2" :data-type="popAdList.type" :data-content="popAdList.content"></image>
  8. <image class="close" src="/static/pages/images/ad_close_w.png" @tap="hideAd"></image>
  9. </view>
  10. </block>
  11. </template>
  12. </view>
  13. </template>
  14. <script>
  15. const req = require("../../utils/request");
  16. const utils = require("../../utils/util");
  17. const app = getApp();
  18. export default {
  19. data() {
  20. return {
  21. isAppLayerAd:app.globalData.isLayerAd
  22. };
  23. },
  24. components: {},
  25. props: {
  26. first:Boolean,
  27. popAdTemplate:Object,
  28. isLayerAd:Boolean,
  29. popAdList:Object,
  30. iscouponAd:Boolean,
  31. storeShow:Boolean
  32. },
  33. options: {
  34. addGlobalClass: true
  35. },
  36. // created(){
  37. // console.log(this.data.merchant)
  38. // req.getRequest('/api/merchant/getMerchantList',{}, res => {
  39. // res = res.filter(it=>it.isDefault==1)
  40. // this.setData({merchant:res[0]})
  41. // })
  42. // },
  43. mounted() {
  44. // console.log(this.iscouponAd,this.first,this.storeShow)
  45. },
  46. methods: {
  47. getUrl2(e) {
  48. var dt = e.currentTarget.dataset;
  49. var url = "";
  50. var id = "";
  51. var acid = "";
  52. if (dt.content != "") {
  53. let conunt = dt.content.split("_");
  54. id = conunt[1];
  55. acid = conunt[0];
  56. }
  57. if (dt.type * 1 == 2 && dt.content != "") {
  58. url = "product/detail/detail?id=" + dt.content;
  59. } else if (dt.type * 1 == 4) {
  60. url = "product/groupDetail/groupDetail?acid=" + acid + "&id=" + id;
  61. } else if (dt.type * 1 == 5) {
  62. url = "product/coupon/coupon";
  63. } else if (dt.type * 1 == 6) {
  64. url = "pages/live/live";
  65. } else if (dt.type * 1 == 7) {
  66. url = "product/groupList/groupList" + dt.merchant;
  67. } else if (dt.type * 1 == 9 && dt.content != "") {
  68. url = "product/list/list?id=" + dt.content;
  69. } else if (dt.type * 1 == 10) {
  70. url = "plugin-private://wx2b03c6e691cd7370/pages/live-player-plugin?room_id=" + dt.content;
  71. } else if (dt.type * 1 == 11) {
  72. url = "activity/group/index/index" + dt.merchant;
  73. } else if (dt.type * 1 == 12) {
  74. url = "activity/seckill/seckill" + dt.merchant;
  75. } else if (dt.type * 1 == 13) {
  76. url = "activity/bargain/index/index" + dt.merchant;
  77. } else if (dt.type * 1 == 14) {
  78. url = "activity/newbornZone/newbornZone" + dt.merchant;
  79. } else if (dt.type * 1 == 15 && dt.content != "") {
  80. url = "activity/newbornDetails/newbornDetails?acid=" + acid + "&id=" + id;
  81. } else if (dt.type * 1 == 16 && dt.content != "") {
  82. url = "activity/seckillDetails/seckillDetails?acid=" + acid + "&id=" + id;
  83. } else if (dt.type * 1 == 17 && dt.content != "") {
  84. url = "activity/bargain/detail/detail?acid=" + acid + "&id=" + id;
  85. } else if (dt.type * 1 == 18 && dt.content != "") {
  86. url = "activity/group/detail/detail?acid=" + acid + "&id=" + id;
  87. } else if (dt.type * 1 == 19 && dt.content != "") {//文章内容
  88. url = "activity/content/content?id=" + dt.content + "&type=" + 1;//1为普通文章内容
  89. } else if (dt.type * 1 == 21 && dt.content != "") {//专题类型
  90. url = "pages/topic/topic?id=" + dt.content;
  91. } else if (dt.type * 1 == 3 && dt.content != "") {//外链类型
  92. url = dt.content;//1为普通文章内容
  93. } else {
  94. url = "";
  95. }
  96. if (dt.type * 1 == 6) app.globalData.switchTab(url);
  97. else app.globalData.openPage(url);
  98. this.hideAd();
  99. },
  100. hideAd() {
  101. //关闭广告
  102. // if(this.data.first==false){
  103. this.setData({
  104. isLayerAd: false
  105. }); // }
  106. },
  107. }
  108. };
  109. </script>
  110. <style>
  111. @import "./popAd.css";
  112. </style>