Merge branch 'develop' into feature/home
Showing
24 changed files
with
283 additions
and
50 deletions
@@ -37,9 +37,21 @@ module.exports = { | @@ -37,9 +37,21 @@ module.exports = { | ||
37 | 37 | ||
38 | /* 获取商品列表 */ | 38 | /* 获取商品列表 */ |
39 | getBrandShopGoods: (req, res) => { | 39 | getBrandShopGoods: (req, res) => { |
40 | - let params = req.query; | ||
41 | - | ||
42 | - brandModel.getBrandShopGoodsData(params).then(result => { | 40 | + brandModel.getBrandShopGoodsData({ |
41 | + sort: req.body.sort, | ||
42 | + page: req.body.page, | ||
43 | + channel: req.body.filter.channel || 'men', | ||
44 | + gender: req.body.filter.gender || '1,2,3', | ||
45 | + brand: req.body.filter.brand, | ||
46 | + shopId: req.body.filter.shopId, | ||
47 | + order: req.body.filter.order || 's_t_desc', | ||
48 | + limit: req.body.filter.limit || '60', | ||
49 | + color: req.body.filter.color, | ||
50 | + price: req.body.filter.price, | ||
51 | + size: req.body.filter.size, | ||
52 | + pd: req.body.filter.pd, | ||
53 | + tagsFilter: req.body.filter.tagsFilter | ||
54 | + }).then(result => { | ||
43 | res.json(result); | 55 | res.json(result); |
44 | }); | 56 | }); |
45 | }, | 57 | }, |
@@ -99,5 +111,14 @@ module.exports = { | @@ -99,5 +111,14 @@ module.exports = { | ||
99 | .then(result => { | 111 | .then(result => { |
100 | res.json(result); | 112 | res.json(result); |
101 | }); | 113 | }); |
114 | + }, | ||
115 | + | ||
116 | + // 品类资源位 | ||
117 | + cateResource: (req, res) => { | ||
118 | + | ||
119 | + res.render('brand/cate-resource', { | ||
120 | + module: 'channel', | ||
121 | + page: 'cate-resource' | ||
122 | + }); | ||
102 | } | 123 | } |
103 | }; | 124 | }; |
@@ -4,7 +4,6 @@ | @@ -4,7 +4,6 @@ | ||
4 | * @date: 2016/05/09 | 4 | * @date: 2016/05/09 |
5 | */ | 5 | */ |
6 | 'use strict'; | 6 | 'use strict'; |
7 | -const brand = require('./brand'); | ||
8 | 7 | ||
9 | /** | 8 | /** |
10 | * 频道选择页 | 9 | * 频道选择页 |
@@ -18,4 +17,4 @@ const component = { | @@ -18,4 +17,4 @@ const component = { | ||
18 | } | 17 | } |
19 | }; | 18 | }; |
20 | 19 | ||
21 | -module.exports = Object.assign(component, brand); | 20 | +module.exports = component; |
@@ -65,7 +65,20 @@ module.exports = { | @@ -65,7 +65,20 @@ module.exports = { | ||
65 | */ | 65 | */ |
66 | getBrandShopGoodsOriginData(params) { | 66 | getBrandShopGoodsOriginData(params) { |
67 | return api.get('', { | 67 | return api.get('', { |
68 | - method: '' | 68 | + method: 'app.search.brand', |
69 | + yh_channel: params.channel ? yhChannel[params.channel].channel : '1', | ||
70 | + brand: params.brand, | ||
71 | + shop_id: params.shopId, | ||
72 | + order: params.order, | ||
73 | + limit: params.limit, | ||
74 | + page: params.page, | ||
75 | + gender: params.gender, | ||
76 | + color: params.color, | ||
77 | + price: params.price, | ||
78 | + size: params.size, | ||
79 | + p_d: params.pd, | ||
80 | + sort: params.sort, | ||
81 | + tags_filter: params.tagsFilter | ||
69 | }); | 82 | }); |
70 | }, | 83 | }, |
71 | 84 | ||
@@ -82,7 +95,7 @@ module.exports = { | @@ -82,7 +95,7 @@ module.exports = { | ||
82 | type: params.type | 95 | type: params.type |
83 | }; | 96 | }; |
84 | 97 | ||
85 | - if (isFav) { | 98 | + if (params.isFav) { |
86 | Object.assign(finalParams, { | 99 | Object.assign(finalParams, { |
87 | method: 'app.favorite.add' | 100 | method: 'app.favorite.add' |
88 | }); | 101 | }); |
@@ -114,5 +127,16 @@ module.exports = { | @@ -114,5 +127,16 @@ module.exports = { | ||
114 | method: 'app.sort.get' | 127 | method: 'app.sort.get' |
115 | }) | 128 | }) |
116 | ); | 129 | ); |
130 | + }, | ||
131 | + | ||
132 | + /** | ||
133 | + * 从接口获取品类资源位数据 | ||
134 | + * @returns {*} | ||
135 | + */ | ||
136 | + getCateResource(params) { | ||
137 | + return api.get('', Object.assign(params, { | ||
138 | + method: 'app.sort.get' | ||
139 | + }) | ||
140 | + ); | ||
117 | } | 141 | } |
118 | }; | 142 | }; |
@@ -230,9 +230,23 @@ const getCateListData = params => { | @@ -230,9 +230,23 @@ const getCateListData = params => { | ||
230 | }); | 230 | }); |
231 | }; | 231 | }; |
232 | 232 | ||
233 | +/** | ||
234 | + * 获取品类资源位数据 | ||
235 | + * @param params | ||
236 | + * @returns {*|Promise.<TResult>} | ||
237 | + */ | ||
238 | +const getCateResource = params => { | ||
239 | + let finalResult = {}; | ||
240 | + | ||
241 | + return brandApi.getCateResource(params).then(result => { | ||
242 | + return finalResult; | ||
243 | + }); | ||
244 | +}; | ||
245 | + | ||
233 | module.exports = { | 246 | module.exports = { |
234 | getBrandData, | 247 | getBrandData, |
235 | getBrandShopGoodsData, | 248 | getBrandShopGoodsData, |
236 | getBrandListData, | 249 | getBrandListData, |
237 | - getCateListData | 250 | + getCateListData, |
251 | + getCateResource | ||
238 | }; | 252 | }; |
@@ -17,15 +17,16 @@ router.get('/', channel.index); // 首页 | @@ -17,15 +17,16 @@ router.get('/', channel.index); // 首页 | ||
17 | router.get('/resources', channel.resources); // 资源位接口 | 17 | router.get('/resources', channel.resources); // 资源位接口 |
18 | router.get('/brand', brand.index); // 店铺首页 | 18 | router.get('/brand', brand.index); // 店铺首页 |
19 | router.get('/get-brand-intro', brand.getBrandIntro); // 店铺介绍 | 19 | router.get('/get-brand-intro', brand.getBrandIntro); // 店铺介绍 |
20 | -router.get('/get-brand-shop-goods', brand.getBrandShopGoods); // 店铺介绍 | 20 | +router.post('/get-brand-shop-goods', brand.getBrandShopGoods); // 店铺介绍 |
21 | router.get('/brand-list', brand.brandList); // 品牌列表页 | 21 | router.get('/brand-list', brand.brandList); // 品牌列表页 |
22 | router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据 | 22 | router.get('/get-brand-list', brand.getBrandList); // 获取品牌列表数据 |
23 | router.get('/brand-share', brand.brandShare); // 获取品牌列表数据 | 23 | router.get('/brand-share', brand.brandShare); // 获取品牌列表数据 |
24 | + | ||
25 | +router.get('/cate-resource', brand.cateResource); // 品类资源位页面 | ||
24 | router.get('/collect-shop', brand.collectShop); // 收藏品牌店铺 | 26 | router.get('/collect-shop', brand.collectShop); // 收藏品牌店铺 |
25 | router.get('/cate', brand.cate); // 全部分类 | 27 | router.get('/cate', brand.cate); // 全部分类 |
26 | router.get('/get-cate-list', brand.getCateList); // 全部分类数据列表 | 28 | router.get('/get-cate-list', brand.getCateList); // 全部分类数据列表 |
27 | 29 | ||
28 | - | ||
29 | router.get('/sidebar', channel.sidebar); // 资源位接口 | 30 | router.get('/sidebar', channel.sidebar); // 资源位接口 |
30 | 31 | ||
31 | module.exports = router; | 32 | module.exports = router; |
@@ -21,9 +21,20 @@ exports.index = (req, res) => { | @@ -21,9 +21,20 @@ exports.index = (req, res) => { | ||
21 | res.render('search', view); | 21 | res.render('search', view); |
22 | }; | 22 | }; |
23 | 23 | ||
24 | +/* 筛选的二级页面 */ | ||
25 | +exports.subFilter = (req, res) => { | ||
26 | + const view = { | ||
27 | + module: 'product', | ||
28 | + page: 'filter-sub' | ||
29 | + }; | ||
30 | + | ||
31 | + res.render('filter-sub', view); | ||
32 | +}; | ||
33 | + | ||
24 | /* 获取 筛选配置 */ | 34 | /* 获取 筛选配置 */ |
25 | exports.fetchFilters = (req, res, next) => { | 35 | exports.fetchFilters = (req, res, next) => { |
26 | const params = { | 36 | const params = { |
37 | + uid: 14741796, // mock data | ||
27 | page: req.body.page || 1, | 38 | page: req.body.page || 1, |
28 | order: req.body.order || 1, | 39 | order: req.body.order || 1, |
29 | yh_channel: req.body.yh_channel || 'all', | 40 | yh_channel: req.body.yh_channel || 'all', |
@@ -41,10 +52,15 @@ exports.fetchFilters = (req, res, next) => { | @@ -41,10 +52,15 @@ exports.fetchFilters = (req, res, next) => { | ||
41 | .then(result => { | 52 | .then(result => { |
42 | let filterConfig = {}; | 53 | let filterConfig = {}; |
43 | 54 | ||
44 | - prettyFilter(result.data.filter); | ||
45 | - filterConfig = camelCase(result.data.filter); | 55 | + if (result.code === 200) { |
56 | + prettyFilter(result.data.filter); | ||
57 | + filterConfig = camelCase(result.data.filter); | ||
58 | + } | ||
46 | 59 | ||
47 | - res.json(filterConfig); | 60 | + res.json({ |
61 | + code: result.code, | ||
62 | + data: filterConfig | ||
63 | + }); | ||
48 | }) | 64 | }) |
49 | .catch(next); | 65 | .catch(next); |
50 | }; | 66 | }; |
@@ -52,6 +68,7 @@ exports.fetchFilters = (req, res, next) => { | @@ -52,6 +68,7 @@ exports.fetchFilters = (req, res, next) => { | ||
52 | /* 查询 产品列表 */ | 68 | /* 查询 产品列表 */ |
53 | exports.fetchProducts = (req, res, next) => { | 69 | exports.fetchProducts = (req, res, next) => { |
54 | const params = { | 70 | const params = { |
71 | + uid: 14741796, // mock data | ||
55 | page: req.body.page || 1, | 72 | page: req.body.page || 1, |
56 | order: req.body.order || 1, | 73 | order: req.body.order || 1, |
57 | yh_channel: req.body.yh_channel || 'all', | 74 | yh_channel: req.body.yh_channel || 'all', |
@@ -67,9 +84,10 @@ exports.fetchProducts = (req, res, next) => { | @@ -67,9 +84,10 @@ exports.fetchProducts = (req, res, next) => { | ||
67 | code: 200 | 84 | code: 200 |
68 | }) | 85 | }) |
69 | .then(result => { | 86 | .then(result => { |
70 | - result.data.productList = processProductList(result.data.productList); | ||
71 | - result = camelCase(result); | ||
72 | - | 87 | + if (result.code === 200) { |
88 | + result.data.productList = processProductList(result.data.productList); | ||
89 | + result = camelCase(result); | ||
90 | + } | ||
73 | res.json(result); | 91 | res.json(result); |
74 | }) | 92 | }) |
75 | .catch(next); | 93 | .catch(next); |
@@ -16,6 +16,7 @@ const search = require(`${cRoot}/search`); | @@ -16,6 +16,7 @@ const search = require(`${cRoot}/search`); | ||
16 | 16 | ||
17 | router.get('/search', search.index); | 17 | router.get('/search', search.index); |
18 | router.post('/search', search.fetchProducts); | 18 | router.post('/search', search.fetchProducts); |
19 | +router.get('/filter', search.subFilter); | ||
19 | router.get('/filters.json', search.fetchFilters); | 20 | router.get('/filters.json', search.fetchFilters); |
20 | 21 | ||
21 | // 商品详情controller | 22 | // 商品详情controller |
apps/product/views/action/filter-sub.hbs
0 → 100644
@@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
14 | "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js", | 14 | "debug": "DEBUG=\"express:*\" nodemon -e js,hbs -i public/ app.js", |
15 | "lint-js": "eslint -c .eslintrc --cache --fix .", | 15 | "lint-js": "eslint -c .eslintrc --cache --fix .", |
16 | "lint-css": "stylelint --config .stylelintrc public/scss/**/*.css", | 16 | "lint-css": "stylelint --config .stylelintrc public/scss/**/*.css", |
17 | - "lint-vue": "stylelint --extract --config .stylelintrc public/vue/**/*.vue; eslint -c .eslintrc --cache --fix public/vue/**/*.vue", | 17 | + "lint-vue": "stylelint --extract --config .stylelintrc public/vue/**/*.vue || eslint -c .eslintrc --cache --fix public/vue/**/*.vue", |
18 | "precommit": "node lint.js" | 18 | "precommit": "node lint.js" |
19 | }, | 19 | }, |
20 | "license": "MIT", | 20 | "license": "MIT", |
public/js/channel/cate-resource.page.js
0 → 100644
1 | +const Vue = require('yoho-vue'); | ||
2 | +const lazyload = require('yoho-vue-lazyload'); | ||
3 | +const cateRes = require('channel/cate-resource-box.vue'); | ||
4 | + | ||
5 | +require('common/vue-filter'); | ||
6 | + | ||
7 | +Vue.use(lazyload); | ||
8 | + | ||
9 | +new Vue({ | ||
10 | + el: '#cate-resource', | ||
11 | + components: { | ||
12 | + 'cate-res': cateRes | ||
13 | + } | ||
14 | +}); |
public/js/product/filter-sub.page.js
0 → 100644
1 | +const Vue = require('yoho-vue'); | ||
2 | +const filterSub = require('product/filter/filter-sub.vue'); | ||
3 | + | ||
4 | +// TODO: 该mock数据 应该有 上级页面传过来 | ||
5 | +const page = { | ||
6 | + type: 'brand', // 二级筛选的 类型 | ||
7 | + data: [ // 二级筛选的 数据 | ||
8 | + { id: 1, name: '红色' }, | ||
9 | + { id: 2, name: '红色' }, | ||
10 | + { id: 3, name: '红色' } | ||
11 | + ], | ||
12 | + val: 3 // 二级筛选 的值 | ||
13 | +}; | ||
14 | + | ||
15 | +new Vue({ | ||
16 | + el: '#filter-sub', | ||
17 | + data: function() { | ||
18 | + return { | ||
19 | + type: page.type, | ||
20 | + data: page.data, | ||
21 | + val: page.val | ||
22 | + }; | ||
23 | + }, | ||
24 | + components: { | ||
25 | + filterSub | ||
26 | + } | ||
27 | +}); | ||
28 | + | ||
29 | + |
@@ -10,7 +10,6 @@ | @@ -10,7 +10,6 @@ | ||
10 | */ | 10 | */ |
11 | 11 | ||
12 | const tip = require('common/tip'); | 12 | const tip = require('common/tip'); |
13 | -const native = window.yohoInterface; | ||
14 | 13 | ||
15 | window.yohoWapInterface = { | 14 | window.yohoWapInterface = { |
16 | headerRightTopBtn: function() {} | 15 | headerRightTopBtn: function() {} |
@@ -35,7 +34,7 @@ const yoho = { | @@ -35,7 +34,7 @@ const yoho = { | ||
35 | */ | 34 | */ |
36 | goTap(args, success, fail) { | 35 | goTap(args, success, fail) { |
37 | if (this.isApp) { | 36 | if (this.isApp) { |
38 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 37 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
39 | method: 'go.tab', | 38 | method: 'go.tab', |
40 | arguments: args | 39 | arguments: args |
41 | }); | 40 | }); |
@@ -52,7 +51,7 @@ const yoho = { | @@ -52,7 +51,7 @@ const yoho = { | ||
52 | */ | 51 | */ |
53 | goLogin(args, success, fail) { | 52 | goLogin(args, success, fail) { |
54 | if (this.isApp) { | 53 | if (this.isApp) { |
55 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 54 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
56 | method: 'go.login', | 55 | method: 'go.login', |
57 | arguments: args | 56 | arguments: args |
58 | }); | 57 | }); |
@@ -69,7 +68,7 @@ const yoho = { | @@ -69,7 +68,7 @@ const yoho = { | ||
69 | */ | 68 | */ |
70 | goShopingCart(args, success, fail) { | 69 | goShopingCart(args, success, fail) { |
71 | if (this.isApp) { | 70 | if (this.isApp) { |
72 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 71 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
73 | method: 'go.shopingCart', | 72 | method: 'go.shopingCart', |
74 | arguments: args | 73 | arguments: args |
75 | }); | 74 | }); |
@@ -86,7 +85,7 @@ const yoho = { | @@ -86,7 +85,7 @@ const yoho = { | ||
86 | */ | 85 | */ |
87 | goAddress(args, success, fail) { | 86 | goAddress(args, success, fail) { |
88 | if (this.isApp) { | 87 | if (this.isApp) { |
89 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 88 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
90 | method: 'go.address', | 89 | method: 'go.address', |
91 | arguments: args | 90 | arguments: args |
92 | }); | 91 | }); |
@@ -103,7 +102,7 @@ const yoho = { | @@ -103,7 +102,7 @@ const yoho = { | ||
103 | */ | 102 | */ |
104 | goImageBrowser(args, success, fail) { | 103 | goImageBrowser(args, success, fail) { |
105 | if (this.isApp) { | 104 | if (this.isApp) { |
106 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 105 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
107 | method: 'go.imageBrowser', | 106 | method: 'go.imageBrowser', |
108 | arguments: args | 107 | arguments: args |
109 | }); | 108 | }); |
@@ -120,7 +119,7 @@ const yoho = { | @@ -120,7 +119,7 @@ const yoho = { | ||
120 | */ | 119 | */ |
121 | goNewPage(args, success, fail) { | 120 | goNewPage(args, success, fail) { |
122 | if (this.isApp) { | 121 | if (this.isApp) { |
123 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 122 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
124 | method: 'go.newPage', | 123 | method: 'go.newPage', |
125 | arguments: args | 124 | arguments: args |
126 | }); | 125 | }); |
@@ -137,7 +136,7 @@ const yoho = { | @@ -137,7 +136,7 @@ const yoho = { | ||
137 | */ | 136 | */ |
138 | goPay(args, success, fail) { | 137 | goPay(args, success, fail) { |
139 | if (this.isApp) { | 138 | if (this.isApp) { |
140 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 139 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
141 | method: 'go.pay', | 140 | method: 'go.pay', |
142 | arguments: args | 141 | arguments: args |
143 | }); | 142 | }); |
@@ -154,7 +153,7 @@ const yoho = { | @@ -154,7 +153,7 @@ const yoho = { | ||
154 | */ | 153 | */ |
155 | goBack(args, success, fail) { | 154 | goBack(args, success, fail) { |
156 | if (this.isApp) { | 155 | if (this.isApp) { |
157 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 156 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
158 | method: 'go.back', | 157 | method: 'go.back', |
159 | arguments: args | 158 | arguments: args |
160 | }); | 159 | }); |
@@ -171,7 +170,7 @@ const yoho = { | @@ -171,7 +170,7 @@ const yoho = { | ||
171 | */ | 170 | */ |
172 | goShare(args, success, fail) { | 171 | goShare(args, success, fail) { |
173 | if (this.isApp) { | 172 | if (this.isApp) { |
174 | - native.triggerEvent(success || function() {}, fail || function() {}, { | 173 | + window.yohoInterface.triggerEvent(success || function() {}, fail || function() {}, { |
175 | method: 'go.share', | 174 | method: 'go.share', |
176 | arguments: args | 175 | arguments: args |
177 | }); | 176 | }); |
@@ -31,8 +31,8 @@ | @@ -31,8 +31,8 @@ | ||
31 | filterConfig: global.filterConfig, | 31 | filterConfig: global.filterConfig, |
32 | 32 | ||
33 | // query | 33 | // query |
34 | - url: '/product/list', | ||
35 | - sort: 3, | 34 | + url: '/get-brand-shop-goods', |
35 | + sort: '', | ||
36 | filter: {}, | 36 | filter: {}, |
37 | page: 0, // page= 0 未搜索, 1 并且productList.length =0 没有数据, page = page_total 全部加载完 | 37 | page: 0, // page= 0 未搜索, 1 并且productList.length =0 没有数据, page = page_total 全部加载完 |
38 | totalPage: 3, | 38 | totalPage: 3, |
@@ -58,11 +58,10 @@ | @@ -58,11 +58,10 @@ | ||
58 | let data = {}; | 58 | let data = {}; |
59 | 59 | ||
60 | $.ajax({ | 60 | $.ajax({ |
61 | - method: 'post', | ||
62 | - url: '/product/list', | 61 | + url: this.url, |
63 | data: data | 62 | data: data |
64 | }).done(result => { | 63 | }).done(result => { |
65 | - this.$set('productList', this.productList.concat(result.data.productList)); | 64 | + this.productList = result.data.productList; |
66 | }).fail(() => { | 65 | }).fail(() => { |
67 | tip('网络错误'); | 66 | tip('网络错误'); |
68 | }); | 67 | }); |
@@ -83,8 +82,8 @@ | @@ -83,8 +82,8 @@ | ||
83 | sort: this.sort, | 82 | sort: this.sort, |
84 | filter: this.filter, | 83 | filter: this.filter, |
85 | page: this.page | 84 | page: this.page |
86 | - }).done(res => { | ||
87 | - self.$set('productList', self.productList.concat(res.data.productList)); | 85 | + }).done(result => { |
86 | + this.productList = result.data.productList; | ||
88 | }).fail(error => { | 87 | }).fail(error => { |
89 | self.page--; | 88 | self.page--; |
90 | console.log(error); | 89 | console.log(error); |
@@ -57,6 +57,8 @@ | @@ -57,6 +57,8 @@ | ||
57 | const shareBottom = require('channel/share-bottom.vue'); | 57 | const shareBottom = require('channel/share-bottom.vue'); |
58 | 58 | ||
59 | module.exports = { | 59 | module.exports = { |
60 | + | ||
61 | + /* TODO 数据需要从接口获取 */ | ||
60 | data() { | 62 | data() { |
61 | return { | 63 | return { |
62 | brandName: 'COLORMAD', | 64 | brandName: 'COLORMAD', |
public/vue/channel/cate-resource-box.vue
0 → 100644
1 | +<template> | ||
2 | + <tab v-bind:page="page"></tab> | ||
3 | + <resources v-bind:content-code.sync="contentCode"></resources> | ||
4 | + <cate-resources></cate-resources> | ||
5 | +</template> | ||
6 | +<script> | ||
7 | + const contentCode = require('content-code'); | ||
8 | + const qs = require('yoho-qs'); | ||
9 | + | ||
10 | + const tab = require('channel/tab.vue'); | ||
11 | + const resources = require('component/resources/index.vue'); | ||
12 | + const cateResources = require('channel/cate-resources.vue'); | ||
13 | + | ||
14 | + module.exports = { | ||
15 | + data() { | ||
16 | + return { | ||
17 | + page: 'brand', | ||
18 | + contentCode: contentCode.brand[qs.brand || 'men'], | ||
19 | + channel: qs.channel | ||
20 | + }; | ||
21 | + }, | ||
22 | + components: { | ||
23 | + tab, | ||
24 | + resources, | ||
25 | + cateResources | ||
26 | + } | ||
27 | + }; | ||
28 | +</script> |
public/vue/channel/cate-resources.vue
0 → 100644
1 | +<template> | ||
2 | + <div class='cate-resource'> | ||
3 | + <ul> | ||
4 | + <li class='width50' style=' | ||
5 | + background:url(http://img11.static.yhbimg.com/brandLogo/2015/08/04/18/01a6f1a7600ab044d1577dd6c357298fb3.png?imageMogr2/thumbnail/150x150/extent/150x150/background/d2hpdGU=/position/center/quality/80);background-size:100% 100%;background-repeat:no-repeat;'> | ||
6 | + <div>上衣</div> | ||
7 | + </li> | ||
8 | + | ||
9 | + <li class='width50' style=' | ||
10 | + background:url(http://img11.static.yhbimg.com/brandLogo/2015/08/04/18/01a6f1a7600ab044d1577dd6c357298fb3.png?imageMogr2/thumbnail/150x150/extent/150x150/background/d2hpdGU=/position/center/quality/80);background-size:100% 100%;background-repeat:no-repeat;'> | ||
11 | + <div>上衣</div> | ||
12 | + </li> | ||
13 | + | ||
14 | + <li class='width100' style=' | ||
15 | + background:url(http://img10.static.yhbimg.com/yhb-img01/2016/07/22/15/014c3887f1320bf024a8bbc01fef5d2a1a.png?imageView2/2/w/750/h/365);background-size:100% 100%;background-repeat:no-repeat;'> | ||
16 | + <div>全部分类</div> | ||
17 | + </li> | ||
18 | + </ul> | ||
19 | + </div> | ||
20 | +</template> | ||
21 | +<style> | ||
22 | +.cate-resource { | ||
23 | + width: 100%; | ||
24 | + | ||
25 | + ul, | ||
26 | + li { | ||
27 | + margin: 0; | ||
28 | + padding: 0; | ||
29 | + } | ||
30 | + | ||
31 | + li { | ||
32 | + float: left; | ||
33 | + text-align: center; | ||
34 | + color: #fff; | ||
35 | + font-size: 60px; | ||
36 | + cursor: pointer; | ||
37 | + | ||
38 | + img { | ||
39 | + width: 100%; | ||
40 | + } | ||
41 | + | ||
42 | + div { | ||
43 | + margin-top: 50px; | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + .width25, | ||
48 | + .width50, | ||
49 | + .width100 { | ||
50 | + width: 25%; | ||
51 | + height: 200px; | ||
52 | + overflow: hidden; | ||
53 | + | ||
54 | + img { | ||
55 | + height: 200px; | ||
56 | + } | ||
57 | + } | ||
58 | + | ||
59 | + .width50 { | ||
60 | + width: 50%; | ||
61 | + } | ||
62 | + | ||
63 | + .width100 { | ||
64 | + width: 100%; | ||
65 | + height: 360px; | ||
66 | + | ||
67 | + img { | ||
68 | + height: 360px; | ||
69 | + } | ||
70 | + | ||
71 | + div { | ||
72 | + margin-top: 120px; | ||
73 | + } | ||
74 | + } | ||
75 | +} | ||
76 | +</style> | ||
77 | +<script> | ||
78 | + | ||
79 | +</script> |
@@ -2,7 +2,6 @@ | @@ -2,7 +2,6 @@ | ||
2 | <div> | 2 | <div> |
3 | <brand-filter v-if="type === 'brand'" :data="data" :val.sync="val"></brand-filter> | 3 | <brand-filter v-if="type === 'brand'" :data="data" :val.sync="val"></brand-filter> |
4 | <normal-filter v-else :data="data" :val.sync="val"> | 4 | <normal-filter v-else :data="data" :val.sync="val"> |
5 | - <slot></slot> | ||
6 | </normal-filter> | 5 | </normal-filter> |
7 | </div> | 6 | </div> |
8 | </template> | 7 | </template> |
@@ -19,7 +18,7 @@ module.exports = { | @@ -19,7 +18,7 @@ module.exports = { | ||
19 | watch: { | 18 | watch: { |
20 | val: function(newV, oldV) { | 19 | val: function(newV, oldV) { |
21 | console.log(`type: ${this.type}, value: ${newV}`); | 20 | console.log(`type: ${this.type}, value: ${newV}`); |
22 | - } | 21 | + } |
23 | } | 22 | } |
24 | }; | 23 | }; |
25 | </script> | 24 | </script> |
1 | <template> | 1 | <template> |
2 | <div class="filter-detail"> | 2 | <div class="filter-detail"> |
3 | - <div class="item" v-for="item in data" :class="{active: item.id === value}" @click="toggleCheck(item.id)"> | 3 | + <div class="item" v-for="item in data" :class="{active: item.id === val}" @click="toggleCheck(item.id)"> |
4 | <div class="item-inner"> | 4 | <div class="item-inner"> |
5 | {{item.name}} | 5 | {{item.name}} |
6 | </div> | 6 | </div> |
@@ -10,12 +10,11 @@ | @@ -10,12 +10,11 @@ | ||
10 | </template> | 10 | </template> |
11 | <script> | 11 | <script> |
12 | module.exports = { | 12 | module.exports = { |
13 | - props: ['data', 'type', 'value'], | 13 | + props: ['data', 'type', 'val'], |
14 | computed: {}, | 14 | computed: {}, |
15 | methods: { | 15 | methods: { |
16 | toggleCheck: function(val) { | 16 | toggleCheck: function(val) { |
17 | - this.value = val; | ||
18 | - this.$parent.select(val); | 17 | + this.val = val; |
19 | } | 18 | } |
20 | } | 19 | } |
21 | }; | 20 | }; |
public/vue/product/index.vue
deleted
100644 → 0
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | <ul class="cardlist card-large clearfix"> | 3 | <ul class="cardlist card-large clearfix"> |
4 | <li class="card" v-for="item in data"> | 4 | <li class="card" v-for="item in data"> |
5 | <div class="card-pic"> | 5 | <div class="card-pic"> |
6 | - <a href=""> | 6 | + <a href="/product/{{item.id}}"> |
7 | <img v-lazy="item.goodsList[0].imagesUrl | resize 372 499" alt="{{item.productName}}"> | 7 | <img v-lazy="item.goodsList[0].imagesUrl | resize 372 499" alt="{{item.productName}}"> |
8 | </a> | 8 | </a> |
9 | </div> | 9 | </div> |
@@ -28,7 +28,7 @@ module.exports = { | @@ -28,7 +28,7 @@ module.exports = { | ||
28 | /* 开启滚动加载 */ | 28 | /* 开启滚动加载 */ |
29 | disableFetch: Boolean, | 29 | disableFetch: Boolean, |
30 | 30 | ||
31 | - //数据 | 31 | + // 数据 |
32 | data: Array | 32 | data: Array |
33 | }, | 33 | }, |
34 | methods: { | 34 | methods: { |
1 | <template> | 1 | <template> |
2 | <div> | 2 | <div> |
3 | - <!--<filter-sub :data="brand" :value="3" type="brand"></filter-sub>--> | ||
4 | <Sort :config="sortConfig" :val="sort"> | 3 | <Sort :config="sortConfig" :val="sort"> |
5 | </Sort> | 4 | </Sort> |
6 | <List :data="productList"></List> | 5 | <List :data="productList"></List> |
@@ -19,7 +18,6 @@ | @@ -19,7 +18,6 @@ | ||
19 | const list = require('product/list.vue'); | 18 | const list = require('product/list.vue'); |
20 | const drawer = require('product/drawer.vue'); | 19 | const drawer = require('product/drawer.vue'); |
21 | const filter = require('product/filter.vue'); | 20 | const filter = require('product/filter.vue'); |
22 | - const filterSub = require('product/filter/filter-detail.vue'); | ||
23 | 21 | ||
24 | Vue.use(lazyload); | 22 | Vue.use(lazyload); |
25 | Vue.use(infinitScroll); | 23 | Vue.use(infinitScroll); |
@@ -51,7 +49,6 @@ | @@ -51,7 +49,6 @@ | ||
51 | list, | 49 | list, |
52 | sort, | 50 | sort, |
53 | filter, | 51 | filter, |
54 | - filterSub, | ||
55 | drawer | 52 | drawer |
56 | }, | 53 | }, |
57 | methods: { | 54 | methods: { |
@@ -76,9 +73,11 @@ | @@ -76,9 +73,11 @@ | ||
76 | page: nextPage | 73 | page: nextPage |
77 | }) | 74 | }) |
78 | .done(res => { | 75 | .done(res => { |
79 | - self.page = res.data.page; | ||
80 | - self.totalPage = res.data.pageTotal; | ||
81 | - self.$set('productList', self.productList.concat(res.data.productList)); | 76 | + if (res.code === 200) { |
77 | + self.page = res.data.page; | ||
78 | + self.totalPage = res.data.pageTotal; | ||
79 | + self.$set('productList', self.productList.concat(res.data.productList)); | ||
80 | + } | ||
82 | }) | 81 | }) |
83 | .fail(error => { | 82 | .fail(error => { |
84 | tip('网络出错~'); | 83 | tip('网络出错~'); |
-
Please register or login to post a comment