Showing
17 changed files
with
124 additions
and
38 deletions
@@ -117,8 +117,8 @@ export default { | @@ -117,8 +117,8 @@ export default { | ||
117 | .account-footer { | 117 | .account-footer { |
118 | position: absolute; | 118 | position: absolute; |
119 | padding: 28px 0; | 119 | padding: 28px 0; |
120 | - left: 0; | ||
121 | - right: 0; | 120 | + left: 40px; |
121 | + right: 40px; | ||
122 | bottom: 40px; | 122 | bottom: 40px; |
123 | .submit-btn { | 123 | .submit-btn { |
124 | height: 88px; | 124 | height: 88px; |
1 | <template> | 1 | <template> |
2 | - <LayoutApp class="yohoufo-channel-page" :show-back="true" :hide-header="hideHeader" :title="title" :isStop="isStop"> | 2 | + <LayoutApp class="yohoufo-channel-page" :show-back="true" :hide-header="hideHeader" :title="title"> |
3 | <div class="fixed-nav scroll-nav-wrap" v-if="navList.length" v-show="isShow"> | 3 | <div class="fixed-nav scroll-nav-wrap" v-if="navList.length" v-show="isShow"> |
4 | <ScrollNav :list="navList" :current="active" @transfer="getIndex"></ScrollNav> | 4 | <ScrollNav :list="navList" :current="active" @transfer="getIndex"></ScrollNav> |
5 | </div> | 5 | </div> |
@@ -27,7 +27,7 @@ | @@ -27,7 +27,7 @@ | ||
27 | </div> | 27 | </div> |
28 | <div class="list-wrap"> | 28 | <div class="list-wrap"> |
29 | <ProductList ref="product" :list="productList.list" :yasParams="listYasParams" v-if="productList.list.length > 0"></ProductList> | 29 | <ProductList ref="product" :list="productList.list" :yasParams="listYasParams" v-if="productList.list.length > 0"></ProductList> |
30 | - <UfoNoItem class="channel-no-item" :tip="`暂无数据`" v-else></UfoNoItem> | 30 | + <UfoNoItem class="channel-no-item" :style="noItemStyle" :tip="`暂无数据`" v-else></UfoNoItem> |
31 | </div> | 31 | </div> |
32 | </div> | 32 | </div> |
33 | </LayoutScroll> | 33 | </LayoutScroll> |
@@ -60,10 +60,6 @@ export default { | @@ -60,10 +60,6 @@ export default { | ||
60 | homeYasParams: [], | 60 | homeYasParams: [], |
61 | options: { | 61 | options: { |
62 | pullUpLoad: true, | 62 | pullUpLoad: true, |
63 | - // pullDownRefresh: true, | ||
64 | - // pullDownRefresh: { | ||
65 | - // txt: '刷新成功', | ||
66 | - // } | ||
67 | }, | 63 | }, |
68 | scrollEvents: ['scroll','scroll-end'], | 64 | scrollEvents: ['scroll','scroll-end'], |
69 | title:'闲鱼潮', | 65 | title:'闲鱼潮', |
@@ -106,6 +102,7 @@ export default { | @@ -106,6 +102,7 @@ export default { | ||
106 | selectedCategory: {}, | 102 | selectedCategory: {}, |
107 | height: 0, | 103 | height: 0, |
108 | isA: false, | 104 | isA: false, |
105 | + isHidden: true, | ||
109 | }; | 106 | }; |
110 | }, | 107 | }, |
111 | computed: { | 108 | computed: { |
@@ -113,8 +110,10 @@ export default { | @@ -113,8 +110,10 @@ export default { | ||
113 | navList() { | 110 | navList() { |
114 | return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || []; | 111 | return get(find(this.channelList.list, ['template_name', 'guessLike']), 'data') || []; |
115 | }, | 112 | }, |
116 | - isStop() { | ||
117 | - return this.scrollY < 10; | 113 | + noItemStyle() { |
114 | + return { | ||
115 | + height: this.total + 'px' | ||
116 | + } | ||
118 | } | 117 | } |
119 | }, | 118 | }, |
120 | watch: { | 119 | watch: { |
@@ -214,6 +213,7 @@ export default { | @@ -214,6 +213,7 @@ export default { | ||
214 | }); | 213 | }); |
215 | }, | 214 | }, |
216 | setYasParam: function(params) { | 215 | setYasParam: function(params) { |
216 | + console.log('setYas') | ||
217 | let {total, list} = this.productList; | 217 | let {total, list} = this.productList; |
218 | 218 | ||
219 | if (params && typeof params === 'object' && Object.keys(params).length) { | 219 | if (params && typeof params === 'object' && Object.keys(params).length) { |
@@ -252,14 +252,17 @@ export default { | @@ -252,14 +252,17 @@ export default { | ||
252 | }, | 252 | }, |
253 | getIndex({index,params}) { | 253 | getIndex({index,params}) { |
254 | this.selectedCategory = params; | 254 | this.selectedCategory = params; |
255 | - this.setYasParam({index,...params}); | ||
256 | this.active = Number(index); | 255 | this.active = Number(index); |
257 | - this.isShow && this.$refs.scroll.scrollTo(0, -this.navTop, 300); | 256 | + this.isShow && this.$refs.scroll.scrollTo(this.navTop); |
257 | + this.setYasParam({index,...params}); | ||
258 | }, | 258 | }, |
259 | scrollEndHandler({y}) { | 259 | scrollEndHandler({y}) { |
260 | let scrollHeight = Math.abs(y) | 260 | let scrollHeight = Math.abs(y) |
261 | - this.reportYas(scrollHeight) | ||
262 | this.$refs.product && this.$refs.product.yasShowEvent(scrollHeight+this.navTop); | 261 | this.$refs.product && this.$refs.product.yasShowEvent(scrollHeight+this.navTop); |
262 | + if(scrollHeight === this.navTop) { | ||
263 | + return | ||
264 | + } | ||
265 | + this.reportYas(scrollHeight) | ||
263 | }, | 266 | }, |
264 | scrollHandler({ y }) { | 267 | scrollHandler({ y }) { |
265 | this.scrollY = -y; | 268 | this.scrollY = -y; |
@@ -453,14 +456,13 @@ export default { | @@ -453,14 +456,13 @@ export default { | ||
453 | 456 | ||
454 | .list-wrap { | 457 | .list-wrap { |
455 | background: #f2f2f2; | 458 | background: #f2f2f2; |
456 | - | ||
457 | /deep/ .item { | 459 | /deep/ .item { |
458 | position: relative; | 460 | position: relative; |
459 | z-index: 1; | 461 | z-index: 1; |
460 | } | 462 | } |
461 | 463 | ||
462 | .channel-no-item { | 464 | .channel-no-item { |
463 | - padding-top: 200px; | 465 | + margin: 0 auto; |
464 | } | 466 | } |
465 | } | 467 | } |
466 | .yohoufo-channel-page { | 468 | .yohoufo-channel-page { |
@@ -507,4 +509,8 @@ input::-webkit-input-placeholder { | @@ -507,4 +509,8 @@ input::-webkit-input-placeholder { | ||
507 | .class-a { | 509 | .class-a { |
508 | padding-top: 104px; | 510 | padding-top: 104px; |
509 | } | 511 | } |
512 | +.hidden { | ||
513 | + visibility: hidden; | ||
514 | + opacity: 0; | ||
515 | +} | ||
510 | </style> | 516 | </style> |
@@ -41,6 +41,14 @@ export default { | @@ -41,6 +41,14 @@ export default { | ||
41 | name: 'ProductDetail', | 41 | name: 'ProductDetail', |
42 | params: { | 42 | params: { |
43 | productId: product.id, | 43 | productId: product.id, |
44 | + | ||
45 | + /** | ||
46 | + * 传递可用的初始化数据,避免白屏 | ||
47 | + */ | ||
48 | + productInfo: { | ||
49 | + ...product, | ||
50 | + price: product[this.priceKey], // 统一接收端使用的价格key | ||
51 | + }, | ||
44 | } | 52 | } |
45 | }); | 53 | }); |
46 | }, | 54 | }, |
@@ -141,6 +149,7 @@ export default { | @@ -141,6 +149,7 @@ export default { | ||
141 | color: #d0021b; | 149 | color: #d0021b; |
142 | font-size: 32px; | 150 | font-size: 32px; |
143 | vertical-align: center; | 151 | vertical-align: center; |
152 | + @include num | ||
144 | } | 153 | } |
145 | 154 | ||
146 | .item-imge { | 155 | .item-imge { |
@@ -72,7 +72,7 @@ export default { | @@ -72,7 +72,7 @@ export default { | ||
72 | } | 72 | } |
73 | 73 | ||
74 | .icon-size2 { | 74 | .icon-size2 { |
75 | - font-size: 38px; | 75 | + font-size: 48px; |
76 | } | 76 | } |
77 | 77 | ||
78 | .index { | 78 | .index { |
@@ -91,6 +91,7 @@ export default { | @@ -91,6 +91,7 @@ export default { | ||
91 | 91 | ||
92 | .name { | 92 | .name { |
93 | font-size: 32px; | 93 | font-size: 32px; |
94 | + font-weight: bold; | ||
94 | margin-bottom: 12px; | 95 | margin-bottom: 12px; |
95 | } | 96 | } |
96 | 97 | ||
@@ -102,5 +103,6 @@ export default { | @@ -102,5 +103,6 @@ export default { | ||
102 | .mobile { | 103 | .mobile { |
103 | font-size: 28px; | 104 | font-size: 28px; |
104 | margin-top: 12px; | 105 | margin-top: 12px; |
106 | + font-weight: bold; | ||
105 | } | 107 | } |
106 | </style> | 108 | </style> |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <div class="input-wrapper"> | 3 | <div class="input-wrapper"> |
4 | <div class="price-symbol">¥</div> | 4 | <div class="price-symbol">¥</div> |
5 | <input ref="input" :value="value" class="tip" type="text" placeholder="定价需以9结尾,例如¥1299" @blur="onBlur" | 5 | <input ref="input" :value="value" class="tip" type="text" placeholder="定价需以9结尾,例如¥1299" @blur="onBlur" |
6 | - @change="onChange"></input> | 6 | + @change="onChange"/> |
7 | </div> | 7 | </div> |
8 | <div class="num-wrapper" v-if="superSell"> | 8 | <div class="num-wrapper" v-if="superSell"> |
9 | <i class="iconfont iconplus-minus icon-class" @click="onMinus"></i> | 9 | <i class="iconfont iconplus-minus icon-class" @click="onMinus"></i> |
@@ -75,6 +75,7 @@ export default { | @@ -75,6 +75,7 @@ export default { | ||
75 | position: relative; | 75 | position: relative; |
76 | overflow: hidden; | 76 | overflow: hidden; |
77 | height: 120px; | 77 | height: 120px; |
78 | + border-radius: 8px; | ||
78 | background: #f5f5f5; | 79 | background: #f5f5f5; |
79 | } | 80 | } |
80 | 81 | ||
@@ -93,6 +94,7 @@ export default { | @@ -93,6 +94,7 @@ export default { | ||
93 | font-weight: 500; | 94 | font-weight: 500; |
94 | line-height: 80px; | 95 | line-height: 80px; |
95 | background: #f5f5f5; | 96 | background: #f5f5f5; |
97 | + @include num | ||
96 | } | 98 | } |
97 | 99 | ||
98 | ::placeholder { | 100 | ::placeholder { |
1 | <template> | 1 | <template> |
2 | <layout-app | 2 | <layout-app |
3 | - :title="$route.params.owner === 'sell' ? '我的出售' : '我的订单'" | 3 | + :title="$route.params.owner === 'sell' ? '我的出售' : '我的购买订单'" |
4 | class="list-page" | 4 | class="list-page" |
5 | > | 5 | > |
6 | <status-nav :status="status" :owner="owner" @select="onStatusChange"/> | 6 | <status-nav :status="status" :owner="owner" @select="onStatusChange"/> |
@@ -10,7 +10,7 @@ | @@ -10,7 +10,7 @@ | ||
10 | > | 10 | > |
11 | </InputPrice> | 11 | </InputPrice> |
12 | <OrderMargin class="order-item order-margin" :data="fee" :super-sell="superSell" :url="tipUrl"></OrderMargin> | 12 | <OrderMargin class="order-item order-margin" :data="fee" :super-sell="superSell" :url="tipUrl"></OrderMargin> |
13 | - <OrderFee class="order-item" :data="fee"></OrderFee> | 13 | + <OrderFee class="order-item order-fee" :data="fee"></OrderFee> |
14 | <AddressInfo :data="address" class="order-item"></AddressInfo> | 14 | <AddressInfo :data="address" class="order-item"></AddressInfo> |
15 | <!-- </Scroll>--> | 15 | <!-- </Scroll>--> |
16 | </div> | 16 | </div> |
@@ -481,6 +481,11 @@ export default { | @@ -481,6 +481,11 @@ export default { | ||
481 | background: #fff; | 481 | background: #fff; |
482 | } | 482 | } |
483 | 483 | ||
484 | +.order-fee { | ||
485 | + padding-top: 20px; | ||
486 | + padding-bottom: 20px; | ||
487 | +} | ||
488 | + | ||
484 | .btn-wrapper { | 489 | .btn-wrapper { |
485 | margin-bottom: 40px; | 490 | margin-bottom: 40px; |
486 | padding: 0 40px; | 491 | padding: 0 40px; |
@@ -9,7 +9,7 @@ | @@ -9,7 +9,7 @@ | ||
9 | <div class="size-item"> | 9 | <div class="size-item"> |
10 | <div class="size"> | 10 | <div class="size"> |
11 | <div class="size-info"><span>{{info.name}}</span><span v-if="info.subName">{{info.subName}}</span></div> | 11 | <div class="size-info"><span>{{info.name}}</span><span v-if="info.subName">{{info.subName}}</span></div> |
12 | - <div class="size-price" v-if="!simplePrice">¥ {{info.price}}</div> | 12 | + <div class="size-price" v-if="!simplePrice">¥{{info.price}}</div> |
13 | </div> | 13 | </div> |
14 | </div> | 14 | </div> |
15 | </li> | 15 | </li> |
@@ -218,10 +218,14 @@ export default { | @@ -218,10 +218,14 @@ export default { | ||
218 | margin-right: -1px; | 218 | margin-right: -1px; |
219 | margin-bottom: -1px; | 219 | margin-bottom: -1px; |
220 | 220 | ||
221 | - .size-info, | ||
222 | - .size-price { | 221 | + .size-info { |
223 | @include num; | 222 | @include num; |
224 | } | 223 | } |
224 | + | ||
225 | + .size-price { | ||
226 | + font-family: "PingFang SC", "HiraginoSansGB-W3", "SanFranciscoText-Regular", Helvetica, Roboto, "Heiti SC", "黑体", Arial; | ||
227 | + } | ||
228 | + | ||
225 | &.selected { | 229 | &.selected { |
226 | background: $primary-color; | 230 | background: $primary-color; |
227 | 231 |
@@ -7,7 +7,8 @@ | @@ -7,7 +7,8 @@ | ||
7 | <cube-slide ref="slide" :data="imageList"> | 7 | <cube-slide ref="slide" :data="imageList"> |
8 | <cube-slide-item v-for="(item, index) in imageList" :key="index"> | 8 | <cube-slide-item v-for="(item, index) in imageList" :key="index"> |
9 | <a click="javascript:void 0" class="square-img-container"> | 9 | <a click="javascript:void 0" class="square-img-container"> |
10 | - <square-img :src="item.image_url" :width="300" :height="300" /> | 10 | + <square-img v-if="!item.initial" :src="item.image_url" :width="600" :height="600" /> |
11 | + <square-img v-else :src="item.image_url" :width="274" :height="274" /> <!-- 利用缓存, productList使用的size --> | ||
11 | </a> | 12 | </a> |
12 | </cube-slide-item> | 13 | </cube-slide-item> |
13 | <template slot="dots" slot-scope="props"> | 14 | <template slot="dots" slot-scope="props"> |
@@ -26,8 +27,8 @@ | @@ -26,8 +27,8 @@ | ||
26 | </div> | 27 | </div> |
27 | <div class="info-name"><div>{{productDetail.product_name}}</div></div> | 28 | <div class="info-name"><div>{{productDetail.product_name}}</div></div> |
28 | </div> | 29 | </div> |
29 | - <a class="banner" v-if="resource" @click.prevent="gotoNewPage(resource.url)"> | ||
30 | - <img-size ref="resourceImg" :src="sizeImg(resource.src)"/> | 30 | + <a class="banner" @click.prevent="gotoNewPage"> |
31 | + <img-size v-if="resource" ref="resourceImg" :src="sizeImg(resource.src)"/> | ||
31 | </a> | 32 | </a> |
32 | <div class="info"> | 33 | <div class="info"> |
33 | <transition-group name="info-list" tag="div" class="info-list"> | 34 | <transition-group name="info-list" tag="div" class="info-list"> |
@@ -202,6 +203,15 @@ export default { | @@ -202,6 +203,15 @@ export default { | ||
202 | throw new Error('无效的商品ID'); | 203 | throw new Error('无效的商品ID'); |
203 | } | 204 | } |
204 | 205 | ||
206 | + /** | ||
207 | + * 接收初始化数据 | ||
208 | + */ | ||
209 | + const initialProductInfo = router.params.productInfo; | ||
210 | + | ||
211 | + if (initialProductInfo) { | ||
212 | + store.dispatch('product/setupInitialProductInfo', initialProductInfo); | ||
213 | + } | ||
214 | + | ||
205 | return store.dispatch('product/fetchProductInfo', {productId}); | 215 | return store.dispatch('product/fetchProductInfo', {productId}); |
206 | }, | 216 | }, |
207 | activated() { | 217 | activated() { |
@@ -252,7 +262,8 @@ export default { | @@ -252,7 +262,8 @@ export default { | ||
252 | next(); | 262 | next(); |
253 | }, | 263 | }, |
254 | methods: { | 264 | methods: { |
255 | - ...mapActions(['fetchProductInfo', 'fetchBrandTop', 'fetchFav', 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']), | 265 | + ...mapActions(['fetchProductInfo', 'fetchBrandTop', 'fetchFav', 'setupInitialProductInfo', |
266 | + 'toggleFav', 'updateTradeInfo', 'getSelectedTradeProduct', 'payment', 'resetSelectedSize']), | ||
256 | historyBackGuard() { | 267 | historyBackGuard() { |
257 | for (let key of Object.keys(this.actionSheetCloseMap)) { | 268 | for (let key of Object.keys(this.actionSheetCloseMap)) { |
258 | if (this[key]) { | 269 | if (this[key]) { |
@@ -347,6 +358,7 @@ export default { | @@ -347,6 +358,7 @@ export default { | ||
347 | name: this.$route.name, | 358 | name: this.$route.name, |
348 | params: { | 359 | params: { |
349 | productId: product.id, | 360 | productId: product.id, |
361 | + productInfo: product, | ||
350 | }, | 362 | }, |
351 | }); | 363 | }); |
352 | }, | 364 | }, |
@@ -507,7 +519,13 @@ export default { | @@ -507,7 +519,13 @@ export default { | ||
507 | }, | 519 | }, |
508 | 520 | ||
509 | // 资源位 | 521 | // 资源位 |
510 | - gotoNewPage(url) { | 522 | + gotoNewPage() { |
523 | + if (!this.resource || !this.resource.url) { | ||
524 | + return; | ||
525 | + } | ||
526 | + | ||
527 | + const url = this.resource.url; | ||
528 | + | ||
511 | /** | 529 | /** |
512 | * 商品详情页中的资源位点击 | 530 | * 商品详情页中的资源位点击 |
513 | * XY_UFO_GDS_DT_BANNER_C | 531 | * XY_UFO_GDS_DT_BANNER_C |
@@ -569,14 +587,14 @@ export default { | @@ -569,14 +587,14 @@ export default { | ||
569 | 587 | ||
570 | .cube-dot { | 588 | .cube-dot { |
571 | display: inline-block; | 589 | display: inline-block; |
572 | - width: 6px; | ||
573 | - height: 6px; | ||
574 | - margin: 0 10px; | 590 | + width: 4px; |
591 | + height: 4px; | ||
592 | + margin: 0 5px; | ||
575 | background: rgba(0, 0, 0, 0.15); | 593 | background: rgba(0, 0, 0, 0.15); |
576 | border-radius: 50%; | 594 | border-radius: 50%; |
577 | &.active { | 595 | &.active { |
578 | transform-origin: 50% 50%; | 596 | transform-origin: 50% 50%; |
579 | - transform: scale(1.3333); | 597 | + transform: scale(1.5); |
580 | background: rgba(0, 0, 0, 1); | 598 | background: rgba(0, 0, 0, 1); |
581 | } | 599 | } |
582 | } | 600 | } |
@@ -600,10 +618,12 @@ export default { | @@ -600,10 +618,12 @@ export default { | ||
600 | 618 | ||
601 | .banner { | 619 | .banner { |
602 | display: block; | 620 | display: block; |
621 | + height: 132px; | ||
603 | 622 | ||
604 | img { | 623 | img { |
624 | + display: block; | ||
605 | width: 100%; | 625 | width: 100%; |
606 | - height: 132px; | 626 | + height: 100%; |
607 | } | 627 | } |
608 | } | 628 | } |
609 | 629 | ||
@@ -636,13 +656,14 @@ export default { | @@ -636,13 +656,14 @@ export default { | ||
636 | } | 656 | } |
637 | 657 | ||
638 | .info-basic { | 658 | .info-basic { |
639 | - padding: 46px 40px 32px; | 659 | + padding: 46px 40px 30px; |
640 | 660 | ||
641 | .info-price { | 661 | .info-price { |
642 | color: #d0021b; | 662 | color: #d0021b; |
643 | font-size: 48px; | 663 | font-size: 48px; |
644 | 664 | ||
645 | @include num; | 665 | @include num; |
666 | + | ||
646 | font-weight: bold; | 667 | font-weight: bold; |
647 | line-height: 56px; | 668 | line-height: 56px; |
648 | height: 56px; | 669 | height: 56px; |
@@ -665,10 +686,11 @@ export default { | @@ -665,10 +686,11 @@ export default { | ||
665 | flex-direction: column; | 686 | flex-direction: column; |
666 | justify-content: center; | 687 | justify-content: center; |
667 | align-items: center; | 688 | align-items: center; |
668 | - overflow: Hide; | 689 | + overflow: hidden; |
669 | 690 | ||
670 | div { | 691 | div { |
671 | font-size: 28px; | 692 | font-size: 28px; |
693 | + font-weight: bold; | ||
672 | line-height: 32px; | 694 | line-height: 32px; |
673 | max-height: 64px; | 695 | max-height: 64px; |
674 | white-space: normal; | 696 | white-space: normal; |
@@ -3,8 +3,9 @@ import { get } from 'lodash'; | @@ -3,8 +3,9 @@ import { get } from 'lodash'; | ||
3 | import Vue from 'vue'; | 3 | import Vue from 'vue'; |
4 | 4 | ||
5 | export default { | 5 | export default { |
6 | - ensureProduct({ commit }, { productId }) { | 6 | + ensureProduct({ commit, state }, { productId }) { |
7 | commit(Types.ENSURE_PRODUCT_DETAIL, { productId }); | 7 | commit(Types.ENSURE_PRODUCT_DETAIL, { productId }); |
8 | + return state.products[productId]; | ||
8 | }, | 9 | }, |
9 | async fetchProductInfo({ commit, state }, { productId }) { | 10 | async fetchProductInfo({ commit, state }, { productId }) { |
10 | const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => { | 11 | const queryTasks = ['', '/resource', '/activity', '/recommend'].map(path => { |
@@ -71,6 +72,18 @@ export default { | @@ -71,6 +72,18 @@ export default { | ||
71 | commit(Types.UPDATE_BRAND_PRODUCT_TOP_LIST, { productId, topList: productList}); | 72 | commit(Types.UPDATE_BRAND_PRODUCT_TOP_LIST, { productId, topList: productList}); |
72 | } | 73 | } |
73 | }, | 74 | }, |
75 | + async setupInitialProductInfo({ commit, state, dispatch }, payload) { | ||
76 | + const { id: productId } = payload; | ||
77 | + if (!productId) { | ||
78 | + return; | ||
79 | + } | ||
80 | + | ||
81 | + const productInfo = await dispatch('ensureProduct', {productId}); | ||
82 | + | ||
83 | + if (productInfo.product_name === null) { | ||
84 | + commit(Types.SETUP_INITIAL_PRODUCT_INFO, payload); | ||
85 | + } | ||
86 | + }, | ||
74 | async toggleFav({ commit }, { productId, isFav }) { | 87 | async toggleFav({ commit }, { productId, isFav }) { |
75 | const result = await this.$api.post(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, { productId }); | 88 | const result = await this.$api.post(`/api/ufo/product/favorite/${isFav ? 'add' : 'cancel'}`, { productId }); |
76 | 89 |
1 | import * as Types from './types'; | 1 | import * as Types from './types'; |
2 | -import { find } from 'lodash'; | 2 | +import { find, set } from 'lodash'; |
3 | 3 | ||
4 | import { defaultProduct, defaultSelectedSize } from './index'; | 4 | import { defaultProduct, defaultSelectedSize } from './index'; |
5 | 5 | ||
@@ -58,4 +58,21 @@ export default { | @@ -58,4 +58,21 @@ export default { | ||
58 | [Types.RESET_SELECTED_PRODUCT_SIZE](state) { | 58 | [Types.RESET_SELECTED_PRODUCT_SIZE](state) { |
59 | Object.assign(state.selectedProductInfo, defaultSelectedSize()); | 59 | Object.assign(state.selectedProductInfo, defaultSelectedSize()); |
60 | }, | 60 | }, |
61 | + [Types.SETUP_INITIAL_PRODUCT_INFO](state, payload) { | ||
62 | + const { id: productId } = payload; | ||
63 | + | ||
64 | + const productInfo = state.products[productId]; | ||
65 | + | ||
66 | + // 规格化数据 | ||
67 | + [['id', 'product_id'], ['price', 'least_price'], ['product_name'], ['default_images', 'goods_list[0].image_list[0].image_url']].forEach((keyMap) => { | ||
68 | + const val = payload[keyMap[0]]; | ||
69 | + | ||
70 | + if (val !== null) { | ||
71 | + set(productInfo, keyMap[1] || keyMap[0], val); | ||
72 | + if (keyMap[0] === 'default_images') { | ||
73 | + set(productInfo, 'goods_list[0].image_list[0].initial', true); // 区分初始化数据,方便使用缓存 | ||
74 | + } | ||
75 | + } | ||
76 | + }); | ||
77 | + } | ||
61 | }; | 78 | }; |
1 | export const UPDATE_PRODUCT_DETAIL = 'UPDATE_PRODUCT_DETAIL'; | 1 | export const UPDATE_PRODUCT_DETAIL = 'UPDATE_PRODUCT_DETAIL'; |
2 | +export const SETUP_INITIAL_PRODUCT_INFO = 'SETUP_INITIAL_PRODUCT_INFO'; | ||
2 | export const ENSURE_PRODUCT_DETAIL = 'ENSURE_PRODUCT_DETAIL'; | 3 | export const ENSURE_PRODUCT_DETAIL = 'ENSURE_PRODUCT_DETAIL'; |
3 | export const UPDATE_PRODUCT_FAV = 'UPDATE_PRODUCT_FAV'; | 4 | export const UPDATE_PRODUCT_FAV = 'UPDATE_PRODUCT_FAV'; |
4 | export const UPDATE_SELECTED_PRODUCT_SIZE = 'UPDATE_SELECTED_PRODUCT_SIZE'; | 5 | export const UPDATE_SELECTED_PRODUCT_SIZE = 'UPDATE_SELECTED_PRODUCT_SIZE'; |
@@ -60,7 +60,10 @@ const webpackConfig = merge(baseConfig, { | @@ -60,7 +60,10 @@ const webpackConfig = merge(baseConfig, { | ||
60 | parallel: true, | 60 | parallel: true, |
61 | sourceMap: true, | 61 | sourceMap: true, |
62 | terserOptions: { | 62 | terserOptions: { |
63 | - safari10: true | 63 | + safari10: true, |
64 | + compress: { | ||
65 | + drop_console: true, | ||
66 | + } | ||
64 | } | 67 | } |
65 | })] | 68 | })] |
66 | }, | 69 | }, |
-
Please register or login to post a comment