diff --git a/.gitignore b/.gitignore index adebf2d..e1e0ad7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,4 @@ dist/ .env.local apps/*/dist/ apps/*/node_modules/ - +.claude \ No newline at end of file diff --git a/apps/admin-web/src/i18n/messages/en-US.ts b/apps/admin-web/src/i18n/messages/en-US.ts index 670a238..cec8ac1 100644 --- a/apps/admin-web/src/i18n/messages/en-US.ts +++ b/apps/admin-web/src/i18n/messages/en-US.ts @@ -447,6 +447,7 @@ const enUS = { }, form: { brandName: "Brand name", + brandWebsite: "Company website (optional)", brandDescription: "Brand description", keywordName: "Keyword", questionText: "Question text", diff --git a/apps/admin-web/src/i18n/messages/zh-CN.ts b/apps/admin-web/src/i18n/messages/zh-CN.ts index 5d93a09..a402f38 100644 --- a/apps/admin-web/src/i18n/messages/zh-CN.ts +++ b/apps/admin-web/src/i18n/messages/zh-CN.ts @@ -454,6 +454,7 @@ const zhCN = { }, form: { brandName: "品牌名称", + brandWebsite: "公司官网(选填)", brandDescription: "品牌描述", keywordName: "关键词名称", questionText: "问题内容", diff --git a/apps/admin-web/src/views/BrandsView.vue b/apps/admin-web/src/views/BrandsView.vue index b0b0d09..299d344 100644 --- a/apps/admin-web/src/views/BrandsView.vue +++ b/apps/admin-web/src/views/BrandsView.vue @@ -12,7 +12,6 @@ import type { TableColumnsType } from "ant-design-vue"; import { computed, reactive, ref, watch } from "vue"; import { useI18n } from "vue-i18n"; -import PageHero from "@/components/PageHero.vue"; import { brandsApi } from "@/lib/api"; import { formatError } from "@/lib/errors"; @@ -36,6 +35,7 @@ const editingCompetitorId = ref(null); const brandForm = reactive({ name: "", + website: "", description: "", }); @@ -60,12 +60,6 @@ const brandListQuery = useQuery({ queryFn: () => brandsApi.list(), }); -const brandDetailQuery = useQuery({ - queryKey: computed(() => ["brands", "detail", selectedBrandId.value]), - enabled: computed(() => Boolean(selectedBrandId.value)), - queryFn: () => brandsApi.detail(selectedBrandId.value as number), -}); - const keywordsQuery = useQuery({ queryKey: computed(() => ["brands", selectedBrandId.value, "keywords"]), enabled: computed(() => Boolean(selectedBrandId.value)), @@ -101,6 +95,7 @@ const brandMutations = { mutationFn: () => brandsApi.create({ name: brandForm.name.trim(), + website: brandForm.website.trim() || null, description: brandForm.description.trim() || null, }), onSuccess: async (brand) => { @@ -118,6 +113,7 @@ const brandMutations = { mutationFn: () => brandsApi.update(editingBrandId.value as number, { name: brandForm.name.trim(), + website: brandForm.website.trim() || null, description: brandForm.description.trim() || null, }), onSuccess: async () => { @@ -274,7 +270,6 @@ const competitorMutations = { }), }; -const selectedBrand = computed(() => brandDetailQuery.data.value); const selectedKeyword = computed(() => keywordsQuery.data.value?.find((item) => item.id === selectedKeywordId.value) ?? null, ); @@ -345,6 +340,7 @@ function stringifyProductLines(value: unknown): string { function openBrandModal(brand?: Brand): void { editingBrandId.value = brand?.id ?? null; brandForm.name = brand?.name ?? ""; + brandForm.website = brand?.website ?? ""; brandForm.description = brand?.description ?? ""; brandModalOpen.value = true; } @@ -439,18 +435,21 @@ async function submitCompetitor(): Promise {