Browse Source

fix:地图缩放等级修改\n打卡定位修改

remotes/origin/HEAD
wally 5 years ago
parent
commit
d48a0b4897
  1. 2
      components/history-map/history-map.vue
  2. 14
      pages.json
  3. 26
      pages/sign/sign.vue

2
components/history-map/history-map.vue

@ -7,7 +7,7 @@
:polyline="polyline"
id="map"
ref="map"
scale="12"
scale="17"
show-location="true"
style="width: 100%; min-height: 1000rpx;height:100%"
/>

14
pages.json

@ -3,7 +3,13 @@
{
"path": "pages/index/index",
"style": {
"navigationBarTitleText": "山大健康码"
"navigationBarTitleText": "山大健康码"
}
},
{
"path": "pages/sign/sign",
"style": {
"navigationBarTitleText": "打卡"
}
},
{
@ -19,12 +25,6 @@
"path": "pages/my-signs/my-signs",
"style": { "navigationBarTitleText": "我的校园打卡" }
},
{
"path": "pages/sign/sign",
"style": {
"navigationBarTitleText": "打卡"
}
},
{
"path": "pages/get-code/get-code",

26
pages/sign/sign.vue

@ -17,6 +17,7 @@
<script>
import { mapState, mapActions } from 'vuex';
import { formatQuery } from 'utils/util';
import { showToast, showLoading, hideLoading, showModal } from 'utils/ui';
import { SCAN_SIGN } from 'api/api';
export default {
@ -27,9 +28,9 @@ export default {
siteName: '',
success: false,
type: 0, // 0 / 1
timer: null,
latitude: 37.80079,
longitude: 112.58679,
timer: null,
latitude: '',
longitude: '',
};
},
@ -42,8 +43,8 @@ export default {
},
onLoad(options) {
this.init(options);
this.getLocation();
this.init(options);
},
methods: {
@ -82,18 +83,24 @@ export default {
this.getSiteByQrId(params);
}
},
//
// mapgcj02
getLocation() {
showLoading();
uni.getLocation({
type: 'gcj02',
// type: 'gcj02',
success: res => {
this.longitude = res.longitude;
this.latitude = res.latitude;
hideLoading();
console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude);
},
fail: err => {
showModal('获取定位失败, 请打开GPS后重试');
console.error(err);
},
});
},
@ -103,7 +110,12 @@ export default {
*/
async handleSign(siteId) {
try {
const params = { param: { siteId, locationLatitude: this.latitude, locationLongitude: this.longitude } };
if (!this.latitude || !this.longitude) {
showToast('位置信息有误, 请打开定位后重试');
}
const params = {
param: { siteId, locationLatitude: this.latitude, locationLongitude: this.longitude },
};
await this.sign(params);
this.success = true;
} catch (error) {

Loading…
Cancel
Save