Authored by 陈轩

fix

@@ -25,23 +25,11 @@ module.exports = { @@ -25,23 +25,11 @@ module.exports = {
25 }, 25 },
26 data: function() { 26 data: function() {
27 return { 27 return {
28 - // mock data  
29 - params: {  
30 - color: [{  
31 - colorId: 11,  
32 - colorName: '红色',  
33 - colorCode: 'ee0000'  
34 - }],  
35 - gender: [{  
36 - genderName: 'BOYS',  
37 - genderId: '1,3'  
38 - }],  
39 - size: [{  
40 - sizeName: '100',  
41 - sizeId: 255  
42 - }] 28 + // 选择的值
  29 + params: {},
43 30
44 - } 31 + // 确定的值
  32 + selected: {}
45 }; 33 };
46 }, 34 },
47 watch: {}, 35 watch: {},
@@ -66,7 +54,6 @@ module.exports = { @@ -66,7 +54,6 @@ module.exports = {
66 }); 54 });
67 }, 55 },
68 entrySub: function(key) { 56 entrySub: function(key) {
69 - console.log(this.config[key]);  
70 bus.$emit('filter.sub.show', { 57 bus.$emit('filter.sub.show', {
71 val: key, 58 val: key,
72 ref: this._uid 59 ref: this._uid
1 -module.exports = {  
2 - A: [{  
3 - id: 5,  
4 - type: '0',  
5 - hotKeyword: 'AAAA 葛民辉',  
6 - isShowNew: 'N',  
7 - domain: 'aaaa',  
8 - alif: 'A',  
9 - isHot: 'N',  
10 - ico: 'http://img10.static.yhbimg.com/logo/2012/04/12/13/013c4f832d97df25ce9f79a294d5e05d6b.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
11 - name: 'AAAA',  
12 - keyword: '街头,嘻哈,创意,潮流,AAAA,TEE,扭蛋',  
13 - nameEn: 'AAAA',  
14 - nameCn: 'AAAA'  
15 - }, {  
16 -  
17 - id: 862,  
18 - type: '0',  
19 - hotKeyword: '',  
20 - isShowNew: 'N',  
21 - domain: 'aape',  
22 - alif: 'A',  
23 - isHot: 'N',  
24 - ico: 'http://img13.static.yhbimg.com/logo/2015/12/03/15/02a0c256f3a75784fbcaa7d37715fcfa00.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
25 - name: 'Aape',  
26 - keyword: '',  
27 - nameEn: 'Aape',  
28 - nameCn: 'Aape'  
29 - }, {  
30 - type: '0',  
31 - id: 1209,  
32 - alif: 'A',  
33 - ico: 'http://img13.static.yhbimg.com/logo/2016/01/04/10/02c340899abe71a7ee1cfeb7591b6b96c0.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
34 - name: 'AAVA Lifestyle',  
35 - keyword: '香薰,首饰,手表,围巾',  
36 - nameEn: 'AAVA Lifestyle',  
37 - nameCn: '爱瓦生活',  
38 - hotKeyword: '创意 品质 居家',  
39 - shelvestime: 1451877790,  
40 - isShowNew: 'N',  
41 - domain: 'aavalifestyle',  
42 - isHot: 'N'  
43 - }, {  
44 - id: 536,  
45 - type: '0',  
46 - hotKeyword: '',  
47 - isShowNew: 'N',  
48 - domain: 'ablejeans',  
49 - alif: 'A',  
50 - isHot: 'Y',  
51 - ico: 'http://img13.static.yhbimg.com/logo/2014/05/08/12/0241b56aa9407b25d60b8d6c03ad6396c6.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
52 - name: 'ABLE JEANS',  
53 - keyword: 'ABLE JEANS',  
54 - nameEn: 'ABLE JEANS',  
55 - nameCn: '欧帛牛仔'  
56 - }, {  
57 - id: 262,  
58 - type: '0',  
59 - hotKeyword: '',  
60 - isShowNew: 'N',  
61 - domain: 'absurdlogic',  
62 - alif: 'A',  
63 - isHot: 'Y',  
64 - ico: 'http://img12.static.yhbimg.com/logo/2015/11/02/16/026f093fae4c9e3c7788508be9d109fc39.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
65 - name: 'ABSURD LOGIC',  
66 - keyword: '',  
67 - nameEn: 'ABSURD LOGIC',  
68 - nameCn: '荒诞逻辑'  
69 - }],  
70 - B: [{  
71 - id: 373,  
72 - type: '0',  
73 - hotKeyword: '',  
74 - isShowNew: 'N',  
75 - domain: 'babyghost',  
76 - alif: 'B',  
77 - isHot: 'Y',  
78 - ico: 'http://img12.static.yhbimg.com/logo/2015/12/09/14/020b4cfa2aa3fb66642259f2be63780cc3.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
79 - name: 'BABYGHOST',  
80 - keyword: '',  
81 - nameEn: 'BABYGHOST',  
82 - nameCn: '北北高斯'  
83 - }, {  
84 - id: 1039,  
85 - type: '0',  
86 - hotKeyword: '',  
87 - isShowNew: 'N',  
88 - domain: 'backbone',  
89 - alif: 'B',  
90 - isHot: 'N',  
91 - ico: 'http://img11.static.yhbimg.com/logo/2015/12/03/16/01c06f7a1524a2a9052350a8c03c2475d7.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
92 - name: 'BACK BONE',  
93 - keyword: '',  
94 - nameEn: 'backbone',  
95 - nameCn: 'BACK BONE'  
96 - }, {  
97 - type: '0',  
98 - id: 980,  
99 - alif: 'B',  
100 - ico: 'http://img10.static.yhbimg.com/logo/2015/09/29/17/0173fd258619dc31c9a659b5be0507eeb1.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/80',  
101 - name: 'B+ by Beautyberry',  
102 - keyword: '原创,设计',  
103 - nameEn: 'B+ by Beautyberry',  
104 - nameCn: 'B+ by Beautyberry',  
105 - hotKeyword: '原创,设计',  
106 - shelvestime: 1448608361,  
107 - isShowNew: 'N',  
108 - domain: 'beautyberry',  
109 - isHot: 'N'  
110 - }]  
111 -};  
@@ -12,19 +12,40 @@ @@ -12,19 +12,40 @@
12 </div> 12 </div>
13 </template> 13 </template>
14 <script> 14 <script>
15 -/**  
16 - * 数据结构:  
17 - * {  
18 - * index: [brandObj, brandObj],  
19 - * index: [{}....]  
20 - * }  
21 - */  
22 -module.exports = {  
23 - props: ['data', 'val'],  
24 - methods: {  
25 - select: function(val) {  
26 - this.val = val; 15 + /**
  16 + * 数据结构:
  17 + * {
  18 + * index: [brandObj, brandObj],
  19 + * index: [{}....]
  20 + * }
  21 + */
  22 + const $ = require('yoho-jquery');
  23 +
  24 + module.exports = {
  25 + props: {
  26 + val: Number,
  27 + data: {
  28 + coerce: (data) => {
  29 + // 以brand.alif 分组
  30 + const res = {};
  31 +
  32 + $.each(data, brand => {
  33 + let groupName = brand.alif;
  34 +
  35 + if (!res.hasOwnProperty(groupName)) {
  36 + res[groupName] = [];
  37 + }
  38 + res[groupName].push(brand);
  39 +
  40 + });
  41 + }
  42 + }
  43 + },
  44 + methods: {
  45 + select: function(val) {
  46 + this.val = val;
  47 + }
27 } 48 }
28 - }  
29 -}; 49 + };
  50 +
30 </script> 51 </script>
1 <template> 1 <template>
2 <div> 2 <div>
3 - <filter-sub :data="brand" :value="3" type="brand"></filter-sub> 3 + <!--<filter-sub :data="brand" :value="3" type="brand"></filter-sub>-->
4 <Sort :config="sortConfig" :val="sort"> 4 <Sort :config="sortConfig" :val="sort">
5 </Sort> 5 </Sort>
6 <List :data="productList"></List> 6 <List :data="productList"></List>
@@ -44,9 +44,7 @@ @@ -44,9 +44,7 @@
44 productList: [], 44 productList: [],
45 45
46 // state 46 // state
47 - inSearching: false, // 请求中  
48 -  
49 - brand: require('product/filter/brand-group-mock') 47 + inSearching: false // 请求中
50 }; 48 };
51 }, 49 },
52 components: { 50 components: {
@@ -90,8 +88,8 @@ @@ -90,8 +88,8 @@
90 }); 88 });
91 }, 89 },
92 90
93 - openFilterSub: function() {  
94 - console.log('TODO: open filter sub'); 91 + openFilterSub: function(classify) {
  92 + console.log('TODO: open filter sub', classify);
95 }, 93 },
96 94
97 /** 95 /**
@@ -147,9 +145,7 @@ @@ -147,9 +145,7 @@
147 * 1. 打开view 145 * 1. 打开view
148 * 2. 监听 router.back ,重新设置 筛选值 146 * 2. 监听 router.back ,重新设置 筛选值
149 */ 147 */
150 - bus.$on('filter.sub.show', function({  
151 - val  
152 - }) { 148 + bus.$on('filter.sub.show', function({val}) {
153 self.openFilterSub(val); 149 self.openFilterSub(val);
154 }); 150 });
155 151
@@ -159,6 +155,4 @@ @@ -159,6 +155,4 @@
159 155
160 </script> 156 </script>
161 <style> 157 <style>
162 -  
163 -  
164 </style> 158 </style>