feat: add brand library management features

- Introduced BrandLibrarySummary type to encapsulate brand library limits and usage.
- Updated Brand interface to include keyword_count and question_count fields.
- Implemented brand library limits in the backend, including max brands, keywords, and questions per keyword.
- Added API endpoint to retrieve brand library summary.
- Enhanced BrandsView.vue to display brand library usage and limits.
- Implemented computed properties to manage brand, keyword, and question limits in the UI.
- Updated mutation handlers to invalidate relevant queries upon creating/updating brands, keywords, and questions.
- Added visual indicators for brand, keyword, and question limits in the UI.
- Enhanced error handling for exceeding brand and keyword limits during creation.
This commit is contained in:
2026-04-16 21:01:40 +08:00
parent 27389164b0
commit 41f3060e00
15 changed files with 731 additions and 44 deletions
+4
View File
@@ -9,6 +9,7 @@ import type {
ArticleVersion,
AuthTokens,
Brand,
BrandLibrarySummary,
BrandRequest,
Competitor,
CompetitorRequest,
@@ -540,6 +541,9 @@ export const brandsApi = {
list() {
return apiClient.get<Brand[]>("/api/tenant/brands");
},
getLibrarySummary() {
return apiClient.get<BrandLibrarySummary>("/api/tenant/brands/library-summary");
},
create(payload: BrandRequest) {
return apiClient.post<Brand, BrandRequest>("/api/tenant/brands", payload);
},
+7
View File
@@ -39,6 +39,13 @@ const errorMessageMap: Record<string, string> = {
object_storage_unavailable: "对象存储未配置或当前不可用",
invalid_payload: "请求参数不合法",
update_failed: "保存文章失败",
brand_exists: "品牌名称已存在",
brand_limit_reached: "品牌公司数量已达当前套餐上限",
keyword_exists: "关键词已存在",
keyword_limit_reached: "关键词数量已达当前套餐上限",
question_limit_reached: "当前关键词下的问题数量已达上限",
brand_not_found: "品牌不存在或已删除",
keyword_not_found: "关键词不存在或已删除",
publish_cover_required: "已选择百家号,请先上传封面图",
publisher_plugin_timeout: "浏览器插件响应超时,请刷新当前页面后重试",
publisher_plugin_empty_response: "浏览器插件未返回数据,请刷新当前页面后重试",