优化
This commit is contained in:
@@ -1,10 +1,18 @@
|
||||
<template>
|
||||
<view class="pkRecord">
|
||||
<view class="bg">
|
||||
<image class="bgImg" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png" mode="scaleToFill" />
|
||||
<image
|
||||
class="bgImg"
|
||||
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/HomeBackground.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="Return" @click="onBack">
|
||||
<image class="ReturnImg" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png" mode="scaleToFill" />
|
||||
<image
|
||||
class="ReturnImg"
|
||||
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Return.png"
|
||||
mode="scaleToFill"
|
||||
/>
|
||||
</view>
|
||||
<view class="title">PK记录</view>
|
||||
<!-- 导航栏 -->
|
||||
@@ -32,7 +40,7 @@
|
||||
<!-- 内容 -->
|
||||
<view class="content">
|
||||
<scroll-view
|
||||
show-scrollbar="false"
|
||||
show-scrollbar="false"
|
||||
scroll-y="true"
|
||||
class="scroll"
|
||||
refresher-enabled="true"
|
||||
@@ -43,48 +51,58 @@
|
||||
:refresher-triggered="triggered"
|
||||
v-if="pkRecordlist.length !== 0"
|
||||
>
|
||||
<uni-card v-for="(item, index) in pkRecordlist" :key="index" >
|
||||
<view class="card" @click="onItemClick(item)">
|
||||
<!-- 主播A -->
|
||||
<view class="AnchorA">
|
||||
<view class="AnchorAImg">
|
||||
<!-- 头像 -->
|
||||
<image class="AnchorAImgcss" :src="item.anchorIconA" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- 皇冠 -->
|
||||
<image class="Crown" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/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" v-if="item.userACoins!== null">
|
||||
<view class="AnchorAIContext">实际金币:</view>
|
||||
<view class="AnchorAIConNum">{{ item.userACoins}}K</view>
|
||||
<uni-card v-for="(item, index) in pkRecordlist" :key="index">
|
||||
<view class="card" @click="onItemClick(item)">
|
||||
<!-- 主播A -->
|
||||
<view class="AnchorA">
|
||||
<view class="AnchorAImg">
|
||||
<!-- 头像 -->
|
||||
<image class="AnchorAImgcss" :src="item.anchorIconA" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- 皇冠 -->
|
||||
<image
|
||||
class="Crown"
|
||||
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/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" v-if="item.userACoins !== null">
|
||||
<view class="AnchorAIContext">实际金币:</view>
|
||||
<view class="AnchorAIConNum">{{ formatCoinNum(item.userACoins) }}</view>
|
||||
</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" v-if="item.userBCoins!== null">
|
||||
<view class="AnchorAIContext">实际打金币:</view>
|
||||
<view class="AnchorAIConNum">{{ item.userBCoins }}K</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" v-if="item.userBCoins !== null">
|
||||
<view class="AnchorAIContext">实际打金币:</view>
|
||||
<view class="AnchorAIConNum">{{ formatCoinNum(item.userBCoins) }}</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="AnchorAImg">
|
||||
<!-- 头像 -->
|
||||
<image class="AnchorBImgcss" :src="item.anchorIconB" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- 皇冠 -->
|
||||
<image
|
||||
class="Crown"
|
||||
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Crown.png"
|
||||
mode="scaleToFill"
|
||||
v-if="item.winnerAnchorId == item.anchorIdB"
|
||||
/>
|
||||
</view>
|
||||
<view class="AnchorAImg">
|
||||
<!-- 头像 -->
|
||||
<image class="AnchorBImgcss" :src="item.anchorIconB" mode="scaleToFill" />
|
||||
</view>
|
||||
<!-- 皇冠 -->
|
||||
<image class="Crown" src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Crown.png" mode="scaleToFill" v-if="item.winnerAnchorId == item.anchorIdB"/>
|
||||
</view>
|
||||
</view>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
<view v-if="pkRecordlist.length === 0" class="nodata">暂无内容</view>
|
||||
@@ -112,20 +130,20 @@ export default {
|
||||
},
|
||||
onLoad() {
|
||||
uni.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.userinfo = res.data;
|
||||
this.getPkRecordList(1);
|
||||
this.getPkRecordList(2);
|
||||
},
|
||||
});
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.userinfo = res.data;
|
||||
this.getPkRecordList(1);
|
||||
this.getPkRecordList(2);
|
||||
},
|
||||
});
|
||||
},
|
||||
onShareAppMessage(res) {
|
||||
if (res.from === 'menu') {
|
||||
if (res.from === "menu") {
|
||||
return {
|
||||
title: '分享',
|
||||
path: "/pages/Home/Home"
|
||||
}
|
||||
title: "分享",
|
||||
path: "/pages/Home/Home",
|
||||
};
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -137,13 +155,33 @@ export default {
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
//金币数量格式化
|
||||
formatCoinNum(coin) {
|
||||
if (coin === null || coin === undefined) {
|
||||
return "";
|
||||
}
|
||||
if (coin < 1000) {
|
||||
return String(coin);
|
||||
}
|
||||
if (coin >= 1000000) {
|
||||
return "1M+";
|
||||
}
|
||||
const kValue = coin / 1000;
|
||||
const formattedString = kValue.toFixed(2); // 确保至少保留两位小数
|
||||
const matchResult = formattedString.match(/^\d+\.\d{0,2}/);
|
||||
if (matchResult === null) {
|
||||
return kValue.toFixed(2) + "k"; // 确保至少保留两位小数
|
||||
}
|
||||
const formatted = matchResult[0];
|
||||
return `${formatted}k`;
|
||||
},
|
||||
onRefresherRefresh() {
|
||||
this.pkRecordlist = [];
|
||||
this.triggered = true;
|
||||
this.page = 0;
|
||||
if (this.current === 1) {
|
||||
this.pkmyRecordlist = [];
|
||||
}else{
|
||||
} else {
|
||||
this.pkInvitationRecordlist = [];
|
||||
}
|
||||
this.getPkRecordList(this.current);
|
||||
@@ -153,21 +191,19 @@ export default {
|
||||
this.getPkRecordList(this.current);
|
||||
},
|
||||
onItemClick(item) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/Mine/minecomponents/DetailsPKRecords/DetailsPKRecords",
|
||||
success: (res) => {
|
||||
res.eventChannel.emit("itemDetail", {
|
||||
item: item,
|
||||
});
|
||||
},
|
||||
uni.navigateTo({
|
||||
url: "/pages/Mine/minecomponents/DetailsPKRecords/DetailsPKRecords",
|
||||
success: (res) => {
|
||||
res.eventChannel.emit("itemDetail", {
|
||||
item: item,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onBack() {
|
||||
uni.navigateBack(
|
||||
{
|
||||
delta: 1,
|
||||
}
|
||||
);
|
||||
uni.navigateBack({
|
||||
delta: 1,
|
||||
});
|
||||
},
|
||||
formatDate: formatDate,
|
||||
//获取我发布的PK记录列表
|
||||
@@ -185,17 +221,17 @@ export default {
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.triggered = false;
|
||||
if (type === 1) {
|
||||
this.pkmyRecordlist.push(...res.data);
|
||||
if (this.current === 1) {
|
||||
this.pkRecordlist = this.pkmyRecordlist;
|
||||
}
|
||||
} else {
|
||||
this.pkInvitationRecordlist.push(...res.data);
|
||||
if (this.current === 2) {
|
||||
this.pkRecordlist = this.pkInvitationRecordlist;
|
||||
}
|
||||
if (type === 1) {
|
||||
this.pkmyRecordlist.push(...res.data);
|
||||
if (this.current === 1) {
|
||||
this.pkRecordlist = this.pkmyRecordlist;
|
||||
}
|
||||
} else {
|
||||
this.pkInvitationRecordlist.push(...res.data);
|
||||
if (this.current === 2) {
|
||||
this.pkRecordlist = this.pkInvitationRecordlist;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(res.msg);
|
||||
}
|
||||
@@ -207,7 +243,7 @@ export default {
|
||||
this.slidetext = val === 1 ? "我发布的PK" : "我邀请的PK";
|
||||
if (val === 1) {
|
||||
this.pkRecordlist = this.pkmyRecordlist;
|
||||
}else{
|
||||
} else {
|
||||
this.pkRecordlist = this.pkInvitationRecordlist;
|
||||
}
|
||||
},
|
||||
@@ -360,8 +396,8 @@ export default {
|
||||
color: #58d8db;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
white-space: nowrap; /* 防止换行 */
|
||||
overflow: hidden; /* 隐藏溢出内容 */
|
||||
white-space: nowrap; /* 防止换行 */
|
||||
overflow: hidden; /* 隐藏溢出内容 */
|
||||
text-overflow: ellipsis; /* 显示省略号 */
|
||||
}
|
||||
.AnchorATime {
|
||||
@@ -405,11 +441,11 @@ export default {
|
||||
border-bottom: #5ddadd solid 2rpx;
|
||||
border-right: #5ddadd solid 2rpx;
|
||||
}
|
||||
.Crown{
|
||||
width: 45.8rpx;
|
||||
height: 39.12rpx;
|
||||
margin-left: -40rpx;
|
||||
margin-top: -100rpx;
|
||||
.Crown {
|
||||
width: 45.8rpx;
|
||||
height: 39.12rpx;
|
||||
margin-left: -40rpx;
|
||||
margin-top: -100rpx;
|
||||
}
|
||||
.vstext {
|
||||
display: flex;
|
||||
@@ -428,5 +464,4 @@ export default {
|
||||
font-style: italic;
|
||||
margin-right: 26rpx;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user