message.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="mesg">
  3. <view v-if="noticelist.length">
  4. <uni-card spacing='0' padding='34rpx' margin='24rpx' shadow='0px 0px 0px 0px rgba(0, 0, 0, 0.08)' v-for="(ite,idx) in noticelist" :key="idx">
  5. <template v-slot:title>
  6. <view class="mestop">
  7. <view class="cirmes flex0" :class="noticeType==1?'co1':'co2'"></view>
  8. <!-- <view class="f15 fw c34 flex1">{{noticeType==1?'系统通知':'待办通知'}}</view> -->
  9. <view class="f15 fw c34 flex1">{{noticeType==1?'系统通知':'待办通知'}}</view>
  10. <view class="f15 c500 fa flex0">{{ite.createTime}}</view>
  11. </view>
  12. </template>
  13. <view class="uni-body f15">
  14. <view>{{ite.noticeTitle}}</view>
  15. <view>{{ite.noticeContent}} </view>
  16. <view class="mt6">祝您生活愉快!</view>
  17. </view>
  18. </uni-card>
  19. <view class="shax">{{wtdt}}</view>
  20. </view>
  21. <block v-else>
  22. <no-data ></no-data>
  23. </block>
  24. </view>
  25. </template>
  26. <script>
  27. import {getNoticelist} from "@/api/work/index.js"
  28. import noData from "@/components/nodata/nodata.vue"
  29. export default{
  30. data(){
  31. return{
  32. extra:'2023-02-21 18:32',
  33. pageSize: 10,
  34. pageNum: 1,
  35. reachflag:true,
  36. noticelist:[],
  37. wtdt:'',
  38. deptId:this.$store.state.user.deptId,
  39. }
  40. },
  41. components:{noData},
  42. onLoad() {
  43. this.getDataFn()
  44. },
  45. onReachBottom() {
  46. if (this.reachflag) {
  47. this.pageNum++
  48. this.getDataFn()
  49. }
  50. },
  51. methods:{
  52. getDataFn(){
  53. var params={
  54. pageSize:this.pageSize,
  55. pageNum: this.pageNum
  56. }
  57. getNoticelist(params).then(res=>{
  58. if(res.code==200){
  59. if (res.rows.length < this.pageSize) {
  60. this.reachflag = false
  61. this.wtdt = '到底了~';
  62. } else {
  63. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  64. if (num < res.total) {
  65. this.reachflag = true
  66. this.wtdt = '上拉加载更多'
  67. } else {
  68. this.reachflag = false
  69. this.wtdt = '到底了~';
  70. }
  71. }
  72. if (this.pageNum == 1) {
  73. this.noticelist = res.rows;
  74. } else {
  75. this.noticelist = this.noticelist.concat(res.rows)
  76. }
  77. }else{
  78. this.$toast(res.msg)
  79. }
  80. })
  81. }
  82. }
  83. }
  84. </script>
  85. <style scoped lang="scss">
  86. .mesg{padding: 4rpx 0 4rpx;}
  87. .mestop{display: flex;align-items: center;border-bottom: 2rpx solid #E5E5E5;min-height: 88rpx;padding: 0 34rpx;}
  88. .cirmes{
  89. width: 20rpx;height: 20rpx;border-radius: 10rpx;margin-right: 20rpx;
  90. &.co1{background: #1FB9F7;}
  91. &.co2{background:#FA5F03;}
  92. }
  93. </style>