index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="loader-container">
  3. <div
  4. style="height: 100%; width: 100%; background: #000; position: relative"
  5. v-if="$userAgent.isWx && !$userAgent.isMiniProgram"
  6. >
  7. <img src="@/assets/image/point.png" alt="" class="point" />
  8. </div>
  9. <div class="loader" v-else></div>
  10. </div>
  11. </template>
  12. <script>
  13. import common from './mixins/common.js';
  14. export default {
  15. name: 'claimCloudPhone',
  16. auth: false,
  17. head: {
  18. title: '0元购机,尽情享受',
  19. },
  20. mixins: [common],
  21. data() {
  22. return {
  23. visible: false,
  24. };
  25. },
  26. mounted() {
  27. if (this.$userAgent.isWx && !this.$userAgent.isMiniProgram) {
  28. return;
  29. }
  30. const {
  31. invitationUserName,
  32. operateActivityId,
  33. userLaunchId,
  34. bool = 0,
  35. } = this.$route.query;
  36. if (invitationUserName && operateActivityId && userLaunchId) {
  37. // 删除旧的token
  38. setTimeout(() => {
  39. localStorage.removeItem('auth._token.password');
  40. })
  41. // 如果有这个说明被邀请人
  42. localStorage.setItem('auth.inviteeNum', 1);
  43. // 活动Id
  44. localStorage.setItem(
  45. 'auth.operateActivityId',
  46. window.atob(operateActivityId),
  47. );
  48. this.$router.replace({
  49. path: '/claimCloudPhone/0',
  50. query: this.$route.query,
  51. });
  52. return;
  53. }
  54. if (!+bool) {
  55. localStorage.removeItem('auth.inviteeNum');
  56. localStorage.setItem('auth.operateActivityId', operateActivityId);
  57. }
  58. setTimeout(() => {
  59. this.bargainingStatus();
  60. });
  61. },
  62. methods: {
  63. bargainingStatus() {
  64. const { operateActivityId, bool = 0 } = this.$route.query;
  65. let params = {};
  66. if (+bool || (!+bool && operateActivityId)) {
  67. params.operateActivityId = localStorage.getItem(
  68. 'auth.operateActivityId',
  69. );
  70. }
  71. this.$axios
  72. .$get('activity/v5/assist/bargaining/current/bargainingStatus', {
  73. headers: this.headers,
  74. params,
  75. })
  76. .then((res) => {
  77. if (res.success) {
  78. localStorage.setItem(
  79. 'bargainingStatusInfo',
  80. JSON.stringify(res.data),
  81. );
  82. console.log(res.data.bargainingStatus)
  83. // bargainingStatus 0 :选择云机界面 1:砍一刀界面 2;邀请好友页面 3:成功,领取下一台云机界面 4:失败,领取下一台云机界面 5:跳官网 6:活动结束选择云手机 7 是到活动页,活动结束
  84. switch (res.data.bargainingStatus) {
  85. case 0:
  86. case 6:
  87. sessionStorage.setItem(
  88. 'activityEmd',
  89. res.data.bargainingStatus,
  90. );
  91. this.$router.replace('/claimCloudPhone/chooseCloudPhone');
  92. break;
  93. case 5:
  94. this.visible = true;
  95. break;
  96. default:
  97. this.$router.replace(
  98. '/claimCloudPhone/' + res.data.bargainingStatus,
  99. );
  100. break;
  101. }
  102. }
  103. })
  104. .catch((error) => {
  105. this.$toast(error.message);
  106. setTimeout(() => {
  107. this.leaveFun();
  108. }, 1000);
  109. });
  110. },
  111. },
  112. };
  113. </script>
  114. <style lang="less" scoped>
  115. .loader-container {
  116. background: rgba(237, 228, 228, 1);
  117. height: 100%;
  118. width: 100%;
  119. }
  120. .point {
  121. position: absolute;
  122. top: 5%;
  123. right: 5%;
  124. width: 250px;
  125. height: 250px;
  126. }
  127. .loader {
  128. position: relative;
  129. width: 2.5em;
  130. height: 2.5em;
  131. transform: rotate(165deg);
  132. }
  133. .loader:before,
  134. .loader:after {
  135. content: '';
  136. position: absolute;
  137. top: 50%;
  138. left: 50%;
  139. display: block;
  140. width: 0.5em;
  141. height: 0.5em;
  142. border-radius: 0.25em;
  143. transform: translate(-50%, -50%);
  144. }
  145. .loader:before {
  146. animation: before8 2s infinite;
  147. }
  148. .loader:after {
  149. animation: after6 2s infinite;
  150. }
  151. @keyframes before8 {
  152. 0% {
  153. width: 0.5em;
  154. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  155. -1em 0.5em rgba(111, 202, 220, 0.75);
  156. }
  157. 35% {
  158. width: 2.5em;
  159. box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75),
  160. 0 0.5em rgba(111, 202, 220, 0.75);
  161. }
  162. 70% {
  163. width: 0.5em;
  164. box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75),
  165. 1em 0.5em rgba(111, 202, 220, 0.75);
  166. }
  167. 100% {
  168. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  169. -1em 0.5em rgba(111, 202, 220, 0.75);
  170. }
  171. }
  172. @keyframes after6 {
  173. 0% {
  174. height: 0.5em;
  175. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  176. -0.5em -1em rgba(233, 169, 32, 0.75);
  177. }
  178. 35% {
  179. height: 2.5em;
  180. box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75),
  181. -0.5em 0 rgba(233, 169, 32, 0.75);
  182. }
  183. 70% {
  184. height: 0.5em;
  185. box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75),
  186. -0.5em 1em rgba(233, 169, 32, 0.75);
  187. }
  188. 100% {
  189. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  190. -0.5em -1em rgba(233, 169, 32, 0.75);
  191. }
  192. }
  193. .loader {
  194. position: absolute;
  195. top: calc(50% - 1.25em);
  196. left: calc(50% - 1.25em);
  197. }
  198. </style>