Loading.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <div class="lottie-bg">
  3. <div id="lottie">
  4. <img
  5. src="@assets/images/live-logo.gif"
  6. rel="preload"
  7. style="width: 100%;"
  8. />
  9. </div>
  10. </div>
  11. </template>
  12. <script>
  13. import { auth } from "@libs/wechat";
  14. export default {
  15. name: "Loading",
  16. mounted() {
  17. const { code, state } = this.$route.query;
  18. auth(code, state)
  19. .then(() => {
  20. location.href = decodeURIComponent(
  21. decodeURIComponent(this.$route.params.url)
  22. );
  23. })
  24. .catch(() => {
  25. location.replace("/");
  26. });
  27. }
  28. };
  29. </script>
  30. <style scoped>
  31. .lottie-bg {
  32. position: fixed;
  33. left: 0;
  34. top: 0;
  35. background-color: #fff;
  36. width: 100%;
  37. height: 100%;
  38. z-index: 999;
  39. display: -webkit-flex;
  40. display: flex;
  41. -webkit-align-items: center;
  42. align-items: center;
  43. -webkit-justify-content: center;
  44. justify-content: center;
  45. }
  46. #lottie {
  47. width: 35%;
  48. display: block;
  49. overflow: hidden;
  50. transform: translate3d(0, 0, 0);
  51. margin: auto;
  52. }
  53. </style>