修改获取位置

This commit is contained in:
shidongli 2024-01-12 14:47:43 +08:00
parent 1097a46c83
commit 20658a9dae
4 changed files with 29 additions and 40 deletions

View File

@ -140,10 +140,10 @@
}, },
// //
fail: (res) => { fail: (res) => {
// uni.showToast({ uni.showToast({
// icon: 'none', icon: 'none',
// title: ',', title: '获取地址失败,请打开定位',
// }) })
} }
}) })
}, },

View File

@ -70,14 +70,14 @@
maxlength='40' /> maxlength='40' />
</view> --> </view> -->
<!-- <view class="name"> <view class="name">
所在位置 所在位置
<view class="selectdata" @tap='getlocation'> <view class="selectdata" @tap='getlocation'>
<text v-if="query.locationName ==''">请选择所在位置</text> <text v-if="query.locationName ==''">请选择所在位置</text>
<text class="testitem" <text class="testitem"
style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{query.locationName}}</text> style="overflow: hidden;text-overflow: ellipsis;white-space: nowrap;">{{query.locationName}}</text>
</view> </view>
</view> --> </view>
<view class="name"> <view class="name">
基础疾病 基础疾病
<view class="select" @tap="godisease"> <view class="select" @tap="godisease">
@ -268,11 +268,9 @@
couponId: null, couponId: null,
patientName: "", patientName: "",
cardNo: "", cardNo: "",
phone: "", phone: "",
address: "", address: "",
areaCode: "", areaCode: "",
// homeLongitude: '118.5816',
// homeLatitude: '37.44875',
homeLongitude: '', homeLongitude: '',
homeLatitude: '', homeLatitude: '',
nurseTypeIdList: [], nurseTypeIdList: [],
@ -420,15 +418,13 @@
type: 'error' type: 'error'
}) })
return return
} } else if (!that.query.locationName) {
// else if (!that.query.locationName) { that.$refs.uToast.show({
// that.$refs.uToast.show({ title: '请选择所在位置',
// title: '', type: 'error'
// type: 'error' })
// }) return
// return } else if (!that.query.birthDate) {
// }
else if (!that.query.birthDate) {
that.$refs.uToast.show({ that.$refs.uToast.show({
title: '请选择出生日期', title: '请选择出生日期',
type: 'error' type: 'error'

View File

@ -189,10 +189,10 @@
classifycurrent: 0, // classifycurrent: 0, //
nurseClassifyInfoId: '', //id nurseClassifyInfoId: '', //id
scrollTop: 0, scrollTop: 0,
// latitude: 39.90374,
// longitude: 116.397827,
latitude: '', latitude: '',
longitude: '', longitude: '',
// latitude: '',
// longitude: '',
} }
}, },
onShow() { onShow() {

View File

@ -98,10 +98,8 @@
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
total: 0, total: 0,
// latitude: 39.90374, latitude: "",
// longitude: 116.397827, longitude: "",
latitude:'',
longitude:'',
nurseClassId: '', //id nurseClassId: '', //id
itemClassId: '', //id itemClassId: '', //id
searchName: '', // searchName: '', //
@ -192,7 +190,6 @@
success: function(res) { success: function(res) {
that.latitude = res.latitude that.latitude = res.latitude
that.longitude = res.longitude that.longitude = res.longitude
that.mask = false that.mask = false
} }
}); });
@ -281,27 +278,23 @@
const value = uni.getStorageSync('patientId'); const value = uni.getStorageSync('patientId');
if (value) { if (value) {
getPatientInfo(value).then(res => { getPatientInfo(value).then(res => {
console.log(res)
if (res.code == 200) { if (res.code == 200) {
if (res.data.homeLatitude && res.data.homeLongitude) { if (res.data.homeLatitude && res.data.homeLongitude) {
that.latitude = res.data.homeLatitude that.latitude = res.data.homeLatitude
that.longitude = res.data.homeLongitude that.longitude = res.data.homeLongitude
that.requestinfo(); that.requestinfo();
} else { } else {
that.requestinfo(); uni.getLocation({
// uni.getLocation({ type: 'wgs84',
// type: 'wgs84', success: function(resp) {
// success: function(resp) { that.latitude = resp.latitude
// that.latitude = resp.latitude that.longitude = resp.longitude
// that.longitude = resp.longitude that.requestinfo();
// console.log(that.latitude,that.longitude) },
// that.requestinfo(); fail(err) {
// }, that.mask = true;
// fail(err) { }
// that.mask = true; });
// }
// });
} }
} else if (res.code == 9999) {} else { } else if (res.code == 9999) {} else {
that.requestinfo(); that.requestinfo();