newssq.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <template>
  2. <view class="car">
  3. <view class="cartop">
  4. <view class="tabtop flexc">
  5. <view class="tabt" :class="ttopval==ite.val?'act':''" v-for="(ite,idx) in ttoplist" :key="idx" @click="getTabtop(ite.val)">{{ite.tit}}</view>
  6. <view class="numbox">
  7. 未读互动<text>27</text>
  8. </view>
  9. </view>
  10. </view>
  11. <!-- 列表 -->
  12. <view class="carlists">
  13. <car-list :datainfo="list" :topval="ttopval" :wtdt="wtdt" type='newssq' @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. cxrq:"",
  29. text:'',
  30. list:[{tit:'皖A IC520',type:1,right:0},{tit:'晋E KD783',type:2,right:0},],
  31. pageSize: 10,
  32. pageNum: 1,
  33. reachflag: true,
  34. wtdt:'',
  35. ttopval:'0',
  36. ttoplist:[{tit:'公告',val:0},{tit:'通知',val:1},{tit:'资讯',val:2}]
  37. }
  38. },
  39. onLoad: function() {
  40. },
  41. // 上拉触底加载更多触发事件
  42. onReachBottom() {
  43. if (this.reachflag) {
  44. this.pageNum++
  45. this.getDataFn()
  46. }
  47. },
  48. methods:{
  49. checkPermi, checkRole,
  50. getAddFn(){
  51. this.$tab.navigateTo("/manage/pages/community/newsaddsq")
  52. },
  53. getTabtop(val){
  54. this.ttopval=val
  55. },
  56. getrefreshData(){
  57. this.pageNum=1;
  58. this.list=[];
  59. this.reachflag=true;
  60. this.getDataFn()
  61. },
  62. getTabFn(val){
  63. this.tabval=val
  64. },
  65. bindDateChangea(e){
  66. var val=e.detail.value;
  67. this.cxrq=val;
  68. },
  69. getDataFn(){
  70. var params={
  71. pageSize:this.pageSize,
  72. pageNum: this.pageNum,
  73. }
  74. params.noticeType=this.tabidx
  75. getNoticeList(params).then(res=>{
  76. if(res.code==200){
  77. if (res.rows.length < this.pageSize) {
  78. this.reachflag = false
  79. this.wtdt = '到底了~';
  80. } else {
  81. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  82. if (num < res.total) {
  83. this.reachflag = true
  84. this.wtdt = ''
  85. } else {
  86. this.reachflag = false
  87. this.wtdt = '到底了~';
  88. }
  89. }
  90. var newArr=JSON.parse(JSON.stringify(res.rows))
  91. newArr.forEach(ite=>{
  92. ite.right=0;
  93. })
  94. // console.log(newArr,555)
  95. if (this.pageNum == 1) {
  96. this.list = newArr;
  97. } else {
  98. this.list = this.list.concat(newArr)
  99. }
  100. }else{
  101. this.$toast(res.msg)
  102. }
  103. })
  104. },
  105. }
  106. }
  107. </script>
  108. <style>
  109. page{background: #F3F3F0;}
  110. </style>
  111. <style lang="scss" scoped>
  112. .car{padding: 148rpx 0 110rpx;}
  113. .cartop{position: fixed;left: 0;right: 0;top: 0;background-color: #ffffff;z-index: 2;
  114. .tabtop{padding:28rpx 200rpx 40rpx 0;position: relative;
  115. .tabt{font-weight: 500;font-size: 32rpx;color: #666666;position: relative;line-height: 56rpx;padding: 0 40rpx;
  116. &.act{font-weight: bold;font-size: 32rpx;color: #272727;
  117. &::after{content: '';width: 40rpx;height: 10rpx;background: #0156FE;border-radius: 6rpx;position: absolute;left: 50%;margin-left: -20rpx;bottom: -10rpx;}
  118. }
  119. }
  120. .numbox{width: 188rpx;height: 58rpx;background-color: #E6E6E6;border-radius: 29rpx 0 0 29rpx;font-weight: 500;font-size: 26rpx;color: #0156FE;display: flex;align-items: center;justify-content: center;position: absolute;right: 0;
  121. text{height: 20rpx;min-width: 20rpx;padding: 0 8rpx;box-sizing: border-box;line-height: 20rpx;margin-left: 10rpx;font-weight: bold;
  122. font-size:16rpx;
  123. color: #FCF9F1;
  124. background: #D32C26;
  125. border-radius: 5px;}
  126. }
  127. }
  128. }
  129. .carlists{padding: 0 18rpx;}
  130. </style>