blacklist.vue 4.0 KB

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