index.vue 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <template>
  2. <view class="lottie-bg">
  3. <view id="lottie">
  4. <image src="/static/img/live-logo.gif" rel="preload" />
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  10. import wechat from "@/libs/wechat";
  11. import {
  12. getUserInfo
  13. } from "@/api/user";
  14. export default {
  15. name: "Auth",
  16. mounted() {
  17. },
  18. onLoad(option) {
  19. let that = this
  20. const {
  21. code,
  22. state
  23. } = option;
  24. wechat.auth(code, state)
  25. .then(() => {
  26. // let newTime = Math.round(new Date() / 1000);
  27. // that.$store.commit("LOGIN", {
  28. // 'token': data.token,
  29. // 'time': dayjs(data.exp) - newTime
  30. // });
  31. // that.$store.commit("SETUID", data.user.uid);
  32. console.log(decodeURIComponent(
  33. decodeURIComponent(option.back_url)
  34. ),'back_url')
  35. location.href = decodeURIComponent(
  36. decodeURIComponent(option.back_url)
  37. );
  38. })
  39. .catch((err) => {
  40. location.replace("/");
  41. });
  42. }
  43. };
  44. </script>
  45. <style scoped lang="scss">
  46. .lottie-bg {
  47. position: fixed;
  48. left: 0;
  49. top: 0;
  50. background-color: #fff;
  51. width: 100%;
  52. height: 100%;
  53. z-index: 999;
  54. display: flex;
  55. align-items: center;
  56. justify-content: center;
  57. }
  58. #lottie {
  59. display: block;
  60. width: 100%;
  61. height: 100%;
  62. display: flex;
  63. align-items: center;
  64. justify-content: center;
  65. overflow: hidden;
  66. transform: translate3d(0, 0, 0);
  67. margin: auto;
  68. image {
  69. width: 200rpx;
  70. height: 200rpx;
  71. }
  72. }
  73. </style>