newsdj.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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="ttopval==ite.val?'act':''" v-for="(ite,idx) in ttoplist" :key="idx" @click="getTabtop(ite.val)">{{ite.tit}}</view>
  9. </view>
  10. </view>
  11. <!-- 列表 -->
  12. <view class="carlists">
  13. <car-list :datainfo="list" :topval="ttopval" :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. ttopval:'0',
  37. ttoplist:[{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. getTabtop(val){
  55. this.ttopval=val
  56. },
  57. getrefreshData(){
  58. this.pageNum=1;
  59. this.list=[];
  60. this.reachflag=true;
  61. this.getDataFn()
  62. },
  63. getTabFn(val){
  64. this.tabval=val
  65. },
  66. bindDateChangea(e){
  67. var val=e.detail.value;
  68. this.cxrq=val;
  69. },
  70. getDataFn(){
  71. var params={
  72. pageSize:this.pageSize,
  73. pageNum: this.pageNum,
  74. }
  75. params.noticeType=this.tabidx
  76. getNoticeList(params).then(res=>{
  77. if(res.code==200){
  78. if (res.rows.length < this.pageSize) {
  79. this.reachflag = false
  80. this.wtdt = '到底了~';
  81. } else {
  82. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  83. if (num < res.total) {
  84. this.reachflag = true
  85. this.wtdt = ''
  86. } else {
  87. this.reachflag = false
  88. this.wtdt = '到底了~';
  89. }
  90. }
  91. var newArr=JSON.parse(JSON.stringify(res.rows))
  92. newArr.forEach(ite=>{
  93. ite.right=0;
  94. })
  95. // console.log(newArr,555)
  96. if (this.pageNum == 1) {
  97. this.list = newArr;
  98. } else {
  99. this.list = this.list.concat(newArr)
  100. }
  101. }else{
  102. this.$toast(res.msg)
  103. }
  104. })
  105. },
  106. }
  107. }
  108. </script>
  109. <style>
  110. page{background: #F3F3F0;}
  111. </style>
  112. <style lang="scss" scoped>
  113. .car{padding: 200rpx 0 110rpx;}
  114. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  115. .toptit{display: flex;justify-content: center;font-weight: 500;font-size: 26rpx;color: #8592AA;height: 70rpx;align-items: center;
  116. background: #E4EDFF;
  117. text{font-size: 32rpx;color: #0156FE;padding: 0 10rpx;}
  118. image{width: 28rpx;height: 26rpx;flex: 0 0 auto;margin-right: 12rpx;}
  119. }
  120. .tabtop{padding-bottom: 40rpx;padding-top: 14rpx;
  121. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  122. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  123. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  124. }
  125. }
  126. }
  127. }
  128. .carlists{padding: 0 18rpx;}
  129. </style>