diff --git a/.gitignore b/.gitignore index bdfb492..0883468 100644 --- a/.gitignore +++ b/.gitignore @@ -142,3 +142,6 @@ components.d.ts # 需要团队共享的结论请写入 AGENTS.md 或 .serena/memories/,不要放这里。 /.workbuddy/ +# ---> 本地调试产物(CDP 截图、登录态、一次性脚本) +/.debug-tmp/ + diff --git a/package.json b/package.json index 6e4792b..9ffcfbe 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,6 @@ "type-check": "vue-tsc -p tsconfig.app.json --noEmit", "type-check:publish": "vue-tsc -p tsconfig.publish.json --noEmit" }, - "pnpm": { - "patchedDependencies": { - "tdesign-mobile-vue@1.16.0": "patches/tdesign-mobile-vue@1.16.0.patch" - } - }, "dependencies": { "@zxing/browser": "^0.1.5", "@zxing/library": "^0.21.3", @@ -28,9 +23,9 @@ "echarts-wordcloud": "^2.1.0", "less": "^4.3.0", "pinia": "^3.0.2", - "tdesign-mobile-vue": "^1.16.2", - "timi-ts": "link:E:/WebProject/timi-ts", + "tdesign-mobile-vue": "^1.17.1", "timi-tdesign-mobile": "link:E:/WebProject/timi-tdesign-mobile", + "timi-ts": "link:E:/WebProject/timi-ts", "timi-web": "link:E:/WebProject/timi-web", "timi-web-api": "link:E:/WebProject/timi-web-api", "ts-node": "^10.9.2", diff --git a/patches/tdesign-mobile-vue@1.16.0.patch b/patches/tdesign-mobile-vue@1.16.0.patch deleted file mode 100644 index 8e56773..0000000 --- a/patches/tdesign-mobile-vue@1.16.0.patch +++ /dev/null @@ -1,153 +0,0 @@ -diff --git a/cjs/swiper/props.js b/cjs/swiper/props.js -index 5615922a8c3410f703f768e363d39afa3138e7b1..b9a192a32dba34970287d0521e7e2077ac5b034c 100644 ---- a/cjs/swiper/props.js -+++ b/cjs/swiper/props.js -@@ -57,7 +57,7 @@ var props = { - default: true - }, - navigation: { -- type: [Object, Function] -+ type: [Boolean, Object, Function] - }, - nextMargin: { - type: [String, Number], -diff --git a/cjs/swiper/type.d.ts b/cjs/swiper/type.d.ts -index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644 ---- a/cjs/swiper/type.d.ts -+++ b/cjs/swiper/type.d.ts -@@ -10,7 +10,7 @@ export interface TdSwiperProps { - height?: string | number; - interval?: number; - loop?: boolean; -- navigation?: SwiperNavigation | TNode; -+ navigation?: boolean | SwiperNavigation | TNode; - nextMargin?: string | number; - previousMargin?: string | number; - onChange?: (current: number, context: { -diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs -index 634ba6d66891d1c98d62c48d2069a0519a6633ed..20c84d3176f194afe1fa530d8db3a87b0faf2979 100644 ---- a/es/shared/hover.mjs -+++ b/es/shared/hover.mjs -@@ -48,13 +48,15 @@ var Hover = { - current: state, - timers: [], - add: function add() { -- if (ctx.current.disabledHover || !ctx.current.className) return; -- if (!el.classList.contains(ctx.current.className)) { -- el.classList.add(ctx.current.className); -+ var current = ctx.current; -+ if (!current || current.disabledHover || !current.className) return; -+ if (!el.classList.contains(current.className)) { -+ el.classList.add(current.className); - } - }, - remove: function remove() { -- if (ctx.current.className) el.classList.remove(ctx.current.className); -+ var current = ctx.current; -+ if (current && current.className) el.classList.remove(current.className); - }, - clearTimers: function clearTimers() { - ctx.timers.forEach(function (t) { -@@ -63,18 +65,20 @@ var Hover = { - ctx.timers = []; - }, - downHandler: function downHandler() { -- if (ctx.current.disabledHover) return; -+ var current = ctx.current; -+ if (!current || current.disabledHover) return; - ctx.clearTimers(); - ctx.timers.push(window.setTimeout(function () { - ctx.add(); -- }, ctx.current.startTime)); -+ }, current.startTime)); - }, - upHandler: function upHandler() { -- if (ctx.current.disabledHover) return; -+ var current = ctx.current; -+ if (!current || current.disabledHover) return; - ctx.clearTimers(); - ctx.timers.push(window.setTimeout(function () { - ctx.remove(); -- }, ctx.current.stayTime)); -+ }, current.stayTime)); - }, - cancelHandler: function cancelHandler() { - ctx.clearTimers(); -diff --git a/es/swiper/props.mjs b/es/swiper/props.mjs -index a48cee3e0abe71c2ef1f3e83303ec061cb098f8d..27511b26df36116f59a27b584120ea71451d7bf0 100644 ---- a/es/swiper/props.mjs -+++ b/es/swiper/props.mjs -@@ -53,7 +53,7 @@ var props = { - default: true - }, - navigation: { -- type: [Object, Function] -+ type: [Boolean, Object, Function] - }, - nextMargin: { - type: [String, Number], -diff --git a/es/swiper/type.d.ts b/es/swiper/type.d.ts -index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644 ---- a/es/swiper/type.d.ts -+++ b/es/swiper/type.d.ts -@@ -10,7 +10,7 @@ export interface TdSwiperProps { - height?: string | number; - interval?: number; - loop?: boolean; -- navigation?: SwiperNavigation | TNode; -+ navigation?: boolean | SwiperNavigation | TNode; - nextMargin?: string | number; - previousMargin?: string | number; - onChange?: (current: number, context: { -diff --git a/esm/swiper/props.js b/esm/swiper/props.js -index 1b4ac31d550b0cb1aac6cc0f4bca7590d6df16cb..c959b7eaa05bd34704bf724f77fe5be230dbb0ad 100644 ---- a/esm/swiper/props.js -+++ b/esm/swiper/props.js -@@ -53,7 +53,7 @@ var props = { - default: true - }, - navigation: { -- type: [Object, Function] -+ type: [Boolean, Object, Function] - }, - nextMargin: { - type: [String, Number], -diff --git a/esm/swiper/type.d.ts b/esm/swiper/type.d.ts -index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644 ---- a/esm/swiper/type.d.ts -+++ b/esm/swiper/type.d.ts -@@ -10,7 +10,7 @@ export interface TdSwiperProps { - height?: string | number; - interval?: number; - loop?: boolean; -- navigation?: SwiperNavigation | TNode; -+ navigation?: boolean | SwiperNavigation | TNode; - nextMargin?: string | number; - previousMargin?: string | number; - onChange?: (current: number, context: { -diff --git a/lib/swiper/props.js b/lib/swiper/props.js -index 1b4ac31d550b0cb1aac6cc0f4bca7590d6df16cb..c959b7eaa05bd34704bf724f77fe5be230dbb0ad 100644 ---- a/lib/swiper/props.js -+++ b/lib/swiper/props.js -@@ -53,7 +53,7 @@ var props = { - default: true - }, - navigation: { -- type: [Object, Function] -+ type: [Boolean, Object, Function] - }, - nextMargin: { - type: [String, Number], -diff --git a/lib/swiper/type.d.ts b/lib/swiper/type.d.ts -index f72d82f2902ebd0636c091450a0d77ae00964917..75b7920cb3e94fac6fc7c1ef909c6972128d06f3 100644 ---- a/lib/swiper/type.d.ts -+++ b/lib/swiper/type.d.ts -@@ -10,7 +10,7 @@ export interface TdSwiperProps { - height?: string | number; - interval?: number; - loop?: boolean; -- navigation?: SwiperNavigation | TNode; -+ navigation?: boolean | SwiperNavigation | TNode; - nextMargin?: string | number; - previousMargin?: string | number; - onChange?: (current: number, context: { diff --git a/patches/tdesign-mobile-vue@1.17.1.patch b/patches/tdesign-mobile-vue@1.17.1.patch new file mode 100644 index 0000000..b42abcc --- /dev/null +++ b/patches/tdesign-mobile-vue@1.17.1.patch @@ -0,0 +1,52 @@ +diff --git a/es/shared/hover.mjs b/es/shared/hover.mjs +index 67b24bad56..c40589c034 100644 +--- a/es/shared/hover.mjs ++++ b/es/shared/hover.mjs +@@ -49,13 +49,15 @@ + hovered: false, + timers: [], + add: function add() { +- if (ctx.current.disabledHover || !ctx.current.className) return; +- if (!el.classList.contains(ctx.current.className)) { +- el.classList.add(ctx.current.className); ++ var current = ctx.current; ++ if (!current || current.disabledHover || !current.className) return; ++ if (!el.classList.contains(current.className)) { ++ el.classList.add(current.className); + } + }, + remove: function remove() { +- if (ctx.current.className) el.classList.remove(ctx.current.className); ++ var current = ctx.current; ++ if (current && current.className) el.classList.remove(current.className); + }, + clearTimers: function clearTimers() { + ctx.timers.forEach(function (t) { +@@ -64,21 +66,23 @@ + ctx.timers = []; + }, + downHandler: function downHandler() { +- if (ctx.current.disabledHover || ctx.hovered) return; ++ var current = ctx.current; ++ if (!current || current.disabledHover || ctx.hovered) return; + ctx.hovered = true; + ctx.clearTimers(); + ctx.timers.push(window.setTimeout(function () { + ctx.add(); +- }, ctx.current.startTime)); ++ }, current.startTime)); + }, + upHandler: function upHandler() { +- if (ctx.current.disabledHover || !ctx.hovered) return; ++ var current = ctx.current; ++ if (!current || current.disabledHover || !ctx.hovered) return; + ctx.hovered = false; + ctx.clearTimers(); + ctx.add(); + ctx.timers.push(window.setTimeout(function () { + ctx.remove(); +- }, ctx.current.stayTime)); ++ }, current.stayTime)); + }, + cancelHandler: function cancelHandler() { + if (!ctx.hovered) return; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 59f0959..5d9b902 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + tdesign-mobile-vue@1.17.1: + hash: c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3 + path: patches/tdesign-mobile-vue@1.17.1.patch + importers: .: @@ -30,8 +35,8 @@ importers: specifier: ^3.0.2 version: 3.0.4(typescript@5.8.3)(vue@3.5.40(typescript@5.8.3)) tdesign-mobile-vue: - specifier: ^1.16.2 - version: 1.16.2(vue@3.5.40(typescript@5.8.3)) + specifier: ^1.17.1 + version: 1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3)) timi-tdesign-mobile: specifier: link:E:/WebProject/timi-tdesign-mobile version: link:../timi-tdesign-mobile @@ -1743,9 +1748,9 @@ packages: peerDependencies: vue: ^3.0.0 - tdesign-mobile-vue@1.16.2: - resolution: {integrity: sha512-05lOApsyGeIFzlOuJvvm+P0o3h7FeHM9HsPcslRFPwOQXIZW1AvJhnvP7aon3mdFtUEFdeja6yq7uJB8Os4haQ==} - engines: {node: '>=12.0.0'} + tdesign-mobile-vue@1.17.1: + resolution: {integrity: sha512-gCmhaNCc2xhSkbITHiXnE/UGs6GHLe9LTE7T26ELOENC5Cqpa+j4KYU9wz6uqFV+Ro10RkG3DFikYHnq0gNN0A==} + engines: {node: '>=18.0.0'} peerDependencies: vue: ^3.2.6 @@ -3681,7 +3686,7 @@ snapshots: '@babel/runtime': 7.29.7 vue: 3.5.40(typescript@5.8.3) - tdesign-mobile-vue@1.16.2(vue@3.5.40(typescript@5.8.3)): + tdesign-mobile-vue@1.17.1(patch_hash=c98db305008fbfd00046666ca890e1c6cb88257c0619418694689cddf8cd78c3)(vue@3.5.40(typescript@5.8.3)): dependencies: '@babel/runtime': 7.29.7 '@use-gesture/vanilla': 10.3.1 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml new file mode 100644 index 0000000..1ee510b --- /dev/null +++ b/pnpm-workspace.yaml @@ -0,0 +1,2 @@ +patchedDependencies: + tdesign-mobile-vue@1.17.1: patches/tdesign-mobile-vue@1.17.1.patch diff --git a/src/assets/styles/global.less b/src/assets/styles/global.less index a0dc3fb..3f3bd6f 100644 --- a/src/assets/styles/global.less +++ b/src/assets/styles/global.less @@ -17,6 +17,20 @@ html { } html.theme-dark { + // TDesign 的深色变量挂在 :root[theme-mode='dark'] 上,项目用的是 html.theme-dark, + // 两者不匹配会让组件和页面骨架一直停在浅色,这里补齐基础色做桥接 + --td-bg-color-page: #10161f; + --td-bg-color-container: #1a2230; + --td-bg-color-container-hover: #222c3c; + --td-component-border: rgba(255, 255, 255, .12); + --td-text-color-primary: rgba(255, 255, 255, .9); + --td-text-color-secondary: rgba(255, 255, 255, .55); + --td-text-color-placeholder: rgba(255, 255, 255, .35); + + // 导航激活项在深色下需要压深,否则浅色胶囊压在深底上太刺眼 + --tui-rail-active-background: rgba(15, 118, 110, .22); + --tui-tabbar-active-background: rgba(15, 118, 110, .22); + color-scheme: dark; background: #10161f; } @@ -38,40 +52,14 @@ html.theme-dark body { box-sizing: border-box; } -.page-layout, +/** + * 页面骨架(tui-page-layout / tui-page-content / tui-navbar / tui-tabbar)由 + * timi-tdesign-mobile 的 page-layout.less 提供,这里只保留业务侧约定。 + */ +.tui-page-layout, .main-layout { - color: var(--td-text-color-primary); - background: var(--td-bg-color-page); - min-height: 100vh; - box-sizing: border-box; - .page-content { - flex: 1; - inset: 0; - width: 100%; - display: flex; - overflow: hidden; - position: absolute; - min-height: 0; - padding-top: calc(env(safe-area-inset-top, 0px) + 48px + 1rem); - box-sizing: border-box; - padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); - flex-direction: column; - - &.scroll { - overflow: auto; - -webkit-overflow-scrolling: touch; - } - - &.column { - gap: 1rem; - display: flex; - flex-direction: column; - - &.scroll > * { - flex-shrink: 0; - } - } + .tui-page-content { .filters { --td-search-bg-color: var(--tui-white); @@ -113,6 +101,7 @@ html.theme-dark body { } } + // 列表页的滚动容器:外层分栏只管宽度,滚动交给它 .pull-refresh { flex: 1; min-height: 0; @@ -136,40 +125,25 @@ html.theme-dark body { } } - &.navbar { - --app-nav-height: calc(env(safe-area-inset-top, 0px) + 48px); + /** + * 列表页的顶部间距必须落在真正的滚动容器上,内容才能穿进导航栏的毛玻璃层。 + * 这类"业务语义"的约定放在项目侧,库只提供骨架和变量。 + * + * 不要求 .scroll:分栏形态下内容区不滚动,滚动的是主栏里的列表容器, + * 但间距的落点一样,所以两种形态共用这一条。 + */ + &.tui-navbar .tui-page-content { - .t-navbar__content { - color: var(--tui-black, #000); - overflow: visible; - box-shadow: 0 3px 8px rgba(0, 0, 0, .1); - background: rgba(250, 250, 250, .8); - backdrop-filter: blur(10px); - -webkit-backdrop-filter: blur(10px); + &.notice { + padding-top: var(--tui-nav-height); } - &.tabbar { + &.list { + padding-top: 0; + padding-bottom: 0; - .page-content.scroll, - .page-content.column { - padding-bottom: 6rem; - } - } - - .page-content.scroll { - - &.notice { - padding-top: var(--app-nav-height); - } - - &.list { - padding-top: 0; - padding-bottom: 0; - - .pull-refresh { - padding-top: calc(var(--app-nav-height) + 1rem); - padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem); - } + .pull-refresh { + padding-top: calc(var(--tui-nav-height) + 1rem); } } } diff --git a/src/components/ProductStockPreview.vue b/src/components/ProductStockPreview.vue index 0a18763..9c5589d 100644 --- a/src/components/ProductStockPreview.vue +++ b/src/components/ProductStockPreview.vue @@ -26,6 +26,7 @@ - - diff --git a/src/main.ts b/src/main.ts index 5aff0b1..96b7095 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,6 +13,7 @@ import { initializeTwaBridge } from "@/utils/twaBridge"; import { VEntranceTransition } from "timi-tdesign-mobile"; import timiWebStyle from "../../timi-web/src/assets/style/timi-web.less?inline"; import tdesignCustomStyle from "../../timi-tdesign-mobile/src/assets/style/tdesign-custom.less?inline"; +import tuiLayoutStyle from "../../timi-tdesign-mobile/src/assets/style/page-layout.less?inline"; import "vue-virtual-scroller/dist/vue-virtual-scroller.css"; import "tdesign-mobile-vue/es/style/index.css"; @@ -33,7 +34,7 @@ function mountLibraryOverrideStyle(): void { const style = document.createElement("style"); style.id = libraryOverrideStyleId; - style.textContent = `${timiWebStyle}\n${tdesignCustomStyle}`; + style.textContent = `${timiWebStyle}\n${tdesignCustomStyle}\n${tuiLayoutStyle}`; document.head.append(style); } diff --git a/src/pages/ai/components/AiChatPanel.vue b/src/pages/ai/components/AiChatPanel.vue index 33442e6..d1333c2 100644 --- a/src/pages/ai/components/AiChatPanel.vue +++ b/src/pages/ai/components/AiChatPanel.vue @@ -341,7 +341,7 @@ onMounted(async () => {