From 2573844f92074b97347762c3a131a45d50af5269 Mon Sep 17 00:00:00 2001 From: super <2903208875@qq.com> Date: Tue, 9 Jun 2026 21:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=96=B0=E9=9C=80=E6=B1=82-?= =?UTF-8?q?=E9=87=87=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/dto/CollectDataSubmitRowDto.java | 9 + .../model/vo/CollectDataResultRowVo.java | 2 + .../CollectDataExcelAssemblyService.java | 124 ++- .../service/CollectDataService.java | 119 ++- .../service/InvalidAsinDataService.java | 10 +- ...V58__invalid_asin_data_brand_normalize.sql | 11 + frontend-vue/DESIGN.md | 177 ++++ .../pages/brand/components/BrandTopBar.vue | 47 +- .../src/pages/image-video/ImageVideoPage.vue | 68 +- .../components/DeliveryVideoWorkspace.vue | 921 ++++++++++++++++++ .../ai-workflow/AiAssetDropzone.vue | 192 ++++ .../components/ai-workflow/AiChoicePills.vue | 100 ++ .../components/ai-workflow/AiModuleSwitch.vue | 105 ++ .../components/ai-workflow/AiSectionCard.vue | 101 ++ .../ai-workflow/AiWorkflowShell.vue | 94 ++ frontend-vue/src/styles/main.css | 12 + frontend-vue/src/styles/tokens.css | 11 +- frontend-vue/vite-image-video.err.log | 1 + frontend-vue/vite-image-video.out.log | 36 + 19 files changed, 2084 insertions(+), 56 deletions(-) create mode 100644 backend-java/src/main/resources/db/V58__invalid_asin_data_brand_normalize.sql create mode 100644 frontend-vue/DESIGN.md create mode 100644 frontend-vue/src/pages/image-video/components/DeliveryVideoWorkspace.vue create mode 100644 frontend-vue/src/shared/components/ai-workflow/AiAssetDropzone.vue create mode 100644 frontend-vue/src/shared/components/ai-workflow/AiChoicePills.vue create mode 100644 frontend-vue/src/shared/components/ai-workflow/AiModuleSwitch.vue create mode 100644 frontend-vue/src/shared/components/ai-workflow/AiSectionCard.vue create mode 100644 frontend-vue/src/shared/components/ai-workflow/AiWorkflowShell.vue create mode 100644 frontend-vue/vite-image-video.err.log create mode 100644 frontend-vue/vite-image-video.out.log diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/dto/CollectDataSubmitRowDto.java b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/dto/CollectDataSubmitRowDto.java index ac9973218..e37b29877 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/dto/CollectDataSubmitRowDto.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/dto/CollectDataSubmitRowDto.java @@ -29,4 +29,13 @@ public class CollectDataSubmitRowDto { @JsonAlias({"关键词", "key_word"}) @Schema(description = "关键词", example = "phone case") private String keyword; + + @JsonProperty("delivery_method") + @JsonAlias({"配送方式", "deliveryMethod", "delivery", "fulfillment"}) + @Schema(description = "配送方式:FBA / FBM / AMZ;未识别时由后端归入“无配送方式”", example = "FBA") + private String deliveryMethod; + + @JsonAlias({"页数", "page", "page_no", "pageNo", "page_index", "pageIndex"}) + @Schema(description = "该行数据所属页码(来自 Python 抓取端的搜索结果页码),后端按关键词取最大值作为总页数", example = "3") + private Integer page; } diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/vo/CollectDataResultRowVo.java b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/vo/CollectDataResultRowVo.java index 9d2d932c0..b7e1b080b 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/vo/CollectDataResultRowVo.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/model/vo/CollectDataResultRowVo.java @@ -9,4 +9,6 @@ public class CollectDataResultRowVo { private String price; private String sellerName; private String keyword; + private String deliveryMethod; + private Integer page; } diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataExcelAssemblyService.java b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataExcelAssemblyService.java index 8bbb044d0..e665813ae 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataExcelAssemblyService.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataExcelAssemblyService.java @@ -10,38 +10,34 @@ import org.springframework.stereotype.Service; import java.io.File; import java.io.FileOutputStream; +import java.util.LinkedHashMap; import java.util.List; +import java.util.Locale; +import java.util.Map; @Service @Slf4j public class CollectDataExcelAssemblyService { - private static final String[] HEADER = {"品牌", "ASIN", "价格", "卖家名称", "关键词"}; + private static final String SHEET_DETAIL_NAME = "采集数据结果"; + private static final String[] SHEET_DETAIL_HEADER = {"品牌", "ASIN", "价格", "卖家名称", "关键词", "配送方式"}; - public void writeWorkbook(File outputXlsx, List items) { + private static final String SHEET_SUMMARY_NAME = "结果文件"; + private static final String[] SHEET_SUMMARY_HEADER = {"关键词", "FBA", "FBM", "AMZ", "无配送方式", "页数"}; + + /** + * 生成采集结果工作簿。 + * + * @param outputXlsx 目标文件 + * @param items 经过 ASIN 去重 / 无效品牌过滤 / 品牌检测后保留下来的明细行,写入「采集数据结果」sheet + * @param rawItems Python 回传的全量原始行(不经后端任何过滤),写入「结果文件」sheet 的关键词聚合统计 + */ + public void writeWorkbook(File outputXlsx, List items, List rawItems) { SXSSFWorkbook workbook = new SXSSFWorkbook(200); workbook.setCompressTempFiles(true); try (FileOutputStream outputStream = new FileOutputStream(outputXlsx)) { - Sheet sheet = workbook.createSheet("采集数据结果"); - Row headerRow = sheet.createRow(0); - for (int i = 0; i < HEADER.length; i++) { - headerRow.createCell(i).setCellValue(HEADER[i]); - sheet.setColumnWidth(i, (i == 3 ? 24 : 18) * 256); - } - int rowIndex = 1; - if (items != null) { - for (CollectDataResultRowVo item : items) { - if (item == null) { - continue; - } - Row row = sheet.createRow(rowIndex++); - row.createCell(0).setCellValue(safe(item.getBrand())); - row.createCell(1).setCellValue(safe(item.getAsin())); - row.createCell(2).setCellValue(safe(item.getPrice())); - row.createCell(3).setCellValue(safe(item.getSellerName())); - row.createCell(4).setCellValue(safe(item.getKeyword())); - } - } + writeDetailSheet(workbook, items); + writeSummarySheet(workbook, rawItems); workbook.write(outputStream); } catch (Exception ex) { log.warn("[collect-data] write workbook failed: {}", ex.getMessage()); @@ -55,7 +51,91 @@ public class CollectDataExcelAssemblyService { } } + private void writeDetailSheet(SXSSFWorkbook workbook, List items) { + Sheet sheet = workbook.createSheet(SHEET_DETAIL_NAME); + Row headerRow = sheet.createRow(0); + for (int i = 0; i < SHEET_DETAIL_HEADER.length; i++) { + headerRow.createCell(i).setCellValue(SHEET_DETAIL_HEADER[i]); + sheet.setColumnWidth(i, (i == 3 ? 24 : 18) * 256); + } + int rowIndex = 1; + if (items != null) { + for (CollectDataResultRowVo item : items) { + if (item == null) { + continue; + } + Row row = sheet.createRow(rowIndex++); + row.createCell(0).setCellValue(safe(item.getBrand())); + row.createCell(1).setCellValue(safe(item.getAsin())); + row.createCell(2).setCellValue(safe(item.getPrice())); + row.createCell(3).setCellValue(safe(item.getSellerName())); + row.createCell(4).setCellValue(safe(item.getKeyword())); + row.createCell(5).setCellValue(safe(item.getDeliveryMethod())); + } + } + } + + /** + * 「结果文件」sheet 基于 Python 回传的全量原始数据按关键词聚合: + * - FBA / FBM / AMZ / 无配送方式 列为各分类的命中行数; + * - 页数列取该关键词所有原始行中页码的最大值,反映 Python 实际抓取到的总页数。 + */ + private void writeSummarySheet(SXSSFWorkbook workbook, List rawItems) { + Sheet sheet = workbook.createSheet(SHEET_SUMMARY_NAME); + Row headerRow = sheet.createRow(0); + for (int i = 0; i < SHEET_SUMMARY_HEADER.length; i++) { + headerRow.createCell(i).setCellValue(SHEET_SUMMARY_HEADER[i]); + sheet.setColumnWidth(i, (i == 0 ? 28 : 12) * 256); + } + + Map grouped = new LinkedHashMap<>(); + if (rawItems != null) { + for (CollectDataResultRowVo item : rawItems) { + if (item == null) { + continue; + } + String keyword = safe(item.getKeyword()); + KeywordSummary summary = grouped.computeIfAbsent(keyword, k -> new KeywordSummary()); + String delivery = item.getDeliveryMethod() == null ? "" : item.getDeliveryMethod().trim().toUpperCase(Locale.ROOT); + switch (delivery) { + case "FBA" -> summary.fba++; + case "FBM" -> summary.fbm++; + case "AMZ" -> summary.amz++; + default -> summary.none++; + } + Integer page = item.getPage(); + if (page != null && page > summary.maxPage) { + summary.maxPage = page; + } + } + } + + int rowIndex = 1; + for (Map.Entry entry : grouped.entrySet()) { + KeywordSummary summary = entry.getValue(); + Row row = sheet.createRow(rowIndex++); + row.createCell(0).setCellValue(entry.getKey()); + row.createCell(1).setCellValue(summary.fba); + row.createCell(2).setCellValue(summary.fbm); + row.createCell(3).setCellValue(summary.amz); + row.createCell(4).setCellValue(summary.none); + if (summary.maxPage > 0) { + row.createCell(5).setCellValue(summary.maxPage); + } else { + row.createCell(5).setCellValue(""); + } + } + } + private String safe(String value) { return value == null ? "" : value; } + + private static class KeywordSummary { + int fba; + int fbm; + int amz; + int none; + int maxPage; + } } diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataService.java b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataService.java index 644c50aff..c8ba54868 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataService.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/collectdata/service/CollectDataService.java @@ -431,7 +431,16 @@ public class CollectDataService { stats.receivedRows += rows.size(); stats.currentChunkRows = rows.size(); - List candidates = filterByExistingAsin(rows, stats); + // 「结果文件」sheet 需要 Python 回传的全量数据(不经任何后端过滤), + // 因此 chunk payload 写入未筛除空 ASIN 的全量 rows; + // 仅当 ASIN 非空时才进入去重 / 无效品牌 / 品牌检测链路并落 biz_task_result_item。 + List rowsForFiltering = new ArrayList<>(rows.size()); + for (CollectDataResultRowVo row : rows) { + if (row.getAsin() != null && !row.getAsin().isBlank()) { + rowsForFiltering.add(row); + } + } + List candidates = filterByExistingAsin(rowsForFiltering, stats); List accepted = filterByBrandCheck(candidates, stats); for (CollectDataResultRowVo row : accepted) { upsertResultItem(task.getId(), result.getId(), scopeKey, row); @@ -483,6 +492,11 @@ public class CollectDataService { return result; } + /** + * 把 Python 回传的原始行映射到 VO。**保留全量数据**(包含 ASIN 为空的行), + * 因为「结果文件」sheet 需要不经过任何过滤的全量统计;ASIN 为空的行 + * 仅在 chunk payload 中保留,下游过滤链由调用方按 ASIN 非空再行筛选。 + */ private List normalizeSubmitRows(List rawRows) { List rows = new ArrayList<>(); if (rawRows == null) { @@ -492,16 +506,14 @@ public class CollectDataService { if (raw == null) { continue; } - String asin = normalizeAsin(raw.getAsin()); - if (asin.isBlank()) { - continue; - } CollectDataResultRowVo row = new CollectDataResultRowVo(); row.setBrand(normalize(raw.getBrand())); - row.setAsin(asin); + row.setAsin(normalizeAsin(raw.getAsin())); row.setPrice(normalize(raw.getPrice())); row.setSellerName(normalize(raw.getSellerName())); row.setKeyword(normalize(raw.getKeyword())); + row.setDeliveryMethod(normalizeDeliveryMethod(raw.getDeliveryMethod())); + row.setPage(raw.getPage()); rows.add(row); } return rows; @@ -525,25 +537,34 @@ public class CollectDataService { .toList()); } } - Set invalidValues = new HashSet<>(); - if (!asins.isEmpty()) { + List brands = rows.stream() + .map(row -> normalizeBrand(row.getBrand())) + .filter(value -> !value.isBlank()) + .distinct() + .toList(); + Set invalidBrands = new HashSet<>(); + if (!brands.isEmpty()) { List invalidRows = invalidAsinDataMapper.selectList(new LambdaQueryWrapper() - .in(InvalidAsinDataEntity::getDataValue, asins)); + .select(InvalidAsinDataEntity::getBrand) + .in(InvalidAsinDataEntity::getBrand, brands)); if (invalidRows != null) { for (InvalidAsinDataEntity row : invalidRows) { - invalidValues.add(normalizeAsin(row.getDataValue())); + String normalized = normalizeBrand(row.getBrand()); + if (!normalized.isBlank()) { + invalidBrands.add(normalized); + } } } } List out = new ArrayList<>(); for (CollectDataResultRowVo row : rows) { - String asin = row.getAsin(); - if (dedupeValues.contains(asin)) { + if (dedupeValues.contains(row.getAsin())) { stats.dedupeFilteredCount++; continue; } - if (invalidValues.contains(asin)) { + String brand = normalizeBrand(row.getBrand()); + if (!brand.isBlank() && invalidBrands.contains(brand)) { stats.invalidFilteredCount++; continue; } @@ -624,9 +645,13 @@ public class CollectDataService { if (row == null || row.getAsin() == null || row.getAsin().isBlank()) { return; } + String brand = normalizeBrand(row.getBrand()); + if (brand.isBlank()) { + return; + } InvalidAsinDataEntity entity = new InvalidAsinDataEntity(); entity.setDataValue(row.getAsin()); - entity.setBrand(row.getBrand()); + entity.setBrand(brand); try { invalidAsinDataMapper.insert(entity); } catch (DuplicateKeyException ignored) { @@ -788,11 +813,14 @@ public class CollectDataService { throw new BusinessException("结果记录不存在"); } List rows = loadFinalRows(task.getId()); + // Sheet「结果文件」按需求基于 Python 回传的全量数据聚合,不经后端 ASIN/品牌过滤丢弃, + // 因此从 biz_task_chunk 反序列化全部原始行。 + List rawRows = loadRawRows(task.getId()); File workRoot = FileUtil.mkdir(FileUtil.file(System.getProperty("java.io.tmpdir"), "collect-data-result", String.valueOf(task.getId()))); String filename = buildResultFilename(task, result); File xlsx = FileUtil.file(workRoot, filename); try { - excelAssemblyService.writeWorkbook(xlsx, rows); + excelAssemblyService.writeWorkbook(xlsx, rows, rawRows); String objectKey = ossStorageService.uploadResultFile(xlsx, MODULE_TYPE); result.setResultFilename(filename); result.setResultFileUrl(objectKey); @@ -841,6 +869,45 @@ public class CollectDataService { return out; } + /** + * 加载 Python 回传的全量原始行,不做 ASIN / 品牌过滤。 + * 数据源是 biz_task_chunk 中按 chunk_index 顺序保存的原始 payload, + * 用于「结果文件」sheet 中按关键词聚合统计配送方式与页数。 + */ + private List loadRawRows(Long taskId) { + List chunks = taskChunkMapper.selectList(new LambdaQueryWrapper() + .eq(TaskChunkEntity::getTaskId, taskId) + .eq(TaskChunkEntity::getModuleType, MODULE_TYPE) + .orderByAsc(TaskChunkEntity::getChunkIndex) + .orderByAsc(TaskChunkEntity::getId)); + List out = new ArrayList<>(); + if (chunks == null || chunks.isEmpty()) { + return out; + } + TypeReference> listType = new TypeReference<>() { + }; + for (TaskChunkEntity chunk : chunks) { + try { + String payloadJson = transientPayloadStorageService.resolvePayload(chunk.getPayloadJson(), "read collect data raw chunk failed"); + if (payloadJson == null || payloadJson.isBlank()) { + continue; + } + List values = objectMapper.readValue(payloadJson, listType); + if (values != null) { + for (CollectDataResultRowVo value : values) { + if (value != null) { + out.add(value); + } + } + } + } catch (Exception ex) { + log.warn("[collect-data] load raw chunk failed taskId={} chunkId={} err={}", + taskId, chunk.getId(), ex.getMessage()); + } + } + return out; + } + private int countFinalRows(Long taskId) { if (taskId == null || taskId <= 0) { return 0; @@ -986,6 +1053,28 @@ public class CollectDataService { return normalize(value).toLowerCase(Locale.ROOT); } + /** + * 将 Python 回传的配送方式标准化为 FBA / FBM / AMZ; + * 空值或未识别值统一返回空字符串,由前端 / Excel 端展示为“无配送方式”。 + */ + private String normalizeDeliveryMethod(String value) { + String normalized = normalize(value); + if (normalized.isBlank()) { + return ""; + } + String upper = normalized.toUpperCase(Locale.ROOT); + if (upper.contains("FBA")) { + return "FBA"; + } + if (upper.contains("FBM")) { + return "FBM"; + } + if (upper.contains("AMZ") || upper.contains("AMAZON")) { + return "AMZ"; + } + return ""; + } + private String buildResultFilename(FileTaskEntity task, FileResultEntity result) { String base = result == null || result.getSourceFilename() == null || result.getSourceFilename().isBlank() ? null diff --git a/backend-java/src/main/java/com/nanri/aiimage/modules/invalidasin/service/InvalidAsinDataService.java b/backend-java/src/main/java/com/nanri/aiimage/modules/invalidasin/service/InvalidAsinDataService.java index 1d73a4650..52d8504c3 100644 --- a/backend-java/src/main/java/com/nanri/aiimage/modules/invalidasin/service/InvalidAsinDataService.java +++ b/backend-java/src/main/java/com/nanri/aiimage/modules/invalidasin/service/InvalidAsinDataService.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; +import java.util.Locale; @Service @RequiredArgsConstructor @@ -47,7 +48,7 @@ public class InvalidAsinDataService { @Transactional public InvalidAsinDataItemVo create(InvalidAsinDataCreateRequest request) { String dataValue = normalizeRequired(request.getDataValue(), "ASIN 不能为空"); - String brand = normalizeOptional(request.getBrand()); + String brand = normalizeRequired(request.getBrand(), "品牌不能为空").toLowerCase(Locale.ROOT); ensureUnique(dataValue, null); InvalidAsinDataEntity entity = new InvalidAsinDataEntity(); entity.setDataValue(dataValue); @@ -60,7 +61,7 @@ public class InvalidAsinDataService { public InvalidAsinDataItemVo update(Long id, InvalidAsinDataUpdateRequest request) { InvalidAsinDataEntity entity = getById(id); String dataValue = normalizeRequired(request.getDataValue(), "ASIN 不能为空"); - String brand = normalizeOptional(request.getBrand()); + String brand = normalizeRequired(request.getBrand(), "品牌不能为空").toLowerCase(Locale.ROOT); ensureUnique(dataValue, id); entity.setDataValue(dataValue); entity.setBrand(brand); @@ -100,11 +101,6 @@ public class InvalidAsinDataService { return normalized; } - private String normalizeOptional(String value) { - String normalized = normalizeText(value); - return normalized.isEmpty() ? null : normalized; - } - private String normalizeText(String value) { if (value == null) { return ""; diff --git a/backend-java/src/main/resources/db/V58__invalid_asin_data_brand_normalize.sql b/backend-java/src/main/resources/db/V58__invalid_asin_data_brand_normalize.sql new file mode 100644 index 000000000..f470d8a12 --- /dev/null +++ b/backend-java/src/main/resources/db/V58__invalid_asin_data_brand_normalize.sql @@ -0,0 +1,11 @@ +-- 不符合 ASIN 库的比对维度从 ASIN 切换到 brand: +-- 1. brand 为空的历史记录在新规则下不再产生、也不再参与比对,直接删除 +-- 2. 存量 brand 统一转小写,与 CollectDataService.normalizeBrand 对齐 +-- (历史数据写入前已经过 trim + 折叠空白,仅缺 lowerCase) +DELETE FROM biz_invalid_asin_data + WHERE brand IS NULL + OR TRIM(brand) = ''; + +UPDATE biz_invalid_asin_data + SET brand = LOWER(TRIM(brand)) + WHERE brand <> LOWER(TRIM(brand)); diff --git a/frontend-vue/DESIGN.md b/frontend-vue/DESIGN.md new file mode 100644 index 000000000..72249bec1 --- /dev/null +++ b/frontend-vue/DESIGN.md @@ -0,0 +1,177 @@ +# Design + +## Source of truth +- Status: Active +- Last refreshed: 2026-06-09 +- Primary product surfaces: + - `image-video.html` + - `src/pages/image-video/ImageVideoPage.vue` +- Evidence reviewed: + - `src/pages/image-video/ImageVideoPage.vue` + - `src/styles/main.css` + - `src/styles/tokens.css` + - `src/components/layout/PageShell.vue` + - `../yaoyaoAI/aiclientpureui/src/styles/main.css` + - `../yaoyaoAI/aiclientpureui/src/components/dashboard/DashboardCard.vue` + - `../yaoyaoAI/aiclientpureui/src/components/workflow/Step02AudioVideo.vue` + - `../yaoyaoAI/aiclientpureui/src/components/workflow/Step03VideoEdit.vue` + +## Brand +- Personality: + - Quiet, tool-oriented, high-density AI workflow workspace + - Dark professional console rather than marketing landing page +- Trust signals: + - Structured step cards + - Stable layout grid + - Clear state summaries and output preview areas +- Avoid: + - Light hero-page styling + - Decorative floating cards wrapped inside larger cards + - Tailwind or PrimeVue-specific visual copies that do not fit Element Plus + +## Product goals +- Goals: + - Add a real `带货视频` module inside `frontend-vue` + - Put `视频复刻` and `图生视频` on one page with tab switching + - Match the visual tone of `aiclientpureui` + - Extract reusable workflow components for future media modules +- Non-goals: + - Backend API integration in this phase + - Rebuilding the entire `aiclientpureui` navigation shell +- Success signals: + - The page is screenshot-ready + - Form sections are organized and legible at desktop widths + - Shared components are reusable beyond this one page + +## Personas and jobs +- Primary personas: + - Internal operators creating or editing commerce videos + - Content operations staff iterating scripts, scenes, and avatars quickly +- User jobs: + - Upload source material + - Configure video generation parameters + - Adjust scene, face, script, and product settings + - Review an output summary before starting generation +- Key contexts of use: + - Desktop-heavy internal tool usage + - Repeated daily workflows with dense settings + +## Information architecture +- Primary navigation: + - Keep a lightweight page header with module switch and back link +- Core routes/screens: + - `image-video.html` as the image/video workspace entry +- Content hierarchy: + - Page header and module switch + - Delivery-video tabs + - Step-oriented configuration grid + - Preview and submission area + +## Design principles +- Principle 1: + - Reuse structure, not framework-specific implementation. Port the dashboard/card language from `aiclientpureui` into Element Plus-native components. +- Principle 2: + - Keep the screen directly operable. The first viewport should show the active workflow, not a placeholder entrance. +- Tradeoffs: + - Prefer a compact dark console layout over a literal flowchart reconstruction from the requirement images. + +## Visual language +- Color: + - Deep neutral background with restrained blue-indigo highlights + - High-contrast text, low-contrast secondary copy +- Typography: + - Existing sans-serif stack from `tokens.css` + - Compact section headings and dense form labels +- Spacing/layout rhythm: + - 20px to 24px outer spacing + - 16px card padding + - Multi-column grid with stable min widths +- Shape/radius/elevation: + - 14px to 18px radii + - Soft border glow, minimal shadow depth +- Motion: + - Short hover and focus transitions only +- Imagery/iconography: + - Use media preview boxes and upload placeholders + - Avoid decorative illustrations + +## Components +- Existing components to reuse: + - `src/components/layout/PageShell.vue` +- New/changed components: + - Shared dark workflow shell + - Shared module switch + - Shared section card + - Shared choice-pill selector + - Shared asset dropzone / preview block +- Variants and states: + - Active/inactive tabs + - Active/inactive pills + - Empty vs selected asset states + - Hover/focus for cards and action buttons +- Token/component ownership: + - Theme tokens in `src/styles/tokens.css` + - Global workflow styles in `src/styles/main.css` + - Shared components under `src/shared/components/ai-workflow/` + +## Accessibility +- Target standard: + - Practical keyboard and screen-readable form semantics for internal desktop usage +- Keyboard/focus behavior: + - Visible focus ring on pills, buttons, upload areas, and tabs +- Contrast/readability: + - Maintain strong foreground/background contrast in dark mode +- Screen-reader semantics: + - Preserve labels for upload regions and tab panels +- Reduced motion and sensory considerations: + - No large-scale animation + +## Responsive behavior +- Supported breakpoints/devices: + - Primary target desktop >= 1280px + - Secondary support tablet widths >= 768px +- Layout adaptations: + - Collapse multi-column workspace into two columns, then one column + - Preview area stops being sticky on narrow screens +- Touch/hover differences: + - Controls remain usable without hover-only affordances + +## Interaction states +- Loading: + - Reserved for future backend integration +- Empty: + - Show upload placeholders and muted guidance text +- Error: + - Use Element Plus messaging if upload type or action constraints fail +- Success: + - Local draft actions can confirm save/export interactions +- Disabled: + - Non-active modules appear disabled but visible +- Offline/slow network, if applicable: + - Not applicable in the current local-only draft + +## Content voice +- Tone: + - Direct and operational +- Terminology: + - Prefer commerce-video workflow language: 素材, 场景, 人脸, 话术, 产品, 输出 +- Microcopy rules: + - Short labels + - Guidance belongs in helper text, not long paragraphs + +## Implementation constraints +- Framework/styling system: + - Vue 3 + TypeScript + Element Plus +- Design-token constraints: + - Extend current CSS variables instead of introducing Tailwind +- Performance constraints: + - Keep the page static and local-first until API wiring is required +- Compatibility constraints: + - Must work within the existing Vite multi-page build +- Test/screenshot expectations: + - Build must pass + - Local dev server should render a screenshot-ready page at `image-video.html` + +## Open questions +- [ ] 图二和图三的字段是否需要完全一致,目前按“共用主流程 + 源素材差异化”实现 +- [ ] 后续是否需要直接接入生成任务接口,目前仅实现本地工作台和交互草稿 diff --git a/frontend-vue/src/pages/brand/components/BrandTopBar.vue b/frontend-vue/src/pages/brand/components/BrandTopBar.vue index 399e21f22..ecbaa42c6 100644 --- a/frontend-vue/src/pages/brand/components/BrandTopBar.vue +++ b/frontend-vue/src/pages/brand/components/BrandTopBar.vue @@ -1,11 +1,14 @@ @@ -62,6 +65,7 @@ type ActiveNavKey = | 'patrol-delete' | 'query-asin' | 'collect-data' + | 'image-video' type NavItem = { key: string @@ -77,9 +81,15 @@ type NavGroup = { const props = defineProps<{ active: ActiveNavKey + showNav?: boolean + showHomeLink?: boolean + showActions?: boolean }>() const active = props.active +const showNav = props.showNav ?? true +const showHomeLink = props.showHomeLink ?? true +const showActions = props.showActions ?? true const allowedColumnKeys = ref(null) const navGroups: ReadonlyArray = [ @@ -88,6 +98,7 @@ const navGroups: ReadonlyArray = [ label: '前端工具', items: [ { key: 'collect-data', label: '采集数据', href: '/new_web_source/collect-data.html' }, + { key: 'image-video', label: '视频', href: '/new_web_source/image-video.html' }, { key: 'variant', label: '变体分析' }, { key: 'brand', label: '品牌检测', href: '/brand' }, { key: 'appearance-patent', label: '外观专利检测', href: '/new_web_source/appearance-patent.html' }, @@ -150,6 +161,14 @@ onMounted(async () => { border-bottom: 1px solid #2a2a2a; } +.top-bar--compact { + min-height: 64px; + align-items: center; + justify-content: flex-start; + padding-top: 0; + padding-bottom: 0; +} + .logo-area { display: flex; align-items: center; @@ -158,6 +177,11 @@ onMounted(async () => { padding-top: 10px; } +.logo-area--compact { + gap: 12px; + padding-top: 0; +} + .app-name { color: #fff; font-size: 18px; @@ -173,6 +197,11 @@ onMounted(async () => { white-space: nowrap; } +.logo-extra { + display: flex; + align-items: center; +} + .btn-home:hover { color: #fff; } @@ -267,6 +296,12 @@ onMounted(async () => { align-items: stretch; } + .top-bar--compact { + min-height: 64px; + flex-direction: row; + align-items: center; + } + .logo-area { padding-top: 0; } diff --git a/frontend-vue/src/pages/image-video/ImageVideoPage.vue b/frontend-vue/src/pages/image-video/ImageVideoPage.vue index c85d11f04..efe707e13 100644 --- a/frontend-vue/src/pages/image-video/ImageVideoPage.vue +++ b/frontend-vue/src/pages/image-video/ImageVideoPage.vue @@ -1,11 +1,11 @@ + + diff --git a/frontend-vue/src/shared/components/ai-workflow/AiAssetDropzone.vue b/frontend-vue/src/shared/components/ai-workflow/AiAssetDropzone.vue new file mode 100644 index 000000000..9aa659396 --- /dev/null +++ b/frontend-vue/src/shared/components/ai-workflow/AiAssetDropzone.vue @@ -0,0 +1,192 @@ + + + + + diff --git a/frontend-vue/src/shared/components/ai-workflow/AiChoicePills.vue b/frontend-vue/src/shared/components/ai-workflow/AiChoicePills.vue new file mode 100644 index 000000000..3ecfc1d8a --- /dev/null +++ b/frontend-vue/src/shared/components/ai-workflow/AiChoicePills.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/frontend-vue/src/shared/components/ai-workflow/AiModuleSwitch.vue b/frontend-vue/src/shared/components/ai-workflow/AiModuleSwitch.vue new file mode 100644 index 000000000..dcbc7c5cf --- /dev/null +++ b/frontend-vue/src/shared/components/ai-workflow/AiModuleSwitch.vue @@ -0,0 +1,105 @@ + + + + + diff --git a/frontend-vue/src/shared/components/ai-workflow/AiSectionCard.vue b/frontend-vue/src/shared/components/ai-workflow/AiSectionCard.vue new file mode 100644 index 000000000..776cde2c6 --- /dev/null +++ b/frontend-vue/src/shared/components/ai-workflow/AiSectionCard.vue @@ -0,0 +1,101 @@ + + + + + diff --git a/frontend-vue/src/shared/components/ai-workflow/AiWorkflowShell.vue b/frontend-vue/src/shared/components/ai-workflow/AiWorkflowShell.vue new file mode 100644 index 000000000..a48b404a7 --- /dev/null +++ b/frontend-vue/src/shared/components/ai-workflow/AiWorkflowShell.vue @@ -0,0 +1,94 @@ + + + diff --git a/frontend-vue/src/styles/main.css b/frontend-vue/src/styles/main.css index 169cc441f..9e3c1b9f3 100644 --- a/frontend-vue/src/styles/main.css +++ b/frontend-vue/src/styles/main.css @@ -3,6 +3,7 @@ body { background: var(--color-bg-light); + font-family: var(--font-family-base); } html { @@ -49,3 +50,14 @@ html { background: var(--color-bg-dark); color: var(--color-text-dark); } + +.theme-dark a { + color: inherit; +} + +.theme-dark .el-tabs__item:focus-visible, +.theme-dark button:focus-visible, +.theme-dark a:focus-visible { + outline: 2px solid rgba(96, 165, 250, 0.9); + outline-offset: 2px; +} diff --git a/frontend-vue/src/styles/tokens.css b/frontend-vue/src/styles/tokens.css index 3195ddd38..f25adb6f7 100644 --- a/frontend-vue/src/styles/tokens.css +++ b/frontend-vue/src/styles/tokens.css @@ -2,15 +2,20 @@ --font-family-base: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif; --color-primary: #409eff; --color-bg-light: #eef3f8; - --color-bg-dark: #0d0d0d; + --color-bg-dark: #060913; --color-surface-light: rgba(255, 255, 255, 0.92); - --color-surface-dark: #1a1a1a; + --color-surface-dark: #0f172a; --color-border-light: #d6e4ef; - --color-border-dark: #2a2a2a; + --color-border-dark: #334155; --color-text-primary: #303133; --color-text-secondary: #606266; --color-text-dark: #e5eaf3; + --color-text-muted-dark: #94a3b8; + --color-accent-blue: #60a5fa; + --color-accent-indigo: #818cf8; + --color-accent-surface: rgba(37, 99, 235, 0.14); --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.08); + --shadow-card-dark: 0 18px 38px rgba(2, 8, 23, 0.35); --radius-lg: 16px; --radius-md: 12px; --radius-sm: 8px; diff --git a/frontend-vue/vite-image-video.err.log b/frontend-vue/vite-image-video.err.log new file mode 100644 index 000000000..947d28056 --- /dev/null +++ b/frontend-vue/vite-image-video.err.log @@ -0,0 +1 @@ +16:09:19 [vite] (client) Pre-transform error: Failed to load url /src/main.ts (resolved id: /src/main.ts). Does the file exist? diff --git a/frontend-vue/vite-image-video.out.log b/frontend-vue/vite-image-video.out.log new file mode 100644 index 000000000..633c7f65b --- /dev/null +++ b/frontend-vue/vite-image-video.out.log @@ -0,0 +1,36 @@ + +> crawler-plugin-frontend-vue@0.0.1 dev +> vite --host --port 5173 + + + VITE v7.3.1 ready in 861 ms + + ➜ Local: http://localhost:5173/ + ➜ Network: http://192.168.31.112:5173/ +14:18:30 [vite] (client) ✨ new dependencies optimized: element-plus/es, element-plus/es/components/base/style/css, element-plus/es/components/select/style/css, element-plus/es/components/option/style/css, element-plus/es/components/slider/style/css, element-plus/es/components/input/style/css, element-plus/es/components/button/style/css, element-plus/es/components/tabs/style/css, element-plus/es/components/tab-pane/style/css, element-plus/es/components/upload/style/css +14:18:30 [vite] (client) ✨ optimized dependencies changed. reloading +14:47:00 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue, /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +15:05:11 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue, /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +15:16:30 [vite] (client) hmr update /src/shared/components/ai-workflow/AiSectionCard.vue?vue&type=style&index=0&scoped=0c43ba21&lang.css +15:16:55 [vite] (client) hmr update /src/shared/components/ai-workflow/AiChoicePills.vue?vue&type=style&index=0&scoped=74573572&lang.css +15:17:34 [vite] (client) hmr update /src/shared/components/ai-workflow/AiAssetDropzone.vue?vue&type=style&index=0&scoped=1625dec6&lang.css +15:22:09 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue, /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +15:23:01 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue, /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +15:23:45 [vite] (client) ✨ new dependencies optimized: element-plus/es/components/dialog/style/css +15:23:45 [vite] (client) ✨ optimized dependencies changed. reloading +15:31:28 [vite] (client) hmr update /src/pages/brand/components/BrandTopBar.vue +15:31:55 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue, /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +15:52:41 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue, /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:02:40 [vite] (client) hmr update /src/pages/brand/components/BrandTopBar.vue, /src/pages/brand/components/BrandTopBar.vue?vue&type=style&index=0&scoped=12cdd860&lang.css +16:03:03 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue, /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +16:05:24 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue, /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:11:14 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue, /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:11:14 [vite] (client) hmr update /src/shared/components/ai-workflow/AiSectionCard.vue?vue&type=style&index=0&scoped=0c43ba21&lang.css +16:16:44 [vite] (client) hmr update /src/pages/brand/components/BrandTopBar.vue, /src/pages/brand/components/BrandTopBar.vue?vue&type=style&index=0&scoped=12cdd860&lang.css +16:18:13 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue +16:19:34 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:19:45 [vite] (client) hmr update /src/pages/image-video/ImageVideoPage.vue?vue&type=style&index=0&scoped=a55049f3&lang.css +16:33:19 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:34:33 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:34:45 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css +16:49:01 [vite] (client) hmr update /src/pages/image-video/components/DeliveryVideoWorkspace.vue?vue&type=style&index=0&scoped=1f627f7d&lang.css