Files
dvcp_v2_wxcp_app/src/apps/AppCountryAlbum/AppCountryAlbum.vue

138 lines
3.0 KiB
Vue
Raw Normal View History

2021-12-21 13:58:03 +08:00
<template>
<div class="AppCountryAlbum">
2022-01-04 17:17:44 +08:00
<div class="list">
<AiTopFixed>
<div class="area-content">
2022-01-13 16:47:34 +08:00
<AiAreaPicker :areaId="user.areaId" :value="areaId" @select="areaSelect" :name.sync="areaName">
2022-01-04 17:17:44 +08:00
<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>
</AiTopFixed>
<div class="album-list">
<div class="item" v-for="(item, index) in list" :key="index" @click="toDetail(item)">
<img :src="`${cdn}/dvcp/album/album${item.type}.png`" alt="">
<p class="text">{{ item.name }}</p>
<div class="tips">{{ item.total }}</div>
</div>
<AiEmpty v-if="!list.length"/>
</div>
</div>
2021-12-21 13:58:03 +08:00
</div>
</template>
<script>
2022-01-04 17:17:44 +08:00
import {mapState} from 'vuex'
2021-12-21 13:58:03 +08:00
export default {
2022-01-04 17:17:44 +08:00
name: "AppCountryAlbum",
appName: "乡村相册",
2021-12-21 13:58:03 +08:00
data() {
return {
2022-01-04 17:17:44 +08:00
list: [],
areaId: '',
areaName: '',
cdn: ''
2021-12-21 13:58:03 +08:00
}
},
2022-01-04 17:17:44 +08:00
computed: {...mapState(['user'])},
2021-12-24 19:57:02 +08:00
onShow() {
2022-01-04 17:17:44 +08:00
this.areaId = this.user.areaId
this.areaName = this.user.areaName
this.getList()
this.cdn = this.$cdn.replace("/dvcp/h5", "");
2022-01-26 17:01:28 +08:00
document.title = '乡村相册'
2021-12-24 19:57:02 +08:00
},
2021-12-21 13:58:03 +08:00
methods: {
2022-01-04 17:17:44 +08:00
areaSelect(e) {
this.areaId = e
this.getList()
2021-12-31 17:23:43 +08:00
},
2022-01-04 17:17:44 +08:00
getList() {
this.$http.post(`/app/appvillagepicturealbum/queryAlbumMenu`, null, {
params: {
areaId: this.areaId,
}
}).then(res => {
2022-03-07 11:09:48 +08:00
if (res?.data) {
2022-01-04 17:17:44 +08:00
this.list = res.data
}
2021-12-31 17:23:43 +08:00
})
2022-01-04 17:17:44 +08:00
},
toDetail(item) {
uni.navigateTo({url: `./detail?type=${item.type}&areaId=${this.areaId}&title=${item.name}&titleImgUrl=${this.cdn}/dvcp/album/album${item.type}.png`})
},
},
onReachBottom() {
this.current++;
this.getList()
2021-12-21 13:58:03 +08:00
},
}
</script>
<style lang="scss" scoped>
2021-12-31 17:23:43 +08:00
.AppCountryAlbum {
2022-01-04 17:17:44 +08:00
.area-content {
width: 100%;
line-height: 64px;
img {
width: 42px;
vertical-align: middle;
margin-right: 16px;
}
.u-icon {
margin-left: 6px;
}
}
.album-list {
padding: 32px 0 0 32px;
overflow: hidden;
.item {
width: calc(33% - 16px);
height: 240px;
border-radius: 8px;
position: relative;
margin: 0 16px 16px 0;
float: left;
img {
width: 100%;
height: 100%;
border-radius: 8px;
}
.text {
position: absolute;
bottom: 16px;
left: 0;
width: 100%;
text-align: center;
font-size: 32px;
font-family: PingFangSC-Semibold, PingFang SC;
font-weight: 600;
color: #FFF;
line-height: 44px;
}
.tips {
position: absolute;
top: 8px;
right: 8px;
padding: 0 8px;
line-height: 40px;
background-color: rgba(0, 0, 0, .6);
color: #fff;
border-radius: 8px;
font-size: 22px;
}
}
}
2021-12-21 13:58:03 +08:00
}
2021-12-31 17:23:43 +08:00
</style>