diff --git a/mini-program/src/stores/app.js b/mini-program/src/stores/app.js index e1a9333..47f9c62 100644 --- a/mini-program/src/stores/app.js +++ b/mini-program/src/stores/app.js @@ -26,7 +26,12 @@ const state = reactive({ childhood: { date: '', text: '' }, joy: { date: '', text: '' }, low: { date: '', text: '' }, - future: { vision: '', ideal: '' } + future: { vision: '', ideal: '' }, + city: '', + industry: '', + company: '', + personalityTags: [], + birthday: '' } }) @@ -69,6 +74,20 @@ const login = async (phone, smsCode) => { } } +const loginWithWechat = async (payload = {}) => { + state.isLoading = true + try { + await authService.wechatLogin(payload) + state.isLoggedIn = true + await fetchUserProfile() + return { success: true, hasProfile: hasProfile.value } + } catch (error) { + return { success: false, error: error.message } + } finally { + state.isLoading = false + } +} + const logout = async () => { await authService.logout() resetAuthState() @@ -400,6 +419,7 @@ export const useAppStore = () => { ...state, hasProfile, login, + loginWithWechat, logout, fetchUserProfile, saveUserProfile,