You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
986 B
39 lines
986 B
<!-- 微信公众号的登录回调页 -->
|
|
<template>
|
|
<!-- 空登陆页 -->
|
|
<view />
|
|
</template>
|
|
|
|
<script setup>
|
|
import { onLoad } from '@dcloudio/uni-app';
|
|
import { getUserInfo} from '@/api/card'
|
|
|
|
onLoad(async (options) => {
|
|
// #ifdef H5
|
|
// 将 search 参数赋值到 options 中,方便下面解析
|
|
new URLSearchParams(location.search).forEach((value, key) => {
|
|
options[key] = value;
|
|
});
|
|
const event = options.event;
|
|
const code = options.code;
|
|
const state = options.state;
|
|
if (code) {
|
|
getUserInfo(code).then(res => {
|
|
console.log(res,9)
|
|
uni.setStorageSync('openid', res.data.openid);
|
|
})
|
|
}
|
|
|
|
// // 检测 H5 登录回调
|
|
// let returnUrl = uni.getStorageSync('returnUrl');
|
|
// if (returnUrl) {
|
|
// uni.removeStorage({key:'returnUrl'});
|
|
// location.replace(returnUrl);
|
|
// } else {
|
|
// uni.switchTab({
|
|
// url: '/',
|
|
// });
|
|
// }
|
|
// #endif
|
|
});
|
|
</script>
|
|
|