From db101eba7e71791af1da21ef5b684c03eb731bbc Mon Sep 17 00:00:00 2001 From: limengyang <2509946015@qq.com> Date: Mon, 29 Apr 2024 17:28:13 +0800 Subject: [PATCH] =?UTF-8?q?fix(lmy):=20=E7=99=BB=E5=BD=95=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=BC=B9=E7=AA=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/user.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/store/modules/user.ts b/src/store/modules/user.ts index 8340d94..d578a80 100644 --- a/src/store/modules/user.ts +++ b/src/store/modules/user.ts @@ -16,7 +16,7 @@ import { RouteRecordRaw } from 'vue-router'; import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; import { isArray } from '/@/utils/is'; import { h } from 'vue'; - +import { message } from 'ant-design-vue'; interface UserState { userInfo: GetUserInfoModel; token?: string; @@ -119,14 +119,22 @@ export const useUserStore = defineStore({ }, //数据对接模拟登录 async tmallabSimulationLogin(params: { loginName: string; password: string }): Promise { - try { - const data = await tmallabLoginApi(params); + const data = await tmallabLoginApi(params); + if (data.success) { this.setTmallabToken(data.data.token); this.setToken(data.data.token); return this.afterLoginAction(true, data.data); - } catch (error) { - return Promise.reject(error); + } else { + message.error(data.message); } + // try { + // const data = await tmallabLoginApi(params); + // this.setTmallabToken(data.data.token); + // this.setToken(data.data.token); + // return this.afterLoginAction(true, data.data); + // } catch (error) { + // return Promise.reject(error); + // } }, async afterLoginAction(goHome?: boolean, data?: any): Promise { if (!this.getTmallabToken) return null; -- 2.24.1