index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="lottie-bg">
  3. <view id="lottie">
  4. </view>
  5. </view>
  6. </template>
  7. <script>
  8. // +----------------------------------------------------------------------
  9. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  10. // +----------------------------------------------------------------------
  11. // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
  12. // +----------------------------------------------------------------------
  13. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  14. // +----------------------------------------------------------------------
  15. // | Author: CRMEB Team <admin@crmeb.com>
  16. // +----------------------------------------------------------------------
  17. import dayjs from "@/plugin/dayjs/dayjs.min.js";
  18. import wechat from "@/libs/wechat";
  19. import {
  20. getUserInfo
  21. } from "@/api/user";
  22. export default {
  23. name: "Auth",
  24. mounted() {
  25. },
  26. onLoad(option) {
  27. let that = this
  28. const {
  29. code,
  30. state
  31. } = option;
  32. wechat.auth(code, state)
  33. .then(() => {
  34. console.log(decodeURIComponent(decodeURIComponent(option.back_url)),'back_url')
  35. const href = decodeURIComponent(decodeURIComponent(option.back_url))
  36. location.replace(href)
  37. })
  38. .catch((err) => {
  39. location.replace("/");
  40. });
  41. }
  42. };
  43. </script>
  44. <style scoped lang="scss">
  45. .lottie-bg {
  46. position: fixed;
  47. left: 0;
  48. top: 0;
  49. background-color: #fff;
  50. width: 100%;
  51. height: 100%;
  52. z-index: 999;
  53. display: flex;
  54. align-items: center;
  55. justify-content: center;
  56. }
  57. #lottie {
  58. display: block;
  59. width: 100%;
  60. height: 100%;
  61. display: flex;
  62. align-items: center;
  63. justify-content: center;
  64. overflow: hidden;
  65. transform: translate3d(0, 0, 0);
  66. margin: auto;
  67. image {
  68. width: 200rpx;
  69. height: 200rpx;
  70. }
  71. }
  72. </style>