commitcommit
Showing
4 changed files
with
54 additions
and
17 deletions
@@ -11,7 +11,7 @@ | @@ -11,7 +11,7 @@ | ||
11 | </div> | 11 | </div> |
12 | <div | 12 | <div |
13 | class="btn-fav hover-opacity" | 13 | class="btn-fav hover-opacity" |
14 | - @click="onFav" | 14 | + @click.stop="onFav" |
15 | :class="favClass">{{favText}}</div> | 15 | :class="favClass">{{favText}}</div> |
16 | </div> | 16 | </div> |
17 | </template> | 17 | </template> |
@@ -72,6 +72,9 @@ export default { | @@ -72,6 +72,9 @@ export default { | ||
72 | time: 1000 | 72 | time: 1000 |
73 | }).show(); | 73 | }).show(); |
74 | } | 74 | } |
75 | + }, | ||
76 | + onClick() { | ||
77 | + this.product.product_skn && this.$yoho.goProductDetail(this.product.product_skn); | ||
75 | } | 78 | } |
76 | } | 79 | } |
77 | }; | 80 | }; |
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 |
@@ -123,7 +123,18 @@ export default { | @@ -123,7 +123,18 @@ export default { | ||
123 | } | 123 | } |
124 | }, | 124 | }, |
125 | onExpand(params) { | 125 | onExpand(params) { |
126 | - this.$refs.actionSheet.show(params); | 126 | + const toast = this.$createToast({ |
127 | + time: 0, | ||
128 | + txt: '加载中', | ||
129 | + mask: true, | ||
130 | + type: 'loading' | ||
131 | + }); | ||
132 | + | ||
133 | + toast.show(); | ||
134 | + | ||
135 | + this.$refs.actionSheet.show(params).then(() => { | ||
136 | + toast.hide(); | ||
137 | + }); | ||
127 | } | 138 | } |
128 | }, | 139 | }, |
129 | components: { | 140 | components: { |
@@ -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 { |
-
Please register or login to post a comment