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.

138 lines
2.8 KiB

// package/startInspection/startInspection.js
Page({
/**
* 页面的初始数据
*/
data: {
dataList: [1, 2, 3]
},
handleChangeTwo(e) {
this.setData({
changeTwo: e.detail.value
})
},
handleChangeThree(e) {
this.setData({
changeThree: e.detail.value
})
},
showModal() {
this.setData({
showModal: true
})
},
bindCancel() {
this.setData({
showModal: false
})
},
selfLocation() {
const self = this
wx.showLoading({
title: '定位中',
mask: true,
});
wx.getLocation({
type: 'gcj02',
success: (res) => {
let latitude, longitude;
latitude = res.latitude.toString();
longitude = res.longitude.toString();
this.latitude = res.latitude
this.longitude = res.longitude
getGeocoder({ lat: latitude, long: longitude }).then(res => { // 获取详细信息的接口
const data = res.data;
self.userAddress.userAddressdetail = ''
var params = {
text: data.address
}
parseAddress(params).then(res => { // 粘贴详细信息的接口
console.log(res)
if (res.status == 200 && res.message == "success") {
this.$forceUpdate(); // 定位后,界面没有反应,因此加上强制刷新
this.userAddress.userAddressdetail = res.data.town + res.data.detail;
this.$set(this.userAddress, 'selectAddress', parseInt(res.data.county_info.city_id));
this.addressInfo[0] = res.data.province_info ? res.data.province_info : {};
this.addressInfo[1] = res.data.city_info ? res.data.city_info : {};
this.addressInfo[2] = res.data.county_info ? res.data.county_info : {};
}
}).catch(res => {
console.log("没有地址信息")
})
wx.hideLoading();
})
},
fail: (res) => {
console.log(res)
wx.hideLoading();
wx.showToast({
title: res.errMsg,
icon: 'none',
duration: 1000
});
}
});
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})