index.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="lottie-bg">
  3. <view id="lottie">
  4. <image :src="urlDomain+'crmebimage/presets/live-logo.gif'" rel="preload" />
  5. </view>
  6. </view>
  7. </template>
  8. <script>
  9. import wechat from "@/libs/wechat";
  10. import {
  11. getUserInfoApi
  12. } from "@/api/user";
  13. export default {
  14. name: "Auth",
  15. data(){
  16. return{
  17. urlDomain: this.$Cache.get("imgHost"),
  18. }
  19. },
  20. mounted() {
  21. },
  22. onLoad(option) {
  23. let that = this
  24. const {
  25. code,
  26. state
  27. } = option;
  28. wechat.auth(code, state)
  29. .then(() => {
  30. getUserInfoApi().then(res => {
  31. location.href = decodeURIComponent(
  32. decodeURIComponent(option.back_url)
  33. );
  34. }).catch(res => {
  35. console.log('getUserInfo错误='+res);
  36. });
  37. })
  38. .catch((err) => {
  39. console.log('auth错误='+err);
  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>