newsdj.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="toptit">
  5. <image :src="djtop"></image>本社区党员共<text>367</text>人
  6. </view>
  7. <view class="tabtop flexc">
  8. <view class="tabt" :class="tabval==ite.val?'act':''" v-for="(ite,idx) in tablist" :key="idx" @click="getTabFn(ite.val)">{{ite.tit}}</view>
  9. </view>
  10. </view>
  11. <!-- 列表 -->
  12. <view class="carlists">
  13. <car-list :datainfo="list" :topval="tabval" :wtdt="wtdt" type='newsdj' @getDetail="getDetail"></car-list>
  14. </view>
  15. <view class="rfbtn" @click="getAddFn">发布</view>
  16. <loading></loading>
  17. </view>
  18. </template>
  19. <script>
  20. import config from '@/config'
  21. const baseUrl = config.baseUrl
  22. import carList from "@/manage/components/car/list.vue"
  23. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  24. export default{
  25. components:{carList},
  26. data(){
  27. return{
  28. djtop:require('@/manage/static/community/djtop.png'),
  29. cxrq:"",
  30. text:'',
  31. list:[{tit:'皖A IC520',type:1,right:0},{tit:'晋E KD783',type:2,right:0},],
  32. pageSize: 10,
  33. pageNum: 1,
  34. reachflag: true,
  35. wtdt:'',
  36. tabval:'0',
  37. tablist:[{tit:'党建活动',val:0},{tit:'党建学习',val:1},{tit:'党建知识',val:2}]
  38. }
  39. },
  40. onLoad: function() {
  41. },
  42. // 上拉触底加载更多触发事件
  43. onReachBottom() {
  44. if (this.reachflag) {
  45. this.pageNum++
  46. this.getDataFn()
  47. }
  48. },
  49. methods:{
  50. checkPermi, checkRole,
  51. getAddFn(){
  52. this.$tab.navigateTo("/manage/pages/community/newsadddj")
  53. },
  54. getrefreshData(){
  55. this.pageNum=1;
  56. this.list=[];
  57. this.reachflag=true;
  58. this.getDataFn()
  59. },
  60. getTabFn(val){
  61. this.tabval=val
  62. },
  63. bindDateChangea(e){
  64. var val=e.detail.value;
  65. this.cxrq=val;
  66. },
  67. getDataFn(){
  68. var params={
  69. pageSize:this.pageSize,
  70. pageNum: this.pageNum,
  71. }
  72. params.noticeType=this.tabidx
  73. getNoticeList(params).then(res=>{
  74. if(res.code==200){
  75. if (res.rows.length < this.pageSize) {
  76. this.reachflag = false
  77. this.wtdt = '到底了~';
  78. } else {
  79. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  80. if (num < res.total) {
  81. this.reachflag = true
  82. this.wtdt = ''
  83. } else {
  84. this.reachflag = false
  85. this.wtdt = '到底了~';
  86. }
  87. }
  88. var newArr=JSON.parse(JSON.stringify(res.rows))
  89. newArr.forEach(ite=>{
  90. ite.right=0;
  91. })
  92. // console.log(newArr,555)
  93. if (this.pageNum == 1) {
  94. this.list = newArr;
  95. } else {
  96. this.list = this.list.concat(newArr)
  97. }
  98. }else{
  99. this.$toast(res.msg)
  100. }
  101. })
  102. },
  103. }
  104. }
  105. </script>
  106. <style>
  107. page{background: #F3F3F0;}
  108. </style>
  109. <style lang="scss" scoped>
  110. .car{padding: 200rpx 0 110rpx;}
  111. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  112. .toptit{display: flex;justify-content: center;font-weight: 500;font-size: 26rpx;color: #8592AA;height: 70rpx;align-items: center;
  113. background: #E4EDFF;
  114. text{font-size: 32rpx;color: #0156FE;padding: 0 10rpx;}
  115. image{width: 28rpx;height: 26rpx;flex: 0 0 auto;margin-right: 12rpx;}
  116. }
  117. .tabtop{padding-bottom: 40rpx;padding-top: 14rpx;
  118. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  119. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  120. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  121. }
  122. }
  123. }
  124. }
  125. .carlists{padding: 0 18rpx;}
  126. </style>