Commit 1db8fedf authored by heduo's avatar heduo

Merge branch 'lmy' of http://119.78.67.12/git/root/ops_2024_vue into hd

parents 19f026a8 db101eba
...@@ -16,7 +16,7 @@ import { RouteRecordRaw } from 'vue-router'; ...@@ -16,7 +16,7 @@ import { RouteRecordRaw } from 'vue-router';
import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic'; import { PAGE_NOT_FOUND_ROUTE } from '/@/router/routes/basic';
import { isArray } from '/@/utils/is'; import { isArray } from '/@/utils/is';
import { h } from 'vue'; import { h } from 'vue';
import { message } from 'ant-design-vue';
interface UserState { interface UserState {
userInfo: GetUserInfoModel; userInfo: GetUserInfoModel;
token?: string; token?: string;
...@@ -119,14 +119,22 @@ export const useUserStore = defineStore({ ...@@ -119,14 +119,22 @@ export const useUserStore = defineStore({
}, },
//数据对接模拟登录 //数据对接模拟登录
async tmallabSimulationLogin(params: { loginName: string; password: string }): Promise<any> { async tmallabSimulationLogin(params: { loginName: string; password: string }): Promise<any> {
try { const data = await tmallabLoginApi(params);
const data = await tmallabLoginApi(params); if (data.success) {
this.setTmallabToken(data.data.token); this.setTmallabToken(data.data.token);
this.setToken(data.data.token); this.setToken(data.data.token);
return this.afterLoginAction(true, data.data); return this.afterLoginAction(true, data.data);
} catch (error) { } else {
return Promise.reject(error); 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<GetUserInfoModel | null> { async afterLoginAction(goHome?: boolean, data?: any): Promise<GetUserInfoModel | null> {
if (!this.getTmallabToken) return null; if (!this.getTmallabToken) return null;
......
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