diff --git a/index.html b/index.html
index 470262f..c13c0de 100644
--- a/index.html
+++ b/index.html
@@ -10,6 +10,8 @@
(coverSupport ? ', viewport-fit=cover' : '') + '" />')
苏州市导游协会
+
+
diff --git a/manifest.json b/manifest.json
index 6f117ab..47395eb 100644
--- a/manifest.json
+++ b/manifest.json
@@ -99,7 +99,7 @@
"key" : "4QQBZ-35LWQ-7725U-45ZGA-MIB5E-ZXBEA"
},
"tencent" : {
- "key" : "YVOBZ-MWJ3Z-34IXK-7J2GL-O33US-QLF5X"
+ "key" : "XCJBZ-XJVL5-JCYID-IYEOP-AM7I2-2CF7E"
}
}
}
diff --git a/pages/index/index.vue b/pages/index/index.vue
index ed23293..121689f 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -85,6 +85,13 @@
isChecked: false
}],
isAllChecked: false,
+ // 打卡中心点经纬度
+ fenceCenter: {
+ latitude: 31.266909,
+ longitude: 120.633401
+ },
+ // 打卡点半径(单位:米)
+ fenceRadius: 500
}
},
onLoad() {
@@ -100,6 +107,7 @@
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(
(position) => {
+ // 获取到定位信息说明浏览器支持定位
const coords = position.coords;
console.log('纬度: ', coords.latitude);
console.log('经度: ', coords.longitude);
@@ -108,6 +116,9 @@
console.log('高度精度: ', coords.altitudeAccuracy);
console.log('移动方向: ', coords.heading);
console.log('移动速度: ', coords.speed);
+ const [gcj02Lng, gcj02Lat] = this.wgs84ToGcj02(coords.longitude, coords.latitude);
+ console.log('转换后的 GCJ - 02 经度:', gcj02Lng);
+ console.log('转换后的 GCJ - 02 纬度:', gcj02Lat);
},
(error) => {
let locationStatus = ''
@@ -141,6 +152,46 @@
})
}
},
+ // WGS84坐标转换为GCJ-02坐标
+ // 判断是否在中国范围内
+ outOfChina(lng, lat) {
+ return (lng < 72.004 || lng > 137.8347) || (lat < 0.8293 || lat > 55.8271);
+ },
+ // 转换纬度
+ transformLat(x, y) {
+ let ret = -100.0 + 2.0 * x + 3.0 * y + 0.2 * y * y + 0.1 * x * y + 0.2 * Math.sqrt(Math.abs(x));
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
+ ret += (20.0 * Math.sin(y * Math.PI) + 40.0 * Math.sin(y / 3.0 * Math.PI)) * 2.0 / 3.0;
+ ret += (160.0 * Math.sin(y / 12.0 * Math.PI) + 320 * Math.sin(y * Math.PI / 30.0)) * 2.0 / 3.0;
+ return ret;
+ },
+ // 转换经度
+ transformLng(x, y) {
+ let ret = 300.0 + x + 2.0 * y + 0.1 * x * x + 0.1 * x * y + 0.1 * Math.sqrt(Math.abs(x));
+ ret += (20.0 * Math.sin(6.0 * x * Math.PI) + 20.0 * Math.sin(2.0 * x * Math.PI)) * 2.0 / 3.0;
+ ret += (20.0 * Math.sin(x * Math.PI) + 40.0 * Math.sin(x / 3.0 * Math.PI)) * 2.0 / 3.0;
+ ret += (150.0 * Math.sin(x / 12.0 * Math.PI) + 300.0 * Math.sin(x / 30.0 * Math.PI)) * 2.0 / 3.0;
+ return ret;
+ },
+ // WGS84 转换为 GCJ02
+ wgs84ToGcj02(lng, lat) {
+ const a = 6378245.0; // 地球长半轴
+ const ee = 0.00669342162296594323; // 扁率
+ if (this.outOfChina(lng, lat)) {
+ return [lng, lat];
+ }
+ let dLat = this.transformLat(lng - 105.0, lat - 35.0);
+ let dLng = this.transformLng(lng - 105.0, lat - 35.0);
+ const radLat = lat / 180.0 * Math.PI;
+ let magic = Math.sin(radLat);
+ magic = 1 - ee * magic * magic;
+ const sqrtMagic = Math.sqrt(magic);
+ dLat = (dLat * 180.0) / ((a * (1 - ee)) / (magic * sqrtMagic) * Math.PI);
+ dLng = (dLng * 180.0) / (a / sqrtMagic * Math.cos(radLat) * Math.PI);
+ const mgLat = lat + dLat;
+ const mgLng = lng + dLng;
+ return [mgLng, mgLat];
+ },
goHX() {
uni.switchTab({
url: '/pages/verification/index'
diff --git a/unpackage/dist/build/web/index.html b/unpackage/dist/build/web/index.html
index 56f8502..cac3f58 100644
--- a/unpackage/dist/build/web/index.html
+++ b/unpackage/dist/build/web/index.html
@@ -1,2 +1,2 @@
daoyou
\ No newline at end of file
+ document.write('')