123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <template>
- <view class="activity-recommend">
- <view class="activity-list">
- <template v-for="(item, index) in activityList">
- <view class="activity-item" :key="index" @click="onClickActivity(item)">
- <view class="activity-title">{{ item.title }}</view>
- <view class="activity-time">{{ formatDate(item.start_time) }} | {{ item.address }}</view>
- <view class="activity-summary">
- <view class="text">{{ item.content }}</view>
- <van-button class="btn-to-detail" type="primary">
- <template>
- <view>了解详情</view> <view class="arrow iconfont icon-right-s"></view>
- </template>
- </van-button>
- </view>
- </view>
- </template>
- </view>
- </view>
- </template>
- <script>
- import { exhibitorsBoothActivityList } from '@/api/exhibitor'
- import { link } from '@/utils/request'
-
- export default {
- options: {
- styleIsolation: 'shared'
- },
- components: {
- },
- props: {
- // 特定的展商ID
- exhibitorId: Number
- },
- watch: {
- exhibitorId(val) {
- this.activityListParams.exhibitors_id = val
- this.getActivityList()
- }
- },
- data() {
- return {
- activityList: [],
- activityListParams: {
- page: 1,
- page_size: 4,
- exhibitors_id: 0
- },
- activityListLoading: false
- }
- },
- created() {
- },
- methods: {
- getActivityList() {
- if (this.activityListLoading === true) {
- return
- }
- this.activityListLoading = true
- exhibitorsBoothActivityList(this.activityListParams).then(res => {
- if (res.code === 0) {
- if (this.activityListParams.page > 1) {
- this.activityList = [...this.activityList, ...res.data.data]
- } else {
- this.activityList = res.data.data
- }
- }
- this.activityListLoading = false
- })
- },
- formatDate(dateString) {
- const date = new Date(dateString);
- const year = date.getFullYear();
- const month = date.getMonth() + 1; // 月份从 0 开始
- const day = date.getDate();
- return `${year}年${month}月${day}日`;
- },
- onClickActivity(item) {
- this.navigateTo(link('/' + item.urla))
- }
- }
- }
- </script>
- <style lang="scss">
- .activity-list{
- display: grid;
- grid-template-columns: 1fr;
- grid-row-gap: 18rpx;
- margin-top: 28rpx;
- }
- .activity-item{
- display: flex;
- flex-direction: column;
- height: 210rpx;
- background-color: #F6F6F6;
- border-radius: 10rpx;
- padding: 24rpx 30rpx;
- }
- .activity-title{
- @include text-ellipsis-line;
- font-family: Arial, Arial;
- font-weight: bold;
- font-size: $fontSize3;
- line-height: 35rpx;
- }
- .activity-time{
- font-size: $fontSize2;
- color: #333333;
- margin: 12rpx 0;
- }
- .activity-summary{
- display: flex;
- align-items: center;
- font-size: $fontSize1;
- line-height: 25rpx;
- .btn-to-detail{
- flex-shrink: 0;
- .van-button__text{
- display: flex!important;
- align-items: center;
- font-size: $fontSize0;
- }
- }
- .text{
- padding-right: 30rpx;
- color: #555555;
- @include text-ellipsis-line;
- -webkit-line-clamp: 2;
- }
- .arrow{
- margin-left: 12rpx;
- font-size: $fontSize0;
- }
- }
-
- .activity-tab{
- van-button{
- margin-right: 13rpx;
- }
- }
- </style>
|