达人列表 8.15

This commit is contained in:
ghusermoon 2020-08-15 18:32:46 +08:00
parent e427748a79
commit 97676d75fb
2 changed files with 75 additions and 38 deletions

View File

@ -54,6 +54,10 @@ export default {
getRecommendList(){ getRecommendList(){
return vm.$u.post('MemberExpert/recommendList'); return vm.$u.post('MemberExpert/recommendList');
}, },
// 获取所有达人
getAllRecommendList({ page }) {
return vm.$u.post('MemberExpert/getRecommendList', { page });
},
// 达人(搜索)列表 // 达人(搜索)列表
getExpertList({ page, store_id, live_status, like_nickname }){ getExpertList({ page, store_id, live_status, like_nickname }){
return vm.$u.post('MemberExpert/expertList', { return vm.$u.post('MemberExpert/expertList', {

View File

@ -1,43 +1,49 @@
<template> <template>
<view class="follow"> <view class="follow">
<view class="sosuo" @click="searchValue"> <scroll-view scroll-y :style="{ height: viewHeight }" @scrolltolower="loadmore" class="container">
<image src="/static/image/common/10.png"></image> <view class="sosuo" @click="searchValue">
<text>输入达人名称</text> <image src="/static/image/common/10.png"></image>
</view> <text>输入达人名称</text>
<view class="list" style="margin-left:-20rpx"> </view>
<darenItem style="margin-top:20rpx;margin-left:20rpx;" v-for="item in recommendList" :key="item.id" :info="item" v-on:pChangeType="changeType"></darenItem> <view class="list" style="margin-left:-20rpx">
</view> <darenItem style="margin-top:20rpx;margin-left:20rpx;" v-for="item in recommendList" :key="item.id" :info="item" v-on:pChangeType="changeType"></darenItem>
</view>
<u-loadmore :status="loadStatus" bgColor="#ECECEC" font-size="14" margin-top="40" margin-bottom="20" v-if="recommendList.length > pageSize" @loadmore="loadmore"></u-loadmore>
</scroll-view>
</view> </view>
</template> </template>
<style lang="scss" scoped> <style lang="scss" scoped>
.follow{ .follow{
background-color: #ECECEC; background-color: #ECECEC;
min-height: calc(100vh - var(--window-top)); min-height: calc(100vh - var(--window-top));
padding: 20rpx 30rpx; .container {
.sosuo{ box-sizing: border-box;
width: 100%; padding: 20rpx 30rpx;
height: 60rpx; .sosuo{
border-radius: 30rpx; width: 100%;
background-color: #fff; height: 60rpx;
display: flex; border-radius: 30rpx;
align-items: center; background-color: #fff;
justify-content: center; display: flex;
>image{ align-items: center;
width: 29rpx; justify-content: center;
height: 29rpx; >image{
} width: 29rpx;
>text{ height: 29rpx;
font-size: 24rpx; }
color: #999; >text{
margin-left: 15rpx; font-size: 24rpx;
} color: #999;
} margin-left: 15rpx;
.list{ }
display: flex; }
flex-wrap: wrap; .list{
width: calc(100% + 23rpx); display: flex;
margin-right: -23rpx; flex-wrap: wrap;
} width: calc(100% + 23rpx);
margin-right: -23rpx;
}
}
} }
</style> </style>
<script> <script>
@ -50,22 +56,45 @@ export default {
}, },
data(){ data(){
return{ return{
pageSize: 2,
recommendList: [], // recommendList: [], //
page: 1,
loadStatus: 'loadmore',
timer: true,
viewHeight: '',
} }
}, },
onLoad() {
this.setViewHeight();
},
onShow() { onShow() {
this.getRecommendList(); this.getRecommendList();
}, },
methods: { methods: {
getRecommendList() { async getRecommendList({ load = 'reload' } = {}) {
this.$u.api.getRecommendList().then(res => { const res = await this.$u.api.getAllRecommendList({ page: this.page });
if(res.errCode == 0) { this.timer = true;
this.recommendList = res.data.list; if(res.errCode == 0) {
} if(load == 'reload') this.recommendList = res.data.list;
if(load == 'loadmore') this.recommendList.push(...res.data.list);
}
return res.data.list.length;
},
loadmore() {
if(!this.timer) return false;
this.timer = false;
this.loadStatus = "loading";
this.page++;
this.getRecommendList({ load: "loadmore" }).then(length => {
this.loadStatus = "nomore";
if(length == 0) this.page--;
}).catch(() => {
this.loadStatus = "nomore";
this.page--;
}) })
}, },
changeType(member_id){ changeType(member_id){
console.log(member_id); // console.log(member_id);
this.$emit("pChangeType") this.$emit("pChangeType")
this.$u.api.attentionMember({ this.$u.api.attentionMember({
member_id: member_id member_id: member_id
@ -79,6 +108,10 @@ export default {
url: '/pageB/search/index?type=2&curent=1' url: '/pageB/search/index?type=2&curent=1'
}) })
}, },
setViewHeight() {
const res = uni.getSystemInfoSync();
this.viewHeight = res.windowHeight + 'px';
}
}, },
} }
</script> </script>