1.优惠券接口联调

sws 2024-09-03
v1.0.0
sws 2024-09-04 11:49:28 +08:00
parent 4c73dd1715
commit d46af781ce
1 changed files with 15 additions and 15 deletions

View File

@ -56,21 +56,21 @@ export default defineComponent({
let script = document.createElement('script');
script.type = 'text/javascript';
script.className = 'loadmap'; // script
if (props.type === '1') {
if (props.type === 'tianditu') {
//
script.src = `https://api.tianditu.gov.cn/api?v=4.0&tk=${common_tianditu_map_ak || 'bf0676d6b99ee6f7f917640a54af0415'}`;
} else if (props.type === '2') {
} else if (props.type === 'baidu') {
//
script.src = `https://api.map.baidu.com/getscript?v=3.0&ak=${common_baidu_map_ak || 'XSdiGjfg3wOHiKjpYEMG6CYA'}`;
} else if (props.type === '3') {
} else if (props.type === 'tencent') {
//
script.src = `https://map.qq.com/api/js?v=2.exp&key=${common_tencent_map_ak || 'IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA'}&callback=init`;
} else if (props.type === '4') {
} else if (props.type === 'amap') {
//
script.src = `https://webapi.amap.com/maps?v=2.0&key=${common_amap_map_ak || '3e92c6bfdd5ddb4aac39ed5e4d0db663'}`;
}
// 使script.onload
if (props.type === '3') {
if (props.type === 'tencent') {
window.init = () => {
init();
};
@ -87,7 +87,7 @@ export default defineComponent({
document.body.removeChild(loadmap[i]);
}
}
if (props.type === '4') {
if (props.type === 'amap') {
window._AMapSecurityConfig = {
securityJsCode: common_amap_map_safety_ak || '6d68c17c7b2a96a0616b1b8c371f391f',
};
@ -100,7 +100,7 @@ export default defineComponent({
let script = document.createElement('script');
script.type = 'text/javascript';
script.className = 'loadmap2'; // script
script.src = 'https://map.qq.com/api/gljs?v=1.exp&key=IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA&libraries=service';
script.src = `https://map.qq.com/api/gljs?v=1.exp&key=${common_tencent_map_ak || 'IMYBZ-QJ6C3-QPZ3Y-OUKL6-IVU5S-ZYBKA'}&libraries=service`;
let loadmap2 = document.getElementsByClassName('loadmap2');
if (loadmap2) {
// append scriptscript
@ -113,7 +113,7 @@ export default defineComponent({
//
const init = () => {
switch (props.type) {
case '1':
case 'tianditu':
const T = window.T;
//
map.value = new T.Map('map');
@ -142,7 +142,7 @@ export default defineComponent({
});
}
break;
case '2':
case 'baidu':
const BMap = window.BMap;
map.value = new BMap.Map('map', {
enableMapClick: false,
@ -176,7 +176,7 @@ export default defineComponent({
cr.addCopyright({ id: 1, content: '<div class="map-dragging-tips"><span>' + '拖动红色图标直接定位' + '</span></div>', bounds: bs });
}
break;
case '3':
case 'tencent':
const qq_maps = window.qq.maps;
let point3 = new qq_maps.LatLng(lat.value, lng.value);
map.value = new qq_maps.Map('map', {
@ -195,7 +195,7 @@ export default defineComponent({
context.emit('point', lng, lat);
});
break;
case '4':
case 'amap':
const AMap = window.AMap;
map.value = new AMap.Map('map', {
zoomEnable: true,
@ -231,7 +231,7 @@ export default defineComponent({
};
const map_event = (value) => {
switch (props.type) {
case '1':
case 'tianditu':
let geo = new T.Geocoder();
geo.getPoint(value, function (result) {
let point = result.getLocationPoint();
@ -246,7 +246,7 @@ export default defineComponent({
}
});
break;
case '2':
case 'baidu':
//
let geo2 = new window.BMap.Geocoder();
// ,
@ -265,7 +265,7 @@ export default defineComponent({
'全国'
);
break;
case '3':
case 'tencent':
let geo3 = new TMap.service.Geocoder();
geo3.getLocation({ address: value }).then((result) => {
let lnglat = result.result.location;
@ -275,7 +275,7 @@ export default defineComponent({
context.emit('point', lng.value, lat.value);
});
break;
case '4':
case 'amap':
AMap.plugin('AMap.Geocoder', () => {
new AMap.Geocoder().getLocation(value, (status, result) => {
if (status === 'complete' && result.geocodes.length) {