From 564d4de51fc9debd1d9d944e88feabd0e8cc9436 Mon Sep 17 00:00:00 2001 From: zoujing Date: Mon, 8 Jun 2026 12:50:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=95=86=E5=93=81=E5=8D=95=E4=B8=AA?= =?UTF-8?q?=E7=9A=84=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/test-ParsedValueView-strict.mjs | 50 +++++++++++ .../ChatLongAnswer/ParsedValueView.vue | 82 +++++++++++++------ .../styles/ParsedValueView.scss | 79 ++++++++++++++++++ 3 files changed, 186 insertions(+), 25 deletions(-) diff --git a/scripts/test-ParsedValueView-strict.mjs b/scripts/test-ParsedValueView-strict.mjs index 140c5f8..35b1ce4 100644 --- a/scripts/test-ParsedValueView-strict.mjs +++ b/scripts/test-ParsedValueView-strict.mjs @@ -6,6 +6,10 @@ const source = await readFile( resolve("src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue"), "utf8" ); +const styleSource = await readFile( + resolve("src/pages/ChatMain/ChatLongAnswer/styles/ParsedValueView.scss"), + "utf8" +); const forbiddenCompatibilitySnippets = [ "valueObj.image_url", @@ -80,6 +84,52 @@ for (const snippet of requiredStrictRenderingSnippets) { ); } +const requiredSingleCommodityOverviewSnippets = [ + ':scroll-x="!isSingleCommodity"', + "'overview-combo-card': isSingleCommodity", + 'v-if="isSingleCommodity"', + 'class="overview-combo-body"', + 'class="overview-combo-cover"', + 'class="overview-combo-info"', + 'class="overview-combo-name"', + 'class="overview-combo-desc"', + 'class="overview-combo-price"', + 'class="overview-combo-currency"', + 'class="overview-combo-button"', +]; + +for (const snippet of requiredSingleCommodityOverviewSnippets) { + assert.equal( + source.includes(snippet), + true, + `ParsedValueView single commodity should use overview combo layout: ${snippet}` + ); +} + +const requiredSingleCommodityOverviewStyleSnippets = [ + ".overview-combo-card", + ".overview-combo-body", + "display: flex;", + ".overview-combo-cover", + "width: 78px;", + "height: 78px;", + ".overview-combo-info", + ".overview-combo-name", + ".overview-combo-desc", + ".overview-combo-price", + ".overview-combo-currency", + ".overview-combo-button", + "height: 40px;", +]; + +for (const snippet of requiredSingleCommodityOverviewStyleSnippets) { + assert.equal( + styleSource.includes(snippet), + true, + `ParsedValueView single commodity should define overview combo style: ${snippet}` + ); +} + const removedInnerSpecialEntrySnippets = [ "createSpecialFieldEntry", "entry.type === 'question-suggest'", diff --git a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue index 7f6ce02..c58b964 100644 --- a/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue +++ b/src/pages/ChatMain/ChatLongAnswer/ParsedValueView.vue @@ -29,39 +29,71 @@