1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- <template>
- <view class="activity-item" hover-class="active" @click="onClickActivity(item)">
- <view class="activity-title">
- <view>{{ item.title }}</view>
- <view v-if="!favoritesHidden" @click.stop="onCollect(item)" class="activity-favourites" :class="{ 'active': index === 1 }">
- <view v-if="item.is_collect" class="iconfont icon-favourites-filled-star-symbol active"></view>
- <view v-else class="iconfont icon-Favourites-Add-Large"></view>
- <view class="activity-favourites-text">收藏</view>
- </view>
- </view>
- <view class="activity-time">{{ formatDate(item.pub_date) }} | {{ item.address }}</view>
- <view class="activity-views">浏览:{{ item.view }}</view>
- <view class="activity-desc">
- <view>
- {{ item.description }}
- </view>
- <view>
- <van-button class="activity-detail-link" type="primary">
- <template>
- <view>了解详情</view> <view class="arrow iconfont icon-right-s"></view>
- </template>
- </van-button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import { meetingCollect, meetingCancelCollect, meetingView } from '@/api/exhibitor'
-
- export default {
- options: {
- styleIsolation: 'shared'
- },
- components: {
- },
- props: {
- // 数据
- item: Object,
- favoritesHidden: Boolean
- },
- data() {
- return {
- websiteUrl: process.env.WEBSITE
- }
- },
- created() {
- },
- methods: {
- onCollect(item) { // 收藏
- this.checkAuth('pages/activity/index')
- if (item.is_collect === 1) {
- meetingCancelCollect({ id: item.id }).then(res => {
- if (res.code === 0) {
- item.is_collect = 0
- this.$emit('updateItemCollect', {
- id: item.id
- })
- }
- })
- } else {
- meetingCollect({ id: item.id }).then(res => {
- if (res.code === 0) {
- item.is_collect = 1
- this.$emit('updateItemCollect', {
- id: item.id
- })
- }
- })
- }
- },
- 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(this.websiteUrl + '/' + item.urla)
- }
- }
- }
- </script>
- <style lang="scss">
- </style>
|