提交代码
This commit is contained in:
1 parent
2c2e4a52b4
commit
ccea2c8fb2
2 files changed
+91
-3
No files matched your search
@@ -928,9 +928,40 @@ export default {
|
||||
const [latStr, lngStr] = this.cancelForm.cancelLocation.split(',');
|
||||
const latitude = parseFloat(latStr);
|
||||
const longitude = parseFloat(lngStr);
|
||||
|
||||
// 调用后台API进行逆地理编码
|
||||
try {
|
||||
const geocodingResponse = await request({
|
||||
url: '/system/SysRegion/reverse-geocode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
longitude: longitude,
|
||||
latitude: latitude,
|
||||
},
|
||||
});
|
||||
|
||||
if (geocodingResponse.code === 200 && geocodingResponse.data) {
|
||||
const formattedAddress = geocodingResponse.data.regeocode?.formattedAddress;
|
||||
if (formattedAddress) {
|
||||
console.log('销假位置逆地理编码成功:', formattedAddress);
|
||||
// 可以选择将地址信息显示给用户或保存到表单中
|
||||
// this.cancelForm.cancelLocationAddress = formattedAddress; // 如果需要保存地址信息
|
||||
}
|
||||
} else {
|
||||
console.warn('销假位置逆地理编码失败:', geocodingResponse.msg);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('销假位置逆地理编码请求失败:', error);
|
||||
// 逆地理编码失败不影响地图打开功能
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
||||
await this.wechatSDK.openLocation({ latitude, longitude, name: '销假位置' });
|
||||
await this.wechatSDK.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: formattedAddress,
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -949,9 +980,40 @@ export default {
|
||||
const latitude = parseFloat(latStr);
|
||||
const longitude = parseFloat(lngStr);
|
||||
if (Number.isNaN(latitude) || Number.isNaN(longitude)) return;
|
||||
|
||||
// 调用后台API进行逆地理编码
|
||||
try {
|
||||
const geocodingResponse = await request({
|
||||
url: '/system/SysRegion/reverse-geocode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
longitude: longitude,
|
||||
latitude: latitude,
|
||||
},
|
||||
});
|
||||
|
||||
if (geocodingResponse.code === 200 && geocodingResponse.data) {
|
||||
const formattedAddress = geocodingResponse.data.regeocode?.formattedAddress;
|
||||
if (formattedAddress) {
|
||||
console.log('请假位置逆地理编码成功:', formattedAddress);
|
||||
// 可以选择将地址信息显示给用户或保存到表单中
|
||||
// this.leaveInfo.leaveLocationAddress = formattedAddress; // 如果需要保存地址信息
|
||||
}
|
||||
} else {
|
||||
console.warn('请假位置逆地理编码失败:', geocodingResponse.msg);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('请假位置逆地理编码请求失败:', error);
|
||||
// 逆地理编码失败不影响地图打开功能
|
||||
}
|
||||
|
||||
try {
|
||||
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
||||
await this.wechatSDK.openLocation({ latitude, longitude, name: '请假位置' });
|
||||
await this.wechatSDK.openLocation({
|
||||
latitude,
|
||||
longitude,
|
||||
name: formattedAddress,
|
||||
});
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@@ -825,13 +825,39 @@ export default {
|
||||
});
|
||||
return;
|
||||
}
|
||||
// 调用高德sdk 逆地理编码
|
||||
try {
|
||||
// 调用后台API进行逆地理编码
|
||||
const geocodingResponse = await request({
|
||||
url: '/system/SysRegion/reverse-geocode',
|
||||
method: 'POST',
|
||||
data: {
|
||||
longitude: longitude,
|
||||
latitude: latitude,
|
||||
},
|
||||
});
|
||||
|
||||
if (geocodingResponse.code === 200 && geocodingResponse.data) {
|
||||
const formattedAddress = geocodingResponse.data.regeocode?.formattedAddress;
|
||||
if (formattedAddress) {
|
||||
console.log('逆地理编码成功:', formattedAddress);
|
||||
// 可以选择将地址信息显示给用户或保存到表单中
|
||||
// this.form.leaveLocationAddress = formattedAddress; // 如果需要保存地址信息
|
||||
}
|
||||
} else {
|
||||
console.warn('逆地理编码失败:', geocodingResponse.msg);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('逆地理编码请求失败:', error);
|
||||
// 逆地理编码失败不影响地图打开功能
|
||||
}
|
||||
|
||||
if (this.isWechatBrowser && this.wechatSDK.isInitialized) {
|
||||
try {
|
||||
await this.wechatSDK.openLocation({
|
||||
latitude: latitude,
|
||||
longitude: longitude,
|
||||
name: '请假地点',
|
||||
name: formattedAddress,
|
||||
address: this.form.leaveLocation || '当前位置',
|
||||
scale: 16,
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user