This commit is contained in:
pengxiaolong
2025-07-14 13:30:18 +08:00
parent f324bf3bc7
commit 6dec463705
24 changed files with 193 additions and 147 deletions

View File

@@ -129,7 +129,7 @@
<!-- 金币 -->
<view class="popup-coin">
<view class="p-coin">
<view class="p-coin-title">最小金币数</view>
<view class="p-coin-title">最小金币数(单位为k)</view>
<uni-number-box
:max="9999999999"
background="ffffff"
@@ -139,9 +139,10 @@
>请填写金币数量</view
>
</view>
<view class="p-dar">K&nbsp;&nbsp;</view>
<view class="p-dar">-</view>
<view class="p-coin">
<view class="p-coin-title">最大金币数</view>
<view class="p-coin-title">最大金币数(单位为k)</view>
<uni-number-box
:max="9999999999"
background="#ffffff"
@@ -151,6 +152,7 @@
>请填写金币数量</view
>
</view>
<view class="p-dar">K</view>
</view>
<!-- 时间 -->
<view class="p-time" v-if="listtype === 2">
@@ -193,6 +195,8 @@ import request from "../../components/request.js";
import formatDate from "../../components/formatDate.js";
import { useCounterStore } from "@/stores/counter";
import optionsArray from "../../components/NationalDictionary.js";
import { TUILogin } from "@tencentcloud/tui-core";
const counter = useCounterStore();
export default {
inject: ["$global"],
@@ -247,6 +251,7 @@ export default {
// });
},
onLoad() {
this.AutomaticCleaning();
uni.getStorage({
key: "userinfo",
success: (res) => {
@@ -272,6 +277,15 @@ export default {
// }, 1000);
},
methods: {
//自动清理
AutomaticCleaning() {
const lastCleanTime = uni.getStorageSync("last_clean_time") || 0;
const now = Date.now();
if (now - lastCleanTime < 7 * 24 * 3600 * 1000) return; // 7 days
uni.clearStorage();
TUILogin.logout();
uni.setStorageSync("last_clean_time", now);
},
//关闭弹窗(取消)
closePopup() {
this.$refs.popup.close();

View File

@@ -8,7 +8,11 @@
/>
</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>
<view class="pkrecords">
@@ -16,24 +20,25 @@
<!-- 主播A -->
<view class="AnchorA">
<view class="Anchor">
<view class="AnchorAImg">
<!-- 头像 -->
<image class="AnchorAImgcss" :src="item.anchorIconA" mode="scaleToFill" />
<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>
<!-- 皇冠 -->
<image
class="Crown"
src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/Crown.png"
mode="scaleToFill"
v-if="item.winnerAnchorId == item.anchorIdA"
/>
</view>
<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="AnchorAICon" v-if="item.userACoins !== null"> -->
<view class="AnchorAICon">
<view class="AnchorAIContext">实际打金币:</view>
<view class="AnchorAIConNum">{{ item.userACoins }}K</view>
<view class="AnchorAIConNum">{{ formatCoinNum(iconNumber) }}</view>
</view>
</view>
</view>
@@ -45,52 +50,63 @@
<!-- 主播B -->
<view class="AnchorB">
<view class="Anchor">
<view class="AnchorAImg">
<!-- 头像 -->
<image class="AnchorBImgcss" :src="item.anchorIconB" mode="scaleToFill" />
<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>
<!-- 皇冠 -->
<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="AnchorBinfo">
<view class="AnchorAname">{{ item.anchorIdB }} </view>
<view class="AnchorATime"> {{ formatDate(item.pkTime) }} </view>
<view class="AnchorAICon" v-if="item.userBCoins!==null">
<view class="AnchorAICon" v-if="item.userBCoins !== null">
<view class="AnchorAIContext">实际打金币:</view>
<view class="AnchorAIConNum">{{ item.userBCoins }}K</view>
<view class="AnchorAIConNum">{{ formatCoinNum(item.userBCoins) }}</view>
</view>
</view>
</view>
</view>
<view class="pkrecords-content">
<scroll-view
show-scrollbar="false"
scroll-y="true"
class="scroll"
refresher-enabled="true"
refresher-threshold="40"
@refresherrefresh="onRefresherRefresh"
:refresher-triggered="triggered"
>
<uni-card v-for="(items,index) in coinNumlist" :key="index">
<view class="contentcard">
<view class="contentcard-titleA":style="{'background-color': items.anchorIdA == items.winnerAnchorId ? '#00fbff21' : '#ff000011'}">
<view class="ciontext">金币数量</view>
<view class="cion">{{items.anchorCoinA}}K</view>
</view>
<view class="contentcard-titleB" :style="{'background-color': items.anchorIdB == items.winnerAnchorId ? '#00fbff21' : '#ff000011'}">
<view class="ciontext">金币数量</view>
<view class="cion">{{items.anchorCoinB}}K</view>
</view>
</view>
</uni-card>
</scroll-view>
show-scrollbar="false"
scroll-y="true"
class="scroll"
refresher-enabled="true"
refresher-threshold="40"
@refresherrefresh="onRefresherRefresh"
:refresher-triggered="triggered"
>
<uni-card v-for="(items, index) in coinNumlist" :key="index">
<view class="contentcard">
<view
class="contentcard-titleA"
:style="{
'background-color':
items.anchorIdA == items.winnerAnchorId ? '#00fbff21' : '#ff000011',
}"
>
<view class="ciontext">金币数量</view>
<view class="cion">{{ formatCoinNum(items.anchorCoinA) }}</view>
</view>
<view
class="contentcard-titleB"
:style="{
'background-color':
items.anchorIdB == items.winnerAnchorId ? '#00fbff21' : '#ff000011',
}"
>
<view class="ciontext">金币数量</view>
<view class="cion">{{ formatCoinNum(items.anchorCoinB) }}</view>
</view>
</view>
</uni-card>
</scroll-view>
</view>
</view>
</view>
@@ -103,9 +119,11 @@ export default {
data() {
return {
title: "Hello",
item:{},
coinNumlist:[],
item: {},
coinNumlist: [],
triggered: false,
iconNumber: 123457,
};
},
onLoad(options) {
@@ -114,15 +132,36 @@ export default {
// 监听itemDetail事件
eventChannel.on("itemDetail", (data) => {
this.item = data.item; // 将接收到的数据赋值给item
this.getCoinNum(this.item)
this.getCoinNum(this.item);
});
},
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(){
onRefresherRefresh() {
this.triggered = true;
this.coinNumlist = [];
this.getCoinNum(this.item)
this.getCoinNum(this.item);
},
// 获取具体金币数量
getCoinNum(item) {
@@ -137,8 +176,8 @@ export default {
if (res.code == 200) {
this.coinNumlist = res.data;
this.triggered = false;
}else{
console.log("获取金币数量失败")
} else {
console.log("获取金币数量失败");
}
});
},
@@ -214,7 +253,7 @@ export default {
align-items: center;
margin-right: 30rpx;
}
.Anchor{
.Anchor {
display: flex;
align-items: center;
}
@@ -318,21 +357,21 @@ export default {
flex-direction: column;
align-items: center;
}
.scroll{
.scroll {
width: 750rpx;
height: 1100rpx;
}
.contentcard{
.contentcard {
width: 694.66rpx;
height: 161.26rpx;
border-radius: 15rpx;
background-color: #ffffff;
display: flex;
margin-left:28.55rpx;
margin-left: 28.55rpx;
margin-top: 25rpx;
border: #5ed8db solid 1rpx;
}
.contentcard-titleA{
.contentcard-titleA {
width: 50%;
height: 100%;
display: flex;
@@ -343,7 +382,7 @@ export default {
border-top-left-radius: 15rpx;
border-bottom-left-radius: 15rpx;
}
.contentcard-titleB{
.contentcard-titleB {
width: 50%;
height: 100%;
display: flex;
@@ -353,11 +392,11 @@ export default {
border-top-right-radius: 15rpx;
border-bottom-right-radius: 15rpx;
}
.ciontext{
.ciontext {
font-size: 28rpx;
color: #a2a2a2;
}
.cion{
.cion {
font-size: 36rpx;
color: #100e0f;
font-weight: bold;

View File

@@ -96,6 +96,8 @@ export default {
uni.setStorageSync("chatInfo", this.info.data.chatInfo)
uni.setStorageSync("userSig", this.userSig)
uni.setStorageSync("userinfo", this.info.data.info);
const now = Date.now();
uni.setStorageSync("last_clean_time", now);
counter.$patch({ myitem:this.info.data.info })
if (this.info.code === 200) {
if (this.info.data.newAccount) {