重新整改积分

This commit is contained in:
aixianling
2022-05-20 15:03:36 +08:00
parent 33833951a4
commit 7e9f5c2739
7 changed files with 851 additions and 187 deletions

View File

@@ -1,63 +1,101 @@
<template>
<section class="userRank">
<div class="bg-blue"/>
<div class="header-content">
<div class="item">
<div class="num color-5AAD6A">{{ Number(info['个人积分']) || '0' }}</div>
<div class="label">个人总分</div>
</div>
<div class="item">
<div class="num color-CD413A">{{ info['个人排行'] || '0' }}</div>
<div class="label">个人排名</div>
</div>
<img src="https://cdn.cunwuyun.cn/dvcp/credit/head.png" alt="">
<div class="area-content">
<AiAreaPicker :areaId="user.areaId" :value="areaId" @select="areaSelect" :name.sync="areaName" selectRoot>
<img src="./img/local-icon.png" alt="">
<span class="label" v-if="areaName">{{ areaName }}</span>
<span v-else>请选择</span>
<u-icon name="arrow-down" color="#666" size="24"/>
</AiAreaPicker>
</div>
<div v-if="!showDetail">
<u-gap height="6"/>
<div class="fill" v-if="info['列表'] && info['列表'].length">
<div class="ranking-content" v-if="info['列表'] && info['列表'].length">
<div class="item" v-if="info['列表'].length > 1">
<img src="https://cdn.cunwuyun.cn/dvcp/credit/2.png" alt="" class="top-img">
<img :src="info['列表'][1].photo" alt="" class="user-img mar-b4" v-if="info['列表'][1].photo">
<div class="user-name-bg mar-b4" v-else>{{ $formatName(info['列表'][1].name) }}</div>
<p class="user-name mar-b8">{{ info['列表'][1].name }}</p>
<p class="item-num">{{ info['列表'][1].integral }}</p>
<img
src="https://cdn.cunwuyun.cn/dvcp/credit/2.png"
alt=""
class="top-img"
/>
<img
:src="info['列表'][1].photo"
alt=""
class="user-img mar-b4"
v-if="info['列表'][1].photo"
/>
<div class="user-name-bg mar-b4" v-else>
{{ formatName(info["列表"][1].name) }}
</div>
<p class="user-name mar-b8">
{{ info["列表"][1].name }}{{ tabIndex == 0 ? "家" : "" }}
</p>
<p class="item-num">{{ info["列表"][1].integral }}</p>
</div>
<div class="item-top item" v-if="info['列表'].length > 0">
<img src="https://cdn.cunwuyun.cn/dvcp/credit/1.png" alt="" class="top-img-one">
<img :src="info['列表'][0].photo" alt="" class="user-img mar-b4" v-if="info['列表'][0].photo">
<div class="user-name-bg mar-b4" v-else>{{ $formatName(info['列表'][0].name) }}</div>
<p class="user-name mar-b8">{{ info['列表'][0].name }}</p>
<p class="item-num">{{ info['列表'][0].integral }}</p>
<img
src="https://cdn.cunwuyun.cn/dvcp/credit/1.png"
alt=""
class="top-img-one"
/>
<img
:src="info['列表'][0].photo"
alt=""
class="user-img mar-b4"
v-if="info['列表'][0].photo"
/>
<div class="user-name-bg mar-b4" v-else>
{{ formatName(info["列表"][0].name) }}
</div>
<p class="user-name mar-b8">
{{ info["列表"][0].name }}{{ tabIndex == 0 ? "家" : "" }}
</p>
<p class="item-num">{{ info["列表"][0].integral }}</p>
</div>
<div class="item" v-if="info['列表'].length > 2">
<img src="https://cdn.cunwuyun.cn/dvcp/credit/3.png" alt="" class="top-img">
<img :src="info['列表'][2].photo" alt="" class="user-img mar-b4" v-if="info['列表'][2].photo">
<div class="user-name-bg mar-b4" v-else>{{ $formatName(info['列表'][2].name) }}</div>
<p class="user-name mar-b8">{{ info['列表'][2].name }}</p>
<p class="item-num">{{ info['列表'][2].integral }}</p>
<img
src="https://cdn.cunwuyun.cn/dvcp/credit/3.png"
alt=""
class="top-img"
/>
<img
:src="info['列表'][2].photo"
alt=""
class="user-img mar-b4"
v-if="info['列表'][2].photo"
/>
<div class="user-name-bg mar-b4" v-else>
{{ formatName(info["列表"][2].name) }}
</div>
<p class="user-name mar-b8">
{{ info["列表"][2].name }}{{ tabIndex == 0 ? "家" : "" }}
</p>
<p class="item-num">{{ info["列表"][2].integral }}</p>
</div>
</div>
<div class="ranking-list" v-if="info['列表'] && info['列表'].length">
<div class="item" v-for="(item, index) in info['列表']" :key="index" v-if="index > 2">
<u-gap height="6"/>
<div class="ranking-list" v-if="info['列表'] && info['列表'].length">
<div
class="item"
v-for="(item, index) in info['列表']"
:key="index"
v-if="index > 2"
>
<span class="item-num">{{ index + 1 }}</span>
<img :src="item.photo" alt="" class="user-img mar-b4" v-if="item.photo">
<div class="user-name-bg mar-b4 mar-r24" v-else>{{ $formatName(item.name) }}</div>
<span class="item-name">{{ item.name }}</span>
<img
:src="item.photo"
alt=""
class="user-img mar-b4"
v-if="item.photo"
/>
<div class="user-name-bg mar-b4 mar-r24" v-else>
{{ formatName(item.name) }}
</div>
<span class="item-name">{{ item.name }}{{ tabIndex == 0 ? "家" : "" }}</span>
<span class="item-point">{{ item.integral }}</span>
</div>
</div>
</div>
<div class="detail-content" v-if="showDetail && list.length">
<div class="title">积分明细</div>
<div class="item" v-for="(item, index) in list" :key="index">
<div class="item-info">
<p>{{ item.residentName + ':' }}{{ item.eventDesc }}</p>
<span>&nbsp;&nbsp;&nbsp;{{ item.doTime }}</span>
</div>
<div class="item-num" :class="'color-'+ (item.changeIntegral >= 0 ? 0 : 1)">
{{ item.changeIntegral > 0 ? '+' + item.changeIntegral : item.changeIntegral }}
</div>
</div>
</div>
<AiEmpty v-else/>
</section>
</template>
<script>
@@ -79,51 +117,55 @@ export default {
info: {},
current: 1,
list: [],
areaId: '',
areaName: '',
tabIndex: 1
}
},
mounted() {
this.getInfo()
if (this.showDetail) {
this.getList()
}
created() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName || ''
this.getInfo();
uni.$on("onShow", () => {
this.getInfo();
})
uni.$on("reachBottom", () => {
if (this.list.length < 50) {
this.current++;
this.getInfo()
}
})
},
methods: {
getInfo() {// 积分排行
this.info = {}
// var url = `/app/appresident/rank?id=00255e188d1225f3fe022cb4eed44a84&type=${this.tabIndex}` //积分排行
var url = `/app/appresident/rank?id=${this.user.residentId}&type=1&areaId=${this.user?.areaId}` //积分排行
this.$http.post(url).then(res => {
if (res.code === 0) {
this.info = res.data
}
})
areaSelect(e) {
this.areaId = e
this.getInfo()
},
getList() {// 积分明细列表
// var url = `/app/appvillagerintegraldetail/IntegralList?residentId=00255e188d1225f3fe022cb4eed44a84&type=${this.tabIndex}&current=${this.current}&size=10` //积分明细
let url = `/app/appvillagerintegraldetail/IntegralList?residentId=${this.user.residentId}&queryType=1&current=${this.current}&size=10` //积分明细
this.$http.post(url).then(res => {
// 积分排行
getInfo() {
this.info = {};
this.$http.post(`/app/appresident/rank-qw?type=${this.tabIndex}&areaId=${this.areaId}`).then((res) => {
if (res?.data) {
if (this.current > res.data.pages) {
return
}
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
this.info = res.data;
}
})
});
},
formatName(name) {
if (name == undefined) {
return
}
return name.substr(name.length - 2, name.length > 2 ? (name.length - 1) : name.length)
},
},
onReachBottom() {
if (this.list.length < 50) {
this.current++;
this.getList()
}
},
destroyed() {
uni.$off("reachBottom")
uni.$off("onShow")
}
}
</script>
<style scoped lang="scss">
.userRank {
width: 100vw;
overflow-x: hidden;
background-color: #f3f6f9;
.bg-blue {
@@ -135,7 +177,7 @@ export default {
.header-content {
width: 690px;
height: 256px;
background: #FFF;
background: #fff;
border-radius: 16px;
margin: -130px 0 40px 30px;
padding: 100px 60px 40px 60px;
@@ -164,15 +206,15 @@ export default {
}
.color-5AAD6A {
color: #5AAD6A;
color: #5aad6a;
}
.color-4185F5 {
color: #4185F5;
color: #4185f5;
}
.color-CD413A {
color: #CD413A;
color: #cd413a;
}
}
@@ -187,17 +229,18 @@ export default {
.ranking-content {
padding: 94px 30px 0;
background-color: #fff;
.item {
display: inline-block;
width: 216px;
height: 320px;
box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.12);
border-radius: 12px;
padding: 40px 0 76px 0;
padding: 40px 0 0 0;
text-align: center;
box-sizing: border-box;
position: relative;
vertical-align: top;
background: #fff;
.user-name {
font-size: 30px;
@@ -205,12 +248,13 @@ export default {
font-weight: 500;
color: #333;
line-height: 42px;
word-break: break-all;
}
.item-num {
font-size: 46px;
font-weight: 6000;
color: #2C51CE;
color: #2c51ce;
line-height: 54px;
}
@@ -225,6 +269,7 @@ export default {
.item-top {
margin: -46px 20px 0;
height: 366px;
.user-img {
width: 104px;
@@ -235,7 +280,7 @@ export default {
width: 104px;
height: 104px;
border-radius: 50%;
background-color: #4E8EEE;
background-color: #4e8eee;
font-size: 28px;
line-height: 104px;
text-align: center;
@@ -259,7 +304,7 @@ export default {
width: 100%;
height: 120px;
line-height: 120px;
background: #FFF;
background: #fff;
padding: 0 64px;
box-sizing: border-box;
@@ -309,7 +354,7 @@ export default {
width: 80px;
height: 80px;
border-radius: 50%;
background-color: #4E8EEE;
background-color: #4e8eee;
font-size: 28px;
line-height: 80px;
text-align: center;
@@ -326,9 +371,9 @@ export default {
.detail-content {
width: 690px;
background: #FFF;
background: #fff;
border-radius: 16px;
margin: 0 0 0 32px;
margin: 432px 0 0 32px;
padding: 30px 30px 94px;
box-sizing: border-box;
@@ -381,15 +426,66 @@ export default {
}
.color-0 {
color: #2C51CE !important;
color: #2c51ce !important;
}
.color-1 {
color: #E6736E !important;
color: #e6736e !important;
}
.fixed-top {
z-index: 999;
}
.header-tab {
height: 96px;
background-color: #3975C6;
padding: 20px 0;
display: flex;
align-items: center;
box-sizing: border-box;
}
.header-tab .tab-item {
flex: 1;
text-align: center;
position: relative;
color: #fff;
font-size: 28px;
}
.header-tab .tab-active {
font-weight: 500;
}
.header-tab .active-line {
position: absolute;
width: 40px;
height: 4px;
background: #FFF;
top: 48px;
left: 50%;
transform: translate(-50%, -50%);
}
.area-content {
padding: 32px;
background-color: #fff;
img {
width: 42px;
vertical-align: middle;
margin-right: 16px;
}
.u-icon {
margin-left: 6px;
}
}
::v-deep .content {
padding: 0;
}
}
</style>