index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. // bargainingStatus 0 :选择云机界面 1:砍一刀界面 2;邀请好友页面 3:成功,领取下一台云机界面 4:失败,领取下一台云机界面 5:跳官网 6:活动结束选择云手机 7 是到活动页,活动结束
  83. switch (res.data.bargainingStatus) {
  84. case 0:
  85. case 6:
  86. sessionStorage.setItem(
  87. 'activityEmd',
  88. res.data.bargainingStatus,
  89. );
  90. this.$router.replace('/claimCloudPhone/chooseCloudPhone');
  91. break;
  92. case 5:
  93. this.visible = true;
  94. break;
  95. default:
  96. this.$router.replace(
  97. '/claimCloudPhone/' + res.data.bargainingStatus,
  98. );
  99. break;
  100. }
  101. }
  102. })
  103. .catch((error) => {
  104. this.$toast(error.message);
  105. setTimeout(() => {
  106. this.leaveFun();
  107. }, 1000);
  108. });
  109. },
  110. },
  111. };
  112. </script>
  113. <style lang="less" scoped>
  114. .loader-container {
  115. background: rgba(237, 228, 228, 1);
  116. height: 100%;
  117. width: 100%;
  118. }
  119. .point {
  120. position: absolute;
  121. top: 5%;
  122. right: 5%;
  123. width: 250px;
  124. height: 250px;
  125. }
  126. .loader {
  127. position: relative;
  128. width: 2.5em;
  129. height: 2.5em;
  130. transform: rotate(165deg);
  131. }
  132. .loader:before,
  133. .loader:after {
  134. content: '';
  135. position: absolute;
  136. top: 50%;
  137. left: 50%;
  138. display: block;
  139. width: 0.5em;
  140. height: 0.5em;
  141. border-radius: 0.25em;
  142. transform: translate(-50%, -50%);
  143. }
  144. .loader:before {
  145. animation: before8 2s infinite;
  146. }
  147. .loader:after {
  148. animation: after6 2s infinite;
  149. }
  150. @keyframes before8 {
  151. 0% {
  152. width: 0.5em;
  153. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  154. -1em 0.5em rgba(111, 202, 220, 0.75);
  155. }
  156. 35% {
  157. width: 2.5em;
  158. box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75),
  159. 0 0.5em rgba(111, 202, 220, 0.75);
  160. }
  161. 70% {
  162. width: 0.5em;
  163. box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75),
  164. 1em 0.5em rgba(111, 202, 220, 0.75);
  165. }
  166. 100% {
  167. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  168. -1em 0.5em rgba(111, 202, 220, 0.75);
  169. }
  170. }
  171. @keyframes after6 {
  172. 0% {
  173. height: 0.5em;
  174. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  175. -0.5em -1em rgba(233, 169, 32, 0.75);
  176. }
  177. 35% {
  178. height: 2.5em;
  179. box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75),
  180. -0.5em 0 rgba(233, 169, 32, 0.75);
  181. }
  182. 70% {
  183. height: 0.5em;
  184. box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75),
  185. -0.5em 1em rgba(233, 169, 32, 0.75);
  186. }
  187. 100% {
  188. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  189. -0.5em -1em rgba(233, 169, 32, 0.75);
  190. }
  191. }
  192. .loader {
  193. position: absolute;
  194. top: calc(50% - 1.25em);
  195. left: calc(50% - 1.25em);
  196. }
  197. </style>