You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.5 KiB
104 lines
2.5 KiB
<template>
|
|
<view class="pageBgImg">
|
|
<topNavbar title="设置驾校经纬度信息"></topNavbar>
|
|
<view class="pad">
|
|
<view class="adrsCon">
|
|
<view class="adr" v-if="vuex_cityInfo.city" @click="getLatLngFn">{{vuex_cityInfo.city}} <text v-if="vuex_cityInfo.name"> / {{vuex_cityInfo.name}}</text></view>
|
|
<view class="adr" v-else @click="getLatLngFn" style="display: flex;align-items: center;">
|
|
<text>获取定位信息</text>
|
|
<!-- <image src="@/static/images/index/down.png" mode="" style="width: 18rpx;height: 18rpx;margin-left: 6rpx;"></image> -->
|
|
</view>
|
|
<view class="adrsIcon">
|
|
<image src="@/static/images/index/down.png" mode=""></image>
|
|
</view>
|
|
</view>
|
|
<view class="card">
|
|
温馨提示:确保你所在位置是您的驾校,更新当前位置会影响科目一学员打卡与学员距离您驾校的位置距离计算
|
|
<view class="btnBg" @click="oneBtnClick">更新位置</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { setLngLat } from '@/config/api.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
|
|
}
|
|
},
|
|
|
|
onLoad() {
|
|
// this.$store.dispatch('getCity')
|
|
},
|
|
|
|
methods: {
|
|
async getLatLngFn() {
|
|
try{
|
|
uni.showLoading({
|
|
title: '正在更新位置...'
|
|
})
|
|
await this.$store.dispatch('getCity')
|
|
this.refresh()
|
|
}catch(e){
|
|
uni.hideLoading()
|
|
}
|
|
},
|
|
async oneBtnClick() {
|
|
let _this = this
|
|
await this.$store.dispatch('getCity')
|
|
if(!this.vuex_cityInfo.lng) return this.$u.toast('没有获取到您的定位信息')
|
|
uni.showModal({
|
|
title: `确定要更新您的驾校经纬为 ${this.vuex_cityInfo.name?this.vuex_cityInfo.name:'当前位置'} 吗?`,
|
|
success() {
|
|
_this.setLngLatFn()
|
|
}
|
|
})
|
|
},
|
|
async setLngLatFn() {
|
|
let obj = {longitude: this.vuex_cityInfo.lng, latitude: this.vuex_cityInfo.lat}
|
|
console.log(obj, '参数')
|
|
const res = await setLngLat(obj)
|
|
this.$u.toast('更新经纬度成功')
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.adrsCon {
|
|
display: flex;
|
|
align-items: center;
|
|
// width: 180rpx;
|
|
height: 88rpx;
|
|
.adrsIcon {
|
|
width: 17rpx;
|
|
height: 17rpx;
|
|
margin-top: 4rpx;
|
|
}
|
|
|
|
.adr {
|
|
padding-right: 14rpx;
|
|
font-size: 28rpx;
|
|
color: #fff;
|
|
}
|
|
}
|
|
|
|
.qcode {
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 20rpx 0;
|
|
height: 500rpx;
|
|
}
|
|
.card {
|
|
padding: 28rpx;
|
|
margin-bottom: 24rpx;
|
|
color: #999;
|
|
}
|
|
.btnBg {
|
|
margin: 50rpx 0 20rpx 0;
|
|
}
|
|
</style>
|