| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- // pages/map/map.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- house: {},
- markers: [],
- agency: {}
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- console.log(options)
- let markers = [
- {
- longitude: Number(options.longitude),
- latitude: Number(options.latitude),
- housename: options.housename,
- iconPath: "none",
- callout: {
- content: options.housename,
- display: 'ALWAYS',
- padding: 15,
- anchorY: 10
- }
- }
- ]
- this.setData({
- house: Object.assign(this.data.house, options),
- markers,
- agency: {
- agency_name: options.agency_name,
- agency_id: options.agency_id,
- phone: options.phone
- }
- })
- },
- callTel () {
- wx.makePhoneCall({
- phoneNumber: this.data.agency.phone
- })
- },
- consultation () {
- wx.navigateTo({
- url: `/pages/chat/chat?toId=${this.data.agency.agency_id}&toName=${this.data.agency.agency_name}`
- })
- },
- toNav () {
- const { markers } = this.data
- wx.openLocation({
- latitude: markers[0].latitude,
- longitude: markers[0].longitude,
- scale: 11,
- name: markers[0].housename
- })
- }
- })
|