Authored by zhangwenxue

商品详情: 调整图片样式,保持原始比率

@@ -7,7 +7,9 @@ @@ -7,7 +7,9 @@
7 </div> 7 </div>
8 </div> 8 </div>
9 <div class="title"> 9 <div class="title">
10 - <img-size class="title-thumbnail" :src="imageUrl" :width="300" :height="300"/> 10 + <div class="title-thumbnail">
  11 + <square-img :src="imageUrl" :width="300" :height="300"/>
  12 + </div>
11 <div>{{productDetail.product_name}} {{goodsName}}</div> 13 <div>{{productDetail.product_name}} {{goodsName}}</div>
12 </div> 14 </div>
13 <div class="size-list"> 15 <div class="size-list">
@@ -29,9 +31,9 @@ import { Scroll } from 'cube-ui'; @@ -29,9 +31,9 @@ import { Scroll } from 'cube-ui';
29 import { get } from 'lodash'; 31 import { get } from 'lodash';
30 import { createNamespacedHelpers } from 'vuex'; 32 import { createNamespacedHelpers } from 'vuex';
31 33
32 -import ImgSize from '../../../components/img-size';  
33 import ActionSheet from './action-sheet'; 34 import ActionSheet from './action-sheet';
34 import stateShortCutsMixins from '../mixins'; 35 import stateShortCutsMixins from '../mixins';
  36 +import SquareImg from './square-img';
35 37
36 const { mapActions, mapGetters } = createNamespacedHelpers('product'); 38 const { mapActions, mapGetters } = createNamespacedHelpers('product');
37 39
@@ -39,7 +41,7 @@ export default { @@ -39,7 +41,7 @@ export default {
39 name: 'BuySheet', 41 name: 'BuySheet',
40 mixins: [stateShortCutsMixins], 42 mixins: [stateShortCutsMixins],
41 components: { 43 components: {
42 - ImgSize, 44 + SquareImg,
43 ActionSheet, 45 ActionSheet,
44 'cube-scroll': Scroll, 46 'cube-scroll': Scroll,
45 }, 47 },
@@ -4,7 +4,9 @@ @@ -4,7 +4,9 @@
4 <div class="select-size"> 4 <div class="select-size">
5 <div class="title" @click="hide">{{config.title}}<i class="cubeic-close"></i></div> 5 <div class="title" @click="hide">{{config.title}}<i class="cubeic-close"></i></div>
6 <div class="selected-info"> 6 <div class="selected-info">
7 - <img-size class="title-thumbnail" :src="imageList[0] && imageList[0].image_url" :width="70" :height="70"/> 7 + <div class="title-thumbnail">
  8 + <square-img :src="imageList[0] && imageList[0].image_url" :width="70" :height="70"/>
  9 + </div>
8 <div class="product"> 10 <div class="product">
9 <div>¥{{product.least_price||''}}</div> 11 <div>¥{{product.least_price||''}}</div>
10 <div> 12 <div>
@@ -18,8 +20,8 @@ @@ -18,8 +20,8 @@
18 @select="onSelectSize" 20 @select="onSelectSize"
19 @add="onAdd" /> 21 @add="onAdd" />
20 <transition name="slide-up"> 22 <transition name="slide-up">
21 - <div class="footer">  
22 - <cube-button @click="select" :class="{active: isTradable}">{{config.title}}</cube-button> 23 + <div class="footer" v-if="isTradable">
  24 + <cube-button @click="select" class="active">{{config.title}}</cube-button>
23 </div> 25 </div>
24 </transition> 26 </transition>
25 </div> 27 </div>
@@ -33,8 +35,8 @@ import { get } from 'lodash'; @@ -33,8 +35,8 @@ import { get } from 'lodash';
33 import { createNamespacedHelpers } from 'vuex'; 35 import { createNamespacedHelpers } from 'vuex';
34 36
35 import ActionSheet from './action-sheet'; 37 import ActionSheet from './action-sheet';
36 -import ImgSize from '../../../components/img-size';  
37 import SizeList from './size-list'; 38 import SizeList from './size-list';
  39 +import SquareImg from './square-img';
38 40
39 const { mapActions, mapState } = createNamespacedHelpers('product'); 41 const { mapActions, mapState } = createNamespacedHelpers('product');
40 42
@@ -64,8 +66,8 @@ export default { @@ -64,8 +66,8 @@ export default {
64 } 66 }
65 }, 67 },
66 components: { 68 components: {
  69 + SquareImg,
67 SizeList, 70 SizeList,
68 - ImgSize,  
69 'cube-button': Button, 71 'cube-button': Button,
70 'cube-scroll': Scroll, 72 'cube-scroll': Scroll,
71 'action-sheet': ActionSheet, 73 'action-sheet': ActionSheet,
@@ -13,8 +13,8 @@ @@ -13,8 +13,8 @@
13 <div class="slide"> 13 <div class="slide">
14 <cube-slide ref="slide" :data="imageList"> 14 <cube-slide ref="slide" :data="imageList">
15 <cube-slide-item v-for="(item, index) in imageList" :key="index"> 15 <cube-slide-item v-for="(item, index) in imageList" :key="index">
16 - <a click="javascript:void 0">  
17 - <img-size :src="item.image_url" :width="300" :height="300"/> 16 + <a click="javascript:void 0" class="square-img-container">
  17 + <square-img :src="item.image_url" :width="300" :height="300" />
18 </a> 18 </a>
19 </cube-slide-item> 19 </cube-slide-item>
20 <template slot="dots" slot-scope="props"> 20 <template slot="dots" slot-scope="props">
@@ -104,6 +104,7 @@ import SizeSelectSheet from './components/size-select-sheet'; @@ -104,6 +104,7 @@ import SizeSelectSheet from './components/size-select-sheet';
104 import SizeRequestSheet from './components/size-request-sheet'; 104 import SizeRequestSheet from './components/size-request-sheet';
105 import BuySheet from './components/buy-sheet'; 105 import BuySheet from './components/buy-sheet';
106 import TopList from './components/top-list'; 106 import TopList from './components/top-list';
  107 +import SquareImg from './components/square-img';
107 import stateShortCutsMixins from './mixins'; 108 import stateShortCutsMixins from './mixins';
108 109
109 const { mapActions } = createNamespacedHelpers('product'); 110 const { mapActions } = createNamespacedHelpers('product');
@@ -120,6 +121,7 @@ export default { @@ -120,6 +121,7 @@ export default {
120 ImgSize, 121 ImgSize,
121 ProductList, 122 ProductList,
122 TopList, 123 TopList,
  124 + SquareImg,
123 'cube-button': Button, 125 'cube-button': Button,
124 'cube-slide': Slide, 126 'cube-slide': Slide,
125 'cube-slide-item': Slide.Item, 127 'cube-slide-item': Slide.Item,
@@ -372,9 +374,13 @@ export default { @@ -372,9 +374,13 @@ export default {
372 } 374 }
373 375
374 .slide { 376 .slide {
  377 + .square-img-container {
  378 + display: block;
375 width: 520px; 379 width: 520px;
376 height: 520px; 380 height: 520px;
377 margin: 0 auto; 381 margin: 0 auto;
  382 + }
  383 +
378 .dot { 384 .dot {
379 width: 10px; 385 width: 10px;
380 height: 10px; 386 height: 10px;