message.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view>
  3. <cu-custom ref="Dustom" id="custom"
  4. bgImage="https://yostest175549.obs.cn-east-2.myhuaweicloud.com:443/202306151686796745663B52544232.png">
  5. <block slot="content">
  6. 消息列表
  7. </block>
  8. </cu-custom>
  9. <u-tabs :list="list1" :current="current" :activeStyle="{ fontWeight: 'bold' }" @change="tabChange" />
  10. <view />
  11. <My_listbox ref="List" @getlist="getlist" :empty='empty'>
  12. <List :list="list" @onReadMsg="onReadMsg" />
  13. <view class="cu-bar tabbar" style="margin-top: 10px;" />
  14. </My_listbox>
  15. </view>
  16. </template>
  17. <script>
  18. let login = false;
  19. import List from "../../message/list.vue"
  20. export default {
  21. name: 'Message',
  22. components: { List },
  23. data() {
  24. return {
  25. uninitialized: true,
  26. empty: true,
  27. list1: [{
  28. name: '应用消息'
  29. }, {
  30. name: '系统消息'
  31. }],
  32. current: 1,
  33. list: [],
  34. "content": {
  35. "nocache": true,
  36. "pageNumber": 1,
  37. "pageTotal": 1,
  38. "pageSize": 20,
  39. "type": "应用",
  40. "where": {}
  41. }
  42. };
  43. },
  44. methods: {
  45. init(forcedUpdating = true) {
  46. this.uninitialized = false;
  47. this.getlist(true)
  48. setTimeout(() => {
  49. this.current = 0
  50. }, 100)
  51. },
  52. tabChange(e) {
  53. let type = e.index == 0 ? '应用' : '系统';
  54. if (this.content.type == type) return;
  55. this.content.type = type;
  56. this.current = e.index;
  57. this.getlist(true)
  58. },
  59. getlist(init) {
  60. if (login) return;
  61. login = true;
  62. let content = this.content;
  63. if (init) content.pageNumber = 1;
  64. if (content.pageNumber > content.pageTotal) return;
  65. this.$Http.basic({
  66. "classname": "system.message.Message",
  67. "method": "queryMessage",
  68. content
  69. }).then(res => {
  70. console.log("消息列表", res)
  71. login = false;
  72. this.$refs.List.RefreshToComplete();
  73. res.pageNumber == 1 ? this.$refs.List.setHeight() : "";
  74. if (this.cutoff(res.msg)) return;
  75. this.empty = res.data.length == 0;
  76. this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
  77. content.pageNumber = res.pageNumber + 1;
  78. content.pageTotal = res.pageTotal;
  79. this.content = content;
  80. })
  81. },
  82. onReadMsg({ messageid }) {
  83. this.list[this.list.findIndex(v => v.messageid == messageid)].isread = 1;
  84. }
  85. },
  86. }
  87. </script>
  88. <style lang="scss" scoped>
  89. /deep/.u-tabs {
  90. height: 44px;
  91. .u-tabs__wrapper__nav {
  92. height: 44px;
  93. .u-tabs__wrapper__nav__item {
  94. height: 44px !important;
  95. .u-tabs__wrapper__nav__item__text {
  96. color: #fff !important;
  97. }
  98. }
  99. }
  100. }
  101. </style>