index.ux 3.3 KB

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