blacklist.vue 4.1 KB

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