ufutx_love_mp/src/pages/users/blacklist.wpy
2024-09-29 16:36:49 +08:00

310 lines
8.4 KiB
Plaintext

<template>
<view class="navbar borrow">
<view class="page__bd">
<view class="weui-tab">
<view class="text-left">
<tabSearchV2 title="搜索黑名单" BColor="#fff" @search="getSearch"></tabSearchV2>
</view>
<view class="weui-cells__title"></view>
<view class="font_22 red flo_r" style="margin-right: 32rpx;">*长按移除黑名单</view>
<view class="page__bd" v-for="(item,index) in list" :key="index" >
<view class="flo_l borrowlist" @tap="gotoFriendPage(item)" @longpress="remove(item.id)">
<view class="flo_l weui-cell__hd" >
<image :src="item.photo|| item.avatar" mode="aspectFill" style="width: 120rpx;height: 120rpx;border-radius: 12rpx;" class="flo_l"></image>
</view>
<view class="flo_l" style="width: 78%;">
<view class="font_28 flo_l color-666 ellipsis_1 bold" style="margin-left: 20rpx;">
{{item.nickname}}
</view>
<view class="font_28 flo_l ellipsis_1" style="margin-left: 6rpx;margin-top: 2rpx;">
<image src="https://images.ufutx.com/202002/20/a92b5d29dedb9932568f97fcdff865bc.png" mode="aspectFit" v-if="item.sex == 1" style="width: 38rpx;height: 38rpx;" class="flo_l"></image>
<image src="https://images.ufutx.com/202002/20/40b26d71cf2af9b1be0f874605c6ef2f.png" mode="aspectFit" v-else style="width: 38rpx;height: 38rpx;" class="flo_l"></image>
</view>
</view>
</view>
</view>
<view class="clearfloat"></view>
</view>
</view>
<pageScroll></pageScroll>
<block v-if="loading">
<view class="weui-loadmore">
<view class="weui-loading"></view>
<view class="weui-loadmore__tips ff">正在加载</view>
</view>
</block>
<block v-if="noMore">
<view class="weui-loadmore weui-loadmore_line weui-loadmore_dot">
<view class="weui-loadmore__tips weui-loadmore__tips_in-line weui-loadmore__tips_in-dot ff"></view>
</view>
</block>
</view>
</template>
<script>
import wepy from '@wepy/core'
import { service } from '../../config.js'
import https from '../../mixins/https'
import base from '../../mixins/base'
wepy.page({
mixins: [base, https],
components: { },
data: {
loaded: false,
init: false,
title: '',
mylibs: [],
list: [],
activeIndex: 0,
sliderOffset: 0,
sliderLeft: 0,
sliderWidth: 180,
screenWidth: 360,
page: 1,
noMore: false,
loading: false,
inputShowed: false,
inputVal: '',
type: ''
},
onShareAppMessage(res) {
},
async onLoad(e) {
let that = this
that.type = e.type
that.list = []
that.page = 1
that.getLibraries()
},
onShow() {
},
onPullDownRefresh() {
this.page = 1
this.getLibraries()
},
onPageScroll(res) {
},
onReachBottom() {
setTimeout(() => {
this.getLibraries()
}, 200)
},
methods: {
getLibraries(keyword) {
let _this = this
_this.loading = true
let url = `${service.host}/user/linking/blacklist`
_this.$get({
url: url,
data: {
page: this.page,
keyword: this.inputVal
}
}).then(({code, data}) => {
console.log(data, 'data====')
_this.init = true
_this.noMore = false
_this.loading = false
if (!data.data || (data.data.length == 0 && this.page != 1)) {
_this.noMore = true
_this.loading = false
return
}
data = data.data
if (!data || data.length === 0) {
_this.noMore = true
_this.list = []
return
}
if (_this.list.length === 0 || _this.page === 1) {
_this.list = data
} else {
data.map(function (item, index) {
_this.list.push(item)
})
}
console.log(this.list, 'list===')
_this.noMore = true
_this.page += 1
})
},
gotoFriendPage(item) {
let url = ''
if (item.linking_user.type == 'single') {
url = '/pages/home/information?id=' + item.linking_user.id
} else {
url = '/pages/home/informationV2?id=' + item.linking_user.id
}
wx.navigateTo({url: url})
},
remove(id) {
let vm = this
wx.showModal({ // 使用模态框提示用户进行操作
title: '提示',
content: '是否移除黑名单?',
cancelText: '取消',
confirmText: '确定',
success: function (res) {
if (res.confirm) {
vm.$delete({url: `${service.host}/user/${id}/linking/blacklist`}).then(({code, data}) => {
vm.$showToast('移除成功')
vm.page = 1
vm.getLibraries()
})
} else if (res.cancel) {
console.log('用户点击取消')
}
}
})
},
showInput() {
this.inputShowed = true
},
hideInput() {
this.inputVal = ''
this.inputShowed = false
},
clearInput() {
this.inputVal = ''
},
inputTyping(e) {
this.inputVal = e.detail.value
console.log(this.inputVal)
this.page = 1
this.getLibraries(this.inputVal)
},
tabClick(e) {
this.sliderOffset = e.currentTarget.offsetLeft
this.activeIndex = e.currentTarget.id
this.getLibraries()
},
goto(url) {
wx.navigateTo({url: url})
},
getSearch(value) { // 搜索返回值
this.page = 1
this.list = []
this.inputVal = value
this.getLibraries()
}
}
})
</script>
<style lang="less">
page{
background: white;
}
.borrow{
.page__bd{
height: 100%;
}
.page__bd{
padding-bottom: 0;
}
.weui-tab__content{
padding-top: 0px;
text-align: center;
}
text-align: center;
background: #fff;
.library-title{
//.h2();
text-align: left;
color: #666;
padding: 20rpx 40rpx 10rpx;
}
.library-wrapper{
padding: 20rpx 0;
}
.library-item{
position: relative;
&:before {
//.setLeftLine(@weuiCellBorderColor);
}
&:first-child {
&:before {
display: none;
}
}
}
.item-title{
//.h3();
line-height: 1;
}
.mini-btn{
// margin: 1em auto;
margin-left: 5px;
margin-right: 5px;
}
}
.list{
padding: 22rpx;
/*background: red;*/
box-shadow: 1rpx 1rpx 12rpx #d3d3d3;
}
.inline-block {display: inline-block}
.flo_l {float: left}
.flo_r {float: right}
.font_26 {font-size: 26rpx}
.font_28 {font-size: 28rpx}
.bold{font-weight: bold}
.clearfloat {clear:both}
.white {background: white}
.ellipsis_2 {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
.ellipsis_1 {
text-overflow:ellipsis;
white-space:nowrap;
overflow:hidden;
}
.imagebox{
width: 33%;
}
.borrowlist{
width: 92%;
box-shadow: 1rpx 1rpx 18rpx #dbdbdb;
margin-top: 18rpx;
border-radius: 6rpx;
margin-left: 4%;
padding: 22rpx;
}
.weui-cell__ft {
margin-top: 10%;
}
.weui-search-bar__form, .weui-search-bar__label{
background: #f6f6f6 !important;
border-radius: 42rpx!important;
//color: @darkgray;
border: 2rpx solid #f0f0f0;
}
</style>
<config>
{
navigationBarTitleText: '黑名单',
enablePullDownRefresh: false,
backgroundColorTop: '#f2f2f2',
backgroundColorBottom: '#f2f2f2',
usingComponents: {
tabSearchV2: '~@/components/tabSearchV2',
pageScroll: '~@/components/pageScroll',
}
}
</config>