index.vue 4.0 KB

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