155 lines
2.9 KiB
Vue
155 lines
2.9 KiB
Vue
<template>
|
|
<view class="home-page">
|
|
<z-paging ref="paging" :auto="false" v-model="contList" @query="queryList" empty-view-text="暂无数据!">
|
|
<template #top>
|
|
<uni-nav-bar leftText=" " :fixed="true" :border="false" leftIcon="back" @clickLeft="leftClick" color="#000000" backgroundColor="#fff" :statusBar="true" title="我的收藏"></uni-nav-bar>
|
|
</template>
|
|
<!-- 内容网格 -->
|
|
<view class="content-grid">
|
|
<square-post-card
|
|
class="grid-item"
|
|
v-for="sitem in contList"
|
|
:key="sitem.id"
|
|
:item="sitem.post"
|
|
:isshow="false"
|
|
@view="navToList"
|
|
@comment="viewPost"
|
|
@like="viewPost" />
|
|
</view>
|
|
</z-paging>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { request,showToast } from '@/api/apiT.js'
|
|
import SquarePostCard from '@/components/SquarePostCard.vue'
|
|
export default {
|
|
components: {
|
|
SquarePostCard
|
|
},
|
|
data() {
|
|
return {
|
|
contList:[]
|
|
}
|
|
},
|
|
onLoad() {
|
|
|
|
},
|
|
onShow(){
|
|
this.$refs.paging.reload()
|
|
},
|
|
methods: {
|
|
leftClick(){
|
|
uni.reLaunch({
|
|
url: '/pages/index/mine',// 替换为你要跳转的页面路径
|
|
});
|
|
// uni.navigateBack({})
|
|
},
|
|
// 点击商品项
|
|
navToList(item) {
|
|
uni.navigateTo({
|
|
url: '/pages/square/detiles?id='+item.id
|
|
});
|
|
},
|
|
queryList(pageNo, pageSize) {
|
|
this.loading = true;
|
|
var that = this;
|
|
request({
|
|
url:'common/post/favorite/self',
|
|
method:'get',
|
|
data: {
|
|
current:pageNo,
|
|
size:10
|
|
}
|
|
}).then(res => {
|
|
|
|
if(res.data.code ==200){
|
|
var datas = res.data.data.records;
|
|
this.$refs.paging.complete(datas);
|
|
}else{
|
|
// this.$refs.paging.complete(null);
|
|
// that.listlength=0
|
|
}
|
|
uni.stopPullDownRefresh();
|
|
//
|
|
})
|
|
},
|
|
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style>
|
|
.home-page{
|
|
min-height: 100vh;
|
|
background: #F5F6FA;
|
|
box-sizing: border-box;
|
|
padding-bottom: 120rpx;
|
|
}
|
|
.content-grid{
|
|
display: flex;
|
|
flex-wrap: wrap;
|
|
padding: 20rpx;
|
|
justify-content: space-between;
|
|
background: #fff;
|
|
}
|
|
.grid-item{
|
|
width: 48%;
|
|
overflow: hidden;
|
|
margin-bottom: 20rpx;
|
|
}
|
|
.grid-image{
|
|
width: 100%;
|
|
height: 320rpx;
|
|
background: #E5E5E5;
|
|
border-radius: 10rpx;
|
|
}
|
|
.grid-footer{
|
|
padding: 20rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
.grid-avatar{
|
|
width: 48rpx;
|
|
height: 48rpx;
|
|
border-radius: 50%;
|
|
margin-right: 12rpx;
|
|
flex-shrink: 0;
|
|
object-fit: cover;
|
|
display: block;
|
|
}
|
|
.grid-info{
|
|
flex: 1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
width: 87%;
|
|
}
|
|
.grid-tag{
|
|
font-size: 24rpx;
|
|
color: #3F435B;
|
|
margin-bottom: 4rpx;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
width: 95%;
|
|
}
|
|
.grid-name{
|
|
font-size: 22rpx;
|
|
color: #8A8D97;
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
width: 88%;
|
|
}
|
|
.iconview{
|
|
margin-right: 10px;
|
|
display: inline-block;
|
|
font-size: 22rpx;
|
|
}
|
|
.icons {
|
|
width: 16px;
|
|
height: 16px;
|
|
margin-right: 5px;
|
|
}
|
|
</style>
|