Files
dvcp_v2_wxcp_app/src/apps/AppBuilding/list.vue

190 lines
4.2 KiB
Vue
Raw Normal View History

2021-12-15 18:07:16 +08:00
<template>
<div class="list">
<AiTopFixed>
2021-12-24 09:05:21 +08:00
<u-search placeholder="小区名称" :show-action="false" v-model="title" @search="current=1,getList()"/>
2021-12-15 18:07:16 +08:00
</AiTopFixed>
<div class="list-content">
2021-12-17 17:31:12 +08:00
<div class="item" v-for="(item, index) in list" :key="index">
2021-12-23 16:42:14 +08:00
<div class="item-content" @click="toDetail(item.id)">
<p class="title line-two">{{ item.communityName }}</p>
2021-12-23 17:00:53 +08:00
<p class="address">{{ item.cellName }}</p>
2021-12-23 16:42:14 +08:00
<span class="status" :class="'color'+item.locationStatus"
v-text="$dict.getLabel('BuildLocationStatus', item.locationStatus)"/>
2021-12-15 18:07:16 +08:00
</div>
2021-12-21 16:40:02 +08:00
<div class="item-btn" v-if="item.locationStatus != 1" @click="toMap(item.id, item.areaId)">
2021-12-15 18:07:16 +08:00
<span>去定位</span>
</div>
</div>
2021-12-17 17:31:12 +08:00
<AiEmpty v-if="!list.length"/>
2021-12-15 18:07:16 +08:00
</div>
</div>
</template>
<script>
2021-12-23 16:42:14 +08:00
import {mapState} from 'vuex'
2021-12-15 18:07:16 +08:00
export default {
data() {
return {
2021-12-17 17:31:12 +08:00
title: '',
current: 1,
2022-01-14 16:14:40 +08:00
list: [],
isMore: false
2021-12-15 18:07:16 +08:00
}
},
2021-12-23 16:42:14 +08:00
computed: {...mapState(['user'])},
2021-12-15 18:07:16 +08:00
mounted() {
2021-12-17 17:31:12 +08:00
this.$dict.load('BuildLocationStatus').then(() => {
this.getList()
})
2021-12-24 14:06:07 +08:00
uni.$on('updateList', () => {
this.current = 1
this.getList()
})
2021-12-15 18:07:16 +08:00
},
2021-12-24 15:27:36 +08:00
onShow() {
document.title = "楼栋列表"
},
2021-12-15 18:07:16 +08:00
methods: {
getList() {
2021-12-17 17:31:12 +08:00
this.$http.post(`/app/appcommunitybuildinginfo/list`, null, {
params: {
2021-12-24 14:06:07 +08:00
current: this.current,
2021-12-17 17:31:12 +08:00
size: 10,
areaId: this.user.areaId,
communityName: this.title
}
}).then(res => {
2021-12-23 17:00:53 +08:00
if (res?.data) {
2022-01-14 16:14:40 +08:00
if (res.data.records.length < 10) {
this.isMore = true
}
2021-12-23 17:00:53 +08:00
res.data.records.forEach(e => {
2021-12-24 10:13:23 +08:00
e.cellName = `${e.communityName + e.buildingNumber}`
2021-12-23 17:00:53 +08:00
})
2021-12-17 17:31:12 +08:00
if (this.current > 1 && this.current > res.data.pages) {
return
}
2022-01-14 16:14:40 +08:00
this.list = this.current > 1 ? [...this.list, ...res.data.records] : res.data.records
2021-12-17 17:31:12 +08:00
this.pages = res.data.pages
}
})
},
toDetail(id) {
2021-12-23 16:42:14 +08:00
uni.navigateTo({url: `./detail?id=${id}`})
2021-12-20 09:35:52 +08:00
},
toMap(id, areaId) {
2021-12-23 16:42:14 +08:00
uni.navigateTo({url: `./map?id=${id}&areaId=${areaId}`})
2021-12-15 18:07:16 +08:00
}
2021-12-21 16:40:02 +08:00
2021-12-17 17:31:12 +08:00
},
onReachBottom() {
2022-01-14 16:14:40 +08:00
if (this.isMore) return
this.current++
this.$nextTick(() => {
this.getList()
})
2021-12-17 17:31:12 +08:00
},
2021-12-15 18:07:16 +08:00
}
</script>
<style lang="scss" scoped>
.list {
2022-01-14 16:14:40 +08:00
padding-bottom: 20px;
2021-12-23 16:42:14 +08:00
.list-content {
padding: 32px 32px 0;
background-color: #F5F5F5;
.item {
2021-12-17 17:31:12 +08:00
width: 100%;
2021-12-15 18:07:16 +08:00
background: #FFF;
2021-12-21 16:40:02 +08:00
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.02);
2021-12-15 18:07:16 +08:00
border-radius: 8px;
box-sizing: border-box;
position: relative;
overflow: hidden;
margin-bottom: 32px;
2021-12-23 16:42:14 +08:00
.item-content {
2021-12-15 18:07:16 +08:00
padding: 32px 32px 42px 32px;
}
2021-12-23 16:42:14 +08:00
.title {
2021-12-17 17:31:12 +08:00
width: calc(100% - 60px);
2021-12-15 18:07:16 +08:00
word-break: break-all;
font-size: 32px;
color: #333;
line-height: 44px;
}
2021-12-23 16:42:14 +08:00
.address {
2021-12-15 18:07:16 +08:00
width: 100%;
word-break: break-all;
font-size: 28px;
color: #999;
line-height: 40px;
}
2021-12-23 16:42:14 +08:00
.status {
width: 160px;
height: 40px;
line-height: 36px;
font-size: 26px;
2021-12-15 18:07:16 +08:00
font-weight: 500;
position: absolute;
2021-12-23 16:42:14 +08:00
right: -38px;
top: 24px;
2021-12-15 18:07:16 +08:00
-webkit-transform: rotate(90deg);
transform: rotate(45deg);
text-align: center;
}
2021-12-23 16:42:14 +08:00
.color0 {
2021-12-15 18:07:16 +08:00
background: #FFECEF;
color: #f46;
}
2021-12-23 16:42:14 +08:00
.color1 {
2021-12-15 18:07:16 +08:00
background: #EEF5FF;
color: #5A98F2;
}
2021-12-23 16:42:14 +08:00
.item-btn {
2021-12-15 18:07:16 +08:00
width: 100%;
padding: 20px 32px 20px 0;
border-top: 1px solid #eee;
text-align: right;
box-sizing: border-box;
2021-12-23 16:42:14 +08:00
span {
2021-12-15 18:07:16 +08:00
display: inline-block;
width: 160px;
height: 56px;
line-height: 56px;
text-align: center;
border-radius: 28px;
border: 1px solid #1365DD;
font-size: 28px;
color: #1365DD;
}
}
}
2021-12-23 16:42:14 +08:00
.line-two {
2021-12-15 18:07:16 +08:00
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
}
}
2021-12-21 16:40:02 +08:00
</style>