From a57b087aa966dcace8fbe90a90e534d7922bc443 Mon Sep 17 00:00:00 2001 From: zhaoxing <2558691827@qq.com> Date: Fri, 13 Nov 2026 13:07:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(frontend):=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B5=E5=B8=B8=E7=8E=A9=E5=9C=B0=E5=8C=BA?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E5=9B=BA=E5=AE=9A=E5=AE=AB=E6=A0=BC=E9=80=89?= =?UTF-8?q?=E6=8B=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../features/seller/SellerListingFormPage.tsx | 106 ++++++++++++++++-- frontend/src/styles/mobile-seller.css | 73 ++++++++++++ 2 files changed, 169 insertions(+), 10 deletions(-) diff --git a/frontend/src/features/seller/SellerListingFormPage.tsx b/frontend/src/features/seller/SellerListingFormPage.tsx index 7412d0e..be2db73 100644 --- a/frontend/src/features/seller/SellerListingFormPage.tsx +++ b/frontend/src/features/seller/SellerListingFormPage.tsx @@ -200,6 +200,84 @@ function ChoiceField(props: { ) } +/** + * 移动端「常玩地区」选择器:固定宫格常驻页面,点选即切换,不渲染输入框。 + * iOS 上输入型下拉会立刻唤起键盘,把候选列表顶到键盘下面,故移动端改用宫格。 + */ +function MobileRegionPicker(props: { + value: string[] + options: string[] + onChange: (value: string[]) => void +}) { + const { value, options, onChange } = props + // 连续快速点选时 React 可能还未重渲染,用 ref 累积最新值,避免后一次点击覆盖前一次。 + const valueRef = useRef(value) + valueRef.current = value + const selected = new Set(valueRef.current) + const customValues = valueRef.current.filter(region => !options.includes(region)) + + function toggle(region: string) { + const current = valueRef.current + const next = current.includes(region) + ? current.filter(item => item !== region) + : [...current, region] + valueRef.current = next + onChange(next) + } + + return ( +
+
+ 已选 {value.length} 个地区 + {value.length > 0 ? ( + + ) : null} +
+
+ {options.map(region => { + const active = selected.has(region) + return ( + + ) + })} +
+ {customValues.length > 0 ? ( +
+ 自定义 + {customValues.map(region => ( + + ))} +
+ ) : null} +
+ ) +} + const PUBLISH_DRAFT_KEY_PREFIX = 'jieyou:seller:publish-draft:v1' interface StoredPublishDraft extends PublishDraft { @@ -1276,17 +1354,25 @@ export function SellerListingFormPage({ mobile = false }: { mobile?: boolean } = onChange={value => updateForm('next_season_pass', value)} /> ) : null} -