重新整改积分

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

@@ -37,10 +37,8 @@ export default {
onReachBottom() { onReachBottom() {
uni.$emit("reachBottom") uni.$emit("reachBottom")
}, },
onShow(){ onShow() {
let index = JSON.parse(JSON.stringify(this.tabIndex)) uni.$emit("onShow")
this.tabIndex = null
this.$nextTick(()=>this.tabIndex = index)
}, },
methods: { methods: {
tabClick(index) { tabClick(index) {

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 700 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -46,8 +46,11 @@ export default {
}, },
created() { created() {
this.getInfo() this.getInfo()
uni.$on("reachBottom", onShow => { uni.$on("onShow", () => {
!onShow && this.current++; this.getInfo();
})
uni.$on("reachBottom", () => {
this.current++;
this.getInfo() this.getInfo()
}) })
}, },
@@ -69,6 +72,10 @@ export default {
gotoGive() { gotoGive() {
uni.navigateTo({url: "./giveIntegral"}) uni.navigateTo({url: "./giveIntegral"})
} }
},
destroyed() {
uni.$off("reachBottom")
uni.$off("onShow")
} }
} }
</script> </script>

View File

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

View File

@@ -0,0 +1,462 @@
<template>
<div class="page">
<div class="credit-points column" flex>
<AiTopFixed>
<div class="header-tab">
<div
class="tab-item"
v-for="(item, index) in tabList"
:key="index"
@click="tabClick(index)"
>
{{ item }}<span class="active-line" v-if="tabIndex == index"></span>
</div>
</div>
<div class="area-content">
<AiAreaPicker :areaId="user.areaId" :value="areaId" @select="areaSelect" :name.sync="areaName" selectRoot>
<img src="./components/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>
</AiTopFixed>
<div class="line-bg"></div>
<div 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 }}{{ 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 }}{{ 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 }}{{ 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"
>
<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 }}{{ tabIndex == 0 ? "家" : "" }}</span
>
<span class="item-point">{{ item.integral }}</span>
</div>
</div>
</div>
<AiEmpty v-else />
</div>
</div>
</template>
<script>
import { mapState } from "vuex";
export default {
name: "AppCreditPoints",
appName: '积分排行',
computed: {
...mapState(["user"]),
},
data() {
return {
tabList: ["家庭积分", "个人积分"],
tabIndex: 0,
info: {},
areaId: '',
areaName: '',
list: []
};
},
onLoad() {
this.areaId = this.user.areaId
this.areaName = this.user.areaName || ''
this.getInfo();
},
onShow() {
document.title = '积分排行'
},
methods: {
areaSelect(e) {
this.areaId = e
this.getInfo()
},
tabClick(index) {
this.tabIndex = index;
this.getInfo();
},
// 积分排行
getInfo() {
this.info = {};
this.$http.post(`/app/appresident/rank-qw?type=${this.tabIndex}&areaId=${this.areaId}`).then((res) => {
if (res.code === 0) {
this.info = res.data;
}
});
},
formatName(name) {
if (name == undefined) {
return
}
return name.substr(name.length - 2, name.length > 2 ? (name.length - 1) : name.length)
},
},
};
</script>
<style scoped lang="scss">
.page {
width: 100%;
// background-color: #f3f6f9;
.credit-points {
.bg-blue {
width: 100%;
height: 176rpx;
background-color: #3975C6;
}
.header-content {
width: 690rpx;
height: 256rpx;
background: #fff;
border-radius: 16rpx;
margin: -130rpx 0 40rpx 30rpx;
padding: 100rpx 60rpx 40rpx 60rpx;
box-sizing: border-box;
display: flex;
justify-content: space-between;
position: relative;
.item {
text-align: center;
z-index: 99;
.num {
font-family: DIN;
font-size: 52rpx;
font-weight: bold;
line-height: 60rpx;
}
.label {
font-size: 28rpx;
font-family: PingFangSC-Regular, PingFang SC;
color: #999;
line-height: 40rpx;
margin-top: 10rpx;
}
.color-5AAD6A {
color: #5aad6a;
}
.color-4185F5 {
color: #4185f5;
}
.color-CD413A {
color: #cd413a;
}
}
img {
position: absolute;
width: 360rpx;
height: 250rpx;
top: -40rpx;
right: 0;
}
}
.ranking-content {
padding: 94rpx 30rpx 0;
background-color: #fff;
.item {
display: inline-block;
width: 216rpx;
height: 320px;
box-shadow: 0 4rpx 20rpx 0 rgba(0, 0, 0, 0.12);
border-radius: 12rpx;
padding: 40rpx 0 0 0;
text-align: center;
box-sizing: border-box;
position: relative;
vertical-align: top;
.user-name {
font-size: 30rpx;
font-family: PingFang-SC-Medium, PingFang-SC;
font-weight: 500;
color: #333;
line-height: 42rpx;
word-break: break-all;
}
.item-num {
font-size: 46rpx;
font-weight: 6000;
color: #2c51ce;
line-height: 54rpx;
}
.top-img {
width: 100%;
height: 34rpx;
position: absolute;
top: -11rpx;
left: 0;
}
}
.item-top {
margin: -46rpx 20rpx 0;
height: 366px;
.user-img {
width: 104rpx;
height: 104rpx;
}
.user-name-bg {
width: 104rpx;
height: 104rpx;
border-radius: 50%;
background-color: #4e8eee;
font-size: 28rpx;
line-height: 104rpx;
text-align: center;
color: #fff;
}
.top-img-one {
width: 100%;
position: absolute;
top: -22rpx;
left: 0;
height: 46rpx;
}
}
}
.ranking-list {
background-color: #fff;
.item {
width: 100%;
height: 120rpx;
line-height: 120rpx;
background: #fff;
padding: 0 64rpx;
box-sizing: border-box;
.item-num {
display: inline-block;
width: 68rpx;
color: #858594;
font-size: 28rpx;
}
.user-img {
margin-right: 24rpx;
vertical-align: middle;
}
.item-name {
color: #333;
font-size: 30rpx;
display: inline-block;
width: 240rpx;
}
.item-point {
display: inline-block;
width: 210rpx;
text-align: right;
font-size: 30rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
}
.mar-r24 {
margin-right: 24rpx;
}
}
}
.user-img {
width: 80rpx;
height: 80rpx;
border-radius: 50%;
}
.user-name-bg {
display: inline-block;
width: 80rpx;
height: 80rpx;
border-radius: 50%;
background-color: #4e8eee;
font-size: 28rpx;
line-height: 80rpx;
text-align: center;
color: #fff;
}
.mar-b4 {
margin-bottom: 8rpx;
}
.mar-b8 {
margin-bottom: 16rpx;
}
.detail-content {
width: 690rpx;
background: #fff;
border-radius: 16rpx;
margin: 432rpx 0 0 32rpx;
padding: 30rpx 30rpx 94rpx;
box-sizing: border-box;
.title {
font-size: 34rpx;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: #333;
line-height: 48rpx;
margin-bottom: 30rpx;
}
.item {
padding: 34rpx 0 32rpx 0;
border-bottom: 2rpx solid #ddd;
display: flex;
.item-info {
width: 500rpx;
p {
word-break: break-all;
font-size: 32rpx;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #333;
line-height: 44px;
}
span {
display: inline-block;
margin-top: 8rpx;
font-size: 24px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #999;
line-height: 34rpx;
}
}
.item-num {
width: calc(100% - 500rpx);
text-align: right;
font-size: 36rpx;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
line-height: 50rpx;
}
}
}
}
.color-0 {
color: #2c51ce !important;
}
.color-1 {
color: #e6736e !important;
}
.fixed-top {
z-index: 999;
}
.header-tab {
height: 96rpx;
background-color: #3975C6;
padding: 20rpx 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: 28rpx;
}
.header-tab .tab-active {
font-weight: 500;
}
.header-tab .active-line {
position: absolute;
width: 40rpx;
height: 4rpx;
background: #FFF;
top: 48rpx;
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;
}
}
.line-bg{
width: 100%;
height: 6px;
background-color: #f3f6f9;
}
::v-deep .content{
padding: 0;
}
}
</style>