// pages/classList/practicalInfo/practicalInfo.js const app = getApp() const util = require("../../../utils/util.js") Page({ data: { hiddenAlert: true, backImg: 'https://yuesuo.yueguanjia.com/MiniProgram/images/goback.png', statusMap: new Map([ ['立即报名', 10], ['查看报名', 20], ['已完成', 30], ['已过期', 40] ]), info: {} }, /** * 生命周期函数--监听页面加载 */ onLoad: function(options) { console.log(options) this.setData({ type: options.type, id: options.id }) this.getClassInfo() }, // 打开位置地图导航 markertap: function () { let obj = { latitude: Number(this.data.info.mi_latitude), longitude: Number(this.data.info.mi_longitude), name: this.data.info.m_name, address: this.data.info.m_address, scale: 17 } if (this.data.type == 'shijian') { obj.name = this.data.info.branches obj.address = this.data.info.address } wx.openLocation(obj) }, // 获取实践课详情 getClassInfo: function(code) { console.log(app.globalData.userphone) let url = this.data.type == 'shijian' ? 'queryPracticeDetail' : 'queryExperienceDetail' util.postData('/college/'+url, { openid: app.globalData.openid, phone: app.globalData.userphone, c_code: this.data.id }) .then(res => { this.setData({ info: res }) }) }, // 返回上一页 backPage: function() { wx.navigateBack({ delta: 1 }) }, // 展示报名弹窗 baoming: function() { console.log(this.data.info.bookingid) if (this.data.info.status == '已完成' || this.data.info.status == '已过期') { return } if (this.data.info.status!='查看预约') { this.setData({ hiddenAlert: false }) return } util.postData('/college/getCollegeBooking', { college_code: this.data.id,openid: app.globalData.openid }) .then(res => { this.setData({ yuyueInfo: res, hiddenAlert: false }) }) }, // 关闭弹窗报名 cancelAlert: function(data) { console.log(data.detail.cliType, data.detail.success) if (data.detail.cliType == 'cancel' || data.detail.success) { this.setData({ yuyueInfo: null }) this.getClassInfo() } this.setData({ hiddenAlert: true }) }, // 输入框取值 bindKeyInput: function(e) { // this.setData({ // inputValue: e.detail.value // }) }, })