1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <template>
-
- <view />
- </template>
- <script setup>
- import sheep from '@/sheep';
- import { onLoad } from '@dcloudio/uni-app';
- import {
- closeAuthModal,
- showAuthModal
- } from '@/sheep/hooks/useModal';
- onLoad(async (options) => {
-
-
- new URLSearchParams(location.search).forEach((value, key) => {
- options[key] = value;
- });
- const event = options.event;
- const code = options.code;
- const state = options.state;
- if (event === 'login') {
- const res = await sheep.$platform.useProvider().login(code, state);
- console.log("login.vue res:",res)
- if(!res){
- console.log("返回第一次登录了",res)
- showAuthModal("officialAccountFirstLogin");
- return false;
- }
- } else if (event === 'bind') {
- sheep.$platform.useProvider().bind(code, state);
- }
-
-
- let returnUrl = uni.getStorageSync('returnUrl');
- if (returnUrl) {
- uni.removeStorage('returnUrl');
- location.replace(returnUrl);
- } else {
- uni.switchTab({
- url: '/',
- });
- }
-
- });
- </script>
|