Files
dvcp_v2_wxcp_app/library/project/fd/AppAnswer/component/Ranking.vue

220 lines
5.1 KiB
Vue
Raw Normal View History

2023-01-10 13:42:45 +08:00
<template>
2023-01-10 14:56:57 +08:00
<div class="ranking">
2023-01-11 15:20:04 +08:00
<div class="list-data">
<div class="item" v-for="(item, index) in list" :key="index">
<div class="flex-left">
<div class="item-rank">
<img :src="imgList[index]" alt="" v-if="index < 3">
<span v-else>{{index+1}}</span>
</div>
<div class="item-user">
<img :src="item.avatar || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" alt="">{{item.name}}
</div>
2023-01-10 14:56:57 +08:00
</div>
2023-01-11 15:20:04 +08:00
<div class="flex-right">{{item.score}}</div>
2023-01-10 14:56:57 +08:00
</div>
2023-01-11 15:20:04 +08:00
</div>
<AiEmpty description="暂无数据" v-if="!list.length"/>
<div class="list-data footer">
<div class="item" @click="linkTo">
<div class="flex-left">
<div class="item-rank">
<span>{{ info['积分排行'] }}</span>
</div>
<div class="item-user">
<img :src="user.avatar || 'https://cdn.cunwuyun.cn/wxmp/tianfuxing/avatar.png'" alt="">{{ user.name }}
</div>
</div>
<div class="flex-right">
<span>{{ info['累计获取积分'] }}</span>
<image class="right" src="../img/right.png" />
2023-01-10 14:56:57 +08:00
</div>
</div>
</div>
</div>
2023-01-10 13:42:45 +08:00
</template>
<script>
2023-01-11 11:31:07 +08:00
import { mapState } from 'vuex'
2023-01-10 14:56:57 +08:00
export default {
data () {
return {
2023-01-11 09:58:04 +08:00
search: {
current: 1,
title: '',
2023-01-11 11:31:07 +08:00
size: 100
2023-01-11 09:58:04 +08:00
},
isMore: false,
2023-01-11 15:20:04 +08:00
barStyle: {
'width': '24px',
'height': '3px',
'border-radius': '2px',
'bottom': '0px',
'background-color': '#3399FF'
},
activeStyle: {
'font-weight' : '400',
'color': '#000000'
},
imgList: [require('../img/top0.png'),require('../img/top1.png'),require('../img/top2.png')],
2023-01-11 11:31:07 +08:00
info: {},
2023-01-11 09:58:04 +08:00
list: []
2023-01-10 14:56:57 +08:00
}
},
2023-01-11 11:31:07 +08:00
computed: {
...mapState(['user']),
},
2023-01-11 09:58:04 +08:00
mounted () {
this.$loading()
this.getList()
2023-01-11 11:31:07 +08:00
this.getInfo()
2023-01-10 14:56:57 +08:00
},
2023-01-10 13:42:45 +08:00
2023-01-10 14:56:57 +08:00
methods: {
linkTo () {
uni.navigateTo({
url: './IntegralDetail'
})
2023-01-11 09:58:04 +08:00
},
2023-01-11 11:31:07 +08:00
getInfo () {
this.$http.post(`/app/applearningquestion/myScore`).then(res => {
if (res.code === 0) {
this.info = res.data
}
})
},
2023-01-11 09:58:04 +08:00
getList () {
if (this.isMore) return
this.$http.post(`/app/applearningquestion/scoreRanking`, null, {
params: {
...this.search
}
}).then(res => {
if (res.code == 0) {
if (this.search.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
uni.hideLoading()
2023-01-11 11:31:07 +08:00
if (res.data.records.length < 100) {
2023-01-11 09:58:04 +08:00
this.isMore = true
return false
}
this.search.current = this.search.current + 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
2023-01-10 14:56:57 +08:00
}
2023-01-11 15:28:53 +08:00
},
onReachBottom () {
this.current = this.current + 1
this.getList()
2023-01-10 14:56:57 +08:00
}
}
2023-01-10 13:42:45 +08:00
</script>
2023-01-10 14:56:57 +08:00
<style scoped lang="scss">
.ranking {
2023-01-11 15:20:04 +08:00
min-height: 100%;
background-color: #F3F5F9;
padding-bottom: 32px;
2023-01-10 14:56:57 +08:00
2023-01-11 15:20:04 +08:00
.list-data {
padding: 32px;
margin-bottom: 80px;
2023-01-10 14:56:57 +08:00
.item {
2023-01-11 15:20:04 +08:00
width: 100%;
2023-01-10 14:56:57 +08:00
display: flex;
justify-content: space-between;
2023-01-11 15:20:04 +08:00
padding: 24px 48px 24px 32px;
box-sizing: border-box;
background-color: #fff;
border-radius: 32px;
2023-01-10 14:56:57 +08:00
margin-bottom: 16px;
2023-01-11 15:20:04 +08:00
.flex-left {
2023-01-10 14:56:57 +08:00
display: flex;
2023-01-11 15:20:04 +08:00
.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;
}
2023-01-10 14:56:57 +08:00
}
}
2023-01-11 15:20:04 +08:00
.flex-right {
font-family: SFPro-SNaNpxibold;
2023-01-10 14:56:57 +08:00
font-weight: 600;
2023-01-11 15:20:04 +08:00
font-size: 36px;
color: #FF9343;
line-height: 42px;
padding-top: 20px;
2023-01-10 14:56:57 +08:00
}
}
}
2023-01-11 15:20:04 +08:00
.footer {
padding: 0;
margin-bottom: 0;
width: 100%;
position: fixed;
bottom: 0;
left: 0;
2023-01-10 14:56:57 +08:00
2023-01-11 15:20:04 +08:00
.item {
border-radius: 0;
margin-bottom: 0;
padding: 24px 14px 24px 32px;
2023-01-10 14:56:57 +08:00
2023-01-11 15:20:04 +08:00
&:active {
background: #eee;
}
}
.flex-right {
display: flex;
align-items: center;
2023-01-10 14:56:57 +08:00
}
2023-01-10 13:42:45 +08:00
2023-01-10 14:56:57 +08:00
.right {
2023-01-11 15:20:04 +08:00
width: 50px;
height: 50px;
2023-01-10 14:56:57 +08:00
}
}
}
2023-01-10 13:42:45 +08:00
</style>