school.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import recruitApi from '../../api/recruit'
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. recruitList:[],
  8. showClear:false,
  9. searchinput:''
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.getRecruitList();
  16. },
  17. /**
  18. * 生命周期函数--监听页面初次渲染完成
  19. */
  20. onReady: function () {
  21. },
  22. /**
  23. * 生命周期函数--监听页面显示
  24. */
  25. onShow: function () {
  26. },
  27. /**
  28. * 生命周期函数--监听页面隐藏
  29. */
  30. onHide: function () {
  31. },
  32. /**
  33. * 生命周期函数--监听页面卸载
  34. */
  35. onUnload: function () {
  36. },
  37. /**
  38. * 页面相关事件处理函数--监听用户下拉动作
  39. */
  40. onPullDownRefresh: function () {
  41. },
  42. /**
  43. * 页面上拉触底事件的处理函数
  44. */
  45. onReachBottom: function () {
  46. },
  47. /**
  48. * 用户点击右上角分享
  49. */
  50. onShareAppMessage: function () {
  51. },
  52. goToInfo:function(e){
  53. var id = e.currentTarget.dataset.id;
  54. wx.navigateTo({
  55. url: '../recruitInfo/recruitInfo?id='+id
  56. })
  57. },
  58. getRecruitList: async function(name='') {
  59. var result = await recruitApi.getRecruitList(name,2,1,100);
  60. this.setData({
  61. recruitList:result.list,
  62. count:result.count,
  63. page:result.page
  64. })
  65. },
  66. inputFocus:function(e) {
  67. var recruit = e.detail.value
  68. if(recruit){
  69. this.setData({
  70. showClear:true
  71. })
  72. }else{
  73. this.setData({
  74. showClear:false
  75. })
  76. }
  77. },
  78. clearInput:function() {
  79. this.setData({
  80. showClear:false,
  81. searchinput:''
  82. })
  83. },
  84. searchContents:function(e) {
  85. var recruit = e.detail.value
  86. this.getRecruitList(recruit)
  87. }
  88. })