sh.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <view class="news">
  3. <box-list :datainfo="list" :wtdt="wtdt" type="plsh" @getDetail='getDetail' @getSh="getSh"></box-list>
  4. <loading></loading>
  5. </view>
  6. </template>
  7. <script>
  8. import config from '@/config'
  9. const baseUrl = config.baseUrl
  10. import boxList from "@/mine/components/box/list.vue"
  11. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  12. import {commentSh,commentContentPut} from "@/api/work/manage.js"
  13. export default{
  14. components:{boxList},
  15. data(){
  16. return{
  17. // hrimg:require('@/static/logo.png'),
  18. list:[],
  19. pageSize: 10,
  20. pageNum: 1,
  21. reachflag: true,
  22. wtdt:'',
  23. tenantId:this.$store.state.user.tenantId
  24. }
  25. },
  26. onLoad: function() {
  27. this.getDataFn()
  28. },
  29. onPageScroll(e) {
  30. var scrollTop = Number(e.scrollTop);
  31. // var listTop=Number(this.listTop)-Number(this.nvaHeight)
  32. if(scrollTop>2){
  33. this.scroflag=true
  34. }else{
  35. this.scroflag=false
  36. }
  37. },
  38. // 上拉触底加载更多触发事件
  39. onReachBottom() {
  40. if (this.reachflag) {
  41. this.pageNum++
  42. this.getDataFn()
  43. }
  44. },
  45. methods:{
  46. checkPermi, checkRole,
  47. // getNextFn(){
  48. // this.$tab.navigateTo("/work/pages/business/add")
  49. // },
  50. getDetail(e){
  51. this.$tab.navigateTo(`/manage/pages/community/newssqdetail?id=${e}`)
  52. },
  53. getDelFn(id){
  54. var that=this;
  55. reservDel(data).then(res=>{
  56. if(res.code==200){
  57. this.$toast("删除成功");
  58. setTimeout(function(){
  59. that.getrefreshData()
  60. },1500)
  61. }
  62. })
  63. },
  64. getrefreshData(){
  65. this.pageNum=1;
  66. this.list=[];
  67. this.reachflag=true;
  68. this.getDataFn()
  69. },
  70. getSh(data){
  71. var that=this;
  72. var params=JSON.parse(JSON.stringify(data))
  73. commentContentPut(params).then(res=>{
  74. if(res.code==200){
  75. this.$toast('审核成功')
  76. setTimeout(function() {
  77. that.getrefreshData()
  78. }, 1500);
  79. }
  80. })
  81. },
  82. getDataFn(){
  83. var params={
  84. pageSize:this.pageSize,
  85. pageNum: this.pageNum,
  86. tenantId:this.tenantId,
  87. "status":'1'
  88. }
  89. commentSh(params).then(res=>{
  90. if(res.code==200){
  91. if (res.rows.length < this.pageSize) {
  92. this.reachflag = false
  93. this.wtdt = '到底了~';
  94. } else {
  95. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  96. if (num < res.total) {
  97. this.reachflag = true
  98. this.wtdt = ''
  99. } else {
  100. this.reachflag = false
  101. this.wtdt = '到底了~';
  102. }
  103. }
  104. var newArr=JSON.parse(JSON.stringify(res.rows))
  105. newArr.forEach(ite=>{
  106. ite.right=0;
  107. })
  108. if (this.pageNum == 1) {
  109. this.list = newArr;
  110. } else {
  111. this.list = this.list.concat(newArr)
  112. }
  113. }else{
  114. this.$toast(res.msg)
  115. }
  116. })
  117. },
  118. }
  119. }
  120. </script>
  121. <style>
  122. page{background: #F3F3F0;}
  123. </style>
  124. <style lang="scss" scoped>
  125. .news{padding:20rpx 18rpx;}
  126. </style>