更换天地图key,修改push云函数配置
This commit is contained in:
@@ -58,9 +58,8 @@ import { ref } from 'vue';
|
||||
import { onLoad } from '@dcloudio/uni-app';
|
||||
import { addActivityLive, signinActivityLive, uploadFile } from '../api/api.js';
|
||||
|
||||
// 高德地图 Web API Key(用于逆地址解析,需要去 https://lbs.amap.com 申请免费 Key)
|
||||
const AMAP_KEY = '38cd7fb803c600a58c5a13e644feab34';
|
||||
// const AMAP_KEY = 'f362f595be12ab7d84bd502b48b30d2a';
|
||||
// 天地图 Web API Key(用于逆地址解析)
|
||||
const TIANDITU_KEY = 'b0201708e26cb56e514d74d1686f6f91';
|
||||
|
||||
// 活动ID
|
||||
const activityId = ref('');
|
||||
@@ -86,20 +85,20 @@ const handleTextInput = (e) => {
|
||||
currentLength.value = e.detail.value.length;
|
||||
};
|
||||
|
||||
// 逆地址解析(坐标转地址)
|
||||
// 逆地址解析(坐标转地址)- 天地图 API
|
||||
const reverseGeocode = async (lng, lat) => {
|
||||
if (!AMAP_KEY) return null;
|
||||
if (!TIANDITU_KEY) return null;
|
||||
try {
|
||||
const res = await uni.request({
|
||||
url: 'https://restapi.amap.com/v3/geocode/regeo',
|
||||
url: 'http://api.tianditu.gov.cn/geocoder',
|
||||
data: {
|
||||
key: AMAP_KEY,
|
||||
location: `${lng},${lat}`,
|
||||
extensions: 'base'
|
||||
type: 'rgc',
|
||||
postStr: JSON.stringify({ lon: lng, lat: lat, ver: 1 }),
|
||||
tk: TIANDITU_KEY
|
||||
}
|
||||
});
|
||||
if (res.data?.status === '1' && res.data.regeocode?.formatted_address) {
|
||||
return res.data.regeocode.formatted_address;
|
||||
if (res.data?.status === '0' && res.data.result?.formatted_address) {
|
||||
return res.data.result.formatted_address;
|
||||
}
|
||||
return null;
|
||||
} catch (e) {
|
||||
|
||||
@@ -2,7 +2,7 @@ let baseUrl = '';
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
baseUrl = 'http://192.168.1.222:8080'; // 开发环境
|
||||
} else {
|
||||
baseUrl = 'https://wuyeapi.bugtc.com'; // 生产环境
|
||||
baseUrl = 'https://wuyeapi.ckdzkj.com'; // 生产环境
|
||||
}
|
||||
|
||||
export default function request(url, data = {}, method = "GET") {
|
||||
|
||||
@@ -202,7 +202,7 @@ const getVerifyCode = () => {
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: '网络异常',
|
||||
title: err.msg||'网络异常',
|
||||
icon: 'error'
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user