Files
tk-mini-program/pages/Mine/minecomponents/DetailsPKRecords/DetailsPKRecords.vue
pengxiaolong f4901f1312 优化页面
2025-06-05 23:50:08 +08:00

334 lines
7.4 KiB
Vue

<template>
<view class="details-pkrecords">
<view class="bg">
<image
class="bgImg"
src="../../../../static/HomeBackground.png"
mode="scaleToFill"
/>
</view>
<view class="Return" @click="onBack">
<image class="ReturnImg" src="../../../../static/Return.png" mode="scaleToFill" />
</view>
<view class="title">PK记录详情</view>
<view class="pkrecords">
<view class="card">
<!-- 主播A -->
<view class="AnchorA">
<view class="AnchorAImg">
<!-- 头像 -->
<image class="AnchorAImgcss" :src="item.anchorIconA" mode="scaleToFill" />
</view>
<!-- 皇冠 -->
<image
class="Crown"
src="../../../../static/Crown.png"
mode="scaleToFill"
v-if="item.winnerAnchorId == item.anchorIdA"
/>
<view class="AnchorAinfo">
<view class="AnchorAname"> {{ item.anchorIdA }} </view>
<view class="AnchorATime">{{ formatDate(item.pkTime) }}</view>
<view class="AnchorAICon">
<view class="AnchorAIContext">实际打金币:</view>
<view class="AnchorAIConNum">{{ item.userAcoin }}K</view>
</view>
</view>
</view>
<!-- 图标 -->
<view class="vstext">
<view class="Vtext">V</view>
<view class="Stext">S</view>
</view>
<!-- 主播B -->
<view class="AnchorB">
<view class="AnchorBinfo">
<view class="AnchorAname">{{ item.anchorIdB }} </view>
<view class="AnchorATime"> {{ formatDate(item.pkTime) }} </view>
<view class="AnchorAICon">
<view class="AnchorAIContext">实际打金币:</view>
<view class="AnchorAIConNum">{{ item.userBcoin }}K</view>
</view>
</view>
<view class="AnchorAImg">
<!-- 头像 -->
<image class="AnchorBImgcss" :src="item.anchorIconB" mode="scaleToFill" />
</view>
<!-- 皇冠 -->
<image
class="Crown"
src="../../../../static/Crown.png"
mode="scaleToFill"
v-if="item.winnerAnchorId == item.anchorIdB"
/>
</view>
</view>
<view class="pkrecords-content">
<scroll-view
scroll-y="true"
class="scroll"
>
<uni-card v-for="(items,index) in coinNumlist" :key="index">
<view class="contentcard">
<view class="contentcard-titleA":style="{'background-color': items.anchorIdA == items.winnerAnchorId ? '#00fbff5d' : '#ff000049'}">
<view>金币数量</view>
<view>{{items.anchorCoinA}}K</view>
</view>
<view class="contentcard-titleB" :style="{'background-color': items.anchorIdB == items.winnerAnchorId ? '#00fbff5d' : '#ff000049'}">
<view>金币数量</view>
<view>{{items.anchorCoinB}}K</view>
</view>
</view>
</uni-card>
</scroll-view>
</view>
</view>
</view>
</template>
<script>
import request from "../../../../components/request.js";
import formatDate from "../../../../components/formatDate.js";
export default {
data() {
return {
title: "Hello",
item: {},
coinNumlist: [{
winnerAnchorId: 1,
anchorIdA: 1,
anchorIdB: 2,
anchorCoinA: 2,
anchorCoinB: 3,
}],
};
},
onLoad(options) {
// 获取源页面的eventChannel对象
const eventChannel = this.getOpenerEventChannel();
// 监听itemDetail事件
eventChannel.on("itemDetail", (data) => {
this.item = data.item; // 将接收到的数据赋值给item
console.log("接收到的数据:", this.item);
// this.getCoinNum(this.item)
});
},
methods: {
// 获取具体金币数量
getCoinNum(item) {
const res = request({
url: "user/pkRecordDetail",
method: "POST",
data: {
id: item.id,
},
userInfo: true,
}).then((res) => {
if (res.code == 200) {
this.coinNumlist = res.data;
}else{
console.log("获取金币数量失败")
}
});
},
formatDate: formatDate,
// 返回上一页
onBack() {
uni.navigateBack({
delta: 1,
});
},
},
};
</script>
<style scoped>
.bg {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: -1;
}
.bgImg {
width: 100%;
height: 100%;
}
.Return {
position: absolute;
top: 110rpx;
left: 35rpx;
width: 46rpx;
height: 46rpx;
}
.title {
position: absolute;
top: 120rpx;
left: 280rpx;
font-size: 34rpx;
color: #100e0f;
font-weight: 500;
}
.ReturnImg {
width: 100%;
height: 100%;
}
.pkrecords {
position: absolute;
top: 200rpx;
left: 0rpx;
right: 0rpx;
}
/* 卡片 */
.card {
width: 694.66rpx;
height: 161.26rpx;
border-radius: 15rpx;
display: flex;
justify-content: center;
align-items: center;
margin-left: 28.55rpx;
margin-top: 12rpx;
}
.AnchorA {
display: flex;
align-items: center;
}
.AnchorB {
display: flex;
align-items: center;
}
.AnchorAImg {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
background-color: #b1b1b1;
display: flex;
}
.AnchorAinfo {
display: flex;
flex-direction: column;
justify-content: center;
margin-left: 20rpx;
}
.AnchorBinfo {
display: flex;
flex-direction: column;
justify-content: center;
margin-right: 20rpx;
}
.AnchorAname {
font-weight: 500;
font-size: 31rpx;
color: #161616;
}
.AnchorATime {
font-weight: 400;
font-size: 23rpx;
color: #a3a3a3;
margin-top: 12rpx;
}
.AnchorAICon {
display: flex;
margin-top: 12rpx;
}
.AnchorAIContext {
font-weight: 400;
font-size: 23rpx;
color: #a3a3a3;
}
.AnchorAIConNum {
font-weight: bold;
font-size: 23rpx;
color: #161616;
}
.AnchorAImgcss {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
border-top: #f7da60 solid 2rpx;
border-left: #ffeeab solid 2rpx;
border-bottom: #ffeeab solid 2rpx;
border-right: #f7da60 solid 2rpx;
}
.AnchorBImgcss {
width: 100rpx;
height: 100rpx;
border-radius: 50rpx;
border-top: #ffc6ba solid 2rpx;
border-left: #ffc6ba solid 2rpx;
border-bottom: #5ddadd solid 2rpx;
border-right: #5ddadd solid 2rpx;
}
.Crown {
width: 45.8rpx;
height: 39.12rpx;
margin-left: -40rpx;
margin-top: -100rpx;
}
.vstext {
display: flex;
}
.Vtext {
font-size: 45.8rpx;
color: #f0836c;
font-weight: bold;
font-style: italic;
margin-left: 26rpx;
}
.Stext {
font-size: 45.8rpx;
color: #58d8db;
font-weight: bold;
font-style: italic;
margin-right: 26rpx;
}
.pkrecords-content {
position: absolute;
top: 240rpx;
left: 0;
right: 0;
display: flex;
flex-direction: column;
align-items: center;
}
.scroll{
width: 750rpx;
height: 1100rpx;
}
.contentcard{
width: 694.66rpx;
height: 161.26rpx;
border-radius: 15rpx;
background-color: #ffffff;
display: flex;
margin-left:28.55rpx;
margin-top: 13rpx;
}
.contentcard-titleA{
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-right: #100e0f solid 1rpx;
border-top-left-radius: 15rpx;
border-bottom-left-radius: 15rpx;
}
.contentcard-titleB{
width: 50%;
height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
border-top-right-radius: 15rpx;
border-bottom-right-radius: 15rpx;
}
</style>