App.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!--
  2. * @Author: your name
  3. * @Date: 2020-09-08 10:49:07
  4. * @LastEditTime: 2021-06-29 11:45:03
  5. * @LastEditors: your name
  6. * @Description: In User Settings Edit
  7. * @FilePath: \ydy_wap_front\src\App.vue
  8. -->
  9. <template>
  10. <div id="app" :class="theme">
  11. <router-view :key="$route.fullpath" />
  12. <div class="package-wrap" @touchmove.prevent v-if="showWrap">
  13. <img @click.stop="closeWrap" :src="imgs" alt="" />
  14. </div>
  15. <div class="package-wrap" @touchmove.prevent v-if="showAd">
  16. <img src="" />
  17. </div>
  18. <!-- <template v-if="isTargetChannel&&showIframe">
  19. <iframe src='//wap.apyingcaisw.com/xingzuo'
  20. width='1px'
  21. height='1px'
  22. style="visibility:hidden"></iframe>
  23. </template> -->
  24. </div>
  25. </template>
  26. <script>
  27. export default {
  28. name: "app",
  29. data() {
  30. return {
  31. theme: localStorage.getItem("theme") || "girl",
  32. showRed: window.options.fission,
  33. activity_imgs: window.options.channel_activities,
  34. redImage: require("./assets/red_package.png"),
  35. imgs: null,
  36. showAd: false,
  37. showWrap: false,
  38. // todayDate: new Date().toLocaleDateString(),
  39. isTargetChannel: window.options.is_show_ad_frame,
  40. showIframe: false
  41. };
  42. },
  43. watch: {
  44. $route(v) {
  45. if (v.name === "BookCity") {
  46. v.query.sex && (this.theme = v.query.sex);
  47. }
  48. }
  49. },
  50. created() {
  51. let { site_gender } = window.options;
  52. if (site_gender) {
  53. // 关注用户 根据用户性别 首页展示不同的频道
  54. this.theme = site_gender === "male" ? "boy" : "girl";
  55. } else this.theme = "girl";
  56. this.initWrap();
  57. //this.$GoLoginPop().then(()=>{console.log('我真的的去绑定了呢')});
  58. //setTimeout(()=>{this.$GoLoginPop.close();},4000)
  59. },
  60. methods: {
  61. closeWrap() {
  62. if (window.options.fission) {
  63. this.showWrap = false;
  64. window.options.fission = 0;
  65. setTimeout(() => {
  66. this.initWrap();
  67. }, 500);
  68. } else {
  69. this.showWrap = false;
  70. window.options.channel_activities.shall_reward = 0;
  71. }
  72. },
  73. initWrap() {
  74. if (window.options.fission) {
  75. // 红包弹窗弹出
  76. this.showWrap = true;
  77. this.imgs = this.redImage;
  78. } else {
  79. if (window.options.channel_activities.shall_reward) {
  80. // 活动弹
  81. this.showWrap = true;
  82. this.imgs = this.activity_imgs.image;
  83. }
  84. }
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .package-wrap {
  91. position: fixed;
  92. top: 0;
  93. bottom: 0;
  94. left: 0;
  95. width: 100%;
  96. background: rgba($color: #000000, $alpha: 0.6);
  97. z-index: 9999;
  98. img {
  99. position: absolute;
  100. width: 80%;
  101. left: 50%;
  102. top: 50%;
  103. transform: translate(-50%, -50%);
  104. }
  105. }
  106. </style>