blackList.vue 3.7 KB

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