1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- // pages/map/map.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- house: {},
- markers: [],
- agency: {}
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (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 () {
- if (!getApp().globalData.token) {
- wx.navigateTo({
- url: '/pages/login/login',
- })
- return
- }
- 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
- })
- }
- })
|