index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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" scoped>
  92. body {
  93. background-color: #f5f5f5;
  94. }
  95. .course-page {
  96. min-height: 100vh;
  97. max-height: 100vh;
  98. overflow: hidden;
  99. display: flex;
  100. flex-direction: column;
  101. align-items: center;
  102. justify-content: space-between;
  103. &-tips {
  104. width: 100%;
  105. height: 80px;
  106. background: #94a7b6;
  107. display: flex;
  108. padding: 0 20px;
  109. align-items: center;
  110. font-weight: 600;
  111. font-size: 16px;
  112. line-height: 22px;
  113. color: #fff;
  114. position: fixed;
  115. top: 0;
  116. left: 0;
  117. z-index: 1;
  118. .tip-icon {
  119. width: 36px;
  120. margin-right: 20px;
  121. }
  122. }
  123. &-pics-wrap {
  124. display: flex;
  125. transition: all 0.5s;
  126. .pic {
  127. width: 100%;
  128. }
  129. }
  130. &-pagination {
  131. display: flex;
  132. justify-content: center;
  133. align-items: center;
  134. .spon {
  135. width: 8px;
  136. height: 8px;
  137. background: #d9d9d9;
  138. margin: 0 3px;
  139. border-radius: 50%;
  140. }
  141. .active {
  142. background: #1d9bf0;
  143. }
  144. }
  145. &-btns {
  146. width: 100%;
  147. display: flex;
  148. padding: 0 8px 30px;
  149. &-btn {
  150. flex: 1;
  151. margin: 0 8px;
  152. height: 54px;
  153. line-height: 54px;
  154. text-align: center;
  155. border-radius: 60px;
  156. }
  157. &-btn:active {
  158. -webkit-tap-highlight-color: transparent;
  159. }
  160. .back {
  161. background: rgba(29, 155, 240, 0.01);
  162. border: 1px solid #e8e8e8;
  163. color: #3d3d3d;
  164. }
  165. .next {
  166. background: rgba(0, 0, 0, 0.01);
  167. border: 1px solid #b5e1ff;
  168. color: #1d9bf0;
  169. }
  170. .retweer {
  171. background: #1d9bf0;
  172. border: 1px solid #1d9bf0;
  173. color: #fff;
  174. }
  175. }
  176. }
  177. </style>