login.vue 905 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <!-- 空登陆页 -->
  3. <view></view>
  4. </template>
  5. <script setup>
  6. import { isEmpty } from 'lodash';
  7. import sheep from '@/sheep';
  8. import { onLoad, onShow } from '@dcloudio/uni-app';
  9. onLoad(async (options) => {
  10. // #ifdef H5
  11. let event = '';
  12. if (options.login_code) {
  13. event = 'login';
  14. const { error } = await sheep.$platform.useProvider().login(options.login_code);
  15. if (error === 0) {
  16. sheep.$store('user').getInfo();
  17. }
  18. }
  19. if (options.bind_code) {
  20. event = 'bind';
  21. const { error } = await sheep.$platform.useProvider().bind(options.bind_code);
  22. }
  23. // 检测H5登录回调
  24. let returnUrl = uni.getStorageSync('returnUrl');
  25. if (returnUrl) {
  26. uni.removeStorage('returnUrl');
  27. location.replace(returnUrl);
  28. } else {
  29. uni.switchTab({
  30. url: '/',
  31. });
  32. }
  33. // #endif
  34. });
  35. </script>