glanceover.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. import {
  2. ApiModel
  3. } from "../../utils/api";
  4. const _Http = new ApiModel();
  5. const processingData = require('../../utils/processingData');
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. history: [], //浏览记录
  12. viewRowIndex: -1,
  13. pageNumber: 1,
  14. pageTotal: 1,
  15. },
  16. /**
  17. * 生命周期函数--监听页面加载
  18. */
  19. onLoad: function (options) {
  20. if (options.id) {
  21. this.setData({
  22. tnoticeid: options.id
  23. })
  24. this.getList()
  25. }
  26. },
  27. getList() {
  28. _Http.basic({
  29. "accesstoken": wx.getStorageSync('userData').token,
  30. "classname": "customer.noticemag.noticemag",
  31. "method": "havereaduserlist",
  32. "content": {
  33. "pageNumber": this.data.pageNumber,
  34. "pageSize": 20,
  35. "tnoticeid": this.data.tnoticeid
  36. }
  37. }).then(res => {
  38. if (res.msg != '成功') return wx.showToast({
  39. title: res.data,
  40. icon: "none"
  41. });
  42. let data = res.data;
  43. for (let i = 0; i < data.length; i++) {
  44. let ffirstreadtime = data[i].ffirstreadtime;
  45. if (ffirstreadtime != null && ffirstreadtime != undefined) data[i].ffirstreadtime = ffirstreadtime.slice(0, ffirstreadtime.lastIndexOf('.'));
  46. }
  47. this.setData({
  48. history: data
  49. })
  50. })
  51. },
  52. viewRow(e) {
  53. const {
  54. index
  55. } = e.currentTarget.dataset;
  56. this.setData({
  57. viewRowIndex: index
  58. })
  59. },
  60. /* 下一页 */
  61. buttonRightClick() {
  62. if (this.data.pageNumber == this.data.pageTotal) return wx.showToast({
  63. title: '已经到达最后一页',
  64. icon: "none"
  65. });
  66. this.setData({
  67. pageNumber: this.data.pageNumber + 1
  68. })
  69. this.getList()
  70. },
  71. /* 上一页 */
  72. buttonLifeClick() {
  73. if (this.data.pageNumber == 1) return wx.showToast({
  74. title: '已经在第一页了哦',
  75. icon: "none"
  76. });
  77. this.setData({
  78. pageNumber: this.data.pageNumber - 1
  79. })
  80. this.getList()
  81. },
  82. /**
  83. * 生命周期函数--监听页面初次渲染完成
  84. */
  85. onReady: function () {
  86. },
  87. /**
  88. * 生命周期函数--监听页面显示
  89. */
  90. onShow: function () {
  91. },
  92. /**
  93. * 生命周期函数--监听页面隐藏
  94. */
  95. onHide: function () {
  96. },
  97. /**
  98. * 生命周期函数--监听页面卸载
  99. */
  100. onUnload: function () {
  101. },
  102. /**
  103. * 页面相关事件处理函数--监听用户下拉动作
  104. */
  105. onPullDownRefresh: function () {
  106. },
  107. /**
  108. * 页面上拉触底事件的处理函数
  109. */
  110. onReachBottom: function () {
  111. },
  112. /**
  113. * 用户点击右上角分享
  114. */
  115. onShareAppMessage: function () {
  116. }
  117. })