blacklist.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="blacklist-box">
  3. <en-nav title="黑名单" :title-color="'#333'" @navHeight="setNavHeight"></en-nav>
  4. <scroll-view class="blacklist-list" :scroll-y="true" :scroll-x="true"
  5. :style="{'height':'calc(100% - '+navHeight+'rpx)'}">
  6. <view class="blacklist-item" v-for="(item,i) in list">
  7. <view class="blacklist-left">
  8. <image class="blacklist-img" src="/static/img/temporary/4.png" mode="aspectFill"></image>
  9. </view>
  10. <view class="blacklist-right">
  11. <view class="blacklist-title">
  12. <view class="title-text sys-color-black sys-weight-600 sys-height-44">{{item.nickName}}</view>
  13. <view class="title-icon" @click.stop="showDel(item,i)">
  14. <text class="iconfont sys-height-44 sys-color-black">&#xe74b;</text>
  15. </view>
  16. </view>
  17. <view class="blacklist-text">
  18. <view class="text-item sys-color-gray-9">{{item.gender}}/24/{{item.constellation}}</view>
  19. <view class="text-item sys-color-gray-9">{{item.date}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </scroll-view>
  24. <en-blank v-if="list<=0"></en-blank>
  25. <uni-popup ref="alertDialog" type="dialog">
  26. <uni-popup-dialog type="center" cancelText="取消" confirmText="确定" title="移除黑名单" content="是否移除黑名单"
  27. @confirm="delBlackItem()" @close="close()"></uni-popup-dialog>
  28. </uni-popup>
  29. </view>
  30. </template>
  31. <script>
  32. import EnNav from "@/components/en-utils/en-nav/en-nav";
  33. import {
  34. delBlackItem,
  35. getBlackList
  36. } from "@/api/my";
  37. import tools from "@/service/tools";
  38. import EnBlank from "@/components/en-utils/en-blank/en-blank";
  39. export default {
  40. components: {
  41. EnBlank,
  42. EnNav
  43. },
  44. data() {
  45. return {
  46. navHeight: 0,
  47. list: [],
  48. isAjax: false,
  49. total: undefined,
  50. page: 1,
  51. selectItem: {},
  52. selectIndex: 0,
  53. }
  54. },
  55. mounted() {
  56. this.startList()
  57. },
  58. methods: {
  59. setNavHeight(navHeight) {
  60. this.navHeight = navHeight
  61. },
  62. close() {
  63. this.isPop = false;
  64. this.$refs.alertDialog.close()
  65. },
  66. showDel(selectItem, selectIndex) {
  67. this.selectItem = selectItem
  68. this.selectIndex = selectIndex
  69. this.$refs.alertDialog.open()
  70. },
  71. delBlackItem() {
  72. delBlackItem(this.selectItem.id).then((res) => {
  73. if (res.code === 1) {
  74. tools.success('取消成功')
  75. this.close()
  76. this.list.splice(this.selectIndex, 1)
  77. } else {
  78. tools.error(res.msg)
  79. }
  80. })
  81. },
  82. startList() {
  83. if (this.userId <= 0) {
  84. // return false
  85. }
  86. this.list = []
  87. this.isAjax = false
  88. this.total = undefined
  89. this.page = 1
  90. this.getBlackList()
  91. },
  92. getBlackList() {
  93. if (this.isAjax) {
  94. return
  95. }
  96. this.isAjax = true
  97. let that = this
  98. getBlackList({
  99. 'pageNo': this.page,
  100. 'pageSize': '20'
  101. }).then((res) => {
  102. this.isAjax = false
  103. if (res.code === 0) {
  104. res.data.data.forEach((item) => {
  105. that.list.push(item)
  106. })
  107. ++that.page
  108. that.total = res.data.total
  109. }
  110. })
  111. },
  112. }
  113. }
  114. </script>
  115. <style scoped lang="scss">
  116. .blacklist-box {
  117. height: 100vh;
  118. padding: 0 32rpx;
  119. overflow-x: auto;
  120. .blacklist-list {
  121. width: calc(100vw - 64rpx);
  122. }
  123. .blacklist-item {
  124. width: calc(100vw - 64rpx);
  125. display: flex;
  126. justify-content: space-between;
  127. .blacklist-left {
  128. padding: 32rpx 0;
  129. margin-right: 28rpx;
  130. .blacklist-img {
  131. border-radius: 50%;
  132. width: 96rpx;
  133. height: 96rpx;
  134. }
  135. }
  136. .blacklist-right {
  137. padding: 32rpx 0;
  138. width: calc(100% - 124rpx);
  139. border-bottom: 1rpx solid #F2F2F2;
  140. .blacklist-title {
  141. display: flex;
  142. justify-content: space-between;
  143. height: 44rpx;
  144. .title-text {
  145. font-size: 32rpx;
  146. }
  147. .title-icon {
  148. .iconfont {
  149. font-size: 24rpx;
  150. }
  151. }
  152. }
  153. .blacklist-text {
  154. display: flex;
  155. justify-content: space-between;
  156. margin-top: 4rpx;
  157. .text-item {
  158. font-size: 28rpx;
  159. }
  160. }
  161. }
  162. }
  163. }
  164. </style>