index.ux 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <template>
  2. <div class="ad-main">
  3. <stack>
  4. <div class="weclome">
  5. </div>
  6. <div class="ad-page" style="{{ styleObj }}" if="{{hasBanner}}" @click="goActivity">
  7. <div class="top-timer">
  8. <text class="number" @click="skep">跳过{{time}}</text>
  9. </div>
  10. <div class="bottom-line">
  11. <image src="../../assets/imgs/logo.png"></image>
  12. <div class="desc">
  13. <text class="title"> 追书云</text>
  14. <text class="more"> 给你极致的阅读体验</text>
  15. </div>
  16. </div>
  17. </div>
  18. </stack>
  19. </div>
  20. </template>
  21. <script>
  22. import storage from "@system.storage";
  23. import router from '@system.router';
  24. import { userOptions } from '../../api/index.js';
  25. export default {
  26. protected: {
  27. name: null,
  28. icon: null
  29. },
  30. private: {
  31. time: 6,
  32. timer: null,
  33. hasBanner: false,
  34. open_alert: null,
  35. styleObj: {
  36. backgroundImage: ""
  37. }
  38. },
  39. onInit() {
  40. this.timer = setInterval(() => {
  41. if (this.time > 0) {
  42. this.time = this.time - 1;
  43. } else {
  44. router.back();
  45. }
  46. }, 1000);
  47. setTimeout(async () => {
  48. let option = this.$app.getAppData('options');
  49. let position;
  50. if (!option) {
  51. let data = await userOptions();
  52. this.$app.setAppData('options', data);
  53. position = data.position;
  54. if (position.open_alert) {
  55. this.open_alert = position.open_alert[0];
  56. this.styleObj.backgroundImage = this.open_alert.img;
  57. this.hasBanner = true;
  58. } else {
  59. setTimeout(() => {
  60. router.back();
  61. }, 1500)
  62. }
  63. } else {
  64. position = option['position'];
  65. if (position && position.open_alert && position.open_alert.length > 0) {
  66. this.open_alert = position.open_alert[0];
  67. this.styleObj.backgroundImage = this.open_alert.img;
  68. this.hasBanner = true;
  69. } else {
  70. setTimeout(() => {
  71. router.back();
  72. }, 1500)
  73. }
  74. }
  75. }, 500)
  76. },
  77. onDestroy() {
  78. clearInterval(this.timer);
  79. },
  80. skep() {
  81. clearInterval(this.timer);
  82. router.back();
  83. },
  84. goActivity() {
  85. router.replace({
  86. uri: '/views/Activity',
  87. params: this.open_alert.params
  88. })
  89. }
  90. }
  91. </script>
  92. <style lang="less">
  93. .weclome {
  94. background-image: url("https://cdn-novel.91duke.com/quickapp/static/20201224165231.jpg");
  95. background-size: cover;
  96. width: 100%;
  97. height: 100%;
  98. }
  99. .ad-page {
  100. background-size: cover;
  101. width: 100%;
  102. height: 100%;
  103. flex-direction: column;
  104. position: relative;
  105. justify-content: space-between;
  106. .top-timer {
  107. display: flex;
  108. justify-content: flex-end;
  109. padding-top: 30px;
  110. padding-right: 30px;
  111. .number {
  112. width: 120px;
  113. height: 60px;
  114. line-height: 60px;
  115. background-color: rgba(0, 0, 0, 0.5);
  116. color: #fff;
  117. font-size: 25px;
  118. text-align: center;
  119. border-radius: 30px;
  120. }
  121. }
  122. .bottom-line {
  123. width: 100%;
  124. height: 200px;
  125. background-color: #fff;
  126. align-items: center;
  127. justify-content: center;
  128. image {
  129. width: 110px;
  130. height: 110px;
  131. margin-right: 15px;
  132. }
  133. .desc {
  134. flex-direction: column;
  135. .title {
  136. font-size: 36px;
  137. font-weight: bold;
  138. line-height: 200%;
  139. }
  140. }
  141. }
  142. }
  143. </style>