Authored by htoooth

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

@@ -97,15 +97,23 @@ export default { @@ -97,15 +97,23 @@ export default {
97 transform: translate3d(100%, 0, 0); 97 transform: translate3d(100%, 0, 0);
98 } 98 }
99 99
  100 +.route-view-forword-enter-active {
  101 + z-index: 2;
  102 +}
  103 +
100 .route-view-forword-leave-active { 104 .route-view-forword-leave-active {
  105 + z-index: 1;
101 transform: translate3d(-30%, 0, 0); 106 transform: translate3d(-30%, 0, 0);
102 } 107 }
103 108
104 .route-view-back-enter { 109 .route-view-back-enter {
105 - z-index: 1;  
106 transform: translate3d(-30%, 0, 0); 110 transform: translate3d(-30%, 0, 0);
107 } 111 }
108 112
  113 +.route-view-back-enter-active {
  114 + z-index: 1;
  115 +}
  116 +
109 .route-view-back-leave-active { 117 .route-view-back-leave-active {
110 transform: translate3d(100%, 0, 0); 118 transform: translate3d(100%, 0, 0);
111 z-index: 2; 119 z-index: 2;
@@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
17 </template> 17 </template>
18 18
19 <script> 19 <script>
  20 +import {mapState} from 'vuex';
  21 +
20 export default { 22 export default {
21 name: 'LayoutHeader', 23 name: 'LayoutHeader',
22 props: { 24 props: {
@@ -29,6 +31,9 @@ export default { @@ -29,6 +31,9 @@ export default {
29 default: 1 31 default: 1
30 } 32 }
31 }, 33 },
  34 + computed: {
  35 + ...mapState(['yoho'])
  36 + },
32 watch: { 37 watch: {
33 transparentSeek(value) { 38 transparentSeek(value) {
34 this.animeEl && this.animeEl.seek(this.animeEl.duration * value); 39 this.animeEl && this.animeEl.seek(this.animeEl.duration * value);
@@ -48,7 +53,11 @@ export default { @@ -48,7 +53,11 @@ export default {
48 }, 53 },
49 methods: { 54 methods: {
50 onBack() { 55 onBack() {
51 - this.$router.go(-1); 56 + if (this.yoho.ssrLoad) {
  57 + this.$yoho.finishPage({});
  58 + } else {
  59 + this.$router.go(-1);
  60 + }
52 } 61 }
53 } 62 }
54 }; 63 };
1 <template> 1 <template>
2 <div 2 <div
3 class="product-item" 3 class="product-item"
4 - :class="{single}"  
5 - @click="onClick"  
6 - > 4 + :class="{single}">
7 <div class="product-content"> 5 <div class="product-content">
8 <ImageFormat :lazy="lazy" class="product-image" :src="product.productImage" :width="136" :height="180"></ImageFormat> 6 <ImageFormat :lazy="lazy" class="product-image" :src="product.productImage" :width="136" :height="180"></ImageFormat>
9 <div class="product-info"> 7 <div class="product-info">
@@ -97,11 +95,11 @@ export default { @@ -97,11 +95,11 @@ export default {
97 white-space: initial; 95 white-space: initial;
98 96
99 &:last-child { 97 &:last-child {
100 - margin-right: 30px; 98 + margin-right: 50px;
101 } 99 }
102 100
103 &.single { 101 &.single {
104 - width: 690px; 102 + width: 670px;
105 } 103 }
106 } 104 }
107 105
1 <template> 1 <template>
2 <div class="icon-btn" @click="onClick" :style="btnStyle"> 2 <div class="icon-btn" @click="onClick" :style="btnStyle">
3 <i class="iconfont" :class="iconClass" :style="iconStyle"></i> 3 <i class="iconfont" :class="iconClass" :style="iconStyle"></i>
4 - <p v-if="text" class="icon-btn-text" :style="textStyle"> 4 + <p v-if="viewText" class="icon-btn-text" :style="textStyle">
5 <span class="view-text">{{viewText}}</span> 5 <span class="view-text">{{viewText}}</span>
6 - <span class="placeholder-text">{{text}}</span> 6 + <span class="placeholder-text">{{placText}}</span>
7 </p> 7 </p>
8 </div> 8 </div>
9 </template> 9 </template>
10 10
11 <script> 11 <script>
12 - import {forEach, get} from 'lodash'; 12 + import {forEach, get, fill} from 'lodash';
13 import {createNamespacedHelpers} from 'vuex'; 13 import {createNamespacedHelpers} from 'vuex';
14 const {mapActions} = createNamespacedHelpers('user'); 14 const {mapActions} = createNamespacedHelpers('user');
15 15
@@ -51,7 +51,12 @@ @@ -51,7 +51,12 @@
51 type: String, 51 type: String,
52 default: 'fav' 52 default: 'fav'
53 }, 53 },
54 - text: [String, Number], 54 + text: {
  55 + type: [String, Number],
  56 + default() {
  57 + return '';
  58 + }
  59 + },
55 articleId: Number, 60 articleId: Number,
56 commentId: Number, 61 commentId: Number,
57 option: { 62 option: {
@@ -125,7 +130,14 @@ @@ -125,7 +130,14 @@
125 return style; 130 return style;
126 }, 131 },
127 viewText() { 132 viewText() {
128 - return this.editText === null ? this.text : this.editText; 133 + return `${(this.editText === null ? this.text : this.editText)}`;
  134 + },
  135 + placText() {
  136 + if (!isNaN(Number(this.text)) && this.viewText.length) {
  137 + return fill(Array(this.viewText.length), 0).join('');
  138 + } else {
  139 + return `${this.text}`;
  140 + }
129 } 141 }
130 }, 142 },
131 methods: { 143 methods: {
@@ -179,7 +191,7 @@ @@ -179,7 +191,7 @@
179 if (this._type === 'fav') { 191 if (this._type === 'fav') {
180 syncFnName = 'praiseArticle'; 192 syncFnName = 'praiseArticle';
181 } else if (this._type === 'star') { 193 } else if (this._type === 'star') {
182 - syncFnName = 'praiseArticle'; 194 + syncFnName = 'followArticle';
183 } 195 }
184 } else if (this.commentId && this._type === 'fav') { 196 } else if (this.commentId && this._type === 'fav') {
185 syncFnName = 'praiseComment'; 197 syncFnName = 'praiseComment';
@@ -192,10 +204,16 @@ @@ -192,10 +204,16 @@
192 204
193 if (res.code !== 200) { 205 if (res.code !== 200) {
194 this.changeBtnStatus(); 206 this.changeBtnStatus();
195 - }  
196 207
197 - if (res.code === 401) {  
198 - // TODO go_login 208 + if (res.code === 401) {
  209 + // TODO go_login
  210 + } else {
  211 + this.$createToast && this.$createToast({
  212 + txt: res.message || '服务器开小差了',
  213 + type: 'warn',
  214 + time: 1000
  215 + }).show();
  216 + }
199 } 217 }
200 }; 218 };
201 219
@@ -32,6 +32,7 @@ export default { @@ -32,6 +32,7 @@ export default {
32 return { 32 return {
33 authorName: this.data.authorName, 33 authorName: this.data.authorName,
34 authorUid: this.data.authorUid, 34 authorUid: this.data.authorUid,
  35 + authorType: this.data.authorType,
35 authorHeadIco: this.data.authorHeadIco, 36 authorHeadIco: this.data.authorHeadIco,
36 hasAttention: this.data.hasAttention, 37 hasAttention: this.data.hasAttention,
37 }; 38 };
@@ -136,6 +136,7 @@ export default { @@ -136,6 +136,7 @@ export default {
136 padding-top: 0; 136 padding-top: 0;
137 padding-bottom: 0; 137 padding-bottom: 0;
138 margin: 40px 0; 138 margin: 40px 0;
  139 + overflow: initial;
139 } 140 }
140 141
141 /deep/ .product-item { 142 /deep/ .product-item {
@@ -32,7 +32,7 @@ @@ -32,7 +32,7 @@
32 </template> 32 </template>
33 33
34 <script> 34 <script>
35 -import {assign} from 'lodash'; 35 +import {assign, get} from 'lodash';
36 36
37 export default { 37 export default {
38 data() { 38 data() {
@@ -91,7 +91,7 @@ export default { @@ -91,7 +91,7 @@ export default {
91 }, 91 },
92 list(newList, oldList) { 92 list(newList, oldList) {
93 if (oldList.length > newList.length || 93 if (oldList.length > newList.length ||
94 - oldList[0].articleId !== newList[0].articleId) { 94 + get(oldList, '[0].articleId') !== get(newList, '[0].articleId')) {
95 this.reset(); 95 this.reset();
96 } 96 }
97 97
@@ -120,9 +120,6 @@ export default { @@ -120,9 +120,6 @@ export default {
120 120
121 this.$emit('calced', nlist); 121 this.$emit('calced', nlist);
122 }, 122 },
123 - calcCoverImgHeight(w, h) {  
124 - return h / w * this.coverImageWidth;  
125 - },  
126 calcLayout() { 123 calcLayout() {
127 let $item = this.$el.getElementsByClassName('wf-item-temp'); 124 let $item = this.$el.getElementsByClassName('wf-item-temp');
128 125
@@ -189,7 +186,7 @@ export default { @@ -189,7 +186,7 @@ export default {
189 } 186 }
190 } 187 }
191 188
192 - this.coverImageWidth = imgWidth; 189 + this.coverImageWidth = Math.floor(imgWidth);
193 }, 190 },
194 reset() { 191 reset() {
195 this.offsetTop = this.$el.offsetTop; 192 this.offsetTop = this.$el.offsetTop;
@@ -306,6 +303,14 @@ export default { @@ -306,6 +303,14 @@ export default {
306 .description { 303 .description {
307 line-height: 1.5; 304 line-height: 1.5;
308 padding: 10px 20px; 305 padding: 10px 20px;
  306 + word-break: break-all;
  307 + text-overflow: -o-ellipsis-lastline;
  308 + overflow: hidden;
  309 + text-overflow: ellipsis;
  310 + display: -webkit-box;
  311 + -webkit-line-clamp: 2;
  312 + line-clamp: 2;
  313 + -webkit-box-orient: vertical;
309 } 314 }
310 315
311 .attribution { 316 .attribution {
@@ -9,7 +9,6 @@ export function createRouter() { @@ -9,7 +9,6 @@ export function createRouter() {
9 mode: 'history', 9 mode: 'history',
10 routes, 10 routes,
11 scrollBehavior(to, from, savedPosition) { 11 scrollBehavior(to, from, savedPosition) {
12 - console.log(to.name)  
13 if (savedPosition) { 12 if (savedPosition) {
14 return savedPosition; 13 return savedPosition;
15 } else { 14 } else {
@@ -26,6 +26,7 @@ export default function() { @@ -26,6 +26,7 @@ export default function() {
26 }, 26 },
27 historys: [], 27 historys: [],
28 direction: 'forword', 28 direction: 'forword',
  29 + ssrLoad: true, // 是否是ssr直出的页面
29 }, 30 },
30 mutations: { 31 mutations: {
31 [Types.SET_ENV](state, {context}) { 32 [Types.SET_ENV](state, {context}) {
@@ -39,6 +40,7 @@ export default function() { @@ -39,6 +40,7 @@ export default function() {
39 state.context.title = title; 40 state.context.title = title;
40 }, 41 },
41 [Types.ROUTE_CHANGE](state, {to, from}) { 42 [Types.ROUTE_CHANGE](state, {to, from}) {
  43 + state.ssrLoad = false;
42 if (!state.historys.length) { 44 if (!state.historys.length) {
43 state.historys.push({ 45 state.historys.push({
44 name: from.name, 46 name: from.name,