From e7bea33521ae8903051f8b7f2872319b3bb9f04f Mon Sep 17 00:00:00 2001 From: yml Date: Fri, 20 Nov 2026 23:18:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=E6=96=97=E9=B1=BC=E9=A2=86?= =?UTF-8?q?=E5=8F=96):=20=E6=8F=90=E4=BA=A4=E6=8C=89=E9=92=AE=E9=80=82?= =?UTF-8?q?=E9=85=8D=E8=8B=B9=E6=9E=9C=E6=B5=8F=E8=A7=88=E5=99=A8=E6=BB=9A?= =?UTF-8?q?=E5=8A=A8=E4=B8=8E=E5=AE=89=E5=85=A8=E5=8C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/frontend/src/App.tsx | 35 ++++++------ .../DouyuFulfillmentPage.tsx | 20 +++---- apps/frontend/src/styles/customer/mobile.css | 2 + .../src/styles/customer/platform/douyu.css | 53 +++++++++++++++++++ .../douyu-customer-mobile-layout.test.ts | 44 +++++++++++++++ 5 files changed, 130 insertions(+), 24 deletions(-) create mode 100644 apps/frontend/tests/douyu-customer-mobile-layout.test.ts diff --git a/apps/frontend/src/App.tsx b/apps/frontend/src/App.tsx index 90487e23..fb314618 100644 --- a/apps/frontend/src/App.tsx +++ b/apps/frontend/src/App.tsx @@ -163,6 +163,7 @@ export default function App() { function DouyuFulfillmentApplication() { useClearStrayHash() + useCustomerMobileViewport() return ( }> @@ -192,21 +193,7 @@ function OrderServiceApplication() { function CustomerFulfillmentApplication() { useClearStrayHash() - /** - * 客户履约页固定移动端: - * 全局 base.css 给 body 设了 min-width:320px,worker.css 又用 overflow-x:hidden - * 裁掉横向溢出。应用内浏览器/分屏/系统显示放大时,实际视口可能小于 320px, - * 页面右侧(输入框、商品值、提示文案)会被直接裁掉。 - * 这里只给客户履约路由挂移动端根类,覆盖最小宽度,不影响后台与打手端。 - */ - useLayoutEffect(() => { - document.documentElement.classList.add('customer-mobile-html') - document.body.classList.add('customer-mobile-body') - return () => { - document.documentElement.classList.remove('customer-mobile-html') - document.body.classList.remove('customer-mobile-body') - } - }, []) + useCustomerMobileViewport() // 非标准子路径也按首段路径绑定平台,避免 /c/.../extra 这类地址绕过严格绑定。 const prefix = window.location.pathname.split('/').filter(Boolean)[0] const wildcardPlatform = prefix === 'c' ? 'huya' : prefix === 'd' ? 'weibo' : undefined @@ -387,6 +374,24 @@ function useClearStrayHash() { }, []) } +/** + * 客户领取/履约页固定按移动端处理: + * 全局 base.css 给 body 设了 min-width:320px,worker.css 又用 overflow-x:hidden + * 裁掉横向溢出。应用内浏览器/分屏/系统显示放大时,实际视口可能小于 320px, + * 页面右侧(输入框、商品值、提示文案)会被直接裁掉。 + * 这里只给客户页面路由挂移动端根类,覆盖最小宽度,不影响后台与打手端。 + */ +function useCustomerMobileViewport() { + useLayoutEffect(() => { + document.documentElement.classList.add('customer-mobile-html') + document.body.classList.add('customer-mobile-body') + return () => { + document.documentElement.classList.remove('customer-mobile-html') + document.body.classList.remove('customer-mobile-body') + } + }, []) +} + function WorkerApplication() { return ( diff --git a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx index f7903aa7..1d80b102 100644 --- a/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx +++ b/apps/frontend/src/pages/douyu-fulfillment/DouyuFulfillmentPage.tsx @@ -413,15 +413,17 @@ export default function DouyuFulfillmentPage() { {roleNameIssue ?