优化页面
This commit is contained in:
@@ -1,125 +1,417 @@
|
||||
<template>
|
||||
<view class="pkRecord">
|
||||
<view>返回</view>
|
||||
<view>pk记录</view>
|
||||
<view></view>
|
||||
<view class="pkRecord">
|
||||
<view class="bg">
|
||||
<image class="bgImg" src="../../../static/HomeBackground.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="Navigation">
|
||||
<view class="PkPosted">我发布的PK</view>
|
||||
<view>我邀请的PK</view>
|
||||
</view>
|
||||
<scroll-view
|
||||
scroll-y="true"
|
||||
class="scroll"
|
||||
refresher-enabled="true"
|
||||
refresher-threshold="40"
|
||||
@refresherrefresh="onRefresherRefresh"
|
||||
lower-threshold="100"
|
||||
@scrolltolower="onScrollToLower"
|
||||
>
|
||||
<uni-card v-for="(item, index) in list">
|
||||
<view class="Return" @click="onBack">
|
||||
<image class="ReturnImg" src="../../../static/Return.png" mode="scaleToFill" />
|
||||
</view>
|
||||
<view class="title">PK记录</view>
|
||||
<!-- 导航栏 -->
|
||||
<view class="navigation">
|
||||
<view class="navigationItem">
|
||||
<view
|
||||
class="navigationItemTitle"
|
||||
@click="toggleActive(1)"
|
||||
:class="{ active: current === 1 }"
|
||||
>我发布的PK</view
|
||||
>
|
||||
<view
|
||||
class="navigationItemTitle"
|
||||
@click="toggleActive(2)"
|
||||
:class="{ active: current === 2 }"
|
||||
>我邀请的PK</view
|
||||
>
|
||||
</view>
|
||||
<view
|
||||
class="slide"
|
||||
:style="{ left: sliderPosition + 'rpx', transition: 'left 0.3s ease-in-out' }"
|
||||
>{{ slidetext }}</view
|
||||
>
|
||||
</view>
|
||||
<!-- 内容 -->
|
||||
<view class="content">
|
||||
<view class="Anchor">
|
||||
<view class="avatar">主播1头像(赢方头像框王冠)</view>
|
||||
<view class="AnchorInfo">
|
||||
<view>主播昵称</view>
|
||||
<view>pk时间</view>
|
||||
<view>实际打了多少金币</view>
|
||||
<scroll-view
|
||||
scroll-y="true"
|
||||
class="scroll"
|
||||
refresher-enabled="true"
|
||||
refresher-threshold="40"
|
||||
@refresherrefresh="onRefresherRefresh"
|
||||
lower-threshold="100"
|
||||
@scrolltolower="onScrollToLower"
|
||||
:refresher-triggered="triggered"
|
||||
>
|
||||
<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>
|
||||
</view>
|
||||
<view>
|
||||
VS
|
||||
</view>
|
||||
<view class="Anchor">
|
||||
<view class="AnchorInfo">
|
||||
<view>主播昵称</view>
|
||||
<view>pk时间</view>
|
||||
<view>实际打了多少金币</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 class="avatar">主播1头像</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>
|
||||
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</uni-card>
|
||||
</scroll-view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
list: [
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
{},
|
||||
]
|
||||
}
|
||||
import request from "../../../components/request.js";
|
||||
import formatDate from "../../../components/formatDate.js";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
triggered: false, // 下拉刷新状态
|
||||
current: 1, // 初始激活状态
|
||||
buttonWidth: 238.55, // 按钮宽度
|
||||
gap: 0, // 按钮间距
|
||||
slidetext: "我发布的PK", // 导航栏文字
|
||||
pkmyRecordlist: [], // PK记录列表
|
||||
pkInvitationRecordlist: [], // PK记录列表
|
||||
pkRecordlist: [{
|
||||
winnerId: "1",
|
||||
pkTime: "1626211200",
|
||||
anchorIdA: "123",
|
||||
anchorIconA: "https://img.yzcdn.cn/vant/cat.jpeg",
|
||||
userAcoin: "100",
|
||||
anchorIdB: "456",
|
||||
anchorIconB: "https://img.yzcdn.cn/vant/dog.jpeg",
|
||||
userBcoin: "200",
|
||||
senderA: "123",
|
||||
senderB: "456",
|
||||
},
|
||||
{
|
||||
winnerId: "2",
|
||||
pkTime: "1626211200",
|
||||
anchorIdA: "789",
|
||||
anchorIconA: "https://img.yzcdn.cn/vant/cat.jpeg",
|
||||
userAcoin: "100",
|
||||
anchorIdB: "101",
|
||||
anchorIconB: "https://img.yzcdn.cn/vant/dog.jpeg",
|
||||
userBcoin: "200",
|
||||
senderA: "789",
|
||||
senderB: "101",
|
||||
},
|
||||
], // PK记录列表
|
||||
userinfo: {}, // 用户信息
|
||||
page: 0, // 页码
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
uni.getStorage({
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.userinfo = res.data;
|
||||
this.getPkRecordList(1);
|
||||
this.getPkRecordList(2);
|
||||
},
|
||||
onLoad() {
|
||||
// 页面加载时执行
|
||||
},
|
||||
methods: {
|
||||
// 方法定义
|
||||
});
|
||||
},
|
||||
computed: {
|
||||
sliderPosition() {
|
||||
const { current, buttonWidth, gap } = this;
|
||||
const containerPadding = 0; // 容器内边距
|
||||
const offset = (buttonWidth + gap) * (current - 1);
|
||||
return containerPadding + offset + 375;
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
onRefresherRefresh() {
|
||||
this.triggered = true;
|
||||
this.page = 0;
|
||||
this.getPkRecordList(this.current);
|
||||
},
|
||||
onScrollToLower() {
|
||||
this.page++;
|
||||
this.getPkRecordList(this.current);
|
||||
},
|
||||
onItemClick(item) {
|
||||
uni.navigateTo({
|
||||
url: "/pages/Mine/minecomponents/DetailsPKRecords/DetailsPKRecords",
|
||||
success: (res) => {
|
||||
res.eventChannel.emit("itemDetail", {
|
||||
item: item,
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
onBack() {
|
||||
uni.navigateBack(
|
||||
{
|
||||
delta: 1,
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
formatDate: formatDate,
|
||||
//获取我发布的PK记录列表
|
||||
getPkRecordList(type) {
|
||||
const res = request({
|
||||
url: "user/handlePkInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
type: type,
|
||||
userId: this.userinfo.id,
|
||||
page: this.page,
|
||||
size: 10,
|
||||
},
|
||||
userInfo: true,
|
||||
}).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.triggered = false;
|
||||
if (type === 1) {
|
||||
this.pkmyRecordlist.push(...res.data);
|
||||
console.log(this.pkRecordlist);
|
||||
if (this.current === 1) {
|
||||
this.pkRecordlist = this.pkmyRecordlist;
|
||||
}
|
||||
} else {
|
||||
this.pkInvitationRecordlist.push(...res.data);
|
||||
console.log(this.pkInvitationRecordlist);
|
||||
if (this.current === 2) {
|
||||
this.pkRecordlist = this.pkInvitationRecordlist;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log(res.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
//按钮点击
|
||||
toggleActive(val) {
|
||||
this.current = val;
|
||||
this.slidetext = val === 1 ? "我发布的PK" : "我邀请的PK";
|
||||
if (val === 1) {
|
||||
this.pkRecordlist = this.pkmyRecordlist;
|
||||
}else{
|
||||
this.pkRecordlist = this.pkInvitationRecordlist;
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.pkRecord{
|
||||
width: 100vw;
|
||||
height: 200rpx;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
background-color: #ffffff;
|
||||
padding-top: 40rpx;
|
||||
border-bottom: 1px solid #000000;
|
||||
}
|
||||
.content{
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 10px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.avatar{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
font-size: 20rpx;
|
||||
background-color: aqua;
|
||||
}
|
||||
.Anchor{
|
||||
display: flex;
|
||||
}
|
||||
.AnchorInfo{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
margin-left: 10rpx;
|
||||
font-size: 20rpx;
|
||||
}
|
||||
.PkPosted{
|
||||
text-align: center;
|
||||
font-size: 30rpx;
|
||||
height: 100rpx;
|
||||
line-height: 100rpx;
|
||||
width: 45%;
|
||||
border-right: 1px solid #000000;
|
||||
}
|
||||
.Navigation{
|
||||
width: 100vw;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 100rpx;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 1px solid #000000;
|
||||
}
|
||||
</style>
|
||||
.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: 315rpx;
|
||||
font-size: 34rpx;
|
||||
color: #100e0f;
|
||||
font-weight: 500;
|
||||
}
|
||||
.ReturnImg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
/* 导航栏 */
|
||||
.navigation {
|
||||
position: absolute;
|
||||
top: 200rpx;
|
||||
left: 0rpx;
|
||||
right: 0rpx;
|
||||
height: 68.7rpx;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
.navigationItem {
|
||||
width: 477.1rpx;
|
||||
height: 68.7rpx;
|
||||
border-radius: 50rpx;
|
||||
background-color: #4fcacd;
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
}
|
||||
.navigationItemTitle {
|
||||
font-weight: 500;
|
||||
font-size: 31rpx;
|
||||
color: #ffffff;
|
||||
}
|
||||
.slide {
|
||||
position: absolute;
|
||||
width: 238.55rpx;
|
||||
height: 68.7rpx;
|
||||
background-image: linear-gradient(135deg, #e4ffff, #ffffff);
|
||||
border-radius: 50rpx;
|
||||
text-align: center;
|
||||
line-height: 68.7rpx;
|
||||
font-weight: 500;
|
||||
font-size: 31rpx;
|
||||
color: #4fcacd;
|
||||
margin-left: -238.55rpx;
|
||||
}
|
||||
.content {
|
||||
position: absolute;
|
||||
top: 300rpx;
|
||||
left: 0rpx;
|
||||
right: 0rpx;
|
||||
bottom: 0rpx;
|
||||
}
|
||||
.scroll {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
/* 卡片 */
|
||||
.card {
|
||||
width: 694.66rpx;
|
||||
height: 161.26rpx;
|
||||
background-color: #ffffff;
|
||||
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;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user