Authored by htoooth

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

... ... @@ -97,15 +97,23 @@ export default {
transform: translate3d(100%, 0, 0);
}
.route-view-forword-enter-active {
z-index: 2;
}
.route-view-forword-leave-active {
z-index: 1;
transform: translate3d(-30%, 0, 0);
}
.route-view-back-enter {
z-index: 1;
transform: translate3d(-30%, 0, 0);
}
.route-view-back-enter-active {
z-index: 1;
}
.route-view-back-leave-active {
transform: translate3d(100%, 0, 0);
z-index: 2;
... ...
... ... @@ -17,6 +17,8 @@
</template>
<script>
import {mapState} from 'vuex';
export default {
name: 'LayoutHeader',
props: {
... ... @@ -29,6 +31,9 @@ export default {
default: 1
}
},
computed: {
...mapState(['yoho'])
},
watch: {
transparentSeek(value) {
this.animeEl && this.animeEl.seek(this.animeEl.duration * value);
... ... @@ -48,7 +53,11 @@ export default {
},
methods: {
onBack() {
this.$router.go(-1);
if (this.yoho.ssrLoad) {
this.$yoho.finishPage({});
} else {
this.$router.go(-1);
}
}
}
};
... ...
<template>
<div
class="product-item"
:class="{single}"
@click="onClick"
>
:class="{single}">
<div class="product-content">
<ImageFormat :lazy="lazy" class="product-image" :src="product.productImage" :width="136" :height="180"></ImageFormat>
<div class="product-info">
... ... @@ -97,11 +95,11 @@ export default {
white-space: initial;
&:last-child {
margin-right: 30px;
margin-right: 50px;
}
&.single {
width: 690px;
width: 670px;
}
}
... ...
<template>
<div class="icon-btn" @click="onClick" :style="btnStyle">
<i class="iconfont" :class="iconClass" :style="iconStyle"></i>
<p v-if="text" class="icon-btn-text" :style="textStyle">
<p v-if="viewText" class="icon-btn-text" :style="textStyle">
<span class="view-text">{{viewText}}</span>
<span class="placeholder-text">{{text}}</span>
<span class="placeholder-text">{{placText}}</span>
</p>
</div>
</template>
<script>
import {forEach, get} from 'lodash';
import {forEach, get, fill} from 'lodash';
import {createNamespacedHelpers} from 'vuex';
const {mapActions} = createNamespacedHelpers('user');
... ... @@ -51,7 +51,12 @@
type: String,
default: 'fav'
},
text: [String, Number],
text: {
type: [String, Number],
default() {
return '';
}
},
articleId: Number,
commentId: Number,
option: {
... ... @@ -125,7 +130,14 @@
return style;
},
viewText() {
return this.editText === null ? this.text : this.editText;
return `${(this.editText === null ? this.text : this.editText)}`;
},
placText() {
if (!isNaN(Number(this.text)) && this.viewText.length) {
return fill(Array(this.viewText.length), 0).join('');
} else {
return `${this.text}`;
}
}
},
methods: {
... ... @@ -179,7 +191,7 @@
if (this._type === 'fav') {
syncFnName = 'praiseArticle';
} else if (this._type === 'star') {
syncFnName = 'praiseArticle';
syncFnName = 'followArticle';
}
} else if (this.commentId && this._type === 'fav') {
syncFnName = 'praiseComment';
... ... @@ -192,10 +204,16 @@
if (res.code !== 200) {
this.changeBtnStatus();
}
if (res.code === 401) {
// TODO go_login
if (res.code === 401) {
// TODO go_login
} else {
this.$createToast && this.$createToast({
txt: res.message || '服务器开小差了',
type: 'warn',
time: 1000
}).show();
}
}
};
... ...
... ... @@ -32,6 +32,7 @@ export default {
return {
authorName: this.data.authorName,
authorUid: this.data.authorUid,
authorType: this.data.authorType,
authorHeadIco: this.data.authorHeadIco,
hasAttention: this.data.hasAttention,
};
... ...
... ... @@ -136,6 +136,7 @@ export default {
padding-top: 0;
padding-bottom: 0;
margin: 40px 0;
overflow: initial;
}
/deep/ .product-item {
... ...
... ... @@ -32,7 +32,7 @@
</template>
<script>
import {assign} from 'lodash';
import {assign, get} from 'lodash';
export default {
data() {
... ... @@ -91,7 +91,7 @@ export default {
},
list(newList, oldList) {
if (oldList.length > newList.length ||
oldList[0].articleId !== newList[0].articleId) {
get(oldList, '[0].articleId') !== get(newList, '[0].articleId')) {
this.reset();
}
... ... @@ -120,9 +120,6 @@ export default {
this.$emit('calced', nlist);
},
calcCoverImgHeight(w, h) {
return h / w * this.coverImageWidth;
},
calcLayout() {
let $item = this.$el.getElementsByClassName('wf-item-temp');
... ... @@ -189,7 +186,7 @@ export default {
}
}
this.coverImageWidth = imgWidth;
this.coverImageWidth = Math.floor(imgWidth);
},
reset() {
this.offsetTop = this.$el.offsetTop;
... ... @@ -306,6 +303,14 @@ export default {
.description {
line-height: 1.5;
padding: 10px 20px;
word-break: break-all;
text-overflow: -o-ellipsis-lastline;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
line-clamp: 2;
-webkit-box-orient: vertical;
}
.attribution {
... ...
... ... @@ -9,7 +9,6 @@ export function createRouter() {
mode: 'history',
routes,
scrollBehavior(to, from, savedPosition) {
console.log(to.name)
if (savedPosition) {
return savedPosition;
} else {
... ...
... ... @@ -26,6 +26,7 @@ export default function() {
},
historys: [],
direction: 'forword',
ssrLoad: true, // 是否是ssr直出的页面
},
mutations: {
[Types.SET_ENV](state, {context}) {
... ... @@ -39,6 +40,7 @@ export default function() {
state.context.title = title;
},
[Types.ROUTE_CHANGE](state, {to, from}) {
state.ssrLoad = false;
if (!state.historys.length) {
state.historys.push({
name: from.name,
... ...