Browse Source

打包

master
chenkainan 8 months ago
parent
commit
018ae68cb2
  1. 3
      index.html
  2. 6
      manifest.json
  3. 65
      pages/index/index.vue
  4. 18
      static/js/CommonFunction.js
  5. 2
      unpackage/dist/build/web/index.html
  6. 18
      unpackage/dist/build/web/static/js/CommonFunction.js
  7. 1
      unpackage/dist/build/web/static/js/index.b3427730.js
  8. 1
      unpackage/dist/build/web/static/js/index.b95df864.js
  9. 1
      unpackage/dist/build/web/static/js/pages-index-index.38b31820.js
  10. 1
      unpackage/dist/build/web/static/js/pages-index-index.cf656599.js

3
index.html

@ -2,6 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<script src="https://map.qq.com/api/js?v=2.exp&key=XCJBZ-XJVL5-JCYID-IYEOP-AM7I2-2CF7E"></script>
<script> <script>
var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') ||
CSS.supports('top: constant(a)')) CSS.supports('top: constant(a)'))
@ -10,8 +11,6 @@
(coverSupport ? ', viewport-fit=cover' : '') + '" />') (coverSupport ? ', viewport-fit=cover' : '') + '" />')
</script> </script>
<title>苏州市导游协会</title> <title>苏州市导游协会</title>
<!-- 引入腾讯地图 SDK -->
<script src="https://map.qq.com/api/js?v=2.exp&key=XCJBZ-XJVL5-JCYID-IYEOP-AM7I2-2CF7E"></script>
<!--preload-links--> <!--preload-links-->
<!--app-context--> <!--app-context-->
</head> </head>

6
manifest.json

@ -98,8 +98,10 @@
"qqmap" : { "qqmap" : {
"key" : "4QQBZ-35LWQ-7725U-45ZGA-MIB5E-ZXBEA" "key" : "4QQBZ-35LWQ-7725U-45ZGA-MIB5E-ZXBEA"
}, },
"tencent" : { "amap" : {
"key" : "XCJBZ-XJVL5-JCYID-IYEOP-AM7I2-2CF7E" "key" : "94570d4c90f67403af4f7ecc0e7fc136",
"securityJsCode" : "b8bc46fc1358ec6a16e8236518ffbdc9",
"serviceHost" : ""
} }
} }
} }

65
pages/index/index.vue

