Index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view class="container">
  3. <view class="contentBox">
  4. <z-paging ref="paging" v-model="listData" @query="onGetOrderList" refresher-update-time-key="list" :auto="false">
  5. <view class="listInfoBox">
  6. <view class="listInfo" v-for="(item, index) in listData" :key="index" @tap="onViewTo(item.notificationId)">
  7. <view class="listDetailBox">
  8. <text class="listDate">{{item.creationTime}}</text>
  9. </view>
  10. <rich-text :nodes="item.title" class="listTitle"></rich-text>
  11. </view>
  12. </view>
  13. </z-paging>
  14. </view>
  15. </view>
  16. </template>
  17. <script>
  18. var that;
  19. export default {
  20. data() {
  21. return {
  22. listData: [],
  23. isReLoad: false,
  24. type: 0,
  25. titleName: '通知公告'
  26. }
  27. },
  28. onLoad(options) {
  29. that = this;
  30. that.type = options.type;
  31. that.titleName = that.type == 0 ? '通知公告' : '宣传视频'
  32. that.$nextTick(function() {
  33. uni.setNavigationBarTitle({
  34. title: that.titleName
  35. })
  36. that.$refs.paging.reload()
  37. })
  38. },
  39. methods: {
  40. onGetOrderList(pageNo, pageSize) {
  41. that.$admin.req({
  42. method: 'GET',
  43. url: '/api/v1/Snapshot/notification?NotifyType=' + that.type + '&QueryIndex=' + (pageNo - 1) + '&QueryCount=' + pageSize
  44. }).then(res => {
  45. if (res && res.length > 0) {
  46. res.forEach((item, index) => {
  47. item.creationTime = that.$util.formatTime(new Date(item.creationTime));
  48. })
  49. that.$refs.paging.complete(res);
  50. } else if (res && res.length == 0) {
  51. that.$refs.paging.complete([]);
  52. } else {
  53. that.$util.msg('网络出错!');
  54. that.$refs.paging.complete(false);
  55. }
  56. typeof fun === 'function' && fun();
  57. }, err => {
  58. if (!that.isReLoad) {
  59. that.isReLoad = true;
  60. that.onGetOrderList(pageNo, pageSize);
  61. } else {
  62. that.$util.msg(err);
  63. that.$refs.paging.complete(false);
  64. }
  65. })
  66. },
  67. onViewTo(id) {
  68. uni.navigateTo({
  69. url: '/pagesPointsBase/Publicize/View?type='+ that.type +'&id=' + encodeURIComponent(id)
  70. })
  71. },
  72. }
  73. }
  74. </script>
  75. <style lang="less">
  76. .container {
  77. background-color: #f3f3f3;
  78. }
  79. .contentBox {
  80. position: relative;
  81. height: calc(100%);
  82. }
  83. .listInfo {
  84. padding: 30rpx 20rpx;
  85. background-color: #fff;
  86. border-bottom: 2rpx #eee solid;
  87. }
  88. .listDetailBox {
  89. color: #666666;
  90. font-size: 24rpx;
  91. display: block;
  92. text-align: right;
  93. text-align: right;
  94. }
  95. .listDate {
  96. font-size: 24rpx;
  97. }
  98. .listTitle {
  99. color: #000405;
  100. font-size: 32rpx;
  101. line-height: 46rpx;
  102. white-space: pre-line;
  103. overflow: hidden;
  104. text-overflow: ellipsis;
  105. display: -webkit-box;
  106. -webkit-box-orient: vertical;
  107. /*行向垂直排列*/
  108. -webkit-line-clamp: 2;
  109. width: 100%;
  110. }
  111. </style>