index.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. course: [],
  31. };
  32. },
  33. computed: {
  34. translastCpd() {
  35. return `translateX(${-this.active * 100}vw)`;
  36. },
  37. isLottaryCpd() {
  38. return +getQueryString('playType') === PlayType.lottery;
  39. },
  40. isCommonCpd() {
  41. return +getQueryString('playType') === PlayType.common;
  42. },
  43. isTreasureCpd() {
  44. return +getQueryString('playType') === PlayType.Treasure;
  45. },
  46. isUsefulCpd() {
  47. return getQueryString('useful') === '1';
  48. },
  49. tipTextCpd() {
  50. if (this.isLottaryCpd) {
  51. return 'Install DeNet chrome extension to claim your prize';
  52. } else if (this.isCommonCpd || this.isTreasureCpd) {
  53. return 'Install Denet Chrome Extension to complete the quest';
  54. } else {
  55. return 'How to install Denet Chrome Extension';
  56. }
  57. },
  58. },
  59. methods: {
  60. next() {
  61. this.active++;
  62. },
  63. back() {
  64. this.active--;
  65. },
  66. retweer() {
  67. if (getQueryString('postId')) {
  68. window.open(`https://twitter.com/intent/retweet?tweet_id=${getQueryString('postId')}`);
  69. }
  70. },
  71. },
  72. async asyncData(params) {
  73. let { route } = params;
  74. let { data } = await axios.post(`${baseURL}/denet/base/guide/getAllMobilePageGuide`, {
  75. baseInfo: {
  76. appVersionCode: appVersionCode,
  77. mid: '00000000-0000-0000-0000-000000000000',
  78. },
  79. });
  80. if (data.code == 0) {
  81. console.log('detail', data.data, route);
  82. return {
  83. course: route.query.useful === '1' ? data.data.withRewardGuideImages : data.data.withoutRewardGuideImages,
  84. };
  85. }
  86. },
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. body {
  91. background-color: #f5f5f5;
  92. }
  93. .course-page {
  94. min-height: 100vh;
  95. max-height: 100vh;
  96. overflow: hidden;
  97. display: flex;
  98. flex-direction: column;
  99. align-items: center;
  100. justify-content: space-between;
  101. &-tips {
  102. width: 100%;
  103. height: 80px;
  104. background: #94a7b6;
  105. display: flex;
  106. padding: 0 20px;
  107. align-items: center;
  108. font-weight: 600;
  109. font-size: 16px;
  110. line-height: 22px;
  111. color: #fff;
  112. position: fixed;
  113. top: 0;
  114. left: 0;
  115. z-index: 1;
  116. .tip-icon {
  117. width: 36px;
  118. margin-right: 20px;
  119. }
  120. }
  121. &-pics-wrap {
  122. display: flex;
  123. transition: all 0.5s;
  124. .pic {
  125. width: 100%;
  126. }
  127. }
  128. &-pagination {
  129. display: flex;
  130. justify-content: center;
  131. align-items: center;
  132. .spon {
  133. width: 8px;
  134. height: 8px;
  135. background: #d9d9d9;
  136. margin: 0 3px;
  137. border-radius: 50%;
  138. }
  139. .active {
  140. background: #1d9bf0;
  141. }
  142. }
  143. &-btns {
  144. width: 100%;
  145. display: flex;
  146. padding: 0 8px 30px;
  147. &-btn {
  148. flex: 1;
  149. margin: 0 8px;
  150. height: 54px;
  151. line-height: 54px;
  152. text-align: center;
  153. border-radius: 60px;
  154. }
  155. &-btn:active {
  156. -webkit-tap-highlight-color: transparent;
  157. }
  158. .back {
  159. background: rgba(29, 155, 240, 0.01);
  160. border: 1px solid #e8e8e8;
  161. color: #3d3d3d;
  162. }
  163. .next {
  164. background: rgba(0, 0, 0, 0.01);
  165. border: 1px solid #b5e1ff;
  166. color: #1d9bf0;
  167. }
  168. .retweer {
  169. background: #1d9bf0;
  170. border: 1px solid #1d9bf0;
  171. color: #fff;
  172. }
  173. }
  174. }
  175. </style>