148 lines
3.9 KiB
Vue
Raw Permalink Normal View History

2024-07-30 18:16:46 +08:00
<template>
<view style="background-color: #F1F2F8;letter-spacing: 1rpx;min-height: 100vh;">
<tn-nav-bar :isBack="false" backTitle="" :bottomShadow="false" backgroundColor="#FFFFFF">
<view class="custom-nav tn-flex tn-flex-col-center tn-flex-row-left">
<view style="padding-left: 15rpx;" @click="goBack()">
<text class="tn-icon-left" style="font-size: 40rpx;"></text>
</view>
<view style="width: 83%;font-weight: bold;">
<text>我的收藏</text>
</view>
</view>
</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<view style="background-color: #FFFFFF;">
<tn-tabs :list="tab_list" :current="current" :isScroll="false" name="name" activeColor="#000000"
inactiveColor="#999999" :barWidth="25" @change="change"></tn-tabs>
</view>
<view style="padding: 30rpx;">
<view v-for="(item,index) in list"
style="background-color: #FFF;border-radius: 20rpx;margin-bottom: 20rpx;">
<view style="padding: 20rpx">
<view>
2024-08-19 18:15:03 +08:00
<view
@click="openUrl(current==0?'/pages/packageB/event/event_info?id='+item.id:'/pages/packageB/paper/paper_info?id='+item.id)"
2024-07-30 18:16:46 +08:00
style="background-color: #FFF;border-radius: 20rpx;">
<view class="tn-flex" style="position: relative;">
2025-03-21 16:50:18 +08:00
<view style="margin-left: 10rpx;" v-if="item.cover!=''">
<image :src="apiImgUrl+item.cover" mode="aspectFill"
2024-07-30 18:16:46 +08:00
style="width: 250rpx;height: 180rpx;border-radius: 10rpx;"></image>
</view>
<view style="margin-left: 20rpx;">
<view class="tn-text-ellipsis-2" style="font-size: 32rpx;font-weight: bold;">
2025-03-21 16:50:18 +08:00
{{item.title}}
2024-07-30 18:16:46 +08:00
</view>
<view class="tn-text-ellipsis-2" style="font-size: 24rpx;margin-top: 20rpx;">
2025-03-21 16:50:18 +08:00
{{item.content}}
2024-07-30 18:16:46 +08:00
</view>
<view style="font-size: 24rpx;margin-top: 20rpx;color: #999999;">
2025-03-21 16:50:18 +08:00
{{item.time}}
2024-07-30 18:16:46 +08:00
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import {
associationInfo,
favsIndex,
} from "@/util/api";
import store from "@/store";
export default {
data() {
return {
current: 0,
tab_list: [{
type: 'article',
name: '活动'
}, {
type: 'tweets',
name: '动态'
}],
list: [],
page: 1,
apiImgUrl: this.$store.state.imgUrl
}
},
onLoad() {
this.getList();
},
methods: {
change(d) {
this.page = 1;
this.list = [];
this.current = d;
this.getList();
},
getList() {
var uid = uni.getStorageSync('uid');
var nw_type = this.tab_list[this.current].type;
favsIndex({
association_id: 1,
page: this.page,
size: 10,
type: nw_type
})
.then(res => {
console.log(res);
2025-03-21 16:50:18 +08:00
var list = res.data.data;
if (nw_type == 'article') {
var transformedSelectList = list.map(item => ({
content: item.related_object.activity_location,
cover: item.related_object.activity_image,
id: item.related_id,
title: item.related_object.activity_name,
time: item.createtime,
}));
console.log(transformedSelectList);
this.list.push(...transformedSelectList);
} else {
var transformedSelectList = list.map(item => ({
content: item.related_object.content,
cover: item.related_object.cover,
id: item.related_id,
title: item.related_object.title,
time: item.createtime,
}));
console.log(transformedSelectList);
this.list.push(...transformedSelectList);
}
2024-07-30 18:16:46 +08:00
})
.catch(error => {
uni.showToast({
title: error,
icon: 'none',
duration: 2000
});
})
},
openUrl(ulr) {
uni.navigateTo({
url: ulr
})
},
goBack() {
if (getCurrentPages().length > 1) {
uni.navigateBack()
} else {
uni.redirectTo({
url: '/pages/index/index'
})
}
}
}
}
</script>
<style>
</style>