Files
dvcp_v2_wxcp_app/library/project/qianxinan/AppPointsRanking/AppPointsRanking.vue

200 lines
4.9 KiB
Vue
Raw Normal View History

2022-12-23 10:49:20 +08:00
<template>
<div class="AppPointsRanking">
<AiTopFixed>
<u-tabs :list="tabList" :is-scroll="false" :current="currentTabs" height="88" bg-color="#fff" font-size="28"
inactive-color="#666" :bar-style="barStyle" :active-item-style="activeStyle" active-color="#3399FF" @change="change">
</u-tabs>
</AiTopFixed>
<div class="list-data">
2022-12-30 17:45:53 +08:00
<div class="item" v-for="(item, index) in list" :key="index">
2022-12-23 10:49:20 +08:00
<div class="flex-left">
<div class="item-rank">
2022-12-30 17:45:53 +08:00
<img :src="imgList[index]" alt="" v-if="index < 3">
<span v-else>{{index+1}}</span>
2022-12-23 10:49:20 +08:00
</div>
<div class="item-user">
2022-12-30 17:45:53 +08:00
<img :src="item.avatar" alt="">{{item.name}}
2022-12-23 10:49:20 +08:00
</div>
</div>
2022-12-30 17:45:53 +08:00
<div class="flex-right">{{item.score}}</div>
2022-12-23 10:49:20 +08:00
</div>
2022-12-30 17:45:53 +08:00
</div>
<AiEmpty description="暂无数据" v-if="!list.length"/>
<div class="list-data footer" v-if="currentTabs<1">
2022-12-23 10:49:20 +08:00
<div class="item">
<div class="flex-left">
<div class="item-rank">
2022-12-30 17:45:53 +08:00
<span>{{userNum}}</span>
2022-12-23 10:49:20 +08:00
</div>
<div class="item-user">
2022-12-30 17:45:53 +08:00
<img :src="userRank.avatar" alt="">{{userRank.name}}
2022-12-23 10:49:20 +08:00
</div>
</div>
2022-12-30 17:45:53 +08:00
<div class="flex-right">{{userRank.score}}</div>
2022-12-23 10:49:20 +08:00
</div>
</div>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
appName: '积分排行',
data() {
return {
list: [],
currentTabs: 0,
tabList: [
{
2022-12-26 16:16:10 +08:00
name: '总排行',
2022-12-23 10:49:20 +08:00
},
{
2022-12-26 16:16:10 +08:00
name: '县局排行',
2022-12-23 10:49:20 +08:00
},
{
2022-12-26 16:16:10 +08:00
name: '派出所排行',
2022-12-23 10:49:20 +08:00
},
],
barStyle: {
'width': '24px',
'height': '3px',
'border-radius': '2px',
'bottom': '0px',
'background-color': '#3399FF'
},
activeStyle: {
'font-weight' : '400',
'color': '#000000'
},
2022-12-30 17:45:53 +08:00
imgList: [require('./img/top0.png'),require('./img/top1.png'),require('./img/top2.png')],
userRank: {},
userNum: ''
2022-12-23 10:49:20 +08:00
}
},
computed: {
...mapState(['user']),
},
created() {
2022-12-30 17:45:53 +08:00
this.getRanking()
this.getUserRank()
2022-12-23 10:49:20 +08:00
},
onShow() {
document.title = '积分排行'
},
methods: {
change(index) {
this.currentTabs = index
2022-12-30 17:45:53 +08:00
this.getRanking()
},
getRanking() {
this.$http.post(`/app/appscoredetail/scoreRanking?type=${this.currentTabs}&size=100`).then(res=> {
if(res?.data) {
this.list = res.data.records
this.list.map((item) => {
if(this.user.phone == item.phone) {
this.userRank = {...item}
}
})
if(this.currentTabs<1) {
this.getUserRank()
}
}
})
},
getUserRank() {
this.$http.post(`/app/appscoredetail/myScore`).then(res=> {
if(res?.data) {
this.userNum = res.data['积分排行']
}
})
2022-12-23 10:49:20 +08:00
},
},
}
</script>
<style lang="scss" scoped>
.AppPointsRanking {
min-height: 100%;
background-color: #F5F5F5;
padding-bottom: 32px;
::v-deep .content {
padding: 0;
min-height: 0;
}
::v-deep .fixed {
min-height: 0;
}
.list-data {
padding: 32px;
2023-01-03 09:29:13 +08:00
margin-bottom: 80px;
2022-12-23 10:49:20 +08:00
.item {
width: 100%;
display: flex;
justify-content: space-between;
padding: 24px 48px 24px 32px;
box-sizing: border-box;
background-color: #fff;
border-radius: 32px;
margin-bottom: 16px;
.flex-left {
display: flex;
.item-rank {
width: 152px;
img {
padding-top: 12px;
width: 56px;
height: 56px;
vertical-align: middle;
}
span {
line-height: 80px;
font-family: SFPro-SNaNpxiboldItalic;
font-weight: SemiboldItalic;
font-size: 40px;
color: #DDD;
}
}
.item-user {
line-height: 80px;
font-family: PingFangSC-Medium;
font-weight: 500;
font-size: 32px;
color: #333;
img {
width: 80px;
height: 80px;
border-radius: 50%;
margin-right: 16px;
vertical-align: middle;
}
}
}
.flex-right {
font-family: SFPro-SNaNpxibold;
font-weight: 600;
font-size: 36px;
color: #FF9343;
line-height: 42px;
padding-top: 20px;
}
}
}
2022-12-30 17:45:53 +08:00
.footer {
padding: 0;
2023-01-03 09:29:13 +08:00
margin-bottom: 0;
2022-12-30 17:45:53 +08:00
width: 100%;
position: fixed;
bottom: 0;
left: 0;
.item {
border-radius: 0;
margin-bottom: 0;
}
}
2022-12-23 10:49:20 +08:00
}
</style>