fix(partner): hide map pick coords from UI

Keep lat/lng in form state for submit; remove pending coords panel and toasts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-29 13:04:41 +08:00
parent f396cb1fef
commit 507a21a318
3 changed files with 25 additions and 58 deletions
@@ -42,6 +42,7 @@ export default function TencentLocPickerOverlay({
const [key, setKey] = useState<string | null>(cachedKey ?? null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState('');
/** 选点结果仅存内存,界面不展示经纬度 */
const [pending, setPending] = useState<TencentPickedLocation | null>(null);
const [iframeReady, setIframeReady] = useState(false);
@@ -73,7 +74,6 @@ export default function TencentLocPickerOverlay({
useEffect(() => {
if (!open) return;
function onMessage(event: MessageEvent) {
// 仅处理腾讯选点回传,忽略其它来源噪声
const picked = parseTencentLocPickerMessage(event.data);
if (!picked) return;
setPending(picked);
@@ -110,7 +110,6 @@ export default function TencentLocPickerOverlay({
background: '#fff',
display: 'flex',
flexDirection: 'column',
// 微信内全屏更稳:避免 100vh 被地址栏裁切
height: '100dvh',
maxHeight: '-webkit-fill-available',
paddingTop: 'env(safe-area-inset-top)',
@@ -138,7 +137,7 @@ export default function TencentLocPickerOverlay({
>
</button>
<span style={{ fontWeight: 600, fontSize: 16 }}></span>
<span style={{ fontWeight: 600, fontSize: 16 }}></span>
<button
type="button"
className="partner-btn-primary"
@@ -155,45 +154,23 @@ export default function TencentLocPickerOverlay({
</button>
</div>
{pending ? (
<div
style={{
margin: 0,
padding: '10px 14px',
borderBottom: '1px solid rgba(0,0,0,0.04)',
flexShrink: 0,
background: 'rgba(166, 29, 36, 0.04)',
}}
>
<div style={{ fontSize: 13, fontWeight: 600, color: 'var(--color-heritage-red, #a61d24)' }}>
</div>
<div className="label-md text-muted" style={{ marginTop: 4, fontSize: 13, lineHeight: 1.4 }}>
{pending.name || '地图选点'}
{pending.address ? ` · ${pending.address}` : ''}
<br />
{pending.latitude.toFixed(6)}, {pending.longitude.toFixed(6)}
</div>
</div>
) : (
<p
className="label-md text-muted"
style={{
margin: 0,
padding: '8px 14px',
borderBottom: '1px solid rgba(0,0,0,0.04)',
flexShrink: 0,
fontSize: 12,
}}
>
</p>
)}
<p
className="label-md text-muted"
style={{
margin: 0,
padding: '8px 14px',
borderBottom: '1px solid rgba(0,0,0,0.04)',
flexShrink: 0,
fontSize: 12,
}}
>
{pending ? '已选定位置,请点右上角「确认」' : '在地图上点选或搜索地点,选中后点右上角「确认」'}
</p>
<div style={{ flex: 1, minHeight: 0, position: 'relative', background: '#f5f5f5' }}>
{loading ? (
<p className="label-md text-muted" style={{ padding: 24, textAlign: 'center' }}>
</p>
) : error ? (
<div style={{ padding: 24 }}>
@@ -224,7 +201,7 @@ export default function TencentLocPickerOverlay({
</p>
) : null}
<iframe
title="腾讯地图选点"
title="地图选点"
src={src}
allow="geolocation *"
onLoad={() => setIframeReady(true)}