index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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-contail">
  9. <div class="course-page-pics-contail-wrap" :style="{ transform: translastCpd }">
  10. <img class="pic" v-for="(item, index) in course" :key="index" :src="item" />
  11. </div>
  12. </div>
  13. <div class="course-page-pagination">
  14. <div class="spon" v-for="(item, index) in course" :key="index" :class="active === index ? 'active' : ''"></div>
  15. </div>
  16. <div class="course-page-btns">
  17. <div v-if="active > 0" class="course-page-btns-btn back" @click="back">Back</div>
  18. <div v-if="active < this.course.length - 1" class="course-page-btns-btn next" @click="next">Next</div>
  19. <div v-if="active === this.course.length - 1 && isUsefulCpd && (isLottaryCpd || isTreasureCpd || isCommonCpd)" @click="retweer" class="course-page-btns-btn retweer">Retweet</div>
  20. </div>
  21. </div>
  22. </template>
  23. <script>
  24. import { PlayType, UsefulType } from '../../types';
  25. import axios from 'axios';
  26. import Report from '../../log-center/log';
  27. import { getQueryString, baseURL, appVersionCode, getMid, appType } from '../../utils/help';
  28. export default {
  29. name: 'course',
  30. data() {
  31. return {
  32. active: 0,
  33. useful: '',
  34. course: [],
  35. };
  36. },
  37. computed: {
  38. translastCpd() {
  39. return `translateX(${-this.active * 100}vw)`;
  40. },
  41. isLottaryCpd() {
  42. return +this.playType === PlayType.lottery;
  43. },
  44. isCommonCpd() {
  45. return +this.playType === PlayType.common;
  46. },
  47. isTreasureCpd() {
  48. return +this.playType === PlayType.Treasure;
  49. },
  50. isUsefulCpd() {
  51. return this.useful === '1';
  52. },
  53. tipTextCpd() {
  54. if (!this.isUsefulCpd) {
  55. return 'How to install Denet Chrome Extension';
  56. } else if (this.isCommonCpd) {
  57. return 'Install DeNet chrome extension to claim your prize';
  58. } else if (this.isLottaryCpd || this.isTreasureCpd) {
  59. return 'Install Denet Chrome Extension to complete the quest';
  60. } else {
  61. return 'How to install Denet Chrome Extension';
  62. }
  63. },
  64. },
  65. methods: {
  66. next() {
  67. this.active++;
  68. this.reportLog();
  69. },
  70. back() {
  71. this.active--;
  72. this.reportLog();
  73. },
  74. retweer() {
  75. Report.reportLog({
  76. baseInfo: {
  77. mid: getMid(),
  78. pageSource: Report.pageSource.tutorialPage,
  79. appType,
  80. machineCode: getMid(),
  81. },
  82. params: {
  83. eventData: {
  84. businessType: Report.businessType.buttonClick,
  85. objectType: Report.objectType.rtButton,
  86. postId: getQueryString('postId'),
  87. },
  88. extParams: {
  89. pageindex: this.active + 1,
  90. },
  91. },
  92. });
  93. if (getQueryString('postId')) {
  94. window.open(`https://twitter.com/intent/retweet?tweet_id=${getQueryString('postId')}`);
  95. }
  96. },
  97. reportLog() {
  98. Report.reportLog({
  99. baseInfo: {
  100. mid: getMid(),
  101. pageSource: Report.pageSource.tutorialPage,
  102. appType,
  103. machineCode: getMid(),
  104. },
  105. params: {
  106. eventData: {
  107. businessType: Report.businessType.pageView,
  108. postId: getQueryString('postId'),
  109. },
  110. extParams: {
  111. pageindex: this.active + 1,
  112. },
  113. },
  114. });
  115. },
  116. },
  117. async asyncData(params) {
  118. let { route } = params;
  119. let { data } = await axios.post(`${baseURL}/denet/base/guide/getAllMobilePageGuide`, {
  120. baseInfo: {
  121. appVersionCode: appVersionCode,
  122. mid: '00000000-0000-0000-0000-000000000000',
  123. },
  124. });
  125. if (data.code == 0) {
  126. return {
  127. useful: route.query.useful,
  128. playType: route.query.playType,
  129. course: route.query.useful === UsefulType.unUseful || route.query.playType === PlayType.NFT ? data.data.withoutRewardGuideImages : data.data.withRewardGuideImages,
  130. };
  131. }
  132. },
  133. mounted() {
  134. this.reportLog();
  135. },
  136. };
  137. </script>
  138. <style lang="scss">
  139. html,
  140. body,
  141. #__nuxt,
  142. #__layout {
  143. width: 100%;
  144. height: 100%;
  145. padding: 0;
  146. margin: 0;
  147. }
  148. </style>
  149. <style lang="scss" scoped>
  150. body {
  151. background-color: #f5f5f5;
  152. }
  153. .course-page {
  154. min-height: 100%;
  155. max-height: 100%;
  156. overflow: hidden;
  157. display: flex;
  158. flex-direction: column;
  159. align-items: center;
  160. justify-content: space-between;
  161. &-tips {
  162. width: 100%;
  163. height: 80px;
  164. background: #94a7b6;
  165. display: flex;
  166. padding: 0 20px;
  167. align-items: center;
  168. font-weight: 600;
  169. font-size: 16px;
  170. line-height: 22px;
  171. color: #fff;
  172. z-index: 1;
  173. .tip-icon {
  174. width: 36px;
  175. margin-right: 20px;
  176. }
  177. }
  178. &-pics-contail {
  179. flex: 1;
  180. overflow: hidden;
  181. &-wrap {
  182. display: flex;
  183. transition: all 0.5s;
  184. .pic {
  185. width: 100%;
  186. }
  187. }
  188. }
  189. &-pagination {
  190. display: flex;
  191. justify-content: center;
  192. align-items: center;
  193. margin: 16px 0;
  194. .spon {
  195. width: 8px;
  196. height: 8px;
  197. background: #d9d9d9;
  198. margin: 0 3px;
  199. border-radius: 50%;
  200. }
  201. .active {
  202. background: #1d9bf0;
  203. }
  204. }
  205. &-btns {
  206. width: 100%;
  207. display: flex;
  208. padding: 0 8px 30px;
  209. &-btn {
  210. flex: 1;
  211. margin: 0 8px;
  212. height: 54px;
  213. line-height: 54px;
  214. text-align: center;
  215. border-radius: 60px;
  216. }
  217. &-btn:active {
  218. -webkit-tap-highlight-color: transparent;
  219. }
  220. .back {
  221. background: rgba(29, 155, 240, 0.01);
  222. border: 1px solid #e8e8e8;
  223. color: #3d3d3d;
  224. }
  225. .next {
  226. background: rgba(0, 0, 0, 0.01);
  227. border: 1px solid #b5e1ff;
  228. color: #1d9bf0;
  229. }
  230. .retweer {
  231. background: #1d9bf0;
  232. border: 1px solid #1d9bf0;
  233. color: #fff;
  234. }
  235. }
  236. }
  237. </style>