Files
tk-mini-program-PC/src/components/mineSubComponent/PKRecord.vue

589 lines
13 KiB
Vue
Raw Normal View History

2025-07-31 22:07:21 +08:00
<template>
2025-08-05 22:07:07 +08:00
<!-- 我的PK记录 -->
<div class="pk-record">
<el-splitter>
<el-splitter-panel>
<div class="demo-panel">
<!-- 选项卡 -->
<div class="custom-style">
2025-08-12 22:05:06 +08:00
<div
class="Options"
v-for="time in options"
@click="segmentedvalue = time.value"
:style="{
borderBottom: segmentedvalue === time.value ? '5px solid #03ABA8' : '',
}"
>
<img
class="Options-icon"
:src="segmentedvalue === time.value ? time.SelectedIcon : time.icon"
alt=""
/>
<div
class="Options-label"
:style="{ color: segmentedvalue === time.value ? '#03ABA8' : '#636363' }"
>
{{ time.label }}
</div>
</div>
2025-08-05 22:07:07 +08:00
</div>
<!-- list -->
<div class="list" style="overflow: auto" v-infinite-scroll="load">
<div v-for="(item, index) in list" :key="index" class="list-item">
<div class="list-content">
<div class="information">
<div class="avatar">
<!-- 头像 -->
</div>
<div class="content-left">
<div class="name">来自世界上最长名的国家的某个人</div>
<div class="time">PK时间2025-07-31 19:07</div>
<div class="gold">
2025-08-12 22:05:06 +08:00
<img
class="goldimg"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
alt=""
/>
2025-08-05 22:07:07 +08:00
实际金币数
<div class="gold-num">10000W</div>
</div>
</div>
</div>
<div class="vs">
<img
style="width: 100%; height: 100%"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
alt=""
/>
</div>
<div class="information">
<div class="content-right">
<div class="name">来自世界上最长名的国家的某个人</div>
<div class="time">PK时间2025-07-31 19:07</div>
<div class="gold">
2025-08-12 22:05:06 +08:00
<img
class="goldimg"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
alt=""
/>
2025-08-05 22:07:07 +08:00
实际金币数
<div class="gold-num">10000W</div>
</div>
</div>
<div class="avatar">
<!-- 头像 -->
</div>
</div>
</div>
</div>
</div>
</div>
</el-splitter-panel>
<el-splitter-panel size="30%" :resizable="false" collapsible>
<div class="demo-panel">
2025-08-12 22:05:06 +08:00
<div class="particularsAvatar">
<img class="particularsAvatar-avatar" src="" alt="" />
<img class="particularsAvatar-avatar" src="" alt="" />
</div>
<!-- -->
<div class="altogether">
<div class="altogethercard">
<div class="altogether-num">总共9999999K</div>
<img
class="altogether-icon"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
alt=""
/>
<div class="altogether-num">总共9999999K</div>
2025-08-05 22:07:07 +08:00
</div>
2025-08-12 22:05:06 +08:00
</div>
<!-- -->
<div class="goldlist">
<div class="goldlist-card goldlist-card-left">
<div class="goldlist-list">
1000w
2025-08-05 22:07:07 +08:00
</div>
</div>
2025-08-12 22:05:06 +08:00
<div class="goldlist-card goldlist-card-right">
<div class="goldlist-list">
<!-- <div class="goldlist-list" v-for="(item, index) in list" :key="index" :style="{background:?????? '#D1F6F7' : '#F9DFD9' }"> -->
10000000000000000w
2025-08-05 22:07:07 +08:00
</div>
</div>
</div>
</div>
</el-splitter-panel>
</el-splitter>
</div>
2025-07-31 22:07:21 +08:00
</template>
<script setup>
import {
ref, // 响应式基础
watch, // 侦听器
onMounted, // 组件挂载完成后执行
onUpdated, // 组件更新后执行
onUnmounted, // 组件销毁前执行
} from "vue";
2025-08-15 13:05:19 +08:00
import {getPkRecord} from "@/api/account";
import { ElMessage } from "element-plus";
import {getPromiseStorage } from "@/utils/storage.js";
const user = ref(null); // 用户信息
2025-08-05 22:07:07 +08:00
const refname = ref("");
const segmentedvalue = ref(1);
const options = [
{
label: "我发布的PK",
value: 1,
2025-08-12 22:05:06 +08:00
icon: require("@/assets/Publish.png"),
SelectedIcon: require("@/assets/PublishSelected.png"),
2025-08-05 22:07:07 +08:00
},
{
label: "我邀请的PK",
value: 2,
2025-08-12 22:05:06 +08:00
icon: require("@/assets/Invitation.png"),
SelectedIcon: require("@/assets/InvitationSelected.png"),
2025-08-05 22:07:07 +08:00
},
];
2025-08-15 13:05:19 +08:00
const list = ref([]);
const page = ref(0);
const IPKPostedData = ref([]);
const InvitationData = ref([]);
//获取PK记录列表
function PkRecord() {
getPkRecord({
type: segmentedvalue.value,
userId: user.value.id,
page: page.value,
size: 10,
}).then((res) => {
console.log(res);
if (segmentedvalue.value === 1) {
IPKPostedData.value.push(...res);
list.value = IPKPostedData.value;
}else{
InvitationData.value.push(...res);
list.value = InvitationData.value;
}
})
}
// 加载更多
2025-08-05 22:07:07 +08:00
function load() {}
2025-08-12 22:05:06 +08:00
2025-08-15 13:05:19 +08:00
// 组件挂载完成后执行
onMounted(() => {
getPromiseStorage("user")
.then((res) => {
user.value = res;
PkRecord();
})
.catch((err) => {
console.log(err);
});
});
2025-07-31 22:07:21 +08:00
onUpdated(() => {
// 组件更新后执行
});
onUnmounted(() => {
// 组件销毁前执行
});
</script>
2025-08-05 22:07:07 +08:00
<style scoped lang="less">
.pk-record {
width: 100%;
height: 100%;
}
.demo-panel {
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.custom-style {
2025-08-12 22:05:06 +08:00
width: 90%;
height: 150px;
display: flex;
.Options {
&:first-child {
&.active {
animation: slideInFromRight 0.3s ease;
}
}
&:last-child {
&.active {
animation: slideInFromLeft 0.3s ease;
}
}
}
}
@keyframes slideInFromLeft {
0% {
transform: translateX(-100%);
}
100% {
transform: translateX(0);
}
}
@keyframes slideInFromRight {
0% {
transform: translateX(100%);
}
100% {
transform: translateX(0);
}
}
.Options {
width: 178px;
height: 100px;
margin-right: 120px;
display: flex;
align-items: center;
justify-content: center;
position: relative;
overflow: hidden;
&::after {
content: "";
position: absolute;
bottom: 0;
left: 0;
width: 100%;
height: 5px;
background-color: #03aba8;
transform: translateX(-100%);
transition: transform 0.3s ease;
}
&.active {
&::after {
transform: translateX(0);
}
}
&.left-to-right {
&::after {
transform: translateX(-100%);
}
&.active::after {
transform: translateX(0);
}
}
&.right-to-left {
&::after {
transform: translateX(100%);
}
&.active::after {
transform: translateX(0);
}
}
display: flex;
}
.Options {
width: 178px;
height: 100px;
margin-right: 120px;
display: flex;
align-items: center;
justify-content: center;
align-items: center;
justify-content: center;
}
.Options-icon {
width: 30px;
height: 30px;
margin-right: 15px;
}
.Options-label {
font-size: 24px;
2025-08-05 22:07:07 +08:00
}
.list {
width: 100%;
2025-08-12 22:05:06 +08:00
height: calc(100% -150px);
2025-08-05 22:07:07 +08:00
}
.list-item {
width: 100%;
height: 150px;
margin-bottom: 15px;
margin-top: 15px;
display: flex;
justify-content: center;
align-items: center;
}
.list-content {
width: 90%;
height: 100%;
border-radius: 20px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
2025-08-12 22:05:06 +08:00
background-image: url(../../assets/PKbackground.png);
background-size: 100% 100%;
2025-08-05 22:07:07 +08:00
transition: all 0.4s ease;
display: flex;
align-items: center;
justify-content: space-around;
}
.list-content:hover {
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);
transform: scale(1.08);
opacity: 0.8;
}
.vs {
width: 50px;
height: 50px;
}
.information {
width: 40%;
height: 100%;
display: flex;
align-items: center;
justify-content: space-around;
}
.avatar {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: #fff;
}
.content-left {
width: calc(100% - 150px);
height: 80%;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.content-right {
width: calc(100% - 150px);
height: 80%;
display: flex;
flex-direction: column;
justify-content: space-around;
align-items: flex-end;
}
.name {
color: @font-color;
font-size: 18px;
font-weight: bold;
white-space: nowrap; /* 防止换行 */
overflow: hidden; /* 隐藏溢出内容 */
text-overflow: ellipsis;
}
.time {
color: @Prompt-text-color;
font-size: 14px;
}
.gold {
color: @font-color;
font-size: 14px;
display: flex;
align-items: center;
}
2025-08-12 22:05:06 +08:00
.goldimg {
width: 38px;
height: 38px;
margin-right: 13px;
}
2025-08-05 22:07:07 +08:00
.gold-num {
color: @font-color;
font-size: 18px;
font-weight: bold;
}
.PKbothinfo {
width: 100%;
height: 70px;
display: flex;
}
.PKbothinfo-left {
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
border-right: 1px solid @border-color;
}
.PKbothinfo-right {
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
border-left: 1px solid @border-color;
}
.PKbothinfo-avatar {
width: 50px;
height: 50px;
border-radius: 50%;
background-color: #fff;
}
2025-08-12 22:05:06 +08:00
.PKbothinfo-gold-num {
2025-08-05 22:07:07 +08:00
font-size: 12px;
font-weight: bold;
color: @font-color;
}
.PKbothinfo-center {
width: 100%;
height: calc(100% - 70px);
display: flex;
flex-direction: column;
align-items: center;
/* 隐藏滚动条外观 */
scrollbar-width: none; /* Firefox */
scrollbar-color: transparent; /* Firefox */
/* Webkit 浏览器Chrome/Safari */
&::-webkit-scrollbar {
display: none; /* 直接隐藏滚动条 */
/* 或者透明处理 */
/* width: 0; height: 0; */
/* background: transparent; */
}
}
.PKbothinfolist-item {
width: 100%;
height: 100px;
margin-bottom: 8px;
margin-top: 8px;
display: flex;
align-items: center;
justify-content: center;
}
.PKbothinfolist-content {
width: 95%;
height: 100%;
border-radius: 10px;
background-color: rgb(255, 255, 255);
transition: all 0.4s ease;
display: flex;
align-items: center;
}
.PKbothinfolist-content:hover {
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
transform: scale(1.02);
opacity: 0.8;
}
.gold-left {
width: 50%;
height: 100%;
color: @font-color;
font-size: 14px;
font-weight: bold;
text-align: center;
line-height: 100px;
border-right: 2px solid @lose-color;
border-bottom-left-radius: 10px;
border-top-left-radius: 10px;
background-color: @lose-color;
}
.gold-right {
width: 50%;
height: 100%;
color: @font-color;
font-size: 14px;
font-weight: bold;
text-align: center;
line-height: 100px;
border-left: 2px solid @win-color;
border-bottom-right-radius: 10px;
border-top-right-radius: 10px;
background-color: @win-color;
}
2025-08-12 22:05:06 +08:00
.particularsAvatar {
width: 100%;
height: 135px;
display: flex;
align-items: flex-end;
justify-content: space-around;
}
.particularsAvatar-avatar {
width: 85px;
height: 85px;
border-radius: 50px;
background-color: #e9e9e9;
}
.altogether {
width: 100%;
height: 55px;
margin-top: 18px;
display: flex;
align-items: center;
justify-content: center;
}
.altogethercard {
width: 90%;
height: 100%;
border-radius: 50px;
background-image: url(@/assets/InTotal.png);
background-size: 100% 100%;
display: flex;
align-items: center;
justify-content: space-around;
}
.altogether-icon {
width: 50px;
height: 40px;
}
.altogether-num {
width: 40%;
text-align: center;
color: #333333;
font-size: 20px;
font-weight: bold;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.goldlist {
width: 90%;
margin-top: 10px;
height: calc(100% - 200px);
display: flex;
justify-content: space-between;
}
.goldlist-card {
width: 48%;
height: 98%;
border-radius: 20px;
display: flex;
flex-direction: column;
align-items: center;
}
.goldlist-card-left {
background-color: #dffefc;
border: 1px solid #86e1e3;
}
.goldlist-card-right {
background-color: #fbece9;
border: 1px solid #f4d0c9;
}
.goldlist-list{
width: 85%;
padding-left: 2.5%;
padding-right: 2.5%;
height: 57px;
margin-bottom: 10px;
text-align: center;
line-height: 57px;
font-size: 20px;
font-weight: bold;
color: #333333;
border-radius: 10px;
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
}
.goldlist-list:first-child {
margin-top: 20px;
}
2025-08-05 22:07:07 +08:00
</style>