|
|
|
|
@ -73,7 +73,6 @@ const UserIndex = observer(() => {
@@ -73,7 +73,6 @@ const UserIndex = observer(() => {
|
|
|
|
|
|
|
|
|
|
// 微信登录
|
|
|
|
|
const handleWechatLogin = async () => { |
|
|
|
|
let grpSn = '212' |
|
|
|
|
try { |
|
|
|
|
userStore.setLoading(true) |
|
|
|
|
|
|
|
|
|
@ -83,10 +82,12 @@ const UserIndex = observer(() => {
@@ -83,10 +82,12 @@ const UserIndex = observer(() => {
|
|
|
|
|
throw new Error('获取微信登录凭证失败') |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
console.log('loginResult', loginResult.code) |
|
|
|
|
// return
|
|
|
|
|
// 调用后端接口
|
|
|
|
|
const response = await wechatLogin(loginResult.code,grpSn) |
|
|
|
|
const response = await wechatLogin(loginResult.code) |
|
|
|
|
|
|
|
|
|
if (response.success && response.data.success) { |
|
|
|
|
if (response.success && response.data) { |
|
|
|
|
// 保存用户信息到store
|
|
|
|
|
userStore.setUserInfoFromWechat(response.data.customer) |
|
|
|
|
|
|
|
|
|
@ -95,7 +96,7 @@ const UserIndex = observer(() => {
@@ -95,7 +96,7 @@ const UserIndex = observer(() => {
|
|
|
|
|
icon: 'success' |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
throw new Error(response.data.message || response.message || '登录失败') |
|
|
|
|
throw new Error(response.data?.message || response.message || '登录失败') |
|
|
|
|
} |
|
|
|
|
} catch (error: any) { |
|
|
|
|
console.error('微信登录失败:', error) |
|
|
|
|
|