安徽骏飞影业有限公司 - 微信小程序
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.
 

154 lines
3.2 KiB

// pages/signIn/signIn.js
var app = getApp()
import { getAbout } from "../../api/home"
let that
Page({
data: {
activeKey: 0,
latitude: 31.462191, //纬度
longitude: 104.75028, //经度
markers: [{
id: 1,
width: 22, //标记宽
height: 43, //标记高
latitude: 31.462191,
longitude: 104.75028,
address:'',
tel:'',
phone:'',
userPhone:'',
}]
},
biaoji(e) {
console.log("标记目的地点击", e)
wx.getLocation({//获取当前地址信息
type: 'wgs84',
success(res) {
const latitude = res.latitude
const longitude = res.longitude
const speed = res.speed
const accuracy = res.accuracy
wx.openLocation({//跳转腾讯地图查看并可以进行导航
latitude: parseFloat(that.data.latitude),
longitude: parseFloat(that.data.longitude)
})
},fail(res){//未授权地理位置处理
wx.showModal({
title: '请授权',
content: '若未授权地理位置,您将不能正常使用导航功能',
confirmText:"授权",
success (res) {
if (res.confirm) {
console.log('用户点击确定')
wx.openSetting({//跳转设置授权界面
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
}
})
},
callPhone (e) {
console.log(e.currentTarget.dataset.phone)
let mobile = e.currentTarget.dataset.phone; //获取data-phone的手机号
wx.makePhoneCall({
phoneNumber: mobile
})
},
getAboutDetails() {
getAbout({}).then(res => {
console.log(res.data.map.split(',')[1])
that.setData({
address: res.data.address,
tel:res.data.tel,
phone:res.data.phone,
longitude:parseFloat(res.data.map.split(',')[0]),
latitude:parseFloat(res.data.map.split(',')[1]),
markers: [{
longitude:parseFloat(res.data.map.split(',')[0]),
latitude:parseFloat(res.data.map.split(',')[1]),
}],
userPhone: res.data.contact_phone
})
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
that = this
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
that.getTabBar().init();
that.getAboutDetails()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
},
// 下拉
onPageScroll: function(e) {
if (e.scrollTop < 0) {
wx.pageScrollTo({
scrollTop: 0
})
}
}
})