340 lines
8.4 KiB
Vue
340 lines
8.4 KiB
Vue
<template>
|
|
<div class="rank-pane">
|
|
<div class="rank-pane-tips">
|
|
<p>
|
|
<span>{{ tipsText }}</span>
|
|
</p>
|
|
</div>
|
|
<div class="rank-pane-top" :class="paneTypeClass">
|
|
<div class="rank-pane-top-image">
|
|
<div class="rank-pane-top-image-avatar">
|
|
<van-image
|
|
width="100%"
|
|
height="100%"
|
|
:src="yesterdayTop.imageUrl"
|
|
fit="cover"
|
|
round
|
|
/>
|
|
</div>
|
|
</div>
|
|
<div class="rank-pane-top-info">
|
|
<div class="rank-pane-top-info-name">{{ yesterdayTop.username }}</div>
|
|
<div class="rank-pane-top-info-id">{{ yesterdayTop.id }}</div>
|
|
</div>
|
|
</div>
|
|
<div class="rank-pane-list">
|
|
<div class="rank-pane-list-rank">
|
|
<rank-list :list="list"></rank-list>
|
|
</div>
|
|
<div class="rank-pane-list-user">
|
|
<rank-list-item
|
|
v-if="myRank"
|
|
class="rank-pane-list-user-item"
|
|
:rank="myRank.rank"
|
|
:avatar="myRank.imageUrl"
|
|
:name="myRank.username"
|
|
:id="myRank.id"
|
|
:value="myRank.diffValue"
|
|
></rank-list-item>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import rankList from "@/components/rankList";
|
|
import rankListItem from "@/components/rankList/rankListItem.vue";
|
|
import { ticketList, giftList } from "@/api/rank";
|
|
export default {
|
|
name: "RankPane",
|
|
components: {
|
|
rankList,
|
|
rankListItem
|
|
},
|
|
props: {
|
|
paneType: {
|
|
type: String,
|
|
default: "ticket"
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
list: [],
|
|
myRank: null,
|
|
yesterdayRank: []
|
|
};
|
|
},
|
|
computed: {
|
|
uid() {
|
|
return this.$route.query.uid;
|
|
},
|
|
tipsText() {
|
|
if (this.paneType === "ticket")
|
|
return "抽奖次数越多,排名越高哦~ 每日零点重置";
|
|
else return "获得奖励价值越高,排名越高哦~ 每日零点重置";
|
|
},
|
|
paneTypeClass() {
|
|
return `rank-pane-${this.paneType}`;
|
|
},
|
|
yesterdayTop() {
|
|
if (this.yesterdayRank.length === 0)
|
|
return {
|
|
username: "暂无",
|
|
id: "暂无"
|
|
};
|
|
return this.yesterdayRank[0];
|
|
}
|
|
},
|
|
created() {
|
|
if (this.paneType === "ticket") this.getTicketList();
|
|
else this.getGiftList();
|
|
},
|
|
methods: {
|
|
getTicketList() {
|
|
ticketList({ uid: this.uid })
|
|
.then(res => {
|
|
this.todoData(res);
|
|
})
|
|
.catch(() => {
|
|
this.$toast.fail("获取排行榜失败!");
|
|
});
|
|
},
|
|
getGiftList() {
|
|
giftList({ uid: this.uid })
|
|
.then(res => {
|
|
this.todoData(res);
|
|
})
|
|
.catch(() => {
|
|
this.$toast.fail("获取排行榜失败!");
|
|
});
|
|
},
|
|
todoData(res) {
|
|
const { code, data, msg } = res;
|
|
if (code === 200) {
|
|
const { myRank, rankVoList, yesterdayRank } = data;
|
|
this.list = rankVoList || [];
|
|
// this.list = [
|
|
// {
|
|
// diffValue: null,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 210,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 30,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 411,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 301,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 123,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 321,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 741,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 963,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// },
|
|
// {
|
|
// diffValue: 987,
|
|
// id: 3333,
|
|
// imageUrl: "http://img.haloapp.vip/wKqYHqdKGZRo?imageslim",
|
|
// levelVo: null,
|
|
// rank: 1,
|
|
// sex: null,
|
|
// showValue: null,
|
|
// uid: 9002,
|
|
// username: "11",
|
|
// value: 100
|
|
// }
|
|
// ];
|
|
this.yesterdayRank = yesterdayRank || [];
|
|
this.myRank = myRank;
|
|
} else {
|
|
this.$toast.fail(msg);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style lang="less" scoped>
|
|
.rank-pane {
|
|
height: 100%;
|
|
&-tips {
|
|
display: flex;
|
|
justify-content: center;
|
|
margin-top: 20px;
|
|
& > p {
|
|
background-color: rgba(255, 255, 255, 0.1);
|
|
padding: 0 50px;
|
|
border-radius: 60px;
|
|
& > span {
|
|
border-radius: 26px;
|
|
font-size: 24px;
|
|
font-weight: 500;
|
|
color: #dbcfff;
|
|
line-height: 54px;
|
|
}
|
|
}
|
|
}
|
|
&-top {
|
|
width: 680px;
|
|
height: 160px;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
display: flex;
|
|
align-items: center;
|
|
margin: 30px auto 40px;
|
|
&-image {
|
|
width: 136px;
|
|
height: 136px;
|
|
background-repeat: no-repeat;
|
|
background-size: cover;
|
|
background-image: url(../../assets/images/hg.png);
|
|
&-avatar {
|
|
width: 112px;
|
|
height: 112px;
|
|
margin-left: 13px;
|
|
margin-top: 13px;
|
|
}
|
|
}
|
|
&-info {
|
|
margin-left: 10px;
|
|
&-name {
|
|
font-size: 30px;
|
|
font-weight: 500;
|
|
color: #ffffff;
|
|
line-height: 48px;
|
|
}
|
|
&-id {
|
|
font-size: 24px;
|
|
font-weight: 500;
|
|
color: #ffffff;
|
|
line-height: 48px;
|
|
opacity: 0.6;
|
|
}
|
|
}
|
|
}
|
|
&-ticket {
|
|
background-image: url(../../assets/images/pcw_zr_bg.png);
|
|
}
|
|
&-gift {
|
|
background-image: url(../../assets/images/pcw_zr_bg2.png);
|
|
}
|
|
&-list {
|
|
height: calc(100% - 20px - 54px - 160px - 30px - 40px);
|
|
display: flex;
|
|
flex-direction: column;
|
|
&-rank {
|
|
flex: 1;
|
|
width: 100%;
|
|
padding: 0 35px;
|
|
margin: 0 auto;
|
|
overflow-x: hidden;
|
|
overflow-y: auto;
|
|
box-sizing: border-box;
|
|
}
|
|
&-user {
|
|
width: 100%;
|
|
height: 138px;
|
|
padding: 0 35px;
|
|
box-sizing: border-box;
|
|
background-color: #34285b;
|
|
display: flex;
|
|
align-items: center;
|
|
&-item {
|
|
width: 100%;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</style>
|