index.js 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. // pages/my/postJob/index.js
  2. const App = getApp();
  3. var util = require("../../utils/util.js");
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. nodata: util.nodata(),
  10. tabs: [
  11. {
  12. i: "01",
  13. label: "进行中",
  14. },
  15. {
  16. i: "02",
  17. label: "已完成",
  18. },
  19. ],
  20. currentTab: 0,
  21. queryParams: {
  22. page: 1,
  23. limit: 10,
  24. },
  25. type: "01",
  26. list: [],
  27. total: 0,
  28. currPage: null,
  29. totalPage: null,
  30. user: wx.getStorageSync("USER"),
  31. cityInfo: wx.getStorageSync("CHOOSECITY"),
  32. },
  33. /**
  34. * 生命周期函数--监听页面加载
  35. */
  36. onLoad(options) {},
  37. /**
  38. * 生命周期函数--监听页面初次渲染完成
  39. */
  40. onReady() {},
  41. /**
  42. * 生命周期函数--监听页面显示
  43. */
  44. onShow() {
  45. this.getlist();
  46. },
  47. getlist() {
  48. if (this.data.total > 0) {
  49. if (this.data.currPage == this.data.totalPage) {
  50. wx.showToast({
  51. title: "没有更多了哦~",
  52. icon: "none",
  53. });
  54. return false;
  55. }
  56. }
  57. wx.showLoading({
  58. title: "努力加载中...",
  59. });
  60. // 全部 ''
  61. App._post_form(
  62. "work/myReleaseListNew",
  63. "",
  64. {
  65. ...this.data.queryParams,
  66. type: this.data.type,
  67. sid: this.data.user.id,
  68. city: this.data.cityInfo.cityId,
  69. },
  70. (res) => {
  71. if (res.code === 0) {
  72. this.setData({
  73. list: [...this.data.list, ...res.data.list],
  74. total: res.data.totalCount,
  75. currPage: res.data.currPage,
  76. totalPage: res.data.totalPage,
  77. });
  78. console.log(this.data.list, 111);
  79. }
  80. },
  81. (err) => {},
  82. (complete) => {
  83. setTimeout(() => {
  84. wx.hideLoading();
  85. });
  86. }
  87. );
  88. },
  89. tabChange(e) {
  90. console.log(e);
  91. if (this.data.currentTab == e.currentTarget.dataset.index) {
  92. return;
  93. }
  94. this.setData({
  95. currentTab: e.currentTarget.dataset.index,
  96. type: e.currentTarget.dataset.type,
  97. });
  98. this.init();
  99. },
  100. init() {
  101. this.setData({
  102. queryParams: {
  103. page: 1,
  104. limit: 10,
  105. },
  106. total: 0,
  107. list: [],
  108. });
  109. this.getlist();
  110. },
  111. seeBigCode(e) {
  112. wx.navigateTo({
  113. url: "/job/postJob/postJob?againType=1&jobId=" + e.currentTarget.dataset.id,
  114. });
  115. },
  116. addJob() {
  117. wx.navigateTo({
  118. url: "/job/postJob/postJob",
  119. });
  120. },
  121. // 兼职详情
  122. toPartDetail(e) {
  123. wx.navigateTo({
  124. url: `/pages/home/index/partDetail/partDetail?id=${e.currentTarget.dataset.id}`,
  125. });
  126. },
  127. /**
  128. * 生命周期函数--监听页面隐藏
  129. */
  130. onHide() {},
  131. /**
  132. * 生命周期函数--监听页面卸载
  133. */
  134. onUnload() {},
  135. /**
  136. * 页面相关事件处理函数--监听用户下拉动作
  137. */
  138. onPullDownRefresh() {},
  139. /**
  140. * 页面上拉触底事件的处理函数
  141. */
  142. onReachBottom() {
  143. this.setData({
  144. queryParams: {
  145. page: ++this.data.queryParams.page,
  146. limit: 10,
  147. },
  148. });
  149. this.getlist();
  150. },
  151. /**
  152. * 用户点击右上角分享
  153. */
  154. onShareAppMessage() {},
  155. });