Commit a761c755 authored by chenkai1's avatar chenkai1
parents eb1d9ebf ded041db
...@@ -52,7 +52,9 @@ const globalStore = useGlobalStore() ...@@ -52,7 +52,9 @@ const globalStore = useGlobalStore()
// 登录获取 cuk // 登录获取 cuk
const wxAutoLogin = async () => { const wxAutoLogin = async () => {
await userStore.wxAutoLogin() await new Promise(resolve => {
userStore.wxAutoLogin(resolve)
})
} }
// 接收webview消息 // 接收webview消息
......
...@@ -236,16 +236,17 @@ export const useUserStore = defineStore("userInfo", { ...@@ -236,16 +236,17 @@ export const useUserStore = defineStore("userInfo", {
} }
}, },
/** /**
* 用户自动登录 * 用户自动登录
*/ */
async wxAutoLogin() { async wxAutoLogin(cb=null) {
uni.login({ uni.login({
provider: "weixin", provider: "weixin",
success: async (res) => { success: async (res) => {
console.log("wxAutoLogin", res); console.log("wxAutoLogin", res);
if (res.errMsg === "login:ok") { if (res.errMsg === "login:ok") {
await this.autoLoginByCode(res.code); await this.autoLoginByCode(res.code);
cb && cb();
} else { } else {
uni.showToast({ uni.showToast({
title: res.errMsg, title: res.errMsg,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment