Authored by 陈峰

commitcommit

... ... @@ -11,7 +11,7 @@
</div>
<div
class="btn-fav hover-opacity"
@click="onFav"
@click.stop="onFav"
:class="favClass">{{favText}}</div>
</div>
</template>
... ... @@ -72,6 +72,9 @@ export default {
time: 1000
}).show();
}
},
onClick() {
this.product.product_skn && this.$yoho.goProductDetail(this.product.product_skn);
}
}
};
... ...
<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();
}
}
};
... ...
... ... @@ -123,7 +123,18 @@ export default {
}
},
onExpand(params) {
this.$refs.actionSheet.show(params);
const toast = this.$createToast({
time: 0,
txt: '加载中',
mask: true,
type: 'loading'
});
toast.show();
this.$refs.actionSheet.show(params).then(() => {
toast.hide();
});
}
},
components: {
... ...
... ... @@ -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 {
... ...