Browse Source

feat(Tpl): 更新默认商品文案配置

- 添加默认商品文案配置,包含颜色名称和性别字段
- 修改商品文案获取逻辑,优先使用缓存数据并合并默认配置
- 优化商品文案数据结构,确保编辑模式下数据完整性
panqiuyao 19 hours ago
parent
commit
288f789676
1 changed files with 8 additions and 2 deletions
  1. 8 2
      frontend/src/views/Tpl/Edit/index.vue

+ 8 - 2
frontend/src/views/Tpl/Edit/index.vue

@@ -55,14 +55,20 @@ const pendingPayload = ref<any | null>(null)
 // 编辑模式:数据将在onMounted中的initTemplateData函数中处理
 
 // 默认商品文案(硬编码的默认值)
-const defaultGoodsTextFallback = []
+const defaultGoodsTextFallback = [{
+  key:"颜色名称",
+  value:"黑色"
+},{
+  key:"性别",
+  value:"女"
+}]
 
 // 从缓存中获取商品文案,如果没有则使用默认值
 const defaultGoodsText = computed(() => {
   console.log(templateDataCache.value)
   if (templateDataCache.value?.template_excel_headers && Array.isArray(templateDataCache.value.template_excel_headers)) {
     // 缓存中已经是完整的商品文案对象结构,直接使用
-    return templateDataCache.value.template_excel_headers
+    return [...defaultGoodsTextFallback,...templateDataCache.value.template_excel_headers]
   }
   // 如果没有缓存数据,使用默认值
   return defaultGoodsTextFallback