|
|
|
@ -20,32 +20,41 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="lf-m-32" v-for="(item,index) in discover_info.list.data" :key="index" @click="goDetails(item.id)"> |
|
|
|
<view class="lf-font-48 lf-color-black lf-font-bold"> |
|
|
|
{{item.create_time[0]}} |
|
|
|
</view> |
|
|
|
<view class="lf-color-777 lf-font-24"> |
|
|
|
{{item.create_time[1]}} |
|
|
|
</view> |
|
|
|
<view class="lf-flex-wrap lf-m-t-20"> |
|
|
|
<image v-for="(picture,index2) in item.attachs" :key="index2" class="qzone-img" :src="picture.url" mode="aspectFill"></image> |
|
|
|
</view> |
|
|
|
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50"> |
|
|
|
<view class="lf-row-center" @click.stop="addLike(item.id)"> |
|
|
|
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="item.is_like"></text> |
|
|
|
<text class="lf-iconfont icon-xihuan" v-else></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.likes_count}}</text> |
|
|
|
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher" |
|
|
|
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh"> |
|
|
|
<view class="lf-m-32" v-for="(item,index) in discover_info.list.data" :key="index" @click="goDetails(item.id)"> |
|
|
|
<view class="lf-font-48 lf-color-black lf-font-bold"> |
|
|
|
{{item.create_time[0]}} |
|
|
|
</view> |
|
|
|
<view class="lf-color-777 lf-font-24"> |
|
|
|
{{item.create_time[1]}} |
|
|
|
</view> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-iconfont icon-chakan"></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.view_count}}</text> |
|
|
|
<view class="lf-flex-wrap lf-m-t-20"> |
|
|
|
<image v-for="(picture,index2) in item.attachs" :key="index2" class="qzone-img" :src="picture.url" mode="aspectFill"></image> |
|
|
|
</view> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-iconfont icon-pinglun-"></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.comments_count}}</text> |
|
|
|
<view class="lf-m-t-30 lf-row-between lf-p-l-50 lf-p-r-50"> |
|
|
|
<view class="lf-row-center" @click.stop="addLike(item.id)"> |
|
|
|
<text class="lf-iconfont icon-xihuanlike lf-color-price" v-if="item.is_like"></text> |
|
|
|
<text class="lf-iconfont icon-xihuan" v-else></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.likes_count}}</text> |
|
|
|
</view> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-iconfont icon-chakan"></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.view_count}}</text> |
|
|
|
</view> |
|
|
|
<view class="lf-row-center"> |
|
|
|
<text class="lf-iconfont icon-pinglun-"></text> |
|
|
|
<text class="lf-font-24 lf-color-777 lf-m-l-10">{{item.comments_count}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 空数据的情况 --> |
|
|
|
<view class="loading-more"> |
|
|
|
<text v-if="discover_info.list.data.length" |
|
|
|
:class="{'loading-more-text': loadingClass}">{{ loadingText }}</text> |
|
|
|
<lf-nocontent v-else></lf-nocontent> |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
<view style="height: 40rpx;"></view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
@ -57,14 +66,32 @@ |
|
|
|
user_id: 0, |
|
|
|
page: 1, |
|
|
|
page_size: 15, |
|
|
|
discover_info: '' |
|
|
|
discover_info: '', |
|
|
|
isPage: true, |
|
|
|
loadingClass: true, |
|
|
|
loadingText: '正在加载中', |
|
|
|
isRefresher: false, |
|
|
|
scrollH: 0, |
|
|
|
nav_height: 0, |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad(e) { |
|
|
|
let info = uni.getSystemInfoSync(); |
|
|
|
this.scrollH = info.screenHeight; |
|
|
|
this.user_id = e.user_id; |
|
|
|
this.loginList(); |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
autoHeight(){ |
|
|
|
return `calc(${this.scrollH}px - ${this.nav_height}px - 460rpx)`; |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// scroll-view 下拉刷新 |
|
|
|
onRefresherrefresh(){ |
|
|
|
this.isRefresher = true; |
|
|
|
this.refreshFn({type: 'scrollRefresh'}); |
|
|
|
}, |
|
|
|
//关注 |
|
|
|
payAttention() { |
|
|
|
this.$http |
|
|
|
@ -104,6 +131,22 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 下拉刷新处理 |
|
|
|
refreshFn(options){ |
|
|
|
this.page = 1; |
|
|
|
this.isPage = true; |
|
|
|
this.loadingClass = true; |
|
|
|
this.discover_info.list.data = []; |
|
|
|
this.loadingText = '正在加载中'; |
|
|
|
this.loginList(options); |
|
|
|
}, |
|
|
|
// 页面触底,加载下一页 |
|
|
|
onScrolltolower(){ |
|
|
|
if(this.isPage){ |
|
|
|
this.page = this.page + 1; |
|
|
|
this.loginList(); |
|
|
|
} |
|
|
|
}, |
|
|
|
//点赞发现 |
|
|
|
addLike(id) { |
|
|
|
let user_info = this.$cookieStorage.get('user_token'); |
|
|
|
@ -121,7 +164,7 @@ |
|
|
|
.then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.status) { |
|
|
|
this.loginList(); |
|
|
|
this.refreshFn({type: 'scrollRefresh'}); |
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
content: res.data.message || '请下拉页面刷新重试', |
|
|
|
@ -151,7 +194,7 @@ |
|
|
|
this.$url('/pages/discover/discoverdetails?discover_id='+id) |
|
|
|
}, |
|
|
|
//登录时的发现列表 |
|
|
|
loginList() { |
|
|
|
loginList(options = {}) { |
|
|
|
this.$http |
|
|
|
.get({ |
|
|
|
api: 'api/discover/user/'+this.user_id, |
|
|
|
@ -166,7 +209,23 @@ |
|
|
|
.then(res => { |
|
|
|
if (res.data.code == 200) { |
|
|
|
if (res.data.status) { |
|
|
|
this.discover_info = res.data.data; |
|
|
|
this.discover_info = res.data.data; |
|
|
|
let isPage = res.data.data.list.last_page == this.page?false:true; |
|
|
|
this.isPage = isPage; |
|
|
|
if(!isPage) { |
|
|
|
this.loadingClass = false; |
|
|
|
this.loadingText = '没有更多数据啦~'; |
|
|
|
} |
|
|
|
if(options.type == 'pageRefresh') { |
|
|
|
uni.stopPullDownRefresh(); |
|
|
|
}else if(options.type == 'scrollRefresh') { |
|
|
|
this.isRefresher = false; |
|
|
|
} |
|
|
|
if(this.page == 1) { |
|
|
|
this.discover_info.list.data = res.data.data.list.data; |
|
|
|
}else { |
|
|
|
this.discover_info.list.data.push(...res.data.data.list.data); |
|
|
|
} |
|
|
|
console.log('登录时的发现列表',this.discover_info); |
|
|
|
} else { |
|
|
|
wx.showModal({ |
|
|
|
|