|
|
|
|
@ -21,7 +21,7 @@ import { setSessionUserInfo } from '@/utils/auth';
|
|
|
|
|
import store from '@/store';
|
|
|
|
|
import { updateUserInfo } from '@/store/user';
|
|
|
|
|
import { getMyComponents, getPubComponents, getTeamComponents } from '@/api/components';
|
|
|
|
|
import { getPublishPage } from '@/api/flow';
|
|
|
|
|
import { getPubFlowList, getMyFlowList } from '@/api/flow';
|
|
|
|
|
import dayjs from 'dayjs';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -65,8 +65,20 @@ export default function MyApp({
|
|
|
|
|
{ promise: getMyComponents(), key: 'myLibs' },
|
|
|
|
|
{ promise: getPubComponents(), key: 'pubLibs' },
|
|
|
|
|
{ promise: getTeamComponents(), key: 'teamLibs' },
|
|
|
|
|
{ promise: getPublishPage(), key: 'pubFlow' }
|
|
|
|
|
// {promise: appId ? getMineSubs({id: appId}) : Promise.resolve(null), key: 'myFlow'},
|
|
|
|
|
{
|
|
|
|
|
promise: getPubFlowList({
|
|
|
|
|
currPage: 1,
|
|
|
|
|
pageSize: 999
|
|
|
|
|
}),
|
|
|
|
|
key: 'pubFlow'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
promise: getMyFlowList({
|
|
|
|
|
currPage: 1,
|
|
|
|
|
pageSize: 999
|
|
|
|
|
}),
|
|
|
|
|
key: 'myFlow'
|
|
|
|
|
}
|
|
|
|
|
// {promise: getEventList(), key: 'eventList'}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
@ -75,7 +87,7 @@ export default function MyApp({
|
|
|
|
|
pubLibs: null,
|
|
|
|
|
teamLibs: null,
|
|
|
|
|
pubFlow: null,
|
|
|
|
|
// myFlow: null,
|
|
|
|
|
myFlow: null,
|
|
|
|
|
updateTime: dayjs().format('YYYY-MM-DD HH:mm:ss')
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -85,32 +97,16 @@ export default function MyApp({
|
|
|
|
|
for (const { promise, key } of requests) {
|
|
|
|
|
try {
|
|
|
|
|
const res: any = await promise;
|
|
|
|
|
if (res?.code === 200 && res.data?.length > 0) {
|
|
|
|
|
// if (key === 'myLibs') {
|
|
|
|
|
// addCompInfo(res.data);
|
|
|
|
|
// libsStore.setMyLibs(res.data);
|
|
|
|
|
// } else if (key === 'pubLibs') {
|
|
|
|
|
// addCompInfo(res.data);
|
|
|
|
|
// libsStore.setPubLibs(res.data);
|
|
|
|
|
// } else if (key === 'teamLibs') {
|
|
|
|
|
// addCompInfo(res.data);
|
|
|
|
|
// libsStore.setTeamLibs(res.data);
|
|
|
|
|
// } else if (key === 'pubFlow') {
|
|
|
|
|
// addCompInfo(res.data, true);
|
|
|
|
|
// libsStore.setPubFlow(res.data);
|
|
|
|
|
// }
|
|
|
|
|
// else if (key === 'myFlow') {
|
|
|
|
|
// let newData = formatFlowMy(res.data);
|
|
|
|
|
// addCompInfo(newData, true);
|
|
|
|
|
// libsStore.setMyFlow(newData);
|
|
|
|
|
// }
|
|
|
|
|
// else if (key === 'eventList') {
|
|
|
|
|
// eventStore.setEventList(res.data);
|
|
|
|
|
// }
|
|
|
|
|
if (res?.code === 200) {
|
|
|
|
|
if (key === 'pubFlow' || key === 'myFlow') {
|
|
|
|
|
// 更新本地存储数据
|
|
|
|
|
obj[key] = res?.data.list || null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
// 更新本地存储数据
|
|
|
|
|
obj[key] = res?.data || null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sessionStorage.setItem(`compLibs${userInfo.userId}`, JSON.stringify(obj));
|
|
|
|
|
} catch (error) {
|
|
|
|
|
console.error(`加载${key}失败:`, error);
|
|
|
|
|
|