This commit is contained in:
花有清香月有阴
2022-02-23 11:19:32 +08:00
parent 9dfcf99125
commit 8a1d74d57b

View File

@@ -9,8 +9,7 @@
</div> </div>
</div> </div>
<div class="activity-list"> <div class="activity-list">
<div class="item" hover-class="bg-hover" @click="$linkTo(`/village/villageActivity/ActivityDetail?id=${item.id}`)" <div class="item" hover-class="bg-hover" @click="$linkTo(`./ActivityDetail?id=${item.id}`)" v-for="(item, index) in list" :key="index">
v-for="(item, index) in list" :key="index">
<div class="left"> <div class="left">
<h2>{{ item.title }}</h2> <h2>{{ item.title }}</h2>
<div class="left-info"> <div class="left-info">
@@ -23,7 +22,7 @@
</div> </div>
<div class="right"> <div class="right">
<span :class="'status' + item.status">{{ item.statusName }}</span> <span :class="'status' + item.status">{{ item.statusName }}</span>
<image :src="item.url" mode="aspectFill"/> <image :src="item.url" mode="aspectFill" />
</div> </div>
</div> </div>
<AiEmpty v-if="!list.length"></AiEmpty> <AiEmpty v-if="!list.length"></AiEmpty>
@@ -33,15 +32,15 @@
<script> <script>
export default { export default {
name: "AppVillageActivity", name: 'AppVillageActivity',
appName: "居民活动", appName: '居民活动',
data() { data() {
return { return {
list: [], list: [],
pageShow: false, pageShow: false,
current: 1, current: 1,
total: 0, total: 0,
isMore: false isMore: false,
} }
}, },
@@ -56,53 +55,56 @@ export default {
getList() { getList() {
if (this.isMore) return if (this.isMore) return
this.$instance.post(`/app/appvillageactivityinfo/listUp`, null, { this.$instance
params: { .post(`/app/appvillageactivityinfo/listUp`, null, {
current: this.current, params: {
size: 15, current: this.current,
areaId: uni.getStorageSync('areaId') size: 15,
} areaId: uni.getStorageSync('areaId'),
}).then(res => { },
if (res.code == 0) { })
this.total = res.data.total .then((res) => {
if (this.current > 1) { if (res.code == 0) {
this.list = [...this.list, ...res.data.records].map(v => { this.total = res.data.total
return { if (this.current > 1) {
...v, this.list = [...this.list, ...res.data.records].map((v) => {
statusName: this.$dict.getLabel('villageActivityStatus', v.status), return {
url: v.url ? JSON.parse(v.url)[0].url : '' ...v,
} statusName: this.$dict.getLabel('villageActivityStatus', v.status),
}) url: v.url ? JSON.parse(v.url)[0].url : '',
}
})
} else {
this.list = res.data.records.map((v) => {
return {
...v,
statusName: this.$dict.getLabel('villageActivityStatus', v.status),
url: v.url ? JSON.parse(v.url)[0].url : '',
}
})
}
uni.hideLoading()
this.pageShow = true
if (res.data.records.length < 15) {
this.isMore = true
return false
}
this.current = this.current + 1
} else { } else {
this.list = res.data.records.map(v => { uni.hideLoading()
return {
...v,
statusName: this.$dict.getLabel('villageActivityStatus', v.status),
url: v.url ? JSON.parse(v.url)[0].url : ''
}
})
} }
})
.catch(() => {
uni.hideLoading() uni.hideLoading()
this.pageShow = true })
if (res.data.records.length < 15) { },
this.isMore = true
return false
}
this.current = this.current + 1
} else {
uni.hideLoading()
}
}).catch(() => {
uni.hideLoading()
})
}
}, },
onReachBottom() { onReachBottom() {
this.getList() this.getList()
} },
} }
</script> </script>
@@ -133,7 +135,7 @@ export default {
} }
i { i {
color: #4181FF; color: #4181ff;
font-style: normal; font-style: normal;
font-size: 28px; font-size: 28px;
} }
@@ -173,7 +175,7 @@ export default {
align-items: center; align-items: center;
i { i {
color: #4181FF; color: #4181ff;
font-style: normal; font-style: normal;
font-size: 26px; font-size: 26px;
} }
@@ -207,15 +209,15 @@ export default {
} }
.status0 { .status0 {
background: #42D784; background: #42d784;
} }
.status1 { .status1 {
background: #1AAAFF; background: #1aaaff;
} }
.status2 { .status2 {
background: #E4E4E4; background: #e4e4e4;
} }
} }
} }