index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. let url = '/claimCloudPhone/chooseCloudPhone'
  91. if(+this.$route.query.exit) url += '?exit=1'
  92. this.$router.replace(url);
  93. break;
  94. case 5:
  95. this.visible = true;
  96. break;
  97. default:
  98. this.$router.replace(
  99. '/claimCloudPhone/' + res.data.bargainingStatus,
  100. );
  101. break;
  102. }
  103. }
  104. })
  105. .catch((error) => {
  106. this.$toast(error.message);
  107. setTimeout(() => {
  108. this.leaveFun();
  109. }, 1000);
  110. });
  111. },
  112. },
  113. };
  114. </script>
  115. <style lang="less" scoped>
  116. .loader-container {
  117. background: rgba(237, 228, 228, 1);
  118. height: 100%;
  119. width: 100%;
  120. }
  121. .point {
  122. position: absolute;
  123. top: 5%;
  124. right: 5%;
  125. width: 250px;
  126. height: 250px;
  127. }
  128. .loader {
  129. position: relative;
  130. width: 2.5em;
  131. height: 2.5em;
  132. transform: rotate(165deg);
  133. }
  134. .loader:before,
  135. .loader:after {
  136. content: '';
  137. position: absolute;
  138. top: 50%;
  139. left: 50%;
  140. display: block;
  141. width: 0.5em;
  142. height: 0.5em;
  143. border-radius: 0.25em;
  144. transform: translate(-50%, -50%);
  145. }
  146. .loader:before {
  147. animation: before8 2s infinite;
  148. }
  149. .loader:after {
  150. animation: after6 2s infinite;
  151. }
  152. @keyframes before8 {
  153. 0% {
  154. width: 0.5em;
  155. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  156. -1em 0.5em rgba(111, 202, 220, 0.75);
  157. }
  158. 35% {
  159. width: 2.5em;
  160. box-shadow: 0 -0.5em rgba(225, 20, 98, 0.75),
  161. 0 0.5em rgba(111, 202, 220, 0.75);
  162. }
  163. 70% {
  164. width: 0.5em;
  165. box-shadow: -1em -0.5em rgba(225, 20, 98, 0.75),
  166. 1em 0.5em rgba(111, 202, 220, 0.75);
  167. }
  168. 100% {
  169. box-shadow: 1em -0.5em rgba(225, 20, 98, 0.75),
  170. -1em 0.5em rgba(111, 202, 220, 0.75);
  171. }
  172. }
  173. @keyframes after6 {
  174. 0% {
  175. height: 0.5em;
  176. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  177. -0.5em -1em rgba(233, 169, 32, 0.75);
  178. }
  179. 35% {
  180. height: 2.5em;
  181. box-shadow: 0.5em 0 rgba(61, 184, 143, 0.75),
  182. -0.5em 0 rgba(233, 169, 32, 0.75);
  183. }
  184. 70% {
  185. height: 0.5em;
  186. box-shadow: 0.5em -1em rgba(61, 184, 143, 0.75),
  187. -0.5em 1em rgba(233, 169, 32, 0.75);
  188. }
  189. 100% {
  190. box-shadow: 0.5em 1em rgba(61, 184, 143, 0.75),
  191. -0.5em -1em rgba(233, 169, 32, 0.75);
  192. }
  193. }
  194. .loader {
  195. position: absolute;
  196. top: calc(50% - 1.25em);
  197. left: calc(50% - 1.25em);
  198. }
  199. </style>