index.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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, getStorage, removeStorage } 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.location.href = `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. const landPageLog = getStorage('land-page-log');
  140. if (landPageLog) {
  141. Report.reportLog(JSON.parse(landPageLog));
  142. removeStorage('land-page-log');
  143. }
  144. },
  145. };
  146. </script>
  147. <style lang="scss">
  148. html,
  149. body,
  150. #__nuxt,
  151. #__layout {
  152. width: 100%;
  153. height: 100%;
  154. padding: 0;
  155. margin: 0;
  156. }
  157. </style>
  158. <style lang="scss" scoped>
  159. body {
  160. background-color: #f5f5f5;
  161. }
  162. .course-page {
  163. min-height: 100%;
  164. max-height: 100%;
  165. overflow: hidden;
  166. display: flex;
  167. flex-direction: column;
  168. align-items: center;
  169. justify-content: space-between;
  170. &-tips {
  171. width: 100%;
  172. height: 80px;
  173. background: #94a7b6;
  174. display: flex;
  175. padding: 0 20px;
  176. align-items: center;
  177. font-weight: 600;
  178. font-size: 16px;
  179. line-height: 22px;
  180. color: #fff;
  181. z-index: 1;
  182. .tip-icon {
  183. width: 36px;
  184. margin-right: 20px;
  185. }
  186. }
  187. &-pics-contail {
  188. flex: 1;
  189. overflow: hidden;
  190. &-wrap {
  191. display: flex;
  192. transition: all 0.5s;
  193. .pic {
  194. width: 100%;
  195. }
  196. }
  197. }
  198. &-pagination {
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. margin: 16px 0;
  203. .spon {
  204. width: 8px;
  205. height: 8px;
  206. background: #d9d9d9;
  207. margin: 0 3px;
  208. border-radius: 50%;
  209. }
  210. .active {
  211. background: #1d9bf0;
  212. }
  213. }
  214. &-btns {
  215. width: 100%;
  216. display: flex;
  217. padding: 0 8px 30px;
  218. &-btn {
  219. flex: 1;
  220. margin: 0 8px;
  221. height: 54px;
  222. line-height: 54px;
  223. text-align: center;
  224. border-radius: 60px;
  225. }
  226. &-btn:active {
  227. -webkit-tap-highlight-color: transparent;
  228. }
  229. .back {
  230. background: rgba(29, 155, 240, 0.01);
  231. border: 1px solid #e8e8e8;
  232. color: #3d3d3d;
  233. }
  234. .next {
  235. background: rgba(0, 0, 0, 0.01);
  236. border: 1px solid #b5e1ff;
  237. color: #1d9bf0;
  238. }
  239. .retweer {
  240. background: #1d9bf0;
  241. border: 1px solid #1d9bf0;
  242. color: #fff;
  243. }
  244. }
  245. }
  246. </style>