feat(admin,partner): Tencent map location picker and expose LBS key
Store create/edit on HQ and partner can pick coords via Tencent locpicker; client-config exposes TENCENT_LBS_KEY; seed empty system settings from env. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -19,6 +19,8 @@ import { fetchPartnerCities, type OpenCityOption } from '../lib/upload';
|
||||
|
||||
import { usePartnerSession } from '../contexts/PartnerSessionContext';
|
||||
|
||||
import TencentLocPickerOverlay from '../components/TencentLocPickerOverlay';
|
||||
|
||||
import {
|
||||
|
||||
clearAllStoreDrafts,
|
||||
@@ -106,6 +108,8 @@ export default function StoreCreatePage() {
|
||||
|
||||
const [locating, setLocating] = useState(false);
|
||||
|
||||
const [mapPickerOpen, setMapPickerOpen] = useState(false);
|
||||
|
||||
const draftSaveDisabledRef = useRef(false);
|
||||
|
||||
function reportFormError(message: string) {
|
||||
@@ -777,10 +781,18 @@ export default function StoreCreatePage() {
|
||||
>
|
||||
{locating ? '定位中…' : '获取当前位置'}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="partner-btn-outline"
|
||||
style={{ padding: '8px 12px', fontSize: 13 }}
|
||||
onClick={() => setMapPickerOpen(true)}
|
||||
>
|
||||
地图选点
|
||||
</button>
|
||||
<span className="label-md text-muted">
|
||||
{formatStoreCoords(form.latitude, form.longitude)
|
||||
? `坐标:${formatStoreCoords(form.latitude, form.longitude)}`
|
||||
: '未定位(提交后可按地址自动解析)'}
|
||||
: '未定位(可定位或地图选点)'}
|
||||
</span>
|
||||
</div>
|
||||
|
||||
@@ -1278,6 +1290,23 @@ export default function StoreCreatePage() {
|
||||
|
||||
</footer>
|
||||
|
||||
<TencentLocPickerOverlay
|
||||
open={mapPickerOpen}
|
||||
onClose={() => setMapPickerOpen(false)}
|
||||
latitude={form.latitude ? Number(form.latitude) : undefined}
|
||||
longitude={form.longitude ? Number(form.longitude) : undefined}
|
||||
onPick={(loc) => {
|
||||
patchForm({
|
||||
latitude: String(loc.latitude),
|
||||
longitude: String(loc.longitude),
|
||||
...(loc.address && !form.address.trim() ? { address: loc.address } : {}),
|
||||
});
|
||||
toastSuccess(
|
||||
`已选点 ${loc.latitude.toFixed(6)}, ${loc.longitude.toFixed(6)}${loc.name ? `(${loc.name})` : ''}`,
|
||||
);
|
||||
}}
|
||||
/>
|
||||
|
||||
</div>
|
||||
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user