release.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. // pages/my/activity/release.js
  2. const App = getApp();
  3. var util = require("../../utils/util.js");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. appAssetsUrl2: App.appAssetsUrl2,
  10. cityInfo: wx.getStorageSync("CHOOSECITY"),
  11. memberId: null,
  12. nodata: util.nodata(),
  13. tabs: [
  14. {
  15. i: 0,
  16. label: "待发布",
  17. },
  18. {
  19. i: 1,
  20. label: "进行中",
  21. },
  22. {
  23. i: 2,
  24. label: "已结束",
  25. },
  26. ],
  27. currentTab: 0,
  28. queryParams: {
  29. page: 1,
  30. limit: 10,
  31. },
  32. status: "",
  33. isPublish: 0,
  34. list: [],
  35. total: 0,
  36. currPage: null,
  37. totalPage: null,
  38. },
  39. /**
  40. * 生命周期函数--监听页面加载
  41. */
  42. onLoad(options) {
  43. this.setData({
  44. memberId: options.memberId,
  45. });
  46. },
  47. /**
  48. * 生命周期函数--监听页面初次渲染完成
  49. */
  50. onReady() {},
  51. /**
  52. * 生命周期函数--监听页面显示
  53. */
  54. onShow() {
  55. this.setData({
  56. list: [],
  57. currPage: 1,
  58. });
  59. this.getlist();
  60. },
  61. getlist() {
  62. wx.showLoading({
  63. title: "努力加载中...",
  64. });
  65. let params = {
  66. memberId: this.data.memberId,
  67. status: this.data.status,
  68. city: this.data.cityInfo.cityId,
  69. ...this.data.queryParams,
  70. }
  71. if (this.data.currentTab == 0 || this.data.currentTab == 1) {
  72. params.isPublish = this.data.isPublish
  73. }
  74. // 全部 ''
  75. App._post_form(
  76. "act/postEventList",
  77. "",
  78. params,
  79. (res) => {
  80. if (res.code === 0) {
  81. this.setData({
  82. list: [...this.data.list, ...res.page.list],
  83. total: res.page.totalCount,
  84. currPage: res.page.currPage,
  85. totalPage: res.page.totalPage,
  86. });
  87. wx.hideLoading();
  88. console.log(this.data.list, 111);
  89. }
  90. },
  91. (err) => {
  92. wx.showToast({
  93. icon: "error",
  94. title: "服务端异常",
  95. });
  96. },
  97. (complete) => {}
  98. );
  99. },
  100. tabChange(e) {
  101. console.log(e);
  102. if (this.data.currentTab == e.currentTarget.dataset.index) {
  103. return;
  104. }
  105. if (e.currentTarget.dataset.index == 0) {
  106. this.data.isPublish = 0;
  107. this.data.status = "";
  108. } else if (e.currentTarget.dataset.index == 1) {
  109. this.data.status = "";
  110. this.data.isPublish = 1;
  111. } else {
  112. this.data.status = 6;
  113. this.data.isPublish = 1;
  114. }
  115. this.setData({
  116. currentTab: e.currentTarget.dataset.index,
  117. isPublish: this.data.isPublish,
  118. status: this.data.status,
  119. });
  120. this.init();
  121. },
  122. init() {
  123. this.setData({
  124. queryParams: {
  125. page: 1,
  126. limit: 10,
  127. },
  128. total: 0,
  129. list: [],
  130. });
  131. this.getlist();
  132. },
  133. addActivity(e) {
  134. if (e && e.currentTarget.dataset.activityid) {
  135. wx.navigateTo({
  136. url:
  137. "/activity/activity/activity?activityId=" +
  138. e.currentTarget.dataset.activityid,
  139. });
  140. } else
  141. [
  142. wx.navigateTo({
  143. url: "/activity/activity/activity",
  144. }),
  145. ];
  146. },
  147. /**
  148. * 生命周期函数--监听页面隐藏
  149. */
  150. onHide() {},
  151. /**
  152. * 生命周期函数--监听页面卸载
  153. */
  154. onUnload() {},
  155. /**
  156. * 页面相关事件处理函数--监听用户下拉动作
  157. */
  158. onPullDownRefresh() {},
  159. /**
  160. * 页面上拉触底事件的处理函数
  161. */
  162. onReachBottom() {
  163. if (this.data.total > 0) {
  164. if (this.data.currPage == this.data.totalPage) {
  165. wx.showToast({
  166. title: "没有更多了哦~",
  167. icon: "none",
  168. });
  169. return false;
  170. }
  171. }
  172. this.setData({
  173. queryParams: {
  174. page: ++this.data.queryParams.page,
  175. limit: 10,
  176. },
  177. });
  178. this.getlist();
  179. },
  180. /**
  181. * 用户点击右上角分享
  182. */
  183. onShareAppMessage() {},
  184. });