index.vue 4.1 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 && (isLottaryCpd || isTreasureCpd || isCommonCpd)" @click="retweer" class="course-page-btns-btn retweer">Retweet</div>
  18. </div>
  19. </div>
  20. </template>
  21. <script>
  22. import { postRequest } from '../../http';
  23. import { PlayType } from '../../types';
  24. import { getQueryString } 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 this.playType === PlayType.lottery;
  39. },
  40. isCommonCpd() {
  41. return this.playType === PlayType.common;
  42. },
  43. isTreasureCpd() {
  44. return this.playType === PlayType.Treasure;
  45. },
  46. isTimeExpiredCpd() {
  47. return this.useful === '0';
  48. },
  49. tipTextCpd() {
  50. if (this.isLottaryCpd) {
  51. return 'Install DeNet chrome extension to claim your prize';
  52. } else if (this.isCommonCpd || this.is) {
  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. getCource() {
  61. postRequest(`/base/guide/getAllMobilePageGuide`, {}).then(({ code, data }) => {
  62. if (code == 0) {
  63. console.log('%c [ data ]-78', 'font-size:13px; background:pink; color:#bf2c9f;', data);
  64. if (this.useful === 1) {
  65. this.course = data.withRewardGuideImages;
  66. } else {
  67. this.course = data.withoutRewardGuideImages;
  68. }
  69. }
  70. });
  71. },
  72. next() {
  73. if (this.active < this.course.length - 1) {
  74. this.active++;
  75. } else {
  76. window.location.replace(`https://twitter.com/intent/retweet?tweet_id=${this.postId}`);
  77. }
  78. },
  79. back() {
  80. this.active--;
  81. },
  82. retweer() {
  83. window.open(`https://twitter.com/intent/retweet?tweet_id=${this.postId}`);
  84. },
  85. },
  86. mounted() {
  87. this.getCource();
  88. this.useful = getQueryString('useful');
  89. this.playType = getQueryString('playType');
  90. this.rewardType = getQueryString('rewardType');
  91. this.postId = getQueryString('postId');
  92. },
  93. };
  94. </script>
  95. <style lang="scss" scoped>
  96. body {
  97. background-color: #f5f5f5;
  98. }
  99. .course-page {
  100. min-height: 100vh;
  101. max-height: 100vh;
  102. overflow: hidden;
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. justify-content: space-between;
  107. &-tips {
  108. width: 100%;
  109. height: 80px;
  110. background: #94a7b6;
  111. display: flex;
  112. padding: 0 20px;
  113. align-items: center;
  114. font-weight: 600;
  115. font-size: 16px;
  116. line-height: 22px;
  117. color: #fff;
  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>