Authored by yyq

fix user detail

... ... @@ -173,6 +173,12 @@ export default {
},
onDounceScroll({item, scrollTop, startIndex}) {
this.scrollTop = scrollTop;
// user 详情页禁止头部交互
if (this.type === 'userArticle') {
return;
}
if (scrollTop <= 0) {
this.showHeader = false;
} else if (item) {
... ...
... ... @@ -5,15 +5,14 @@
<div class="h-name flex">
<span class="h-name-b">{{authorBaseData.nickName}}</span>
<span v-if="authorBaseData.sex" class="iconfont icon-women author-sex-icon" :class="`icon-${authorBaseData.sex}`"></span>
<div v-if="!isOwner" class="h-follow flex">
<WidgetFollow class="widget-follow" :class="{invisible: !tabFixed}" :author-uid="authorInfo.authorUid" :author-type="authorInfo.authorType" :follow="authorBaseData.isAttention" @on-follow="follow => onFollow(follow)" :pos-id="sceneId"></WidgetFollow>
</div>
</div>
<div class="h-more">
<div class="flex">
<WidgetAvatar class="h-headico" :src="authorBaseData.headIco" :width="100" :height="100"></WidgetAvatar>
</div>
<div v-if="!isOwner" class="h-follow flex">
<WidgetFollow class="widget-follow" :author-uid="authorInfo.authorUid" :author-type="authorInfo.authorType" :follow="authorBaseData.isAttention" @on-follow="follow => onFollow(follow)" :pos-id="sceneId"></WidgetFollow>
</div>
</div>
</div>
</LayoutHeader>
... ... @@ -113,6 +112,21 @@ export default {
this.init(this.$route.params);
this.listMinHeight = this.$el.offsetHeight - this.$refs.tabBlock.offsetHeight - $dom.offsetHeight;
if ($dom.offsetHeight) {
this._animeDuration = 300;
import('animejs').then(({default: anime}) => {
this._animeEl = anime({
targets: $dom,
translateY: -$dom.offsetHeight,
easing: 'easeInOutSine',
duration: this._animeDuration,
autoplay: false
});
});
}
this.beforeRouteEnter = this.beforeRouteUpdate;
},
computed: {
list() {
... ... @@ -126,12 +140,15 @@ export default {
authorUid: this.authorInfo.authorUid,
},
query: {
userName: this.authorBaseData.nickName
userName: `${this.isOwner ? '我' : this.authorBaseData.nickName}的${this.waterFallTypeName}`
}
};
},
waterFallType() {
return ['publish', 'fav'][this.activeIndex];
},
waterFallTypeName() {
return ['内容', '收藏'][this.activeIndex];
}
},
methods: {
... ... @@ -154,6 +171,10 @@ export default {
this.emptyTip = '';
if (this.scrollY > 0) {
if (this._animeEl) {
this._animePlayed = false;
this._animeEl.seek(0);
}
this.$refs.scroll.scrollTo(0, 0);
}
... ... @@ -197,6 +218,25 @@ export default {
this.tabFixed = animePlayed;
let start;
let self = this;
function step(timestamp) {
if (!start) {
start = timestamp
};
let progress = Math.floor(timestamp - start);
self._animeEl.seek(animePlayed ? progress : self._animeDuration - progress);
if (progress < self._animeDuration) {
window.requestAnimationFrame(step);
}
};
window.requestAnimationFrame(step);
this._animePlayed = animePlayed;
},
onScrollEndHandle(scroll) {
... ... @@ -395,7 +435,7 @@ export default {
font-weight: 500;
.h-name-b {
max-width: 60%;
max-width: 80%;
line-height: 1.4;
overflow: hidden;
text-overflow: ellipsis;
... ...