From e9d1fbd218546707ed2bf753381b292369447d37 Mon Sep 17 00:00:00 2001 From: danial Date: Sat, 29 Nov 2025 12:48:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(order):=20=E5=AE=9E=E7=8E=B0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E6=80=BB=E7=BB=93=E5=86=85=E5=AE=B9=E7=9A=84=E5=AE=9E?= =?UTF-8?q?=E6=97=B6=E6=B5=81=E5=BC=8F=E6=B8=B2=E6=9F=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 替换订单总结接口响应类型为object,支持事件流格式 - 采用EventSource实现订单总结的SSE连接,支持服务器推送数据 - 实现打字机效果,实时显示总结文本的追加内容 - 使用marked解析Markdown格式摘要内容,支持GFM和换行 - 使用DOMPurify清理生成HTML,保障内容安全,仅允许部分标签 - 增加实时生成中状态提示和闪烁的输入光标动画 - 添加超时机制和连接错误处理,保证用户提示友好 - 组件卸载时自动关闭SSE连接,防止资源泄漏 - 更新依赖,新增dompurify和marked及相关类型定义 - 调整ESLint和构建配置支持新增脚本模式 --- .claude/settings.local.json | 3 +- package.json | 4 + pnpm-lock.yaml | 77 +++++-- src/api/generated/.openapi-generator/FILES | 2 - src/api/generated/apis/default-api.ts | 11 +- src/api/generated/docs/DefaultApi.md | 6 +- src/api/generated/models/index.ts | 1 - src/views/merchant/single/order.vue | 231 +++++++++++++++++++-- 8 files changed, 281 insertions(+), 54 deletions(-) diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 040ebaf..782f2bc 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -11,7 +11,8 @@ "Bash(pnpm eslint:*)", "Bash(mkdir:*)", "Bash(pnpm build)", - "Bash(pnpm eslint:fix)" + "Bash(pnpm eslint:fix)", + "Bash(pnpm eslint:fix:*)" ], "deny": [], "ask": [] diff --git a/package.json b/package.json index a4ebadb..ed6f1c1 100644 --- a/package.json +++ b/package.json @@ -61,8 +61,10 @@ "codemirror": "^6.0.2", "crypto-js": "^4.2.0", "dayjs": "^1.11.19", + "dompurify": "^3.3.0", "echarts": "^5.6.0", "lodash": "^4.17.21", + "marked": "^17.0.1", "mitt": "^3.0.1", "nprogress": "^0.2.0", "pinia": "^2.3.1", @@ -83,7 +85,9 @@ "@openapi-codegen/cli": "^3.1.0", "@openapi-codegen/typescript": "^11.0.1", "@types/crypto-js": "^4.2.2", + "@types/dompurify": "^3.2.0", "@types/lodash": "^4.17.20", + "@types/marked": "^6.0.0", "@types/mockjs": "^1.0.10", "@types/node": "^22.14.1", "@types/nprogress": "^0.2.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 01be742..56f0b14 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -66,12 +66,18 @@ importers: dayjs: specifier: ^1.11.19 version: 1.11.19 + dompurify: + specifier: ^3.3.0 + version: 3.3.0 echarts: specifier: ^5.6.0 version: 5.6.0 lodash: specifier: ^4.17.21 version: 4.17.21 + marked: + specifier: ^17.0.1 + version: 17.0.1 mitt: specifier: ^3.0.1 version: 3.0.1 @@ -127,9 +133,15 @@ importers: '@types/crypto-js': specifier: ^4.2.2 version: 4.2.2 + '@types/dompurify': + specifier: ^3.2.0 + version: 3.2.0 '@types/lodash': specifier: ^4.17.20 version: 4.17.20 + '@types/marked': + specifier: ^6.0.0 + version: 6.0.0 '@types/mockjs': specifier: ^1.0.10 version: 1.0.10 @@ -156,7 +168,7 @@ importers: version: 4.1.2(vite@5.4.19(@types/node@22.15.18)(less@4.3.0))(vue@3.5.22(typescript@5.8.3)) autoprefixer: specifier: ^10.4.21 - version: 10.4.21(postcss@8.5.3) + version: 10.4.21(postcss@8.5.6) consola: specifier: ^3.4.2 version: 3.4.2 @@ -192,7 +204,7 @@ importers: version: 1.8.0 postcss-less: specifier: ^6.0.0 - version: 6.0.0(postcss@8.5.3) + version: 6.0.0(postcss@8.5.6) prettier: specifier: ^3.5.3 version: 3.5.3 @@ -213,13 +225,13 @@ importers: version: 37.0.0(stylelint@16.19.1(typescript@5.8.3)) stylelint-config-standard-less: specifier: ^3.0.1 - version: 3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)) + version: 3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)) stylelint-config-standard-vue: specifier: ^1.0.0 version: 1.0.0(postcss-html@1.8.0)(stylelint@16.19.1(typescript@5.8.3)) stylelint-less: specifier: ^3.0.1 - version: 3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)) + version: 3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)) stylelint-order: specifier: ^6.0.4 version: 6.0.4(stylelint@16.19.1(typescript@5.8.3)) @@ -1491,6 +1503,10 @@ packages: '@types/debug@4.1.12': resolution: {integrity: sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==} + '@types/dompurify@3.2.0': + resolution: {integrity: sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg==} + deprecated: This is a stub types definition. dompurify provides its own type definitions, so you do not need this installed. + '@types/estree@1.0.7': resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} @@ -1542,6 +1558,10 @@ packages: '@types/lodash@4.17.20': resolution: {integrity: sha512-H3MHACvFUEiujabxhaI/ImO6gUrd8oOurg7LQtS7mbwIXA/cUqWrvBsaeJ23aZEPk1TAYkurjfMbSELfoCXlGA==} + '@types/marked@6.0.0': + resolution: {integrity: sha512-jmjpa4BwUsmhxcfsgUit/7A9KbrC48Q0q8KvnY107ogcjGgTFDlIL3RpihNpx2Mu1hM4mdFQjoVc4O6JoGKHsA==} + deprecated: This is a stub types definition. marked provides its own type definitions, so you do not need this installed. + '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} @@ -2428,8 +2448,8 @@ packages: resolution: {integrity: sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==} engines: {node: '>= 4'} - dompurify@3.2.5: - resolution: {integrity: sha512-mLPd29uoRe9HpvwP2TxClGQBzGXeEC/we/q+bFlmPPmj2p2Ugl3r6ATu/UU1v77DXNcehiBg9zsr1dREyA/dJQ==} + dompurify@3.3.0: + resolution: {integrity: sha512-r+f6MYR1gGN1eJv0TVQbhA7if/U7P87cdPl3HN5rikqaBSBxLiCb/b9O+2eG0cxz0ghyU+mU1QkbsOwERMYlWQ==} domutils@2.8.0: resolution: {integrity: sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A==} @@ -3772,6 +3792,11 @@ packages: markdown-table@3.0.4: resolution: {integrity: sha512-wiYz4+JrLyb/DqW2hkFJxP7Vd7JuTDm77fvbM8VfEQdmSMqcImWeeRbHwZjBjIFki/VaMK2BhFi7oUUZeM5bqw==} + marked@17.0.1: + resolution: {integrity: sha512-boeBdiS0ghpWcSwoNm/jJBwdpFaMnZWRzjA6SkUMYb40SVaN1x7mmfGKp0jvexGcx+7y2La5zRZsYFZI6Qpypg==} + engines: {node: '>= 20'} + hasBin: true + math-intrinsics@1.1.0: resolution: {integrity: sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==} engines: {node: '>= 0.4'} @@ -6684,7 +6709,7 @@ snapshots: '@types/lodash.debounce': 4.0.9 '@types/lodash.throttle': 4.1.9 clsx: 2.1.1 - dompurify: 3.2.5 + dompurify: 3.3.0 lodash.debounce: 4.0.8 lodash.throttle: 4.1.1 nanoid: 5.1.5 @@ -7314,6 +7339,10 @@ snapshots: dependencies: '@types/ms': 2.1.0 + '@types/dompurify@3.2.0': + dependencies: + dompurify: 3.3.0 + '@types/estree@1.0.7': {} '@types/glob@7.2.0': @@ -7374,6 +7403,10 @@ snapshots: '@types/lodash@4.17.20': {} + '@types/marked@6.0.0': + dependencies: + marked: 17.0.1 + '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 @@ -7758,14 +7791,14 @@ snapshots: asynckit@0.4.0: {} - autoprefixer@10.4.21(postcss@8.5.3): + autoprefixer@10.4.21(postcss@8.5.6): dependencies: browserslist: 4.24.5 caniuse-lite: 1.0.30001718 fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.1.1 - postcss: 8.5.3 + postcss: 8.5.6 postcss-value-parser: 4.2.0 axios@1.12.2: @@ -8404,7 +8437,7 @@ snapshots: dependencies: domelementtype: 2.3.0 - dompurify@3.2.5: + dompurify@3.3.0: optionalDependencies: '@types/trusted-types': 2.0.7 @@ -9872,6 +9905,8 @@ snapshots: markdown-table@3.0.4: {} + marked@17.0.1: {} + math-intrinsics@1.1.0: {} mathml-tag-names@2.1.3: {} @@ -10678,9 +10713,9 @@ snapshots: postcss: 8.5.3 postcss-safe-parser: 6.0.0(postcss@8.5.3) - postcss-less@6.0.0(postcss@8.5.3): + postcss-less@6.0.0(postcss@8.5.6): dependencies: - postcss: 8.5.3 + postcss: 8.5.6 postcss-resolve-nested-selector@0.1.6: {} @@ -11389,14 +11424,14 @@ snapshots: stylelint: 16.19.1(typescript@5.8.3) stylelint-order: 6.0.4(stylelint@16.19.1(typescript@5.8.3)) - stylelint-config-recommended-less@3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)): + stylelint-config-recommended-less@3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)): dependencies: - postcss-less: 6.0.0(postcss@8.5.3) + postcss-less: 6.0.0(postcss@8.5.6) stylelint: 16.19.1(typescript@5.8.3) stylelint-config-recommended: 14.0.1(stylelint@16.19.1(typescript@5.8.3)) - stylelint-less: 3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)) + stylelint-less: 3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)) optionalDependencies: - postcss: 8.5.3 + postcss: 8.5.6 stylelint-config-recommended-vue@1.6.0(postcss-html@1.8.0)(stylelint@16.19.1(typescript@5.8.3)): dependencies: @@ -11418,13 +11453,13 @@ snapshots: dependencies: stylelint: 16.19.1(typescript@5.8.3) - stylelint-config-standard-less@3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)): + stylelint-config-standard-less@3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)): dependencies: stylelint: 16.19.1(typescript@5.8.3) - stylelint-config-recommended-less: 3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)) + stylelint-config-recommended-less: 3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)) stylelint-config-standard: 35.0.0(stylelint@16.19.1(typescript@5.8.3)) optionalDependencies: - postcss: 8.5.3 + postcss: 8.5.6 stylelint-config-standard-vue@1.0.0(postcss-html@1.8.0)(stylelint@16.19.1(typescript@5.8.3)): dependencies: @@ -11444,9 +11479,9 @@ snapshots: stylelint: 16.19.1(typescript@5.8.3) stylelint-config-recommended: 15.0.0(stylelint@16.19.1(typescript@5.8.3)) - stylelint-less@3.0.1(postcss@8.5.3)(stylelint@16.19.1(typescript@5.8.3)): + stylelint-less@3.0.1(postcss@8.5.6)(stylelint@16.19.1(typescript@5.8.3)): dependencies: - postcss: 8.5.3 + postcss: 8.5.6 postcss-resolve-nested-selector: 0.1.6 postcss-value-parser: 4.2.0 stylelint: 16.19.1(typescript@5.8.3) diff --git a/src/api/generated/.openapi-generator/FILES b/src/api/generated/.openapi-generator/FILES index 4f7d00b..1cd97c3 100644 --- a/src/api/generated/.openapi-generator/FILES +++ b/src/api/generated/.openapi-generator/FILES @@ -338,7 +338,6 @@ docs/KamiApiMerchantV1OrderQueryRecord.md docs/KamiApiMerchantV1OrderQueryReq.md docs/KamiApiMerchantV1OrderQueryRes.md docs/KamiApiMerchantV1OrderQuerySummaryReq.md -docs/KamiApiMerchantV1OrderQuerySummaryRes.md docs/KamiApiMerchantV1PlatformRateRecord.md docs/KamiApiMerchantV1SampleAllListRes.md docs/KamiApiMerchantV1StealCreateReq.md @@ -770,7 +769,6 @@ models/kami-api-merchant-v1-order-query-record.ts models/kami-api-merchant-v1-order-query-req.ts models/kami-api-merchant-v1-order-query-res.ts models/kami-api-merchant-v1-order-query-summary-req.ts -models/kami-api-merchant-v1-order-query-summary-res.ts models/kami-api-merchant-v1-platform-rate-record.ts models/kami-api-merchant-v1-sample-all-list-res.ts models/kami-api-merchant-v1-steal-create-req.ts diff --git a/src/api/generated/apis/default-api.ts b/src/api/generated/apis/default-api.ts index 69bd0c9..f1166f0 100644 --- a/src/api/generated/apis/default-api.ts +++ b/src/api/generated/apis/default-api.ts @@ -307,8 +307,6 @@ import type { KamiApiMerchantV1MerchantSampleAllListRes } from '../models'; // @ts-ignore import type { KamiApiMerchantV1OrderQueryRes } from '../models'; // @ts-ignore -import type { KamiApiMerchantV1OrderQuerySummaryRes } from '../models'; -// @ts-ignore import type { KamiApiMerchantV1StealCreateReq } from '../models'; // @ts-ignore import type { KamiApiMerchantV1StealListRes } from '../models'; @@ -15860,10 +15858,7 @@ export const DefaultApiFp = function (configuration?: Configuration) { merchantOrderNo?: string, options?: RawAxiosRequestConfig ): Promise< - ( - axios?: AxiosInstance, - basePath?: string - ) => AxiosPromise + (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.apiMerchantOrderSummaryGet( @@ -20459,7 +20454,7 @@ export const DefaultApiFactory = function ( apiMerchantOrderSummaryGet( requestParameters: DefaultApiApiMerchantOrderSummaryGetRequest = {}, options?: RawAxiosRequestConfig - ): AxiosPromise { + ): AxiosPromise { return localVarFp .apiMerchantOrderSummaryGet(requestParameters.merchantOrderNo, options) .then(request => request(axios, basePath)); @@ -23159,7 +23154,7 @@ export interface DefaultApiInterface { apiMerchantOrderSummaryGet( requestParameters?: DefaultApiApiMerchantOrderSummaryGetRequest, options?: RawAxiosRequestConfig - ): AxiosPromise; + ): AxiosPromise; /** * diff --git a/src/api/generated/docs/DefaultApi.md b/src/api/generated/docs/DefaultApi.md index 2ccfd33..f958319 100644 --- a/src/api/generated/docs/DefaultApi.md +++ b/src/api/generated/docs/DefaultApi.md @@ -7150,7 +7150,7 @@ No authorization required # **apiMerchantOrderSummaryGet** -> KamiApiMerchantV1OrderQuerySummaryRes apiMerchantOrderSummaryGet() +> object apiMerchantOrderSummaryGet() ### Example @@ -7174,7 +7174,7 @@ const { status, data } = ### Return type -**KamiApiMerchantV1OrderQuerySummaryRes** +**object** ### Authorization @@ -7183,7 +7183,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: application/json +- **Accept**: text/event-stream ### HTTP response details diff --git a/src/api/generated/models/index.ts b/src/api/generated/models/index.ts index ce7c04b..5395abc 100644 --- a/src/api/generated/models/index.ts +++ b/src/api/generated/models/index.ts @@ -317,7 +317,6 @@ export * from './kami-api-merchant-v1-order-query-record'; export * from './kami-api-merchant-v1-order-query-req'; export * from './kami-api-merchant-v1-order-query-res'; export * from './kami-api-merchant-v1-order-query-summary-req'; -export * from './kami-api-merchant-v1-order-query-summary-res'; export * from './kami-api-merchant-v1-platform-rate-record'; export * from './kami-api-merchant-v1-sample-all-list-res'; export * from './kami-api-merchant-v1-steal-create-req'; diff --git a/src/views/merchant/single/order.vue b/src/views/merchant/single/order.vue index 3fafa70..2648985 100644 --- a/src/views/merchant/single/order.vue +++ b/src/views/merchant/single/order.vue @@ -1,3 +1,4 @@ +