index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 } 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 === '1' ? data.data.withRewardGuideImages : data.data.withoutRewardGuideImages,
  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. position: fixed;
  126. top: 0;
  127. left: 0;
  128. z-index: 1;
  129. .tip-icon {
  130. width: 36px;
  131. margin-right: 20px;
  132. }
  133. }
  134. &-pics-wrap {
  135. display: flex;
  136. transition: all 0.5s;
  137. .pic {
  138. width: 100%;
  139. }
  140. }
  141. &-pagination {
  142. display: flex;
  143. justify-content: center;
  144. align-items: center;
  145. .spon {
  146. width: 8px;
  147. height: 8px;
  148. background: #d9d9d9;
  149. margin: 0 3px;
  150. border-radius: 50%;
  151. }
  152. .active {
  153. background: #1d9bf0;
  154. }
  155. }
  156. &-btns {
  157. width: 100%;
  158. display: flex;
  159. padding: 0 8px 30px;
  160. &-btn {
  161. flex: 1;
  162. margin: 0 8px;
  163. height: 54px;
  164. line-height: 54px;
  165. text-align: center;
  166. border-radius: 60px;
  167. }
  168. &-btn:active {
  169. -webkit-tap-highlight-color: transparent;
  170. }
  171. .back {
  172. background: rgba(29, 155, 240, 0.01);
  173. border: 1px solid #e8e8e8;
  174. color: #3d3d3d;
  175. }
  176. .next {
  177. background: rgba(0, 0, 0, 0.01);
  178. border: 1px solid #b5e1ff;
  179. color: #1d9bf0;
  180. }
  181. .retweer {
  182. background: #1d9bf0;
  183. border: 1px solid #1d9bf0;
  184. color: #fff;
  185. }
  186. }
  187. }
  188. </style>