publish.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. // pages/publish/publish.js
  2. const app = getApp();
  3. const api = require('../../api/api');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. height: 0,
  10. pintuan: []
  11. },
  12. /**
  13. * 生命周期函数--监听页面加载
  14. */
  15. onLoad: function (options) {
  16. },
  17. /**
  18. * 生命周期函数--监听页面初次渲染完成
  19. */
  20. onReady: function () {
  21. },
  22. /**
  23. * 生命周期函数--监听页面显示
  24. */
  25. onShow: function () {
  26. let that = this;
  27. that.setData({
  28. height: app.globalData.height
  29. })
  30. // 获取团长详情
  31. wx.showLoading({
  32. title: '加载中',
  33. mask: true
  34. })
  35. wx.request({
  36. url: api.Head_info,
  37. header: {
  38. 'Authorization': wx.getStorageSync('token')
  39. },
  40. data: {
  41. id: wx.getStorageSync('userinfo').id,
  42. },
  43. success(res) {
  44. console.log(res);
  45. if (res.data.code === 1) {
  46. that.setData({
  47. pintuan: res.data.data.gang_list
  48. })
  49. } else {
  50. wx.showToast({
  51. title: res.data.msg,
  52. mask: true,
  53. icon: 'none'
  54. })
  55. }
  56. },
  57. fail(err) {
  58. wx.showToast({
  59. title: '发起网络请求失败',
  60. icon: 'none',
  61. mask: true
  62. })
  63. },
  64. complete() {
  65. wx.hideLoading()
  66. }
  67. })
  68. },
  69. /**
  70. * 生命周期函数--监听页面隐藏
  71. */
  72. onHide: function () {
  73. },
  74. /**
  75. * 生命周期函数--监听页面卸载
  76. */
  77. onUnload: function () {
  78. },
  79. /**
  80. * 页面相关事件处理函数--监听用户下拉动作
  81. */
  82. onPullDownRefresh: function () {
  83. },
  84. /**
  85. * 页面上拉触底事件的处理函数
  86. */
  87. onReachBottom: function () {
  88. },
  89. /**
  90. * 用户点击右上角分享
  91. */
  92. onShareAppMessage: function () {
  93. },
  94. // 自定义方法
  95. navgo(e) {
  96. let url = e.currentTarget.dataset.url;
  97. wx.navigateTo({
  98. url: url
  99. })
  100. },
  101. // 拼团跳转
  102. navToPinTuanDetail(e) {
  103. let id = e.currentTarget.dataset.id;
  104. wx.navigateTo({
  105. url: '/pages/pintuandetail/pintuandetail?type=dingyue&id=' + id,
  106. })
  107. },
  108. })