App.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. <!-- <div class="close-btn" @click="showAd = false">关闭</div> -->
  17. <img
  18. src="https://cdn-novel.iycdm.com/zsy_ios_app/user_privacy/20220221155858.png"
  19. width="100%"
  20. class="mask-img"
  21. />
  22. </div>
  23. <!-- <template v-if="isTargetChannel&&showIframe">
  24. <iframe src='//wap.apyingcaisw.com/xingzuo'
  25. width='1px'
  26. height='1px'
  27. style="visibility:hidden"></iframe>
  28. </template> -->
  29. </div>
  30. </template>
  31. <script>
  32. import goLogin from "../src/components/gologin";
  33. export default {
  34. name: "app",
  35. data() {
  36. return {
  37. theme: localStorage.getItem("theme") || "girl",
  38. showRed: window.options.fission,
  39. redImage: require("./assets/red_package.png"),
  40. imgs: null,
  41. showAd: false,
  42. showWrap: false,
  43. // todayDate: new Date().toLocaleDateString(),
  44. isTargetChannel: window.options.is_show_ad_frame,
  45. showIframe: false
  46. };
  47. },
  48. watch: {
  49. $route(v) {
  50. if (v.name === "BookCity") {
  51. v.query.sex && (this.theme = v.query.sex);
  52. }
  53. }
  54. },
  55. created() {
  56. let { site_gender } = window.options;
  57. if (site_gender) {
  58. // 关注用户 根据用户性别 首页展示不同的频道
  59. this.theme = site_gender === "male" ? "boy" : "girl";
  60. } else this.theme = "girl";
  61. this.initWrap();
  62. //sessionSotrage判断展示加桌提醒图
  63. const showBanner = sessionStorage.getItem("showBanner");
  64. //获取是否加桌过
  65. const { is_add_desk } = window.options;
  66. if (!showBanner && !is_add_desk && !window.navigator.standalone) {
  67. this.showAd = true;
  68. sessionStorage.setItem("showBanner", true);
  69. }
  70. },
  71. methods: {
  72. closeWrap() {
  73. if (window.options.fission) {
  74. this.showWrap = false;
  75. window.options.fission = 0;
  76. setTimeout(() => {
  77. this.initWrap();
  78. }, 500);
  79. } else {
  80. this.showWrap = false;
  81. }
  82. },
  83. initWrap() {
  84. if (window.options.fission) {
  85. // 红包弹窗弹出
  86. this.showWrap = true;
  87. this.imgs = this.redImage;
  88. }
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .package-wrap {
  95. position: fixed;
  96. top: 0;
  97. bottom: 0;
  98. left: 0;
  99. width: 100%;
  100. background: rgba($color: #000000, $alpha: 0.6);
  101. z-index: 9999;
  102. .mask-img {
  103. width: 100%;
  104. z-index: 100;
  105. }
  106. .close-btn {
  107. width: 1.2rem;
  108. height: 0.5rem;
  109. line-height: 0.5rem;
  110. text-align: center;
  111. background: rgba(255, 255, 255, 0.6);
  112. color: #fff;
  113. font-size: 0.28rem;
  114. position: absolute;
  115. right: 0.5rem;
  116. top: 0.5rem;
  117. z-index: 101;
  118. border-radius: 0.4rem;
  119. }
  120. img {
  121. position: absolute;
  122. width: 80%;
  123. left: 50%;
  124. top: 50%;
  125. transform: translate(-50%, -50%);
  126. }
  127. }
  128. </style>