index.vue 5.4 KB

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