Browse Source

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

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

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

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

12
pages.json

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

22
pages/sign/sign.vue

@ -17,6 +17,7 @@
<script> <script>
import { mapState, mapActions } from 'vuex'; import { mapState, mapActions } from 'vuex';
import { formatQuery } from 'utils/util'; import { formatQuery } from 'utils/util';
import { showToast, showLoading, hideLoading, showModal } from 'utils/ui';
import { SCAN_SIGN } from 'api/api'; import { SCAN_SIGN } from 'api/api';
export default { export default {
@ -28,8 +29,8 @@ export default {
success: false, success: false,
type: 0, // 0 / 1 type: 0, // 0 / 1
timer: null, timer: null,
latitude: 37.80079, latitude: '',
longitude: 112.58679, longitude: '',
}; };
}, },
@ -42,8 +43,8 @@ export default {
}, },
onLoad(options) { onLoad(options) {
this.init(options);
this.getLocation(); this.getLocation();
this.init(options);
}, },
methods: { methods: {
@ -86,14 +87,20 @@ export default {
// //
// mapgcj02 // mapgcj02
getLocation() { getLocation() {
showLoading();
uni.getLocation({ uni.getLocation({
type: 'gcj02', // type: 'gcj02',
success: res => { success: res => {
this.longitude = res.longitude; this.longitude = res.longitude;
this.latitude = res.latitude; this.latitude = res.latitude;
hideLoading();
console.log('当前位置的经度:' + res.longitude); console.log('当前位置的经度:' + res.longitude);
console.log('当前位置的纬度:' + res.latitude); console.log('当前位置的纬度:' + res.latitude);
}, },
fail: err => {
showModal('获取定位失败, 请打开GPS后重试');
console.error(err);
},
}); });
}, },
@ -103,7 +110,12 @@ export default {
*/ */
async handleSign(siteId) { async handleSign(siteId) {
try { 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); await this.sign(params);
this.success = true; this.success = true;
} catch (error) { } catch (error) {

Loading…
Cancel
Save