Authored by 陈峰

Merge branch 'master' of http://git.yoho.cn/fe/yoho-community-web

... ... @@ -119,6 +119,7 @@ export default {
font-size: 18PX;
letter-spacing: 0.09PX;
overflow: hidden;
z-index: 1;
}
.opts {
... ...
<template>
<Layout class="author-page">
<LayoutHeader slot='header' theme="white">
<LayoutHeader slot='header' theme="white" class="author-page-header">
<div ref="headerAuthor" class="header-author">
<div class="h-name flex">
<span class="h-name-b">{{baseData.nickName}}</span>
... ... @@ -39,7 +39,7 @@
</li>
</ul>
<div class="operate-wrap">
<router-link v-if="isOwner" class="operate-btn btn-user-edit" :to="mineInfoUrl">编辑个人资料</router-link>
<a v-if="isOwner" class="operate-btn btn-user-edit" :href="mineInfoUrl">编辑个人资料</a>
<WidgetFollow v-else class="operate-btn" :author-uid="autherInfo.authorUid" :follow="isAttention" @on-follow="follow => onFollow(follow)"></WidgetFollow>
</div>
</div>
... ... @@ -47,10 +47,11 @@
<p v-if="baseData.signature" class="author-desc">{{baseData.signature}}</p>
<FavTabBlock :tabs-num="tabsNum" :active-index="activeIndex" @change="changeTab"></FavTabBlock>
<div ref="contantList" class="contant-list">
<p v-if="emptyTip" class="empty-tip" :height="emptyTipHeight">{{emptyTip}}</p>
<WaterFall class="pannel-wrap" :list="list" :params="params"></WaterFall>
</div>
<div v-if="loadStatus" class="loading">
<div v-if="loadStatus && !emptyTip" class="loading">
<Loading v-if="loadStatus === 1" class="load-icon" :size="20"></Loading>
<p v-else class="load-text">没有更多了</p>
</div>
... ... @@ -87,11 +88,19 @@
tabsNum: [0, 0],
activeIndex: 0,
fetchInfo: {},
loadStatus: ''
loadStatus: '',
emptyTipHeight: '',
emptyTip: ''
}
},
created() {
this.isOwner = !this.$route.params.id;
},
mounted() {
let $dom = this.$refs.headerAuthor;
let i = 1;
this.emptyTipHeight = this.$el.offsetHeight - this.$refs.contantList.offsetTop - $dom.offsetHeight - 40;
this.init(this.$route.params);
... ... @@ -145,11 +154,14 @@
params = params || {};
this._apiNamePre = 'auther';
this.isOwner = !params.id;
this.tabFixed = false;
this.tabsNum = [0, 0];
this.activeIndex = 0;
this.fetchInfo = {};
this.loadStatus = '';
this.emptyTip = '';
if (!params.id) {
this._apiNamePre += 'Mine';
... ... @@ -220,6 +232,8 @@
changeTab(index) {
if (this.activeIndex !== index) {
this.activeIndex = index;
this.loadStatus = '';
this.emptyTip = '';
let info = this.fetchInfo[index] || {};
... ... @@ -292,9 +306,11 @@
info.list = (info.list || []).concat(result.data.list || []);
info.page++;
info.totalPage = result.data.totalPage;
info.totalPage = result.data.totalPage || 1;
info.lastedTime = result.data.lastedTime;
this.setEmptyTip(info.list, result.data.totalCount);
if (info.list.length) {
info.list[0]._type = `${info.list[0].articleId}_${this.activeIndex}`;
}
... ... @@ -313,10 +329,21 @@
this.$refs.scroll.refresh();
}, 100);
},
goUserInfoEdit() {
if (this.$yoho.isYohoBuy) {
this.$yoho.goMineInfo();
setEmptyTip(list, totalCount) {
let tip = '';
if (!list.length && !totalCount) {
switch (this.activeIndex) {
case 0:
tip = this.isOwner ? '发布你的第一篇潮人态度' : 'TA还没有分享过哦';
break;
case 1:
tip = this.isOwner ? '快去种下你的第一棵草吧;' : 'TA还没有种过草哦';
break;
}
}
this.emptyTip = tip;
},
onFollow(follow) {
this.isAttention = follow;
... ... @@ -324,8 +351,6 @@
},
components: {
CubeScroll: Scroll,
CubeSticky: Sticky,
CubeStickyEle,
Loading,
FavTabBlock,
WaterFall
... ... @@ -340,6 +365,10 @@
color: #4a4a4a;
}
.author-page-header > .title {
overflow: visible!important;
}
.fixed-tab {
width: 100%;
position: absolute;
... ... @@ -507,6 +536,15 @@
white-space: nowrap;
}
.empty-tip {
display: flex;
justify-content: center;
align-items: center;
height: 1000px;
font-size: 28px;
color: #ddd;
}
.loading {
padding: 20px 0;
... ...
... ... @@ -139,14 +139,29 @@ export default {
this.colsList = list;
},
toArticle({articleId}) {
this.$router.push({
let router = {
name: 'article.user',
params: {
id: articleId,
...this.params.params
},
query: this.params.query
});
};
if (!router.params.authorUid) {
try {
this.$sdk.getUser().then(res => {
if (get(res, 'uid') > 0) {
router.params.authorUid = res.uid;
this.$router.push(router);
}
});
} catch(e){
console.log(e);
}
} else {
this.$router.push(router);
}
}
},
components: {
... ...