Browse Source

发现优化 我的优化

master
Enzo 4 years ago
parent
commit
24004f4a5d
  1. 88
      pages/discover/discover.vue
  2. 49
      pages/user/my/my.vue

88
pages/discover/discover.vue

@ -7,7 +7,7 @@
<swiper :style="{height: autoHeight}" :current="tab_current" @change="swiperChange">
<swiper-item v-for="(tab, tabIndex) in tab_list" :key="tabIndex">
<scroll-view :style="{height: autoHeight}" :scroll-y="true" :refresher-enabled="true" :refresher-triggered="isRefresher"
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh">
@scrolltolower="onScrolltolower" @refresherrefresh="onRefresherrefresh" :scroll-top="scrollTop" @scroll="scroll">
<view v-for="(item,index) of tab.list" :key="index">
<view class="lf-p-32">
<view class="lf-flex" @click="$url('/pages/user/my/my?user_id='+item.user_id)">
@ -58,6 +58,11 @@
<text class="lf-iconfont icon-fabu lf-font-50"></text>
</view>
</view>
<view class="fixed-right1" v-if="showTotop">
<view class="fixed-btn" hover-class="lf-opacity" @click="goTop()">
<text class="lf-iconfont icon-zhiding lf-font-50"></text>
</view>
</view>
<view style="height: 30rpx;"></view>
<lf-tabbar></lf-tabbar>
</view>
@ -77,6 +82,9 @@
loadingText: '正在加载中'
}
return {
scrollTop: 0,
oldScrollTop:0,
showTotop: false,
tab_list: [
{name: '最新',type: 'created_at',list:[],..._public},
{name: '最热',type: 'view_count',list:[],..._public},
@ -100,6 +108,23 @@
this.getHotActivity()
},
methods: {
scroll (e) {
//scroll
this.oldScrollTop = e.detail.scrollTop;
if(this.oldScrollTop > 900) {
this.showTotop = true;
}else {
this.showTotop = false;
}
},
goTop(e) {
//
this.scrollTop = this.oldScrollTop;
// 0
this.$nextTick(() =>{
this.scrollTop = 0;
});
},
checkPicture(image_list,current) {
if(image_list.length <= 0) return;
let list = [];
@ -147,10 +172,6 @@
})
.catch(() => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
},
getMyAttention(options = {}) {
@ -158,14 +179,22 @@
this.$http
.get({
api: 'api/discover/follow',
data: {
page: tab_item.page,
page_size: this.pageSize,
},
header: {
Authorization: this.$cookieStorage.get('user_token')
},
})
.then(res => {
if (res.data.code == 200) {
let isPage = res.data.data.next_page_url == null?false:true;
tab_item.isPage = isPage;
let isPage;
if(res.data.data.per_page == res.data.data.data.length) {
isPage = true;
}else {
isPage = false;
}
if(!isPage) {
tab_item.loadingClass = false;
tab_item.loadingText = '没有更多数据啦~';
@ -214,7 +243,7 @@
tab_item.list = []
tab_item.loadingText = '正在加载中';
if(this.tab_current == 2) {
this.getMyAttention();
this.getMyAttention(options);
}else {
this.getHotActivity(options);
}
@ -253,17 +282,24 @@
this.$http
.get({
api: 'api/discover',
page: tab_item.page,
page_size: this.pageSize,
data:{
order: discover_type,
user_id: this.$cookieStorage.get('user_info').id
}
page: tab_item.page,
page_size: this.pageSize,
order: discover_type
},
header: {
Authorization: this.$cookieStorage.get('user_token')
},
})
.then(res => {
if (res.data.code == 200) {
if (res.data.status) {
let isPage = res.data.next_page_url == null?false:true;
let isPage;
if(res.data.data.per_page == res.data.data.data.length) {
isPage = true;
}else {
isPage = false;
}
tab_item.isPage = isPage;
if(!isPage) {
tab_item.loadingClass = false;
@ -296,10 +332,6 @@
})
.catch(() => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
}
}
@ -370,6 +402,26 @@
}
}
.fixed-right1{
position: fixed;
right: 32rpx;
bottom: 320rpx;
width: max-content;
height: max-content;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
.fixed-btn{
width: 100rpx;
height: 100rpx;
border-radius: 50%;
background-color: #15716E;
display: flex;
justify-content: center;
align-items: center;
color: #FFFFFF;
}
}
// tab
/deep/.u-scroll-box {

49
pages/user/my/my.vue

@ -62,12 +62,7 @@
},
onLoad(e) {
this.user_id = e.user_id;
let user_info = this.$cookieStorage.get('user_token');
if(user_info) {
this.loginList();
}else {
this.noLoginList();
}
this.loginList();
},
methods: {
//
@ -155,51 +150,11 @@
goDetails(id) {
this.$url('/pages/discover/discoverdetails?discover_id='+id)
},
//
noLoginList() {
this.$http
.get({
api: 'api/discover/user/',
data: {
page: this.page,
page_size: this.page_size
},
header: {
Authorization: this.$cookieStorage.get('user_token')
},
})
.then(res => {
if (res.data.code == 200) {
if (res.data.status) {
this.discover_info = res.data.data;
console.log('未登录时的发现列表',this.discover_info);
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
} else {
wx.showModal({
content: res.data.message || '请下拉页面刷新重试',
showCancel: false
});
}
wx.hideLoading();
})
.catch(() => {
wx.hideLoading();
wx.showModal({
content: '请求失败',
showCancel: false
});
});
},
//
loginList() {
this.$http
.get({
api: 'api/discover/my/'+this.user_id,
api: 'api/discover/user/'+this.user_id,
data: {
page: this.page,
page_size: this.page_size

Loading…
Cancel
Save