@ -85,13 +85,21 @@
isChecked: false isChecked: false
}], }],
isAllChecked: false, isAllChecked: false,
// 广 //
fenceCenter: { fenceCenter: [
latitude: 31.267166, {latitude: 31.267166, longitude: 120.632449}, // 广
longitude: 120.632449 {latitude: 31.266902, longitude: 120.630162}, //
}, {latitude: 31.266841, longitude: 120.628526},
{latitude: 31.26576, longitude: 120.629256}
],
//
nearestFenceIndex: null,
// //
fenceRadius: 500 fenceRadius: 500,
//
distance: null,
// watchPosition 便
watchId: null
} }
}, },
onLoad() { onLoad() {
@ -99,22 +107,38 @@
this.getList() this.getList()
}, },
onShow() { onShow() {
this.checkLocation() //
this.watchLocation()
},
onHide() {
//
if (this.watchId) {
navigator.geolocation.clearWatch(this.watchId)
}
}, },
methods: { methods: {
// //
checkLocation() { watchLocation() {
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition( this.watchId = navigator.geolocation.watchPosition(
(position) => { (position) => {
//
const coords = position.coords; const coords = position.coords;
console.log('纬度: ', coords.latitude);
console.log('经度: ', coords.longitude);
const [gcj02Lng, gcj02Lat] = this.wgs84ToGcj02(coords.longitude, coords.latitude); const [gcj02Lng, gcj02Lat] = this.wgs84ToGcj02(coords.longitude, coords.latitude);
console.log('转换后的 GCJ - 02 经度:', gcj02Lng); //
console.log('转换后的 GCJ - 02 纬度:', gcj02Lat); let minDistance = Infinity;
console.log(this.isInsideFence(gcj02Lat, gcj02Lng)); let nearestIndex = null;
this.fenceCenter.forEach(i => {
const distance = this.calculateDistance(item.latitude,item.longitude, gcj02Lat, gcj02Lng)
console.log(distance)
if (distance < minDistance) {
minDistance = distance;
nearestIndex = index;
}
})
this.distance = minDistance;
this.nearestFenceIndex = nearestIndex;
console.log('用户与最近打卡点之间的距离',this.distance)
console.log('最近的打卡点索引', this.nearestFenceIndex);
}, },
(error) => { (error) => {
let locationStatus = '' let locationStatus = ''
@ -146,15 +170,6 @@
}) })
} }
}, },
isInsideFence(lat, lng) {
//
const userPoint = new qq.maps.LatLng(lat, lng);
const centerPoint = new qq.maps.LatLng(this.fenceCenter.latitude, this.fenceCenter.longitude);
//
const distance = qq.maps.geometry.spherical.computeDistanceBetween(userPoint, centerPoint);
console.log('用户位置与围栏中心点的距离',distance)
return distance <= this.fenceRadius;
},
// WGS84GCJ-02 // WGS84GCJ-02
// //
outOfChina(lng, lat) { outOfChina(lng, lat) {

18
static/js/CommonFunction.js

@ -167,6 +167,22 @@ Vue.prototype.ShowDateDay = day => {
} }
// 手机号显示加密 // 手机号显示加密
Vue.prototype.encryptPhone = (phone) =>{ Vue.prototype.encryptPhone = (phone) => {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
} }
// 计算两个经纬度间的距离
Vue.prototype.calculateDistance = (lat1, lon1, lat2, lon2) => {
const R = 6371e3; // 地球半径,单位:米
const φ1 = lat1 * (Math.PI / 180);
const φ2 = lat2 * (Math.PI / 180);
const Δφ = (lat2 - lat1) * (Math.PI / 180);
const Δλ = (lon2 - lon1) * (Math.PI / 180);
const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
Math.cos(φ1) * Math.cos(φ2) *
Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c;
}

2
unpackage/dist/build/web/index.html

@ -1,2 +1,2 @@
<!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>daoyou</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)')) <!DOCTYPE html><html lang=zh-CN><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><title>daoyou</title><script>var coverSupport = 'CSS' in window && typeof CSS.supports === 'function' && (CSS.supports('top: env(a)') || CSS.supports('top: constant(a)'))
document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.27f6cb6a.js></script><script src=/static/js/index.b3427730.js></script></body></html> document.write('<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0' + (coverSupport ? ', viewport-fit=cover' : '') + '" />')</script><link rel=stylesheet href=/static/index.2da1efab.css></head><body><noscript><strong>Please enable JavaScript to continue.</strong></noscript><div id=app></div><script src=/static/js/chunk-vendors.27f6cb6a.js></script><script src=/static/js/index.b95df864.js></script></body></html>

18
unpackage/dist/build/web/static/js/CommonFunction.js

@ -167,6 +167,22 @@ Vue.prototype.ShowDateDay = day => {
} }
// 手机号显示加密 // 手机号显示加密
Vue.prototype.encryptPhone = (phone) =>{ Vue.prototype.encryptPhone = (phone) => {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2'); return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
} }
// 计算两个经纬度间的距离
Vue.prototype.calculateDistance = (lat1, lon1, lat2, lon2) => {
const R = 6371e3; // 地球半径,单位:米
const φ1 = lat1 * (Math.PI / 180);
const φ2 = lat2 * (Math.PI / 180);
const Δφ = (lat2 - lat1) * (Math.PI / 180);
const Δλ = (lon2 - lon1) * (Math.PI / 180);
const a = Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
Math.cos(φ1) * Math.cos(φ2) *
Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
return R * c;
}

1
unpackage/dist/build/web/static/js/index.b3427730.js

File diff suppressed because one or more lines are too long

1
unpackage/dist/build/web/static/js/index.b95df864.js

File diff suppressed because one or more lines are too long

1
unpackage/dist/build/web/static/js/pages-index-index.38b31820.js

File diff suppressed because one or more lines are too long

1
unpackage/dist/build/web/static/js/pages-index-index.cf656599.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save