Skip to content

Commit

Permalink
feat: hide model page
Browse files Browse the repository at this point in the history
  • Loading branch information
icebergtsn committed Sep 3, 2024
1 parent d75662c commit 36a66a0
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 44 deletions.
14 changes: 4 additions & 10 deletions frontend/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,21 @@ import { useSocketStore } from 'src/stores/websocketStore';
import { BtNotify, NotifyDefinedType } from '@bytetrade/ui';
import { bus, BUS_EVENT } from 'src/utils/bus';
import { useUserStore } from 'src/stores/user';
import { useSettingStore } from 'src/stores/setting';
// import { testSatisfies } from 'src/utils/version';
export default {
async preFetch() {
const appStore = useAppStore();
const userStore = useUserStore();
const settingStore = useSettingStore();
await appStore.prefetch();
userStore.init();
appStore.init();
settingStore.init();
},
setup() {
const appStore = useAppStore();
const websocketStore = useSocketStore();
const userStore = useUserStore();
onMounted(async () => {
if (!appStore.isPublic) {
// testSatisfies();
websocketStore.start();
await appStore.prefetch();
userStore.init();
appStore.init();
}
bus.on(BUS_EVENT.APP_BACKEND_ERROR, onErrorMessage);
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/api/private/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export async function getOperateHistory(source: string): Promise<any> {
}
}

export async function getAppsBriefInfoByStatus(state: APP_STATUS[]) {
export async function getAppsBriefInfoByStatus(
state: APP_STATUS[]
): Promise<[]> {
try {
const response: any = await axios.get('/app-store/v1/apps/app', {
params: {
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,12 @@ const itemsRef = ref([
label: t('main.recommendation'),
key: MENU_TYPE.Application.Recommendation,
icon: 'sym_r_featured_play_list'
},
{
label: t('main.models'),
key: MENU_TYPE.Application.Models,
icon: 'sym_r_neurology'
}
// {
// label: t('main.models'),
// key: MENU_TYPE.Application.Models,
// icon: 'sym_r_neurology'
// }
]
}
]);
Expand Down
50 changes: 25 additions & 25 deletions frontend/src/pages/recommend/RecommendPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,40 @@ const latestLoading = ref(true);
const pageData = ref();
const appStore = useAppStore();
onMounted(async () => {
await fetchData(true);
onMounted(() => {
fetchData(true);
});
async function fetchData(showLoading = false) {
if (showLoading) {
pageLoading.value = true;
latestLoading.value = true;
}
const all = await appStore.getPageData(CATEGORIES_TYPE.LOCAL.ALL);
console.log(all);
if (all && all.data) {
console.log(all.data);
pageData.value = all.data;
pageLoading.value = false;
const latest = pageData.value.find(
(item: any) => item.type === 'Default Topic' && item.id === 'Newest'
);
if (latest) {
// await Promise.all([
// getRecommendApps(CATEGORIES_TYPE.SERVER.News),
// getRecommendApps(CATEGORIES_TYPE.SERVER.Sports),
// getRecommendApps(CATEGORIES_TYPE.SERVER.LifeStyle)
// ]).then(([array1, array2, array3]) => {
// latestApps.value = [...array1, ...array2, ...array3];
// });
latestApps.value = await getRecommendApps();
appStore
.getPageData(CATEGORIES_TYPE.LOCAL.ALL)
.then((all) => {
console.log(all);
if (all && all.data) {
pageData.value = all.data;
pageLoading.value = false;
const latest = pageData.value.find(
(item: any) => item.type === 'Default Topic' && item.id === 'Newest'
);
if (latest) {
getRecommendApps()
.then((data) => {
latestApps.value = data;
})
.finally(() => {
latestLoading.value = false;
});
}
}
})
.finally(() => {
latestLoading.value = false;
}
}
pageLoading.value = false;
latestLoading.value = false;
});
}
</script>

Expand Down
6 changes: 3 additions & 3 deletions frontend/src/stores/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { CFG_TYPE } from 'src/constants/config';

export type AppState = {
tempAppMap: Record<string, AppStoreInfo>;
pageData: [] | null;
pageData: [];
installApps: AppStoreInfo[];
updateApps: AppStoreInfo[];
queue: AsyncQueue;
Expand All @@ -47,7 +47,7 @@ export const useAppStore = defineStore('app', {
tempAppMap: {},
installApps: [],
updateApps: [],
pageData: null,
pageData: [],
isPublic: !!process.env.PUBLIC_URL,
queue: new AsyncQueue()
} as AppState;
Expand All @@ -69,7 +69,7 @@ export const useAppStore = defineStore('app', {

async getPageData(category: string): Promise<any> {
if (!this.pageData || this.pageData.length == 0) {
return null;
await this.prefetch();
}
switch (category) {
case CATEGORIES_TYPE.LOCAL.ALL:
Expand Down

0 comments on commit 36a66a0

Please sign in to comment.