148 lines
3.9 KiB
Vue
148 lines
3.9 KiB
Vue
<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>
|
|
<view
|
|
@click="openUrl(current==0?'/pages/packageB/event/event_info?id='+item.id:'/pages/packageB/paper/paper_info?id='+item.id)"
|
|
style="background-color: #FFF;border-radius: 20rpx;">
|
|
<view class="tn-flex" style="position: relative;">
|
|
<view style="margin-left: 10rpx;" v-if="item.cover!=''">
|
|
<image :src="apiImgUrl+item.cover" mode="aspectFill"
|
|
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;">
|
|
{{item.title}}
|
|
</view>
|
|
<view class="tn-text-ellipsis-2" style="font-size: 24rpx;margin-top: 20rpx;">
|
|
{{item.content}}
|
|
</view>
|
|
<view style="font-size: 24rpx;margin-top: 20rpx;color: #999999;">
|
|
{{item.time}}
|
|
</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);
|
|
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);
|
|
}
|
|
})
|
|
.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> |