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:
@@ -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)}
|
||||
|
||||
Reference in New Issue
Block a user