Browse Source

发现我的中心优化/发现评论跳转优化

master
Enzo 4 years ago
parent
commit
96eaf15911
  1. 2
      pages/coupon/index/index.vue
  2. 4
      pages/discover/discoverdetails.vue
  3. 2
      pages/index/collectCoupons/collectCoupons.vue
  4. 111
      pages/user/my/my.vue

2
pages/coupon/index/index.vue

@ -38,7 +38,7 @@
</view> </view>
<view class="coupon-right"> <view class="coupon-right">
<view class="lf-font-32 lf-font-bold lf-color-white">{{item.discount.title}}</view> <view class="lf-font-32 lf-font-bold lf-color-white">{{item.discount.title}}</view>
<view class="lf-font-24 lf-color-white">有效期{{item.discount.ends_at}}</view>
<view class="lf-font-24 lf-color-white">有效期{{item.discount.starts_at}}~{{item.discount.ends_at}}</view>
</view> </view>
</view> </view>
</view> </view>

4
pages/discover/discoverdetails.vue

@ -45,7 +45,7 @@
<view v-for="(commentitem,commentindex) of commentList" :key="commentindex"> <view v-for="(commentitem,commentindex) of commentList" :key="commentindex">
<view class="lf-m-t-20" @click="applySub(commentitem.user.id,commentitem.id)"> <view class="lf-m-t-20" @click="applySub(commentitem.user.id,commentitem.id)">
<view class="lf-flex"> <view class="lf-flex">
<view>
<view @click="$url('/pages/user/my/my?user_id='+commentitem.user_id)">
<image class="comment-img" :src="commentitem.user.avatar" mode="aspectFill"></image> <image class="comment-img" :src="commentitem.user.avatar" mode="aspectFill"></image>
</view> </view>
<view class="lf-flex-column lf-m-l-20"> <view class="lf-flex-column lf-m-l-20">
@ -66,7 +66,7 @@
<view class="comment-replay" v-if="$isRight(commentitem.sub)" v-for="(subitem,index2) of commentitem.sub" :key="index2"> <view class="comment-replay" v-if="$isRight(commentitem.sub)" v-for="(subitem,index2) of commentitem.sub" :key="index2">
<view class="lf-flex" @click="applySub(subitem.user.id,subitem.parent_id)"> <view class="lf-flex" @click="applySub(subitem.user.id,subitem.parent_id)">
<view class="lf-flex lf-m-t-30"> <view class="lf-flex lf-m-t-30">
<view>
<view @click="$url('/pages/user/my/my?user_id='+subitem.user_id)">
<image class="comment-img" :src="subitem.user.avatar" mode="aspectFill"></image> <image class="comment-img" :src="subitem.user.avatar" mode="aspectFill"></image>
</view> </view>
<view class="lf-flex-column lf-m-l-20"> <view class="lf-flex-column lf-m-l-20">

2
pages/index/collectCoupons/collectCoupons.vue

@ -23,7 +23,7 @@
</view> </view>
<view class="coupon-right"> <view class="coupon-right">
<view class="lf-font-32 lf-font-bold lf-color-white">{{item.title}}</view> <view class="lf-font-32 lf-font-bold lf-color-white">{{item.title}}</view>
<view class="lf-font-24 lf-color-white">有效期{{item.starts_at}}-{{item.ends_at}}</view>
<view class="lf-font-24 lf-color-white">有效期{{item.starts_at}}~{{item.ends_at}}</view>
</view> </view>
</view> </view>
</view> </view>

111
pages/user/my/my.vue

@ -20,32 +20,41 @@
</view> </view>
</view> </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>
<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>
<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>
</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 style="height: 40rpx;"></view>
</view> </view>
</template> </template>
@ -57,14 +66,32 @@
user_id: 0, user_id: 0,
page: 1, page: 1,
page_size: 15, page_size: 15,
discover_info: ''
discover_info: '',
isPage: true,
loadingClass: true,
loadingText: '正在加载中',
isRefresher: false,
scrollH: 0,
nav_height: 0,
} }
}, },
onLoad(e) { onLoad(e) {
let info = uni.getSystemInfoSync();
this.scrollH = info.screenHeight;
this.user_id = e.user_id; this.user_id = e.user_id;
this.loginList(); this.loginList();
}, },
computed: {
autoHeight(){
return `calc(${this.scrollH}px - ${this.nav_height}px - 460rpx)`;
}
},
methods: { methods: {
// scroll-view
onRefresherrefresh(){
this.isRefresher = true;
this.refreshFn({type: 'scrollRefresh'});
},
// //
payAttention() { payAttention() {
this.$http 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) { addLike(id) {
let user_info = this.$cookieStorage.get('user_token'); let user_info = this.$cookieStorage.get('user_token');
@ -121,7 +164,7 @@
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.status) { if (res.data.status) {
this.loginList();
this.refreshFn({type: 'scrollRefresh'});
} else { } else {
wx.showModal({ wx.showModal({
content: res.data.message || '请下拉页面刷新重试', content: res.data.message || '请下拉页面刷新重试',
@ -151,7 +194,7 @@
this.$url('/pages/discover/discoverdetails?discover_id='+id) this.$url('/pages/discover/discoverdetails?discover_id='+id)
}, },
// //
loginList() {
loginList(options = {}) {
this.$http this.$http
.get({ .get({
api: 'api/discover/user/'+this.user_id, api: 'api/discover/user/'+this.user_id,
@ -166,7 +209,23 @@
.then(res => { .then(res => {
if (res.data.code == 200) { if (res.data.code == 200) {
if (res.data.status) { 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); console.log('登录时的发现列表',this.discover_info);
} else { } else {
wx.showModal({ wx.showModal({

Loading…
Cancel
Save