注册修改为绑定

This commit is contained in:
2025-10-21 21:51:51 +08:00
parent 5ee4e077fb
commit be2323074b
28 changed files with 729 additions and 211 deletions

View File

@@ -64,26 +64,12 @@ class MapService {
clearTimeout(timeout);
console.error('高德地图SDK定位失败:', err);
// 如果高德SDK失败,尝试使用微信原生API
console.log('尝试使用微信原生getLocation API...');
wx.getLocation({
type: 'gcj02',
success: (wxRes) => {
console.log('微信原生API定位成功:', wxRes);
resolve({
longitude: wxRes.longitude,
latitude: wxRes.latitude
});
},
fail: (wxErr) => {
console.error('微信原生API定位失败:', wxErr);
// 所有方法都失败,使用模拟位置
console.log('所有定位方法失败,使用模拟位置');
resolve({
longitude: 102.7123,
latitude: 25.0409
});
}
// 注释:高德SDK失败后,直接使用模拟位置,不调用微信原生API
// 原因:微信小程序可能没有位置权限,避免权限错误
console.log('高德地图SDK定位失败使用模拟位置');
resolve({
longitude: 102.7123,
latitude: 25.0409
});
}
}, (locationString: string) => {