From 0f50620a12c9116350fae542da0dd87ccbb93705 Mon Sep 17 00:00:00 2001 From: PetrichorFun <127877748+PetrichorFun@users.noreply.github.com> Date: Thu, 10 Sep 2026 17:51:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=20about-points=20?= =?UTF-8?q?=E6=8B=86=E5=88=86=E5=AF=BC=E5=87=BA=EF=BC=88=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?+=E4=BA=91=E7=AB=AF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 合并自 fix/detail-page-image 分支的以下提交: - feat: local export splits abouts into point columns (147616c) - refactor: apply about-points expansion to both local and cloud export (f0a5463) Co-authored-by: Cursor --- package.json | 2 +- src/options/views/AmazonResultTable.vue | 48 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index fc861e2..e629ecb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "azon-seeker", - "displayName": "Azon Seeker v0.7.1.10-beta", + "displayName": "Azon Seeker v0.7.1.12-beta", "version": "0.7.2", "private": true, "description": "Starter modify by honestfox101 and PetrichorFun", diff --git a/src/options/views/AmazonResultTable.vue b/src/options/views/AmazonResultTable.vue index e21732b..426c34d 100644 --- a/src/options/views/AmazonResultTable.vue +++ b/src/options/views/AmazonResultTable.vue @@ -210,13 +210,55 @@ const filteredData = computed(() => { return data; }); +/** 导出时将「关于」拆成「要点1…要点n」多列 */ +function prepareExportItemsWithAboutPoints( + headers: Header[], + items: AmazonItem[], +): { headers: Header[]; items: Record[] } { + const aboutLines = (item: AmazonItem) => { + const raw = item.abouts; + if (!raw?.length) return []; + return raw + .flatMap((line) => line.split(/\r?\n/)) + .map((s) => s.trim()) + .filter(Boolean); + }; + + const nextHeaders = headers.filter((h) => h.prop !== 'abouts'); + const lineArrays = items.map(aboutLines); + const maxN = Math.max(1, ...lineArrays.map((l) => l.length)); + + for (let i = 0; i < maxN; i++) { + nextHeaders.push({ + label: `要点${i + 1}`, + prop: `aboutPoint${i + 1}`, + }); + } + + const nextItems = items.map((item, idx) => { + const row: Record = { ...item }; + const lines = lineArrays[idx]; + for (let i = 0; i < maxN; i++) { + row[`aboutPoint${i + 1}`] = lines[i] ?? ''; + } + return row; + }); + + return { headers: nextHeaders, items: nextItems }; +} + const handleExport = async (opt: 'local' | 'cloud') => { - const headers = getItemHeaders(); - const items = toRaw(filteredData.value); + let headers = getItemHeaders(); + let items: Record[] | AmazonItem[] = toRaw(filteredData.value); + + const prepared = prepareExportItemsWithAboutPoints(headers, items as AmazonItem[]); + headers = prepared.headers; + items = prepared.items; + const fragments = [ { data: items, - headers: headers, + headers, imageColumn: ['A+截图', '商品图片链接'], name: 'items', },