practicalInfo.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // pages/classList/practicalInfo/practicalInfo.js
  2. const app = getApp()
  3. const util = require("../../../utils/util.js")
  4. Page({
  5. data: {
  6. hiddenAlert: true,
  7. backImg: 'https://yuesuo.yueguanjia.com/MiniProgram/images/goback.png',
  8. statusMap: new Map([
  9. ['立即报名', 10],
  10. ['查看报名', 20],
  11. ['已完成', 30],
  12. ['已过期', 40]
  13. ]),
  14. info: {}
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function(options) {
  20. console.log(options)
  21. this.setData({
  22. type: options.type,
  23. id: options.id
  24. })
  25. this.getClassInfo()
  26. },
  27. // 打开位置地图导航
  28. markertap: function () {
  29. let obj = {
  30. latitude: Number(this.data.info.mi_latitude),
  31. longitude: Number(this.data.info.mi_longitude),
  32. name: this.data.info.m_name,
  33. address: this.data.info.m_address,
  34. scale: 17
  35. }
  36. if (this.data.type == 'shijian') {
  37. obj.name = this.data.info.branches
  38. obj.address = this.data.info.address
  39. }
  40. wx.openLocation(obj)
  41. },
  42. // 获取实践课详情
  43. getClassInfo: function(code) {
  44. console.log(app.globalData.userphone)
  45. let url = this.data.type == 'shijian' ? 'queryPracticeDetail' : 'queryExperienceDetail'
  46. util.postData('/college/'+url, {
  47. openid: app.globalData.openid,
  48. phone: app.globalData.userphone,
  49. c_code: this.data.id
  50. })
  51. .then(res => {
  52. this.setData({
  53. info: res
  54. })
  55. })
  56. },
  57. // 返回上一页
  58. backPage: function() {
  59. wx.navigateBack({
  60. delta: 1
  61. })
  62. },
  63. // 展示报名弹窗
  64. baoming: function() {
  65. console.log(this.data.info.bookingid)
  66. if (this.data.info.status == '已完成' || this.data.info.status == '已过期') {
  67. return
  68. }
  69. if (this.data.info.status!='查看预约') {
  70. this.setData({
  71. hiddenAlert: false
  72. })
  73. return
  74. }
  75. util.postData('/college/getCollegeBooking', { college_code: this.data.id,openid: app.globalData.openid })
  76. .then(res => {
  77. this.setData({
  78. yuyueInfo: res,
  79. hiddenAlert: false
  80. })
  81. })
  82. },
  83. // 关闭弹窗报名
  84. cancelAlert: function(data) {
  85. console.log(data.detail.cliType, data.detail.success)
  86. if (data.detail.cliType == 'cancel' || data.detail.success) {
  87. this.setData({
  88. yuyueInfo: null
  89. })
  90. this.getClassInfo()
  91. }
  92. this.setData({
  93. hiddenAlert: true
  94. })
  95. },
  96. // 输入框取值
  97. bindKeyInput: function(e) {
  98. // this.setData({
  99. // inputValue: e.detail.value
  100. // })
  101. },
  102. })