Files
tk-mini-program/pages/Mine/minecomponents/pkInformation.vue

619 lines
16 KiB
Vue
Raw Normal View History

2025-05-30 22:04:45 +08:00
<template>
2025-06-04 22:36:28 +08:00
<view class="pk-information">
<view class="bg">
2025-06-10 23:06:51 +08:00
<image class="bgImg" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png" mode="scaleToFill" />
2025-05-30 22:04:45 +08:00
</view>
2025-06-04 22:36:28 +08:00
<view class="Return" @click="onBack">
2025-06-10 23:06:51 +08:00
<image class="ReturnImg" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill" />
2025-06-04 22:36:28 +08:00
</view>
2025-06-05 23:50:08 +08:00
<view class="title">PK信息</view>
2025-06-04 22:36:28 +08:00
<view class="content">
<scroll-view
2025-06-16 22:09:12 +08:00
show-scrollbar="false"
2025-06-04 22:36:28 +08:00
scroll-y="true"
class="scroll"
refresher-enabled="true"
refresher-threshold="40"
@refresherrefresh="onRefresherRefresh"
lower-threshold="100"
@scrolltolower="onScrollToLower"
2025-06-05 23:50:08 +08:00
:refresher-triggered="triggered"
2025-06-19 22:27:00 +08:00
v-if="pkList.length !== 0"
2025-06-04 22:36:28 +08:00
>
<uni-card class="card" v-for="(item, index) in pkList" :key="index">
<view class="Profile">
2025-06-09 19:18:38 +08:00
<image :src="item.anchorIcon" style="width: 89.12rpx; height: 89.12rpx;border-radius: 72.25rpx;" mode="scaleToFill" />
2025-06-04 22:36:28 +08:00
</view>
<view class="Individual">
<view class="Name">{{ item.anchorId }}</view>
<view class="Label">
<view>
<view
:class="{
Gendermale: item.sex === '1',
Genderfemale: item.sex === '2',
}"
>
<image
v-if="item.sex === '2'"
class="Genderimg"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/female.png"
2025-06-04 22:36:28 +08:00
mode="scaleToFill"
/>
<image
v-else
class="Genderimg"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/male.png"
2025-06-04 22:36:28 +08:00
mode="scaleToFill"
/>
<view class="age">{{ item.sex === "1" ? "男" : "女" }}</view>
</view>
</view>
2025-05-30 22:04:45 +08:00
2025-06-04 22:36:28 +08:00
<view class="state">{{ item.country }}</view>
<view class="species">
<image
style="width: 28.63rpx; height: 28.63rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/species.png"
2025-06-04 22:36:28 +08:00
mode="scaleToFill"
/>
<view class="species-text">金币:</view>
<view class="species-num">{{ item.coin }}K</view>
</view>
</view>
<view class="time">PK时间:{{ formatDate(item.pkTime) }}</view>
</view>
2025-06-09 19:18:38 +08:00
<!-- <view class="handle"> -->
<view class="handle" v-if="item.inviteStatus === 0">
2025-06-17 22:04:18 +08:00
<view class="recompose" @click="onTop(item)" v-if="item.isPin === false">
2025-05-30 22:04:45 +08:00
<image
2025-06-16 22:09:12 +08:00
style="width: 40rpx; height: 40rpx"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/pin.png"
mode="scaleToFill"
/>
</view>
2025-06-17 22:04:18 +08:00
<view class="recompose" @click="onOutTop(item)" v-if="item.isPin === true">
2025-06-16 22:09:12 +08:00
<image
style="width: 40rpx; height: 40rpx"
2025-06-17 22:04:18 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/cancelPin.png"
2025-06-16 22:09:12 +08:00
mode="scaleToFill"
/>
2025-06-17 22:04:18 +08:00
</view>
2025-06-16 22:09:12 +08:00
<view class="expurgate" @click="onRecompose(item)">
<image
style="width: 40rpx; height: 40rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/recompose.png"
2025-05-30 22:04:45 +08:00
mode="scaleToFill"
/>
2025-06-04 22:36:28 +08:00
</view>
<view class="expurgate" @click="onExpurgate(item)">
2025-05-30 22:04:45 +08:00
<image
2025-06-16 22:09:12 +08:00
style="width: 40rpx; height: 40rpx"
2025-06-10 23:06:51 +08:00
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/expurgate.png"
2025-05-30 22:04:45 +08:00
mode="scaleToFill"
/>
</view>
</view>
2025-06-04 22:36:28 +08:00
</uni-card>
</scroll-view>
2025-06-19 22:27:00 +08:00
<view v-if="pkList.length === 0" class="no-data">暂无内容</view>
2025-06-04 22:36:28 +08:00
</view>
</view>
2025-06-16 22:09:12 +08:00
<Recompose ref="createModule" class="createModule" :message="parentMessage" @Refresh="onRefresherRefresh"></Recompose>
2025-06-18 16:01:55 +08:00
<!-- 置顶弹窗 -->
2025-06-17 22:04:18 +08:00
<uni-popup ref="popup" type="center" border-radius="10px 10px 0 0">
<view class="popup-container">
<view class="popup-title">选择置顶时长</view>
2025-06-19 22:27:00 +08:00
<view class="popup-text"> 置顶后该用户将在首页置顶并在指定时长内享有置顶特权置顶时长不足 1 小时系统将按 1 小时计算积分扣除请选择置顶时长</view>
2025-06-17 22:04:18 +08:00
<view class="popup-picker">
<picker mode = "selector" :range="pickerArray" :value="index" @change="bindPickerChange">
<view class="uni-input">{{pickerArray[index]}}小时</view>
</picker>
</view>
<view class="popup-btn">
<view class="uni-primary" @click="onTopConfirm">确定</view>
<view class="uni-default" @click="closePopup">取消</view>
</view>
</view>
</uni-popup>
2025-06-18 16:01:55 +08:00
<!-- 取消置顶弹窗 -->
<uni-popup ref="popupOut" type="center" border-radius="10px 10px 0 0">
<view class="popup-container-out">
<view class="popup-title">您确定要取消置顶吗</view>
<view class="popup-text"> 取消置顶后该用户将不再享有置顶特权但仍可继续参与 PK 挑战若置顶时长不足 1 小时系统将按 1 小时计算积分扣除并于取消后按实际使用时长比例返还剩余积分是否确认执行此操作</view>
<view class="popup-btn">
<view class="uni-primary" @click="onOutTopConfirm">确定</view>
<view class="uni-default" @click="closePopupOut">取消</view>
</view>
</view>
</uni-popup>
<!-- 删除弹窗 -->
<uni-popup ref="popupExpurgate" type="center" border-radius="10px 10px 0 0">
<view class="popup-container-expurgate">
<view class="popup-title">您确定要删除该PK吗</view>
<view class="popup-text"> 删除后该用户将无法再参与该 PK 挑战是否确认执行此操作</view>
<view class="popup-btn">
<view class="uni-primary" @click="onExpurgateConfirm">确定</view>
<view class="uni-default" @click="closePopupExpurgate">取消</view>
</view>
</view>
</uni-popup>
2025-05-30 22:04:45 +08:00
</template>
<script>
import request from "../../../components/request.js";
import formatDate from "../../../components/formatDate.js";
2025-06-17 22:04:18 +08:00
import DifferenceArray from "../../../components/DifferenceArray.js";
2025-06-05 23:50:08 +08:00
import Recompose from "../minecomponents/recompose/recompose.vue";
2025-06-04 22:36:28 +08:00
2025-05-30 22:04:45 +08:00
export default {
data() {
return {
2025-06-04 22:36:28 +08:00
pkList: [],
userinfo: {},
page: 0,
createModule: null,
parentMessage: null,
2025-06-05 23:50:08 +08:00
triggered: false,
2025-06-17 22:04:18 +08:00
pickerArray: [],
index:0,
topPinnedPersondata:{},
2025-06-18 16:01:55 +08:00
Topdate:0,
popupOutdata:{},
popupExpurgatedata:{},
2025-05-30 22:04:45 +08:00
};
},
2025-06-04 22:36:28 +08:00
onLoad() {
uni.getStorage({
key: "userinfo",
success: (res) => {
this.userinfo = res.data;
this.getpkList();
},
});
},
2025-05-30 22:04:45 +08:00
mounted() {
2025-06-04 22:36:28 +08:00
this.createModule = this.$refs.createModule; // 挂载后赋值
2025-05-30 22:04:45 +08:00
},
2025-06-23 22:00:46 +08:00
onShareAppMessage(res) {
if (res.from === 'menu') {
return {
title: '分享',
path: "/pages/Home/Home"
}
}
},
2025-05-30 22:04:45 +08:00
methods: {
2025-06-13 22:13:15 +08:00
// 刷新
2025-06-05 23:50:08 +08:00
onRefresherRefresh() {
this.page = 0;
this.pkList = [];
this.getpkList();
this.triggered = true;
},
2025-06-13 22:13:15 +08:00
// 下拉加载
2025-06-05 23:50:08 +08:00
onScrollToLower() {
this.page++;
this.getpkList();
},
2025-06-13 22:13:15 +08:00
// 返回
2025-06-04 22:36:28 +08:00
onBack() {
2025-06-05 23:50:08 +08:00
uni.navigateBack({
delta: 1,
});
2025-05-30 22:04:45 +08:00
},
2025-06-13 22:13:15 +08:00
//时间格式化
2025-06-04 22:36:28 +08:00
formatDate: formatDate,
2025-06-13 22:13:15 +08:00
// 获取pk列表
2025-06-04 22:36:28 +08:00
getpkList() {
const res = request({
url: "user/queryMyAllPkData",
2025-05-30 22:04:45 +08:00
method: "POST",
data: {
2025-06-04 22:36:28 +08:00
userId: this.userinfo.id,
page: this.page,
size: 10,
2025-05-30 22:04:45 +08:00
},
2025-06-09 19:18:38 +08:00
userInfo: true,
2025-06-04 22:36:28 +08:00
}).then((res) => {
if (res.code == 200) {
2025-06-05 23:50:08 +08:00
this.pkList.push(...res.data);
this.triggered = false;
2025-05-30 22:04:45 +08:00
} else {
2025-06-04 22:36:28 +08:00
console.log(res.msg);
2025-05-30 22:04:45 +08:00
}
2025-06-04 22:36:28 +08:00
});
2025-05-30 22:04:45 +08:00
},
2025-06-13 22:13:15 +08:00
// 打开修改窗口
2025-06-04 22:36:28 +08:00
onRecompose(item) {
2025-06-05 23:50:08 +08:00
this.parentMessage = item;
this.createModule.open();
2025-06-16 22:09:12 +08:00
},
// 置顶
onTop(item) {
2025-06-17 22:04:18 +08:00
this.pickerArray = DifferenceArray(item.pkTime)
this.$refs.popup.open("center");
this.topPinnedPersondata = item
},
bindPickerChange(e){
this.index = e.detail.value
},
closePopup() {
this.$refs.popup.close();
this.index = 0
this.pickerArray = []
this.topPinnedPersondata = {}
},
onTopConfirm() {
2025-06-19 22:27:00 +08:00
this.Topdate = Math.ceil(Date.now() / 1000 + Number(this.pickerArray[this.index]) * 3600)
2025-06-17 22:04:18 +08:00
request({
url: "user/pinToTop",
method: "POST",
data: {
articleId: this.topPinnedPersondata.id,
pinExpireTime: this.Topdate,
},
userInfo: true,
}).then((res) => {
if (res.code == 200) {
this.onRefresherRefresh();
uni.showToast({
2025-06-18 16:01:55 +08:00
title:res.data,
2025-06-17 22:04:18 +08:00
icon: "none",
duration: 3000,
});
this.closePopup()
} else {
uni.showToast({
title:res.msg,
icon: "none",
duration: 3000,
});
}
});
},
//取消置顶
onOutTop(item) {
2025-06-18 16:01:55 +08:00
this.$refs.popupOut.open("center");
this.popupOutdata = item
},
// 确认取消置顶
onOutTopConfirm() {
2025-06-17 22:04:18 +08:00
request({
url: "user/cancelPin",
method: "POST",
data: {
2025-06-18 16:01:55 +08:00
articleId: this.popupOutdata.id,
2025-06-17 22:04:18 +08:00
},
userInfo: true,
}).then((res) => {
if (res.code == 200) {
2025-06-18 16:01:55 +08:00
this.closePopupOut();
this.onRefresherRefresh()
2025-06-17 22:04:18 +08:00
uni.showToast({
title: res.data,
icon: "none",
duration: 3000,
});
} else {
console.log(res.msg);
}
});
2025-06-04 22:36:28 +08:00
},
2025-06-18 16:01:55 +08:00
// 取消取消置顶
closePopupOut() {
this.$refs.popupOut.close();
this.popupOutdata = {}
},
2025-06-13 22:13:15 +08:00
// 删除pk
2025-06-05 23:50:08 +08:00
onExpurgate(item) {
2025-06-18 16:01:55 +08:00
this.$refs.popupExpurgate.open("center");
this.popupExpurgatedata = item
},
// 确认删除pk
onExpurgateConfirm() {
2025-06-04 22:36:28 +08:00
const res = request({
url: "pk/deletePkDataWithId",
2025-05-30 22:04:45 +08:00
method: "POST",
data: {
2025-06-18 16:01:55 +08:00
id: this.popupExpurgatedata.id,
2025-05-30 22:04:45 +08:00
},
2025-06-09 19:18:38 +08:00
userInfo: true,
2025-06-04 22:36:28 +08:00
}).then((res) => {
if (res.code == 200) {
2025-06-11 22:16:44 +08:00
this.onRefresherRefresh();
2025-06-18 16:01:55 +08:00
this.closePopupExpurgate();
2025-06-04 22:36:28 +08:00
uni.showToast({
2025-06-18 16:01:55 +08:00
title: res.msg,
2025-06-05 23:50:08 +08:00
icon: "none",
duration: 2000,
});
2025-06-04 22:36:28 +08:00
} else {
2025-06-18 16:01:55 +08:00
uni.showToast({
title: res.msg,
icon: "none",
duration: 2000,
});
2025-06-04 22:36:28 +08:00
}
2025-05-30 22:04:45 +08:00
});
2025-06-05 23:50:08 +08:00
},
2025-06-18 16:01:55 +08:00
// 关闭删除弹窗
closePopupExpurgate() {
this.$refs.popupExpurgate.close();
this.popupExpurgatedata = {}
},
//
2025-06-04 22:36:28 +08:00
},
components: {
2025-06-05 23:50:08 +08:00
Recompose,
2025-05-30 22:04:45 +08:00
},
};
</script>
<style scoped>
2025-06-04 22:36:28 +08:00
.bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
}
.bgImg {
width: 100%;
height: 100%;
}
.Return {
position: absolute;
2025-06-05 23:50:08 +08:00
top: 110rpx;
2025-06-04 22:36:28 +08:00
left: 35rpx;
width: 46rpx;
height: 46rpx;
}
2025-06-05 23:50:08 +08:00
.title {
position: absolute;
top: 120rpx;
2025-06-16 22:09:12 +08:00
left: 335rpx;
2025-06-05 23:50:08 +08:00
font-size: 34rpx;
color: #100e0f;
2025-06-16 22:09:12 +08:00
font-weight: bold;
2025-06-05 23:50:08 +08:00
}
2025-06-04 22:36:28 +08:00
.ReturnImg {
width: 100%;
height: 100%;
}
2025-05-30 22:04:45 +08:00
.scroll {
2025-06-04 22:36:28 +08:00
position: absolute;
top: 200rpx;
left: 0;
right: 0;
height: 1300rpx;
width: 100%;
2025-05-30 22:04:45 +08:00
}
2025-07-21 22:10:59 +08:00
.scroll ::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
display: none;
}
2025-06-19 22:27:00 +08:00
.no-data{
position: absolute;
top: 200rpx;
left: 0;
right: 0;
height: 1300rpx;
width: 100%;
line-height: 1300rpx;
text-align: center;
font-size: 30rpx;
color: #959595;
}
2025-06-04 22:36:28 +08:00
.card {
width: 695rpx;
2025-06-16 22:09:12 +08:00
height: 180rpx;
2025-05-30 22:04:45 +08:00
background: #ffffff;
border-radius: 15rpx;
display: flex;
align-items: center;
2025-06-04 22:36:28 +08:00
margin-left: 30rpx;
2025-06-13 22:13:15 +08:00
margin-top: 20rpx;
2025-05-30 22:04:45 +08:00
}
2025-06-04 22:36:28 +08:00
.Profile {
width: 89rpx;
height: 89rpx;
border-radius: 50rpx;
background-color: #cccccc;
margin-left: 27.5rpx;
2025-05-30 22:04:45 +08:00
}
.Gendermale {
2025-06-10 23:06:51 +08:00
background: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/maleimg.png) no-repeat center;
2025-05-30 22:04:45 +08:00
width: 56.3rpx;
height: 29.58rpx;
background-size: 100% 100%;
display: flex;
align-items: center;
margin-right: 10rpx;
}
.Genderfemale {
2025-06-10 23:06:51 +08:00
background: url(https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/femaleimg.png) no-repeat center;
2025-05-30 22:04:45 +08:00
width: 56.3rpx;
height: 29.58rpx;
background-size: 100% 100%;
display: flex;
align-items: center;
margin-right: 10rpx;
}
2025-06-04 22:36:28 +08:00
.Individual {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 37rpx;
}
.Name {
2025-06-11 22:16:44 +08:00
width: 288.17rpx;
2025-06-04 22:36:28 +08:00
font-size: 30.53rpx;
color: #161616;
font-weight: 500;
2025-06-11 22:16:44 +08:00
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 显示省略号 */
2025-06-04 22:36:28 +08:00
}
.time {
margin-top: 13rpx;
2025-05-30 22:04:45 +08:00
font-size: 23rpx;
color: #a3a3a3;
}
2025-06-04 22:36:28 +08:00
.state {
2025-06-11 22:16:44 +08:00
width: 56.3rpx;
2025-06-04 22:36:28 +08:00
height: 30rpx;
background: #f6f6f6;
border-radius: 14rpx;
line-height: 30rpx;
font-size: 17rpx;
color: #666666;
padding: 0 15rpx;
2025-06-11 22:16:44 +08:00
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis; /* 显示省略号 */
text-align: center;
2025-06-04 22:36:28 +08:00
}
.Label {
margin-top: 15rpx;
display: flex;
}
.age {
font-size: 17rpx;
color: #ffffff;
margin-left: 10rpx;
}
.Genderimg {
width: 14.22rpx;
height: 14.22rpx;
margin-left: 10rpx;
}
.species {
display: flex;
margin-left: 10rpx;
}
.species-text {
2025-05-30 22:04:45 +08:00
font-size: 23rpx;
color: #a3a3a3;
}
2025-06-04 22:36:28 +08:00
.species-num {
2025-05-30 22:04:45 +08:00
font-size: 23rpx;
color: #161616;
2025-06-04 22:36:28 +08:00
font-weight: bold;
}
.handle {
display: flex;
}
.recompose {
width: 46rpx;
height: 46rpx;
2025-06-16 22:09:12 +08:00
margin-left: 80rpx;
2025-06-04 22:36:28 +08:00
}
.expurgate {
width: 46rpx;
height: 46rpx;
2025-06-16 22:09:12 +08:00
margin-left: 10rpx;
2025-05-30 22:04:45 +08:00
}
2025-06-05 23:50:08 +08:00
.createModule {
position: fixed;
bottom: 0;
right: 0;
z-index: 998;
width: 100vw;
}
2025-06-17 22:04:18 +08:00
.popup-container{
width: 500rpx;
2025-06-19 22:27:00 +08:00
height: 500rpx;
2025-06-17 22:04:18 +08:00
background-color: #ffffff;
border-radius: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
2025-06-19 22:27:00 +08:00
padding: 30rpx;
2025-06-17 22:04:18 +08:00
}
2025-06-18 16:01:55 +08:00
.popup-container-out{
width: 500rpx;
height: 400rpx;
background-color: #ffffff;
border-radius: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 30rpx;
}
.popup-container-expurgate{
width: 500rpx;
height: 300rpx;
background-color: #ffffff;
border-radius: 30rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 30rpx;
}
2025-06-17 22:04:18 +08:00
.popup-title{
font-size: 30rpx;
color: #161616;
font-weight: bold;
margin-top: 30rpx;
}
2025-06-18 16:01:55 +08:00
.popup-text{
font-size: 25rpx;
color: #959595;
margin-top: 30rpx;
2025-06-19 22:27:00 +08:00
width: 400rpx;
2025-06-18 16:01:55 +08:00
}
2025-06-17 22:04:18 +08:00
.popup-picker{
2025-06-19 22:27:00 +08:00
margin-top: 60rpx;
width: 450rpx;
height: 60rpx;
2025-06-17 22:04:18 +08:00
border: #5bced1 solid 1rpx;
border-radius: 15rpx;
}
.uni-input{
font-size: 30rpx;
color: #ffffff;
2025-06-19 22:27:00 +08:00
width: 450rpx;
height: 60rpx;
2025-06-17 22:04:18 +08:00
text-align: center;
2025-06-19 22:27:00 +08:00
line-height: 60rpx;
2025-06-17 22:04:18 +08:00
background-color: #5bced1;
border-radius: 15rpx;
}
.popup-btn{
2025-06-19 22:27:00 +08:00
margin-top: 60rpx;
2025-06-17 22:04:18 +08:00
display: flex;
justify-content: center;
}
.uni-primary{
2025-06-19 22:27:00 +08:00
width: 200rpx;
height: 60rpx;
2025-06-17 22:04:18 +08:00
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-bottom-right-radius: 50rpx;
background-image: linear-gradient(135deg, #4fcacd, #5fdbde);
font-size: 25rpx;
color: #ffffff;
text-align: center;
2025-06-19 22:27:00 +08:00
line-height: 60rpx;
margin-right: 30rpx;
2025-06-17 22:04:18 +08:00
}
.uni-default{
2025-06-19 22:27:00 +08:00
width: 200rpx;
height: 60rpx;
2025-06-17 22:04:18 +08:00
border-top-left-radius: 50rpx;
border-bottom-left-radius: 50rpx;
border-bottom-right-radius: 50rpx;
background-image: linear-gradient(135deg, #cecece, #ffffff);
font-size: 25rpx;
color: #161616;
text-align: center;
2025-06-19 22:27:00 +08:00
line-height: 60rpx;
2025-06-17 22:04:18 +08:00
}
2025-05-30 22:04:45 +08:00
</style>