detail.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. var app = getApp();
  2. var util = require("../../utils/util.js")
  3. let wxParse = require("../../wxParse/wxParse.js");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. activityId: null,
  10. user: {},
  11. bottomLeft: app.bottomLeft,
  12. appAssetsUrl: app.appAssetsUrl,
  13. appAssetsUrl2: app.appAssetsUrl2,
  14. detail: {},
  15. member: {},
  16. content: '',
  17. schoolInfo: {},
  18. vipMessage: '',
  19. roleList: ['平台管理员', '校园代理人', '行家', '行家;平台管理员', '行家;校园代理人'],
  20. },
  21. /**
  22. * 生命周期函数--监听页面加载
  23. */
  24. onLoad: function (options) {
  25. if (options.activityId) {
  26. this.setData({
  27. activityId: options.activityId
  28. })
  29. }
  30. this.setData({
  31. detail: wx.getStorageSync('activityDetail'),
  32. user: wx.getStorageSync('USER')
  33. })
  34. this.loadVipSel()
  35. console.log(this.data.detail.activityAppletsDetailsList,'detail.activityAppletsDetailsList')
  36. },
  37. // 查看地图
  38. goLocal() {
  39. let that = this
  40. let [latitude, longitude] = [this.data.detail.coordinate.split(',')[0], this.data.detail.coordinate.split(',')[1]]
  41. console.log(Number(latitude), Number(longitude))
  42. wx.openLocation({
  43. latitude: Number(longitude),
  44. longitude: Number(latitude),
  45. name: that.data.title,
  46. address: that.data.address,
  47. success: function () {
  48. console.log("success");
  49. },
  50. });
  51. },
  52. loadVipSel() {
  53. let _this = this;
  54. wx.showLoading({
  55. title: '努力加载中...',
  56. })
  57. app._post_form('wgfillinfo/apiSelectwgfillinfo', 'application/json',
  58. null,
  59. function (res) {
  60. if (res.code === 0) {
  61. setTimeout(function () {
  62. wxParse.wxParse('vipMessage', 'html', res.wgFillInfo.vipMessage, _this, 5)
  63. }, 300)
  64. }
  65. }
  66. )
  67. },
  68. // 查看二维码
  69. seeCode() {
  70. this.popup3.showPopup();
  71. },
  72. /**
  73. * 生命周期函数--监听页面初次渲染完成
  74. */
  75. onReady: function () {
  76. //获得popup组件
  77. this.popup3 = this.selectComponent("#popup3"); // 二维码
  78. },
  79. /**
  80. * 生命周期函数--监听页面显示
  81. */
  82. onShow: function () {},
  83. /**
  84. * 生命周期函数--监听页面隐藏
  85. */
  86. onHide: function () {},
  87. /**
  88. * 生命周期函数--监听页面卸载
  89. */
  90. onUnload: function () {},
  91. /**
  92. * 页面相关事件处理函数--监听用户下拉动作
  93. */
  94. onPullDownRefresh: function () {
  95. },
  96. /**
  97. * 页面上拉触底事件的处理函数
  98. */
  99. onReachBottom: function () {
  100. },
  101. submit() {
  102. wx.showLoading({
  103. title: '提交中...',
  104. })
  105. if (this.data.activityId) {
  106. app._put_form('activity/updateActivity', '', {
  107. ...this.data.detail,
  108. id: this.data.activityId
  109. }, res => {
  110. if (res.code === 0) {
  111. wx.showToast({
  112. title: '修改成功',
  113. })
  114. wx.removeStorageSync('activityDetail')
  115. wx.switchTab({
  116. url: '/pages/home/index/index',
  117. })
  118. }
  119. }, err => {}, complete => {
  120. setTimeout(() => {
  121. wx.hideLoading()
  122. }, 300)
  123. })
  124. } else {
  125. app._post_form('activity/saveActivity', '', this.data.detail, res => {
  126. if (res.code === 0) {
  127. wx.showToast({
  128. title: '添加成功',
  129. })
  130. wx.removeStorageSync('activityDetail')
  131. wx.switchTab({
  132. url: '/pages/home/index/index',
  133. })
  134. }
  135. }, err => {}, complete => {
  136. setTimeout(() => {
  137. wx.hideLoading()
  138. }, 300)
  139. })
  140. }
  141. },
  142. /**
  143. * 用户点击右上角分享
  144. */
  145. onShareAppMessage() {},
  146. //取消事件
  147. _error(e) {
  148. this.popup3.hidePopup();
  149. },
  150. //确认事件
  151. _success(e) {
  152. this.popup3.hidePopup();
  153. }
  154. })