blackList.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <template>
  2. <view>
  3. <view v-if="list.length>0" class="list flex justify-center">
  4. <view class="list-box">
  5. <block v-for="(item,index) in list" :key="index">
  6. <view class="list-box-item flex align-center justify-between" >
  7. <view class="list-box-item-l flex align-center">
  8. <image :src="item.user?item.user.avatar:'../../static/logo.png'" mode=""></image>
  9. <text>{{item.user.userName}}</text>
  10. </view>
  11. <view class="list-box-item-r flex justify-center align-center" @click="delShield(item.shieldCompanyId)">
  12. 移除
  13. </view>
  14. </view>
  15. <view class="list-box-line"></view>
  16. </block>
  17. </view>
  18. </view>
  19. <empty v-if="list.length==0" />
  20. </view>
  21. </template>
  22. <script>
  23. import empty from '../../components/empty.vue'
  24. export default {
  25. components:{
  26. empty
  27. },
  28. data() {
  29. return {
  30. page:1,
  31. limit:10,
  32. totalPage:'',
  33. list:[]
  34. };
  35. },
  36. onLoad() {
  37. this.getList()
  38. },
  39. onReachBottom() {
  40. if(this.page < this.totalPage){
  41. this.page += 1
  42. this.getList()
  43. }
  44. },
  45. onPullDownRefresh() {
  46. this.page = 1
  47. this.getList()
  48. },
  49. methods:{
  50. //移除黑名单
  51. delShield(shieldCompanyId){
  52. let that = this
  53. let data = {
  54. shieldCompanyId:shieldCompanyId
  55. }
  56. that.$Request.postT('/app/shieldCompany/deleteShieldCompany',data).then(res => {
  57. if(res.code==0){
  58. uni.showToast({
  59. title:'移除黑名单成功',
  60. duration:1500,
  61. })
  62. setTimeout(()=>{
  63. that.getList()
  64. },1500)
  65. }else{
  66. uni.showToast({
  67. title:res.msg,
  68. icon:'none'
  69. })
  70. }
  71. })
  72. },
  73. //获取企业拉黑的用户名单
  74. getList(){
  75. let data = {
  76. page:this.page,
  77. limit:this.limit,
  78. // userId:uni.getStorageSync('userId'),
  79. companyId:uni.getStorageSync('companyId')
  80. }
  81. this.$Request.getT('/app/shieldCompany/selectShieldList',data).then(res => {
  82. uni.stopPullDownRefresh()
  83. if(res.code == 0){
  84. this.totalPage = res.data.totalPage
  85. if(this.page==1){
  86. this.list = res.data.list
  87. }else{
  88. this.list = [...this.list,...res.data.list]
  89. }
  90. }else{
  91. // this.list = []
  92. }
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style lang="scss">
  99. page{
  100. background-color: #FFFFFF;
  101. }
  102. .list{
  103. width: 100%;
  104. .list-box{
  105. width: 686rpx;
  106. .list-box-line{
  107. width: 100%;
  108. border: 1rpx solid #F2F2F2;
  109. margin-top: 20rpx;
  110. }
  111. .list-box-item{
  112. width: 100%;
  113. margin-top: 50rpx;
  114. }
  115. .list-box-item-l{
  116. image{
  117. width: 70rpx;
  118. height: 70rpx;
  119. }
  120. text{
  121. margin-left: 20rpx;
  122. color: #1E1E1E;
  123. font-size: 32rpx;
  124. font-weight: bold;
  125. }
  126. }
  127. .list-box-item-r{
  128. width: 102rpx;
  129. height: 50rpx;
  130. background: #00B88F;
  131. border-radius: 8rpx;
  132. font-size: 24rpx;
  133. color: #FFFFFF;
  134. font-weight: 500;
  135. }
  136. }
  137. }
  138. </style>