diff --git a/api/api.js b/api/api.js
index d7ebbd1..0ec8f40 100644
--- a/api/api.js
+++ b/api/api.js
@@ -345,4 +345,20 @@ export function getCateData(data) {
return request.get("diy/category", data, {
noAuth: true
});
+}
+
+/**
+ * 获取所在的地区数据
+ * @param {Object} data
+ */
+export function village(data) {
+ return request.get('v2/system/geo/lst', data, { noAuth: true });
+}
+
+/**
+ * 获取所在的村队数据
+ * @param {Object} data
+ */
+export function brigade(data) {
+ return request.get('v2/system/brigade', data, { noAuth: true });
}
\ No newline at end of file
diff --git a/components/Authorize.vue b/components/Authorize.vue
new file mode 100644
index 0000000..cfb0ef7
--- /dev/null
+++ b/components/Authorize.vue
@@ -0,0 +1,365 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/components/areaWindow/index.vue b/components/areaWindow/index.vue
index aee98a5..d217e3a 100644
--- a/components/areaWindow/index.vue
+++ b/components/areaWindow/index.vue
@@ -29,14 +29,14 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
- // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
+ // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team
// +----------------------------------------------------------------------
import {getAddressList} from '@/api/user.js';
- import { getCityV2 } from '@/api/api.js';
+ import { getCityV2,village } from '@/api/api.js';
import { mapGetters } from "vuex";
const CACHE_ADDRESS = {};
export default {
@@ -45,14 +45,7 @@
type: Boolean,
default: true
},
- cityShow: {
- type: Number,
- default: 3
- },
- address: {
- type:Array | Object,
- default:[]
- },
+ address: Array,
},
data() {
return {
@@ -72,7 +65,7 @@
return this.selectedIndex == -1 ? 0 : this.selectedArr[this.selectedIndex].id
},
showMore(){
- return this.selectedArr.length ? (this.selectedArr[this.selectedArr.length - 1].hasOwnProperty('children') && ((this.cityShow==1 && this.addressList.level<2) || (this.cityShow==2 && this.addressList.level<3) || (this.cityShow==3 && this.addressList.level<4))) : true
+ return this.selectedArr.length ? this.selectedArr[this.selectedArr.length - 1].snum > 0 : true
}
},
watch:{
@@ -94,25 +87,74 @@
this.loadAddress(0)
},
methods: {
- change(pid,index){
+ change(pid){
if(this.selectedIndex == index) return;
if(pid === -1){
pid = this.selectedArr.length ? this.selectedArr[this.selectedArr.length -1].id : 0;
}
+ console.log(index)
this.selectedIndex = index;
this.loadAddress(pid);
},
- loadAddress(pid){
+ loadAddress(pid,type){
if(CACHE_ADDRESS[pid]){
this.addressList = CACHE_ADDRESS[pid];
return ;
}
this.is_loading = true;
- getCityV2(pid).then(res=>{
- this.is_loading = false;
- CACHE_ADDRESS[pid] = res.data;
- this.addressList = res.data;
- })
+ // getCityV2(pid).then(res=>{
+
+ // this.is_loading = false;
+ // CACHE_ADDRESS[pid] = res.data;
+ // this.addressList = res.data;
+ // })
+
+ if(type=='province'){
+
+ village({province_code:pid}).then(res=>{
+ this.is_loading = false;
+ CACHE_ADDRESS[pid] = res.data;
+ this.addressList = res.data;
+
+ })
+ }else if(type=='city'){
+ village({city_code:pid}).then(res=>{
+ this.is_loading = false;
+ CACHE_ADDRESS[pid] = res.data;
+ this.addressList = res.data;
+
+ })
+ }else if(type=='area'){
+ village({area_code:pid}).then(res=>{
+ if(res.data.length>0){
+ this.is_loading = false;
+ CACHE_ADDRESS[pid] = res.data;
+ this.addressList = res.data;
+ }else{
+ this.$emit('submit', [...this.selectedArr]);
+ this.$emit('changeClose');
+ }
+ })
+ }else if(type=='street'){
+ village({street_code:pid}).then(res=>{
+ if(res.data.length>0){
+ this.is_loading = false;
+ CACHE_ADDRESS[pid] = res.data;
+ this.addressList = res.data;
+ }else{
+ this.$emit('submit', [...this.selectedArr]);
+ this.$emit('changeClose');
+ }
+ })
+ }else{
+
+ village().then(res=>{
+ this.is_loading = false;
+ CACHE_ADDRESS[pid] = res.data;
+ this.addressList = res.data;
+ })
+ }
+
this.goTop()
},
selected(item){
@@ -121,17 +163,49 @@
this.selectedArr.splice(this.selectedIndex + 1,999)
this.selectedArr[this.selectedIndex] = item;
this.selectedIndex = -1;
- }else if(!item.parent_id){
+ }
+
+ // else if(!item.parent_id){
+ // this.selectedArr = [item];
+ // }else{
+ // this.selectedArr.push(item);
+ // }
+ else if(!item.id){
this.selectedArr = [item];
}else{
- this.selectedArr.push(item);
+
+ if(this.selectedArr.length>4){
+ let arry=[]
+ arry.push(item)
+ this.selectedArr=arry
+ }else{
+ this.selectedArr.push(item);
+ }
+
+
}
- if(item.snum && ((this.cityShow==1 && this.addressList[0].level<2) || (this.cityShow==2 && this.addressList[0].level<3) || (this.cityShow==3 && this.addressList[0].level<4))){
- this.loadAddress(item.id);
+
+ if(item.type=="province"){
+
+ this.loadAddress(item.code,"province");
+
+ }else if(item.type=="city"){
+ this.loadAddress(item.code,"city");
+ }else if(item.type=="area"){
+ this.loadAddress(item.code,"area");
+ }else if(item.type=="street"){
+ this.loadAddress(item.code,"street");
} else {
this.$emit('submit', [...this.selectedArr]);
this.$emit('changeClose');
}
+
+ // if(item.snum){
+ // this.loadAddress(item.id);
+ // } else {
+ // this.$emit('submit', [...this.selectedArr]);
+ // this.$emit('changeClose');
+ // }
this.goTop()
},
close: function() {
@@ -141,10 +215,10 @@
this.old.scrollTop = e.detail.scrollTop
},
goTop: function(e) {
- this.scrollTop = this.old.scrollTop
- this.$nextTick(() => {
- this.scrollTop = 0
- });
+ this.scrollTop = this.old.scrollTop
+ this.$nextTick(() => {
+ this.scrollTop = 0
+ });
}
}
}
diff --git a/components/villageTeam/villageTeam.vue b/components/villageTeam/villageTeam.vue
new file mode 100644
index 0000000..0cd0015
--- /dev/null
+++ b/components/villageTeam/villageTeam.vue
@@ -0,0 +1,261 @@
+
+
+
+ 请选择所在村队
+
+
+
+ {{item.name}}
+
+
+
+
+ 请选择
+
+
+
+
+ {{item.name}}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/config/app.js b/config/app.js
index 7af22ad..de184c3 100644
--- a/config/app.js
+++ b/config/app.js
@@ -15,7 +15,7 @@ let openPlantGrass = '-openPlantGrass-'
// 网络接口修改此字符 小程序域名要求https
// let httpApi = 'http://192.168.31.106:8324' //测试
-let httpApi = 'https://test.shop.lihaink.cn/' //生产
+let httpApi = 'https://test.shop.lihaink.cn' //生产
// 聊天接口修改此字符 小程序聊天要求wss 例如:wss://mer.crmeb.net
// let wsApi = 'ws://192.168.3.20:8324'
diff --git a/pages/users/user_address/index.vue b/pages/users/user_address/index.vue
index 070d788..338bfa7 100644
--- a/pages/users/user_address/index.vue
+++ b/pages/users/user_address/index.vue
@@ -5,47 +5,70 @@
姓名
-
+
联系电话
-
+
所在地区
- 请选择地址
+ 请选择地区
{{addressText}}
-
+
+
+
+
+ 所在村队
+
+
+ 请选择村队
+ {{villageText}}
+
+
+
+
详细地址
-
-
+
+
+
- 设置为默认地址
+ 设置为默认地址
+
-
+
+
导入微信地址
- 导入微信地址
+ 导入微信地址
+
-
+
+
+
+
@@ -53,21 +76,35 @@
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
- // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
+ // | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team
// +----------------------------------------------------------------------
- import { editAddress, getAddressDetail } from '@/api/user.js';
- import { getCityV2, getCityList } from '@/api/api.js';
- import { mapGetters } from "vuex";
+ import {
+ editAddress,
+ getAddressDetail
+ } from '@/api/user.js';
+ import { wgsToGcj } from "@/utils/wgs.js";
+ import {
+ getCityV2,
+ getCityList
+ } from '@/api/api.js';
+ import {
+ mapGetters
+ } from "vuex";
import areaWindow from '@/components/areaWindow';
- import { getGeocoder } from '@/api/store.js';
- import { toLogin } from '@/libs/login.js';
+ import villageTeam from '@/components/villageTeam/villageTeam.vue';
+ import {
+ getGeocoder
+ } from '@/api/store.js';
+ import authorize from '@/components/Authorize';
export default {
components: {
areaWindow,
+ authorize,
+ villageTeam
},
data() {
return {
@@ -75,26 +112,33 @@
pinkId: 0, //拼团id
couponId: 0, //优惠券id
address_id: 0, //地址id
- productType: 0,
userAddress: {
is_default: false
}, //地址详情
region: ['省', '市', '区'],
valueRegion: [0, 0, 0],
+ isAuto: false, //没有授权的不会自动授权
+ isShowAuth: false, //是否隐藏授权
district: [],
multiArray: [],
multiIndex: [0, 0, 0],
cityId: 0,
display: false,
- addressInfo:[],
+ display_one: false,
+ addressInfo: [],
+ villageInfo: [],
+ list: [],
latitude: '',
- longitude: '',
- loading: false
+ longitude: ''
};
},
- computed: {...mapGetters(['isLogin','viewColor']),
- addressText(){
- return this.addressInfo.map(v=>v.name).join('/');
+ computed: {
+ ...mapGetters(['isLogin', 'viewColor']),
+ addressText() {
+ return this.addressInfo.map(v => v.name).join('/');
+ },
+ villageText() {
+ return this.villageInfo.map(v => v.name).join('/');
}
},
onLoad(options) {
@@ -103,19 +147,24 @@
this.pinkId = options.pinkId || 0;
this.couponId = options.couponId || 0;
this.address_id = options.id || 0;
- this.productType = options.product_type || 0;
uni.setNavigationBarTitle({
title: options.id ? '修改地址' : '添加地址'
})
this.getUserAddress();
this.getCityList();
} else {
- toLogin()
+ this.isAuto = true;
+ this.isShowAuth = true
}
},
methods: {
- OnChangeAddress(address){
+ OnChangeAddress(address) {
this.addressInfo = address;
+ this.list = address
+ },
+ OnChangevAddress(address) {
+ this.villageInfo = address;
+ console.log(this.villageInfo)
},
// 地址数据
getCityList: function() {
@@ -124,13 +173,28 @@
this.district = res.data
})
},
- changeRegion(){
+ changeRegion() {
this.display = true;
},
+ changevillage() {
+ this.display_one = true;
+ },
// 关闭地址弹窗;
changeClose: function() {
this.display = false;
},
+ changevClose: function() {
+ this.display_one = false;
+ },
+ // 授权回调
+ onLoadFun: function() {
+ this.isShowAuth = false;
+ this.getUserAddress();
+ },
+ // 授权关闭
+ authColse: function(e) {
+ this.isShowAuth = e
+ },
toggleTab(str) {
this.$refs[str].show();
},
@@ -141,11 +205,14 @@
if (!this.address_id) return false;
let that = this;
getAddressDetail(this.address_id).then(res => {
- let region = [res.data.province, res.data.city, res.data.district];
+ let region = [res.data.province, res.data.city, res.data.district, res.data.street, res
+ .data.village
+ ];
that.$set(that, 'userAddress', res.data);
that.$set(that, 'region', region);
that.city_id = res.data.city_id
- that.addressInfo = res.data.area
+ that.addressInfo = res.data.areas
+ that.villageInfo = [res.data.brigade]
});
},
// 导入共享地址(小程序)
@@ -156,7 +223,8 @@
success: function(res) {
uni.chooseAddress({
success: function(res) {
- getCityList(res.provinceName+'/'+res.cityName+'/'+res.countyName).then(res=>{
+ getCityList(res.provinceName + '/' + res.cityName + '/' + res
+ .countyName).then(res => {
that.addressInfo = res.data;
})
that.userAddress.real_name = res.userName;
@@ -169,9 +237,10 @@
icon: 'none',
duration: 1000
});
- if (res.errMsg == 'chooseAddress:cancel') return that.$util.Tips({
- title: '取消选择'
- });
+ if (res.errMsg == 'chooseAddress:cancel') return that.$util
+ .Tips({
+ title: '取消选择'
+ });
},
})
},
@@ -198,14 +267,14 @@
getAddress() {
let that = this;
that.$wechat.openAddress().then(res => {
- getCityList(res.provinceName+'/'+res.cityName+'/'+res.countryName).then(res=>{
+ getCityList(res.provinceName + '/' + res.cityName + '/' + res.countryName).then(res => {
that.addressInfo = res.data;
})
that.userAddress.real_name = res.userName;
that.userAddress.phone = res.telNumber;
that.userAddress.detail = res.detailInfo;
}).catch(err => {
- console.log(err);
+ // console.log(err);
});
},
selfLocation() {
@@ -214,9 +283,11 @@
title: '定位中',
mask: true,
});
+ if (uni.getStorageSync('RejectTarget')) return
uni.getLocation({
- type: 'gcj02',
+ type: 'wgs84',
success: (res) => {
+ res = wgsToGcj(res);
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
@@ -227,11 +298,15 @@
long: longitude
}).then(res => {
const data = res.data;
- getCityList(data.address_component.province+'/'+data.address_component.city+'/'+data.address_component.district+'/'+(!data.address_reference.town ? '' : data.address_reference.town.title)).then(res=>{
+ getCityList(data.address_component.province + '/' + data.address_component
+ .city + '/' + data.address_component.district + '/' + (!data
+ .address_reference.town ? '' : data.address_reference.town
+ .title)).then(res => {
self.addressInfo = res.data;
- self.$set(self.userAddress, 'detail', data.formatted_addresses.recommend);
+ self.$set(self.userAddress, 'detail', data.formatted_addresses
+ .recommend);
uni.hideLoading();
- }).catch(e=>{
+ }).catch(e => {
uni.hideLoading();
uni.showToast({
title: '定位失败,请手动输入地址',
@@ -239,7 +314,7 @@
duration: 1000
});
})
- }).catch(e=>{
+ }).catch(e => {
uni.hideLoading();
uni.showToast({
title: '定位失败,请手动输入地址',
@@ -277,19 +352,23 @@
if (!that.addressInfo.length) return that.$util.Tips({
title: '请选择所在地区'
});
+ if (!that.villageInfo.length) return that.$util.Tips({
+ title: '请选择所在村队'
+ });
if (!value.detail) return that.$util.Tips({
title: '请填写详细地址'
});
value.address_id = that.address_id;
value.is_default = that.userAddress.is_default ? 1 : 0;
value.area = that.addressInfo;
+ value.brigade = that.villageInfo[0]
+
uni.showLoading({
title: '保存中',
mask: true
})
- that.loading = true;
editAddress(value).then(res => {
- if (that.address_id)
+ if (that.id)
that.$util.Tips({
title: '修改成功',
icon: 'success'
@@ -308,17 +387,12 @@
that.pinkId = '';
that.couponId = '';
uni.$emit('updataAddress')
- if(that.productType == 20){
- uni.navigateTo({
- url: '/pages/points_mall/integral_order?cartId=' + cartId + '&addressId=' + (that.id ? that.id : res.data
- .address_id) + '&pinkId=' + pinkId + '&couponId=' + couponId
- });
- }else{
- uni.navigateTo({
- url: '/pages/users/order_confirm/index?cartId=' + cartId + '&addressId=' + (that.id ? that.id : res.data
- .address_id) + '&pinkId=' + pinkId + '&couponId=' + couponId
- });
- }
+ uni.navigateTo({
+ url: '/pages/users/order_confirm/index?cartId=' + cartId +
+ '&addressId=' + (that.id ? that.id : res.data
+ .address_id) + '&pinkId=' + pinkId + '&couponId=' +
+ couponId
+ });
} else {
// #ifdef H5
return history.back();
@@ -329,10 +403,8 @@
})
// #endif
}
- that.loading = false;
}, 1000);
}).catch(err => {
- that.loading = false;
return that.$util.Tips({
title: err
});
@@ -348,74 +420,92 @@
+
\ No newline at end of file
diff --git a/pages/users/user_spread_user/index.vue b/pages/users/user_spread_user/index.vue
index abe35f4..ae3106d 100644
--- a/pages/users/user_spread_user/index.vue
+++ b/pages/users/user_spread_user/index.vue
@@ -47,14 +47,14 @@
推广人订单
-
+
diff --git a/utils/WSCoordinate.js b/utils/WSCoordinate.js
new file mode 100644
index 0000000..1332765
--- /dev/null
+++ b/utils/WSCoordinate.js
@@ -0,0 +1,147 @@
+/**
+ * 判断经纬度是否超出中国境内
+ */
+function isLocationOutOfChina(latitude, longitude) {
+ if (longitude < 72.004 || longitude > 137.8347 || latitude < 0.8293 || latitude > 55.8271)
+ return true;
+ return false;
+}
+
+
+/**
+ * 将WGS-84(国际标准)转为GCJ-02(火星坐标):
+ */
+function transformFromWGSToGCJ(latitude, longitude) {
+ var lat = "";
+ var lon = "";
+ var ee = 0.00669342162296594323;
+ var a = 6378245.0;
+ var pi = 3.14159265358979324;
+
+ if (isLocationOutOfChina(latitude, longitude)) {
+ lat = latitude;
+ lon = longitude;
+ }
+ else {
+ var adjustLat = transformLatWithXY(longitude - 105.0, latitude - 35.0);
+ var adjustLon = transformLonWithXY(longitude - 105.0, latitude - 35.0);
+ var radLat = latitude / 180.0 * pi;
+ var magic = Math.sin(radLat);
+ magic = 1 - ee * magic * magic;
+ var sqrtMagic = Math.sqrt(magic);
+ adjustLat = (adjustLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * pi);
+ adjustLon = (adjustLon * 180.0) / (a / sqrtMagic * Math.cos(radLat) * pi);
+ latitude = latitude + adjustLat;
+ longitude = longitude + adjustLon;
+ }
+ return { latitude: latitude, longitude: longitude };
+
+}
+
+/**
+ * 将GCJ-02(火星坐标)转为百度坐标:
+ */
+function transformFromGCJToBaidu(latitude, longitude) {
+ var pi = 3.14159265358979324 * 3000.0 / 180.0;
+
+ var z = Math.sqrt(longitude * longitude + latitude * latitude) + 0.00002 * Math.sin(latitude * pi);
+ var theta = Math.atan2(latitude, longitude) + 0.000003 * Math.cos(longitude * pi);
+ var a_latitude = (z * Math.sin(theta) + 0.006);
+ var a_longitude = (z * Math.cos(theta) + 0.0065);
+
+ return { latitude: a_latitude, longitude: a_longitude };
+}
+
+/**
+ * 将百度坐标转为GCJ-02(火星坐标):
+ */
+function transformFromBaiduToGCJ(latitude, longitude) {
+ var xPi = 3.14159265358979323846264338327950288 * 3000.0 / 180.0;
+
+ var x = longitude - 0.0065;
+ var y = latitude - 0.006;
+ var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * xPi);
+ var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * xPi);
+ var a_latitude = z * Math.sin(theta);
+ var a_longitude = z * Math.cos(theta);
+
+ return { latitude: a_latitude, longitude: a_longitude };
+}
+
+/**
+ * 将GCJ-02(火星坐标)转为WGS-84:
+ */
+function transformFromGCJToWGS(latitude, longitude) {
+ var threshold = 0.00001;
+
+ // The boundary
+ var minLat = latitude - 0.5;
+ var maxLat = latitude + 0.5;
+ var minLng = longitude - 0.5;
+ var maxLng = longitude + 0.5;
+
+ var delta = 1;
+ var maxIteration = 30;
+
+ while (true) {
+ var leftBottom = transformFromWGSToGCJ(minLat, minLng);
+ var rightBottom = transformFromWGSToGCJ(minLat, maxLng);
+ var leftUp = transformFromWGSToGCJ(maxLat, minLng);
+ var midPoint = transformFromWGSToGCJ((minLat + maxLat) / 2, (minLng + maxLng) / 2);
+ delta = Math.abs(midPoint.latitude - latitude) + Math.abs(midPoint.longitude - longitude);
+
+ if (maxIteration-- <= 0 || delta <= threshold) {
+ return { latitude: (minLat + maxLat) / 2, longitude: (minLng + maxLng) / 2 };
+ }
+
+ if (isContains({ latitude: latitude, longitude: longitude }, leftBottom, midPoint)) {
+ maxLat = (minLat + maxLat) / 2;
+ maxLng = (minLng + maxLng) / 2;
+ }
+ else if (isContains({ latitude: latitude, longitude: longitude }, rightBottom, midPoint)) {
+ maxLat = (minLat + maxLat) / 2;
+ minLng = (minLng + maxLng) / 2;
+ }
+ else if (isContains({ latitude: latitude, longitude: longitude }, leftUp, midPoint)) {
+ minLat = (minLat + maxLat) / 2;
+ maxLng = (minLng + maxLng) / 2;
+ }
+ else {
+ minLat = (minLat + maxLat) / 2;
+ minLng = (minLng + maxLng) / 2;
+ }
+ }
+
+}
+
+function isContains(point, p1, p2) {
+ return (point.latitude >= Math.min(p1.latitude, p2.latitude) && point.latitude <= Math.max(p1.latitude, p2.latitude)) && (point.longitude >= Math.min(p1.longitude, p2.longitude) && point.longitude <= Math.max(p1.longitude, p2.longitude));
+}
+
+function transformLatWithXY(x, y) {
+ var pi = 3.14159265358979324;
+ var lat = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
+ lat += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+ lat += (20.0 * Math.sin(y * pi) + 40.0 * Math.sin(y / 3.0 * pi)) * 2.0 / 3.0;
+ lat += (160.0 * Math.sin(y / 12.0 * pi) + 320 * Math.sin(y * pi / 30.0)) * 2.0 / 3.0;
+ return lat;
+}
+
+function transformLonWithXY(x, y) {
+ var pi = 3.14159265358979324;
+ var lon = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
+ lon += (20.0 * Math.sin(6.0 * x * pi) + 20.0 * Math.sin(2.0 * x * pi)) * 2.0 / 3.0;
+ lon += (20.0 * Math.sin(x * pi) + 40.0 * Math.sin(x / 3.0 * pi)) * 2.0 / 3.0;
+ lon += (150.0 * Math.sin(x / 12.0 * pi) + 300.0 * Math.sin(x / 30.0 * pi)) * 2.0 / 3.0;
+ return lon;
+}
+
+
+
+module.exports = {
+ isLocationOutOfChina: isLocationOutOfChina,
+ transformFromWGSToGCJ: transformFromWGSToGCJ,
+ transformFromGCJToBaidu: transformFromGCJToBaidu,
+ transformFromBaiduToGCJ: transformFromBaiduToGCJ,
+ transformFromGCJToWGS: transformFromGCJToWGS
+}
\ No newline at end of file
diff --git a/utils/wgs.js b/utils/wgs.js
new file mode 100644
index 0000000..13e4dc2
--- /dev/null
+++ b/utils/wgs.js
@@ -0,0 +1,14 @@
+const util = require('./WSCoordinate.js')
+
+export const wgsToGcj = (data)=>{
+ try{
+ let d = data;
+ //将WGS-84(国际标准)转为GCJ-02(火星坐标)
+ let e = util.transformFromWGSToGCJ(data.latitude, data.longitude);
+ d.latitude = e.latitude;
+ d.longitude = e.longitude;
+ return d;
+ }catch(e){
+ return data;
+ }
+}
\ No newline at end of file