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

345 lines
8.1 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
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-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-04 22:36:28 +08:00
<view class="recompose" @click="onRecompose(item)">
2025-05-30 22:04:45 +08:00
<image
2025-06-04 22:36:28 +08:00
style="width: 46rpx; height: 46rpx"
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-04 22:36:28 +08:00
style="width: 46rpx; height: 46rpx"
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>
</view>
</view>
2025-06-05 23:50:08 +08:00
<Recompose ref="createModule" class="createModule" :message="parentMessage"></Recompose>
2025-05-30 22:04:45 +08:00
</template>
<script>
import request from "../../../components/request.js";
import formatDate from "../../../components/formatDate.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-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;
console.log(this.userinfo);
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
},
methods: {
2025-06-05 23:50:08 +08:00
onRefresherRefresh() {
this.page = 0;
this.pkList = [];
this.getpkList();
this.triggered = true;
},
onScrollToLower() {
this.page++;
this.getpkList();
},
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-04 22:36:28 +08:00
formatDate: formatDate,
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);
2025-06-04 22:36:28 +08:00
console.log(this.pkList);
2025-06-05 23:50:08 +08:00
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-04 22:36:28 +08:00
onRecompose(item) {
2025-06-05 23:50:08 +08:00
this.parentMessage = item;
this.createModule.open();
2025-06-04 22:36:28 +08:00
},
2025-06-05 23:50:08 +08:00
onExpurgate(item) {
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-04 22:36:28 +08:00
id: item.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-04 22:36:28 +08:00
uni.showToast({
2025-06-05 23:50:08 +08:00
title: "删除成功",
icon: "none",
duration: 2000,
});
2025-06-04 22:36:28 +08:00
} else {
console.log(res.msg);
}
2025-05-30 22:04:45 +08:00
});
2025-06-05 23:50:08 +08:00
},
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;
left: 315rpx;
font-size: 34rpx;
color: #100e0f;
font-weight: 500;
}
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-06-04 22:36:28 +08:00
.card {
width: 695rpx;
2025-05-30 22:04:45 +08:00
height: 161rpx;
background: #ffffff;
border-radius: 15rpx;
display: flex;
align-items: center;
2025-06-04 22:36:28 +08:00
margin-left: 30rpx;
margin-top: 11.5rpx;
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;
margin-left: 90rpx;
}
.expurgate {
width: 46rpx;
height: 46rpx;
margin-left: 40rpx;
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-05-30 22:04:45 +08:00
</style>