index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <!-- 移动端 教程页面 -->
  2. <template>
  3. <div class="course-page">
  4. <div class="course-page-tips">
  5. <img class="tip-icon" src="./../../static/img/icon-h5-topc.png" />
  6. <span class="tip-text">{{ tipTextCpd }}</span>
  7. </div>
  8. <div class="course-page-pics-wrap" :style="{ transform: translastCpd }">
  9. <img class="pic" v-for="(item, index) in course" :key="index" :src="item" />
  10. </div>
  11. <div class="course-page-pagination">
  12. <div class="spon" v-for="(item, index) in course" :key="index" :class="active === index ? 'active' : ''"></div>
  13. </div>
  14. <div class="course-page-btns">
  15. <div v-if="active > 0" class="course-page-btns-btn back" @click="back">Back</div>
  16. <div v-if="active < this.course.length - 1" class="course-page-btns-btn next" @click="next">Next</div>
  17. <div v-if="active === this.course.length - 1 && isUsefulCpd && (isLottaryCpd || isTreasureCpd || isCommonCpd)" @click="retweer" class="course-page-btns-btn retweer">Retweet</div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { PlayType, UsefulType } from '../../types';
  23. import axios from 'axios';
  24. import { getQueryString, baseURL, appVersionCode } from '../../utils/help';
  25. export default {
  26. name: 'course',
  27. data() {
  28. return {
  29. active: 0,
  30. useful: '',
  31. course: [],
  32. };
  33. },
  34. computed: {
  35. translastCpd() {
  36. return `translateX(${-this.active * 100}vw)`;
  37. },
  38. isLottaryCpd() {
  39. return +this.playType === PlayType.lottery;
  40. },
  41. isCommonCpd() {
  42. return +this.playType === PlayType.common;
  43. },
  44. isTreasureCpd() {
  45. return +this.playType === PlayType.Treasure;
  46. },
  47. isUsefulCpd() {
  48. return this.useful === '1';
  49. },
  50. tipTextCpd() {
  51. if (this.isLottaryCpd) {
  52. return 'Install DeNet chrome extension to claim your prize';
  53. } else if (this.isCommonCpd || this.isTreasureCpd) {
  54. return 'Install Denet Chrome Extension to complete the quest';
  55. } else {
  56. return 'How to install Denet Chrome Extension';
  57. }
  58. },
  59. },
  60. methods: {
  61. next() {
  62. this.active++;
  63. },
  64. back() {
  65. this.active--;
  66. },
  67. retweer() {
  68. if (getQueryString('postId')) {
  69. window.open(`https://twitter.com/intent/retweet?tweet_id=${getQueryString('postId')}`);
  70. }
  71. },
  72. },
  73. async asyncData(params) {
  74. let { route } = params;
  75. let { data } = await axios.post(`${baseURL}/denet/base/guide/getAllMobilePageGuide`, {
  76. baseInfo: {
  77. appVersionCode: appVersionCode,
  78. mid: '00000000-0000-0000-0000-000000000000',
  79. },
  80. });
  81. if (data.code == 0) {
  82. return {
  83. useful: route.query.useful,
  84. playType: route.query.playType,
  85. course: route.query.useful === UsefulType.unUseful || route.query.playType === PlayType.NFT ? data.data.withoutRewardGuideImages : data.data.withRewardGuideImages,
  86. };
  87. }
  88. },
  89. };
  90. </script>
  91. <style lang="scss">
  92. html,
  93. body,
  94. #__nuxt,
  95. #__layout {
  96. width: 100%;
  97. height: 100%;
  98. padding: 0;
  99. margin: 0;
  100. }
  101. </style>
  102. <style lang="scss" scoped>
  103. body {
  104. background-color: #f5f5f5;
  105. }
  106. .course-page {
  107. min-height: 100%;
  108. max-height: 100%;
  109. overflow: hidden;
  110. display: flex;
  111. flex-direction: column;
  112. align-items: center;
  113. justify-content: space-between;
  114. &-tips {
  115. width: 100%;
  116. height: 80px;
  117. background: #94a7b6;
  118. display: flex;
  119. padding: 0 20px;
  120. align-items: center;
  121. font-weight: 600;
  122. font-size: 16px;
  123. line-height: 22px;
  124. color: #fff;
  125. z-index: 1;
  126. .tip-icon {
  127. width: 36px;
  128. margin-right: 20px;
  129. }
  130. }
  131. &-pics-wrap {
  132. display: flex;
  133. transition: all 0.5s;
  134. .pic {
  135. width: 100%;
  136. }
  137. }
  138. &-pagination {
  139. display: flex;
  140. justify-content: center;
  141. align-items: center;
  142. .spon {
  143. width: 8px;
  144. height: 8px;
  145. background: #d9d9d9;
  146. margin: 0 3px;
  147. border-radius: 50%;
  148. }
  149. .active {
  150. background: #1d9bf0;
  151. }
  152. }
  153. &-btns {
  154. width: 100%;
  155. display: flex;
  156. padding: 0 8px 30px;
  157. &-btn {
  158. flex: 1;
  159. margin: 0 8px;
  160. height: 54px;
  161. line-height: 54px;
  162. text-align: center;
  163. border-radius: 60px;
  164. }
  165. &-btn:active {
  166. -webkit-tap-highlight-color: transparent;
  167. }
  168. .back {
  169. background: rgba(29, 155, 240, 0.01);
  170. border: 1px solid #e8e8e8;
  171. color: #3d3d3d;
  172. }
  173. .next {
  174. background: rgba(0, 0, 0, 0.01);
  175. border: 1px solid #b5e1ff;
  176. color: #1d9bf0;
  177. }
  178. .retweer {
  179. background: #1d9bf0;
  180. border: 1px solid #1d9bf0;
  181. color: #fff;
  182. }
  183. }
  184. }
  185. </style>