feat: 微信小程序登录改造(手机号授权 + API前缀改为/mp-api + 隐私协议检查)
This commit is contained in:
+12
@@ -3,6 +3,18 @@ import { onLaunch } from '@dcloudio/uni-app'
|
||||
import { useUserStore } from './store/user'
|
||||
|
||||
onLaunch(() => {
|
||||
// #ifdef MP-WEIXIN
|
||||
wx.getPrivacySetting({
|
||||
success: (res: any) => {
|
||||
if (res.needAuthorization) {
|
||||
uni.setStorageSync('needPrivacy', true)
|
||||
} else {
|
||||
uni.removeStorageSync('needPrivacy')
|
||||
}
|
||||
}
|
||||
})
|
||||
// #endif
|
||||
|
||||
const userStore = useUserStore()
|
||||
// 如果有 token,尝试获取用户信息
|
||||
if (userStore.isLogin) {
|
||||
|
||||
Reference in New Issue
Block a user