Files
dvcp_v2_wechat_app/src/project/tianfuxing/AppHome/AppHome.vue

206 lines
4.5 KiB
Vue
Raw Normal View History

2022-11-01 18:30:12 +08:00
<template>
2022-11-01 19:08:20 +08:00
<div class="home">
2022-11-02 17:23:17 +08:00
<image class="banner" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/banner.png" />
2022-11-01 19:08:20 +08:00
<div class="nav">
2022-11-02 14:11:53 +08:00
<div class="nav-item" hover-class="text-hover" @click="$linkTo('./PhotoReport')">
2022-11-02 17:23:17 +08:00
<image mode="aspectFill" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/ssp.png" />
2022-11-01 19:08:20 +08:00
</div>
2022-11-02 17:23:17 +08:00
<div class="nav-item" hover-class="text-hover" @click="$linkTo('./Culture')">
<image mode="aspectFill" src="https://cdn.cunwuyun.cn/wxmp/tianfuxing/wmcd.png" />
2022-11-01 19:08:20 +08:00
</div>
</div>
<div class="activity-wrapper">
<h2>线下活动</h2>
<div class="activity-list">
2022-11-02 16:05:35 +08:00
<div class="activity-item" @click="$linkTo('./Activity?id=' + item.id)" hover-class="bg-hover" v-for="(item, index) in list" :key="index">
2022-11-01 19:08:20 +08:00
<div class="top">
2022-11-02 16:05:35 +08:00
<h2>{{ item.title }}</h2>
<p>{{ item.detail }}</p>
2022-11-01 19:08:20 +08:00
</div>
<div class="bottom">
<div class="item">
<h3>进场时间</h3>
2022-11-02 16:05:35 +08:00
<span>{{ item.intoBegintime }} {{ item.intoEndtime }}</span>
2022-11-01 19:08:20 +08:00
</div>
<div class="item">
<h3>进场时间</h3>
2022-11-02 16:05:35 +08:00
<span>{{ item.exitBegintime }} {{ item.exitEndtime }}</span>
2022-11-01 19:08:20 +08:00
</div>
</div>
</div>
2022-11-02 14:11:53 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2022-11-01 19:08:20 +08:00
</div>
</div>
2022-11-01 18:30:12 +08:00
</div>
</template>
<script>
2022-11-02 14:11:53 +08:00
import { mapActions, mapState } from 'vuex'
2022-11-01 18:30:12 +08:00
export default {
2022-11-01 19:08:20 +08:00
appName: '天府星小程序',
2022-11-02 14:11:53 +08:00
name: 'AppHome',
data () {
return {
current: 1,
list: [],
isMore: false
}
},
computed: {
...mapState(['user', 'token'])
},
onLoad () {
this.getList()
if (!this.token) {
this.autoLogin()
} else {
this.getUserInfo()
}
},
methods: {
...mapActions(['autoLogin', 'getUserInfo']),
getList () {
if (this.isMore) return
this.$loading()
this.$instance.post(`/appactivityinfo/list`, null, {
withoutToken: true,
params: {
current: this.current,
size: 10
}
}).then(res => {
2022-11-02 14:44:45 +08:00
if (res.code === 0) {
2022-11-02 14:11:53 +08:00
this.$hideLoading()
2022-11-02 14:44:45 +08:00
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
2022-11-02 14:11:53 +08:00
} else {
2022-11-02 14:44:45 +08:00
this.list = res.data.records
2022-11-02 14:11:53 +08:00
}
2022-11-02 14:44:45 +08:00
if (res.data.records.length < 10) {
2022-11-02 14:11:53 +08:00
this.isMore = true
return false
}
2022-11-02 14:44:45 +08:00
this.current = this.current + 1
2022-11-02 14:11:53 +08:00
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
}
},
onReachBottom () {
this.getList()
}
2022-11-01 18:30:12 +08:00
}
</script>
<style lang="scss" scoped>
2022-11-01 19:08:20 +08:00
.home {
padding: 32px 0 40px;
.banner {
display: block;
width: 686px;
height: 240px;
margin: 0 auto 32rpx;
2022-11-02 17:23:17 +08:00
border-radius: 10px;
2022-11-01 19:08:20 +08:00
}
.nav {
display: flex;
align-items: center;
justify-content: space-between;
margin: 0 32rpx 58rpx;
.nav-item {
width: 328px;
2022-11-02 17:23:17 +08:00
height: 122px;
2022-11-01 19:08:20 +08:00
image {
width: 100%;
height: 100%;
2022-11-02 17:23:17 +08:00
border-radius: 10px;
2022-11-01 19:08:20 +08:00
}
}
}
.activity-wrapper {
padding: 0 32px;
& > h2 {
margin-bottom: 26px;
color: #1D2229;
font-size: 34px;
font-weight: 600;
}
2022-11-01 18:30:12 +08:00
2022-11-01 19:08:20 +08:00
.activity-item {
margin-bottom: 24px;
padding: 24px;
background: #FCFCFC;
box-shadow: 0 0 8px 0 rgba(0,0,0,0.02);
border-radius: 16px;
.bottom {
padding-top: 24px;
.item {
display: flex;
line-height: 1.3;
margin-bottom: 8px;
h3 {
font-size: 28px;
color: #999999;
}
span {
flex: 1;
text-align: justify;
font-size: 28px;
color: #333333;
}
}
}
.top {
padding-bottom: 24px;
border-bottom: 1px solid #eee;
h2 {
margin-bottom: 14px;
font-weight: 500;
font-size: 34px;
color: #333333;
}
p {
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
line-height: 1.3;
font-size: 30px;
color: #999999;
text-align: justify;
}
}
}
}
}
2022-11-01 18:30:12 +08:00
</style>