log.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. const app = getApp();
  2. let self;
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. list: [],
  9. page: 1,
  10. no_more: false,
  11. password: '',
  12. modalName: '',
  13. nowId: 0,
  14. },
  15. /**
  16. * 生命周期函数--监听页面加载
  17. */
  18. onLoad(options) {
  19. self = this;
  20. self.getList();
  21. },
  22. /**
  23. * 页面相关事件处理函数--监听用户下拉动作
  24. */
  25. onPullDownRefresh() {
  26. self.setData({list:[],page:1,no_more:false});
  27. self.getList();
  28. wx.stopPullDownRefresh();
  29. },
  30. /**
  31. * 页面上拉触底事件的处理函数
  32. */
  33. onReachBottom() {
  34. self.getList();
  35. },
  36. toIndex() {
  37. wx.navigateTo({
  38. url: "/pages/teahouse/home/home"
  39. });
  40. },
  41. //列表
  42. getList() {
  43. var self = this;
  44. if (self.data.no_more) {
  45. return false;
  46. }
  47. app.post('teahouse/user/getBookList',{
  48. page:self.data.page,
  49. },function(res){
  50. if (res.length < 10) {
  51. self.setData({no_more:true});
  52. }
  53. let list = self.data.list;
  54. list = list.concat(res);
  55. let page = self.data.page;
  56. page++;
  57. self.setData({list:list,page:page});
  58. });
  59. },
  60. //密码
  61. showPassword(e) {
  62. wx.showLoading();
  63. app.post('teahouse/user/showPassword',{id:e.currentTarget.dataset.id},function(res){
  64. wx.hideLoading();
  65. self.setData({modalName:'DialogModal',password:res.password,nowId:e.currentTarget.dataset.id});
  66. });
  67. },
  68. hideModal() {
  69. self.setData({modalName:''});
  70. },
  71. refreshPassword(e) {
  72. wx.showLoading();
  73. app.post('teahouse/user/refreshPassword',{id:self.data.nowId},function(res){
  74. wx.hideLoading();
  75. self.setData({password:res.password});
  76. });
  77. },
  78. /**
  79. * 用户点击右上角分享
  80. */
  81. onShareAppMessage() {
  82. return {
  83. title: "晋爱人才",
  84. path: "/pages/home/home/home",
  85. };
  86. }
  87. })