sh.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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. getDelFn(id){
  51. var that=this;
  52. reservDel(data).then(res=>{
  53. if(res.code==200){
  54. this.$toast("删除成功");
  55. setTimeout(function(){
  56. that.getrefreshData()
  57. },1500)
  58. }
  59. })
  60. },
  61. getrefreshData(){
  62. this.pageNum=1;
  63. this.list=[];
  64. this.reachflag=true;
  65. this.getDataFn()
  66. },
  67. getSh(data){
  68. var that=this;
  69. var params=JSON.parse(JSON.stringify(data))
  70. commentContentPut(params).then(res=>{
  71. if(res.code==200){
  72. this.$toast('审核成功')
  73. setTimeout(function() {
  74. that.getrefreshData()
  75. }, 1500);
  76. }
  77. })
  78. },
  79. getDataFn(){
  80. var params={
  81. pageSize:this.pageSize,
  82. pageNum: this.pageNum,
  83. tenantId:this.tenantId,
  84. "status":'1'
  85. }
  86. commentSh(params).then(res=>{
  87. if(res.code==200){
  88. if (res.rows.length < this.pageSize) {
  89. this.reachflag = false
  90. this.wtdt = '到底了~';
  91. } else {
  92. var num = parseInt(res.rows.length) + parseInt(this.pageSize) * parseInt(this.pageNum - 1)
  93. if (num < res.total) {
  94. this.reachflag = true
  95. this.wtdt = ''
  96. } else {
  97. this.reachflag = false
  98. this.wtdt = '到底了~';
  99. }
  100. }
  101. var newArr=JSON.parse(JSON.stringify(res.rows))
  102. newArr.forEach(ite=>{
  103. ite.right=0;
  104. })
  105. if (this.pageNum == 1) {
  106. this.list = newArr;
  107. } else {
  108. this.list = this.list.concat(newArr)
  109. }
  110. }else{
  111. this.$toast(res.msg)
  112. }
  113. })
  114. },
  115. }
  116. }
  117. </script>
  118. <style>
  119. page{background: #F3F3F0;}
  120. </style>
  121. <style lang="scss" scoped>
  122. .news{padding:20rpx 18rpx;}
  123. </style>