index.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. const getHeight = require("../../../utils/getRheRemainingHeight"),
  2. _Http = getApp().globalData.http;
  3. Page({
  4. /**
  5. * 页面的初始数据
  6. */
  7. data: {
  8. height: 0,
  9. list: [],
  10. content: {
  11. nocache: true,
  12. pageNumber: 1,
  13. pageSize: 20,
  14. pageTotal: 1,
  15. type: "应用",
  16. where: {}
  17. },
  18. total: 0,
  19. },
  20. /**
  21. * 生命周期函数--监听页面加载
  22. */
  23. onLoad(options) {},
  24. //切换tab选项
  25. tabChange({
  26. detail
  27. }) {
  28. this.setData({
  29. "content.type": detail.name
  30. })
  31. this.getlist(true);
  32. },
  33. onReady() {
  34. getHeight.getHeight(".head", this).then(res => {
  35. this.setData({
  36. height: res
  37. })
  38. })
  39. },
  40. async toDetails(e) {
  41. const {
  42. objectname,
  43. objectid,
  44. messageid
  45. } = e.currentTarget.dataset.item;
  46. _Http.basic({
  47. "classname": "system.message.Message",
  48. "method": "readMessage",
  49. "content": {
  50. messageid
  51. }
  52. }, false)
  53. const res = await _Http.basic({
  54. "classname": "saletool.common.auth",
  55. "method": "isAuth",
  56. "content": {
  57. objectid,
  58. objectname
  59. }
  60. });
  61. if (res.msg != '成功' || res.data[0].isAuth != 1) return wx.showToast({
  62. title: '暂无权限进入应用',
  63. icon: "none"
  64. });
  65. switch (objectname) {
  66. case 'sat_courseware':
  67. wx.navigateTo({
  68. url: `/pages/college/index`,
  69. })
  70. break;
  71. case 'sat_sharematerial':
  72. wx.navigateTo({
  73. url: `/pages/promotional/index`,
  74. })
  75. break;
  76. case 'sat_notice':
  77. wx.navigateTo({
  78. url: `/pages/annunciate/index`,
  79. })
  80. break;
  81. case 'sat_submitedit':
  82. wx.navigateTo({
  83. url: `/pages/submission/index`,
  84. })
  85. break;
  86. case 'sat_orderclue':
  87. wx.navigateTo({
  88. url: `/pages/threadedTree/index`,
  89. })
  90. break;
  91. case 'sys_attachment':
  92. let item = {
  93. attachmentid: objectid,
  94. document: '营销物料'
  95. }
  96. wx.navigateTo({
  97. url: 'pages/tabbar/smartStore/index',
  98. })
  99. break;
  100. default:
  101. wx.showToast({
  102. title: '当前应用暂不支持跳转',
  103. icon: "none"
  104. })
  105. break;
  106. }
  107. /* wx.navigateTo({
  108. url: './details?id=' + item.messageid,
  109. }) */
  110. },
  111. getlist(init = false) {
  112. if (init.detail != undefined) init = init.detail;
  113. let content = this.data.content
  114. if (init) content.pageNumber = 1;
  115. if (content.pageNumber > content.pageTotal) return;
  116. _Http.basic({
  117. "classname": "system.message.Message",
  118. "method": "queryMessage",
  119. content
  120. }).then(res => {
  121. this.selectComponent('#ListBox').RefreshToComplete();
  122. if (res.msg != '成功') return wx.showToast({
  123. title: res.msg,
  124. icon: "none"
  125. })
  126. this.setData({
  127. total: res.total,
  128. list: (res.pageNumber == 1) ? res.data : this.data.list.concat(res.data),
  129. ['content.pageNumber']: res.pageNumber + 1,
  130. ['content.pageTotal']: res.pageTotal
  131. })
  132. })
  133. },
  134. onShow() {
  135. this.getlist(true);
  136. this.getTabBar().init();
  137. },
  138. })