history.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel();
  5. Page({
  6. /**
  7. * 页面的初始数据
  8. */
  9. data: {
  10. },
  11. /**
  12. * 生命周期函数--监听页面加载
  13. */
  14. onLoad: function (options) {
  15. this.setData({
  16. userid: wx.getStorageSync('userData').userid,
  17. timdialogid: options.id
  18. })
  19. this.query_imdialogMessage();
  20. },
  21. query_imdialogMessage() {
  22. let condition = "",
  23. begdate = '',
  24. enddate = '';
  25. _Http.basic({
  26. "accesstoken": wx.getStorageSync('userData').token,
  27. "classname": "system.im.imdialog.imdialog",
  28. "method": "query_imdialogMessage",
  29. "content": {
  30. "pageNumber": this.data.pageNumber,
  31. "pageSize": 50,
  32. "timdialogid": this.data.timdialogid,
  33. "where": {
  34. "condition": condition,
  35. "begdate": begdate,
  36. "enddate": enddate
  37. }
  38. }
  39. }).then(res => {
  40. if (res.pageNumber != 1) {
  41. let list = res.data;
  42. list = list.reverse();
  43. list = list.concat(this.data.socketMsgQueue);
  44. this.setData({
  45. socketMsgQueue: list
  46. })
  47. } else {
  48. let list = res.data;
  49. list = list.reverse();
  50. this.setData({
  51. socketMsgQueue: list,
  52. toView: `item${res.data.length - 1}`,
  53. pageTotal: res.pageTotal
  54. })
  55. }
  56. })
  57. },
  58. /**
  59. * 生命周期函数--监听页面初次渲染完成
  60. */
  61. onReady: function () {
  62. },
  63. /**
  64. * 生命周期函数--监听页面显示
  65. */
  66. onShow: function () {
  67. },
  68. /**
  69. * 生命周期函数--监听页面隐藏
  70. */
  71. onHide: function () {
  72. },
  73. /**
  74. * 生命周期函数--监听页面卸载
  75. */
  76. onUnload: function () {
  77. },
  78. /**
  79. * 页面相关事件处理函数--监听用户下拉动作
  80. */
  81. onPullDownRefresh: function () {
  82. },
  83. /**
  84. * 页面上拉触底事件的处理函数
  85. */
  86. onReachBottom: function () {
  87. },
  88. /**
  89. * 用户点击右上角分享
  90. */
  91. onShareAppMessage: function () {
  92. }
  93. })