140 lines
2.8 KiB
JavaScript
Raw Permalink Normal View History

2024-03-12 11:13:43 +08:00
const app = getApp()
import {
selectCoordinateRq
} from "../../../../api/meeting/meetingRoom.js"
import {
showroomDetailRq
} from "../../../../api/meeting/exhibition.js"
Page({
/**
* 页面的初始数据
*/
data: {
IMG_NAME: app.IMG_NAME,
id: null,
detail: {},
bannerList: [],
mapData: {}
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let _this = this;
console.log('onLoad', options);
_this.setData({
...options
})
showroomDetailRq(_this.data.id).then(res => {
console.log('showroomDetailRq', res);
2024-04-08 16:46:10 +08:00
let detail = res.data;
let bannerList = []
if (detail.indoorPicUrl) {
try {
bannerList = JSON.parse(detail.indoorPicUrl).map(item=>item.url)
} catch (error) {
console.log(`JSON error : ${error}`);
}
}
2024-03-12 11:13:43 +08:00
_this.setData({
2024-04-08 16:46:10 +08:00
detail,
bannerList
2024-03-12 11:13:43 +08:00
})
})
// 获取地址信息
_this.getAddress()
},
// 获取地址信息
getAddress() {
let _this = this;
selectCoordinateRq().then(res => {
_this.setData({
address: res,
mapData: {
latitude: res.lat,
longitude: res.lng,
markers: [{
id: 1,
latitude: res.lat,
longitude: res.lng,
title: res.address,
}]
},
})
})
},
// 打开地图
openMap(e) {
console.log('openMap', e);
let _this = this;
wx.openLocation({
name: _this.data.address.address,
latitude: _this.data.address.lat,
longitude: _this.data.address.lng,
})
},
// 跳转-预约
jumpBooked() {
let id = this.data.id;
wx.navigateTo({
url: "/pages/meeting/exhibition/booked/booked?id=" + id,
})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {
},
/**
* 生命周期函数--监听页面显示
*/
onShow() {
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage() {
}
})