From 94d057e5cc84d3a3dd1180304714a16b23039570 Mon Sep 17 00:00:00 2001 From: AnnyTerfect <1247470246@qq.com> Date: Mon, 6 Nov 2023 22:47:49 +0800 Subject: [PATCH 1/6] feat(frontend): heterogeneousMode -> isHeterogeneous --- .../src/components/Search/UserRequirement.vue | 2 ++ .../packages/main/src/request/engine/index.ts | 6 ++--- frontend/packages/main/src/views/Search.vue | 27 ++++++++----------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/frontend/packages/main/src/components/Search/UserRequirement.vue b/frontend/packages/main/src/components/Search/UserRequirement.vue index d1b4588..1c79308 100644 --- a/frontend/packages/main/src/components/Search/UserRequirement.vue +++ b/frontend/packages/main/src/components/Search/UserRequirement.vue @@ -12,6 +12,7 @@ import type { DataType, TaskType, LibraryType, Filter } from "@beiming-system/ty export interface Props { modelValue: Filter; isAdmin?: boolean; + isHeterogeneous?: boolean; } const { t } = useI18n(); @@ -20,6 +21,7 @@ const emits = defineEmits(["update:modelValue"]); withDefaults(defineProps(), { isAdmin: false, + isHeterogeneous: false, }); const route = useRoute(); diff --git a/frontend/packages/main/src/request/engine/index.ts b/frontend/packages/main/src/request/engine/index.ts index 72d0a0b..2c0a091 100644 --- a/frontend/packages/main/src/request/engine/index.ts +++ b/frontend/packages/main/src/request/engine/index.ts @@ -44,7 +44,7 @@ function searchLearnware({ scenarioList, files, isVerified, - heterogeneousMode, + isHeterogeneous, page, limit, }: { @@ -56,7 +56,7 @@ function searchLearnware({ scenarioList: ScenarioList; files: Files; isVerified: boolean; - heterogeneousMode: boolean; + isHeterogeneous: boolean; page: number; limit: number; }): Promise<{ @@ -85,7 +85,7 @@ function searchLearnware({ } fd.append("semantic_specification", JSON.stringify(semanticSpec)); fd.append("statistical_specification", (files.length > 0 && files[0]) || ""); - fd.append("heterogeneous_mode", String(heterogeneousMode)); + fd.append("is_heterogeneous", String(isHeterogeneous)); fd.append("is_verified", String(isVerified)); fd.append("limit", String(limit)); fd.append("page", String(page)); diff --git a/frontend/packages/main/src/views/Search.vue b/frontend/packages/main/src/views/Search.vue index 4cb9313..6f77b91 100644 --- a/frontend/packages/main/src/views/Search.vue +++ b/frontend/packages/main/src/views/Search.vue @@ -43,7 +43,7 @@ const singleRecommendedLearnwarePage = ref(1); const singleRecommendedLearnwarePageNum = ref(1); const singleRecommendedLearnwarePageSize = ref(Math.ceil(display.height.value / 900) * 10); const singleRecommendedLearnwareItems = ref([]); -const heterogeneousMode = ref(false); +const isHeterogeneous = ref(false); const rkmeTypeTable = ref(false); const loading = ref(false); const isVerified = ref(route.query.is_verified ? route.query.is_verified === "true" : true); @@ -82,7 +82,7 @@ function fetchByFilterAndPage( filters: Filter, page: number, isVerified: boolean = false, - heterogeneousMode: boolean = false, + isHeterogeneous: boolean = false, ): void { showError.value = false; loading.value = true; @@ -96,7 +96,7 @@ function fetchByFilterAndPage( scenarioList: filters.scenarioList, files: filters.files, isVerified, - heterogeneousMode, + isHeterogeneous, page, limit: singleRecommendedLearnwarePageSize.value, }) @@ -233,17 +233,17 @@ watch( filters.value, singleRecommendedLearnwarePage.value, isVerified.value, - heterogeneousMode.value, + isHeterogeneous.value, ], (newVal) => { - const [newFilters, newPage, newIsVerified, newHeterogeneousMode] = newVal as [ + const [newFilters, newPage, newIsVerified, newIsHeterogeneous] = newVal as [ Filter, number, boolean, boolean, ]; - fetchByFilterAndPage(newFilters, newPage - 1, newIsVerified, newHeterogeneousMode); + fetchByFilterAndPage(newFilters, newPage - 1, newIsVerified, newIsHeterogeneous); }, { deep: true }, ); @@ -286,7 +286,7 @@ function init(): void { filters.value, singleRecommendedLearnwarePage.value - 1, isVerified.value, - heterogeneousMode.value, + isHeterogeneous.value, ); } @@ -316,11 +316,11 @@ onMounted(() => init()); >