Authored by biao

Merge branch 'develop' into feature/my-order

... ... @@ -5,205 +5,53 @@
*/
'use strict';
const brand = require('../models/brand');
const index = (req, res) => {
res.display('index', {
module: 'brand',
page: 'index',
title: '品牌',
brand: {
nav: [
{
link: '//guang.yohobuy.com/index/index?type=0',
pathTitle: '首页',
name: 'MEN首页'
},
{
link: '/',
pathTitle: '品牌',
name: 'Brand品牌'
}
],
tabs: [
{
url: '#',
name: '',
src: '#'
},
{
url: '#',
name: '',
src: '#'
},
{
url: '#',
name: '',
src: '#'
}
],
navigation: [
{
name: 'A'
},
{
name: 'B'
},
{
name: 'C'
},
{
name: 'D'
},
{
name: 'E'
},
{
name: 'F'
},
{
name: 'G'
}
],
category: [
{
key: 'A',
brandList: [
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
}
]
},
{
key: 'B',
brandList: [
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
}
]
},
{
key: 'C',
brandList: [
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
}
]
},
{
key: 'D',
brandList: [
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
},
{
key: 'A',
href: '#',
name: 'edhwke'
}
]
}
]
},
brand.getListData().then((result) => {
res.display('index', {
module: 'brand',
page: 'index',
title: '品牌',
brand: {
nav: [
{
link: '//guang.yohobuy.com/index/index?type=0',
pathTitle: '首页',
name: 'MEN首页'
},
{
link: '/',
pathTitle: '品牌',
name: 'Brand品牌'
}
],
tabs: [
{
url: '#',
name: '',
src: '//img10.static.yhbimg.com/yhb-img01/2016/07/06/17/01932e57d2dcd5c74afeaffd2525da5834.jpg'
},
{
url: '#',
name: '',
src: '//img10.static.yhbimg.com/yhb-img01/2016/07/06/17/01932e57d2dcd5c74afeaffd2525da5834.jpg'
},
{
url: '#',
name: '',
src: '//img10.static.yhbimg.com/yhb-img01/2016/07/06/17/01932e57d2dcd5c74afeaffd2525da5834.jpg'
}
],
category: result.category
},
helpers: {
// import component, path depends on your project
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
}
helpers: {
// import component, path depends on your project
pagination: require('../../../doraemon/components/pagination/pagination').createPagination
}
});
});
};
... ...
'use strict';
// const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const camelCase = global.yoho.camelCase;
const _ = require('lodash');
const logger = global.yoho.logger;
const _processListData = (list) => {
// let category = {
// key: '',
// brands: []
// };
let listData = [];
list = list || [];
list = camelCase(list);
_.forEach(list.data.allList, function(value, index) {
if (index === '0~9') {
index = '0-9';
}
listData.push(
{
key: index,
brands: value
}
);
});
return listData;
};
const _processTabData = (list) => {
list = list || [];
list = camelCase(list);
};
const _getResources = () => {
return api.get('', {
// method: 'web.brand.series'
}).then((result) => {
if (result && result.code === 200) {
return _processTabData(result.data);
} else {
// logger.error('品牌页Tab数据返回 code 不是 200');
// return {};
}
});
};
const _getBreakingSort = () => {
return api.get('', {
method: 'app.brand.newBrandList'
}).then((result) => {
if (result && result.code === 200) {
return _processListData(result);
} else {
logger.error('品牌页数据返回 code 不是 200');
return {};
}
});
};
const getListData = () => {
return Promise.all([_getResources(), _getBreakingSort()])
.then((result) => {
return {
tabs: result[0],
category: result[1]
};
});
};
module.exports = {
getListData: getListData
};
... ...
... ... @@ -9,7 +9,7 @@
<a href="{{url}}" target="_blank">
<div class="g-mask"></div>
<p class="tips">{{name}}</p>
<img class="lazy" data-original="{{src}}"/>
<img class="lazy" data-original="{{image src 370 304}}"/>
</a>
</li>
{{/each}}
... ... @@ -18,8 +18,8 @@
<div class="brands-category">
<div class="category-nav">
{{#each navigation}}
<a href="#{{name}}">{{name}}</a>
{{#each category}}
<a href="#{{key}}">{{key}}</a>
{{/each}}
</div>
</div>
... ...
... ... @@ -3,11 +3,11 @@
<dt>{{key}}</dt>
<dd>
<ul class="clearfix">
{{#each brandList}}
{{#each brands}}
<li>
<a data-key="{{key}}" href="{{href}}" target="_blank">
<img class="lazy" data-original="{{href}}">
<span>{{name}}</span>
<img class="lazy" data-original="{{image brandIco 270 190}}">
<span>{{brandName}}</span>
</a>
</li>
{{/each}}
... ...
... ... @@ -28,11 +28,6 @@ const index = (req, res, next) => {
link: '/editorial?type=1',
pathTitle: '资讯',
name: '资讯'
},
{
link: '/',
pathTitle: '资讯',
name: '资讯'
}
],
msgTypes: result.msgTypes,
... ...
... ... @@ -34,7 +34,7 @@ const _processListData = (list) => {
// let data = moment('2016年06月02日 15:56', 'YYYY年MM月DD日 HH:mm').format('YYYY/MM/DD HH:mm');
let artList = list.list.artList.map(data =>{
let artList = list.list.artList.map(data => {
data.publishTime = data.publishTime.replace(/年|月/g, '/');
data.publishTime = data.publishTime.replace(/日/g, '');
... ...
... ... @@ -90,10 +90,33 @@ const setDefaultAddress = (req, res) => {
});
};
/**
* 获取地址信息
* @function getAddressData
* @return { Object }
*/
const getAddressData = (req, res) => {
addressModel.getAddressData(req.params.areaId).then(result => {
if (result.code === 200) {
result.data = result.data.map((item) => {
return {
is_support: item.is_support_express,
text: item.caption,
value: item.id
};
});
res.json(result);
} else {
res.json(result);
}
});
};
module.exports = {
index,
addAddressData,
updateAddressData,
delAddressData,
setDefaultAddress
setDefaultAddress,
getAddressData
};
... ...
... ... @@ -119,10 +119,28 @@ const setDefaultAddress = (id, uid) => {
});
};
/**
* 获取地址信息
* @function getAddressData
* @return { Array } [返回带有areaId的地址数组]
* @param id
* @param caption
* @param is_support_express
*/
const getAddressData = (areaId) => {
return api.get('', {
method: 'app.address.provinces',
id: areaId || 0
}).then(result => {
return result;
});
};
module.exports = {
getAddressDataAsync: getAddressDataAsync,
addAddressData: addAddressData,
updateAddressData: updateAddressData,
delAddressData: delAddressData,
setDefaultAddress: setDefaultAddress
setDefaultAddress: setDefaultAddress,
getAddressData
};
... ...
... ... @@ -28,5 +28,6 @@ router.post('/address/add', address.addAddressData);
router.post('/address/update', address.updateAddressData);
router.post('/address/del', address.delAddressData);
router.post('/address/default', address.setDefaultAddress);
router.get('/address/areas/:areaId', address.getAddressData);
module.exports = router;
... ...
... ... @@ -16,5 +16,5 @@ module.exports = app => {
app.use('/me', require('./apps/me')); // 个人中心
app.use('/editorial', require('./apps/editorial')); // 资讯
app.use('/product', require('./apps/product'));
app.use('/brand', require('./apps/brand')); // 资讯
app.use('/brand', require('./apps/brand')); // 品牌
};
... ...
No preview for this file type
... ... @@ -2,11 +2,7 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
<<<<<<< HEAD
Created by FontForge 20120731 at Thu Jul 7 17:43:49 2016
=======
Created by FontForge 20120731 at Fri Jul 8 14:37:44 2016
>>>>>>> feature/product
Created by FontForge 20120731 at Wed Jul 13 11:11:58 2016
By admin
</metadata>
<defs>
... ... @@ -23,11 +19,7 @@ Created by FontForge 20120731 at Fri Jul 8 14:37:44 2016
bbox="0 -224 1303 896.303"
underline-thickness="50"
underline-position="-100"
<<<<<<< HEAD
unicode-range="U+0078-E638"
=======
unicode-range="U+0078-E63B"
>>>>>>> feature/product
unicode-range="U+0078-E642"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -138,11 +130,8 @@ d="M361 194q45 -63 81 -152h143q42 68 75 152l82 -29q-32 -69 -70 -123h202v-71h-724
<glyph glyph-name="uniE624" unicode="&#xe624;"
d="M897 -212h-770q-44 0 -71 34.5t-21 82.5l89 598q3 31 30 52.5t61 21.5h51q4 111 73 173t171.5 62t171 -62t73.5 -173h54q34 0 61 -21.5t30 -52.5l89 -598q6 -48 -21 -82.5t-71 -34.5zM230 406q0 -25 18 -43t43 -18t42.5 18t17.5 43t-17.5 42.5t-42.5 17.5t-43 -17.5
t-18 -42.5zM510 767q-87 0 -144.5 -49t-61.5 -141h412q-4 92 -61.5 141t-144.5 49zM736 466q-25 0 -42.5 -17.5t-17.5 -42.5t17.5 -43t42.5 -18t43 18t18 43t-18 42.5t-43 17.5z" />
<<<<<<< HEAD
=======
<glyph glyph-name="uniE625" unicode="&#xe625;"
d="M43 0h938l-469 811zM555 128h-86v85h86v-85zM555 299h-86v170h86v-170z" />
>>>>>>> feature/product
<glyph glyph-name="uniE626" unicode="&#xe626;"
d="M139 233q-24 -59 -27.5 -108t15.5 -60q13 -7 32.5 7.5t38.5 45.5q16 -66 72 -116q-29 -11 -45.5 -28.5t-16.5 -37.5q0 -34 43.5 -57.5t105.5 -23.5q56 0 97.5 19.5t50.5 48.5h18q8 -29 50 -48.5t98 -19.5q62 0 105.5 23.5t43.5 57.5q0 20 -16.5 37.5t-45.5 28.5
q56 50 71 116q20 -31 39 -45.5t32 -7.5q19 11 16 60t-27 108q-19 46 -42 78t-43 40q1 7 1 12q0 35 -17 64v4q0 16 -7 30q-5 125 -77.5 207t-190 82t-189.5 -82t-77 -207q-7 -14 -7 -30v-4q-17 -29 -17 -64q0 -5 1 -12q-20 -8 -43.5 -40t-41.5 -78z" />
... ... @@ -178,16 +167,16 @@ q18 2 30 7q5 0 16.5 1.5t31 -3.5t39 -12.5t40.5 -25t35 -41.5q25 -57 10 -109q-6 -17
<glyph glyph-name="uniE62F" unicode="&#xe62f;"
d="M756 -133h-488q-21 0 -36.5 13t-15.5 32v780q0 19 15.5 32t36.5 13h488q21 0 36.5 -13t15.5 -32v-780q0 -19 -15.5 -32t-36.5 -13zM512 -88q14 0 24.5 9t10.5 21t-10.5 21t-24.5 9t-24.5 -9t-10.5 -21t10.5 -21t24.5 -9zM756 647h-488v-630h488v630z" />
<glyph glyph-name="uniE630" unicode="&#xe630;"
d="M513 857q98 0 184.5 -37t151 -102t102 -151.5t37.5 -185.5t-37.5 -185t-102 -151t-151 -102t-184.5 -37q-100 0 -186.5 37t-151 102t-102 151t-37.5 185t37.5 185.5t102 151.5t151 102t186.5 37zM784 316q28 0 47.5 20t19.5 48t-19.5 47t-47.5 19h-202v203q0 28 -20 48
t-48 20t-47.5 -20t-19.5 -48v-203h-203q-28 0 -47.5 -19t-19.5 -47t19.5 -48t47.5 -20h203v-202q0 -28 19.5 -48t47.5 -20t48 20t20 48v202h202z" />
d="M512 812q-139 0 -257 -68.5t-186.5 -186.5t-68.5 -257t68.5 -257t186.5 -186.5t257 -68.5t257 68.5t186.5 186.5t68.5 257t-68.5 257t-186.5 186.5t-257 68.5zM768 215h-512v170h512v-170z" />
<glyph glyph-name="uniE631" unicode="&#xe631;"
d="M831 612q-2 12 -11 20t-21 8h-160v32q0 66 -47 113t-113 47t-112.5 -47t-46.5 -113v-32h-160q-12 0 -21.5 -8t-10.5 -20l-64 -576q-1 -15 8.5 -25.5t23.5 -10.5h767q14 0 23.5 10.5t7.5 25.5zM351.5 448q-13.5 0 -23 9.5t-9.5 22.5t9.5 22.5t23 9.5t22.5 -9.5t9 -22.5
t-9 -22.5t-22.5 -9.5zM575 640h-192v32q0 40 28.5 68t68 28t67.5 -28t28 -68v-32zM607.5 448q-13.5 0 -23 9.5t-9.5 22.5t9.5 22.5t23 9.5t22.5 -9.5t9 -22.5t-9 -22.5t-22.5 -9.5z" />
<glyph glyph-name="uniE632" unicode="&#xe632;"
d="M684 670q-23 96 -68.5 153t-103.5 57t-103.5 -57t-68.5 -153h-178l-69 -798h838l-69 798h-178zM406 670q18 67 47 107t59 40t59 -40t47 -107h-212z" />
<glyph glyph-name="uniE633" unicode="&#xe633;"
d="M512 764q-94 0 -180 -36.5t-148.5 -99t-99 -148.5t-36.5 -180t36.5 -180t99 -148.5t148.5 -99t180 -36.5t180 36.5t148.5 99t99 148.5t36.5 180t-36.5 180t-99 148.5t-148.5 99t-180 36.5zM724 244h-424q-23 0 -39.5 16.5t-16.5 39.5t16.5 39.5t39.5 16.5h424
q23 0 39 -16.5t16 -39.5t-16 -39.5t-39 -16.5z" />
d="M512 832q-122 0 -225 -60t-163 -163t-60 -225t60 -225t163 -163t225 -60t225 60t163 163t60 225t-60 225t-163 163t-225 60zM512 24q-149 0 -254.5 105.5t-105.5 254.5t105.5 254.5t254.5 105.5t254.5 -105.5t105.5 -254.5t-105.5 -254.5t-254.5 -105.5zM635 409
q-25 17 -53 27t-53 20.5t-41 25.5q-16 14 -16 39q0 17 10 31t32 14q19 0 28.5 -16t9.5 -38v-11h126q0 75 -32.5 111.5t-105.5 43.5v42h-66v-42q-133 -22 -133 -157q0 -44 15.5 -71.5t39 -44.5t51.5 -28q27 -10 51 -21q24 -10 39.5 -24.5t15.5 -39.5q0 -20 -11 -33
q-12 -14 -33 -14q-20 0 -32.5 12t-12.5 45v14h-130v-20q0 -69 35.5 -100t104.5 -39v-65h67v65q74 8 113 44q38 35 38 109q0 47 -16 75q-17 29 -41 46z" />
<glyph glyph-name="uniE634" unicode="&#xe634;"
d="M500 775l-348 -298q-16 -14 -16 -35v-386q0 -25 17.5 -42.5t42.5 -17.5h197v257h238v-257h197q25 0 42.5 17.5t17.5 42.5v386q0 21 -16 35l-348 298q-12 10 -24 0z" />
<glyph glyph-name="uniE635" unicode="&#xe635;"
... ... @@ -199,12 +188,47 @@ d="M512 -212q-104 0 -199 40.5t-163.5 109t-109 163.5t-40.5 199t40.5 199t109 163.5
t271.5 -112.5t271.5 112.5t112.5 271.5t-112.5 271.5t-271.5 112.5z" />
<glyph glyph-name="uniE638" unicode="&#xe638;"
d="M511 833q-91 0 -174 -35.5t-143 -95.5t-95.5 -143t-35.5 -174t35.5 -174t95.5 -143t143 -95t174 -35t174 35t143 95t95.5 143t35.5 174t-35.5 174t-95.5 143t-143 95.5t-174 35.5z" />
<<<<<<< HEAD
=======
<glyph glyph-name="uniE639" unicode="&#xe639;"
d="M512 -212q-139 0 -257 68.5t-186.5 186.5t-68.5 257t68.5 257t186.5 186.5t257 68.5t257 -68.5t186.5 -186.5t68.5 -257t-68.5 -257t-186.5 -186.5t-257 -68.5zM585 373v293h-146v-293h-293v-146h293v-293h146v293h293v146h-293z" />
<glyph glyph-name="uniE63A" unicode="&#xe63a;"
d="M963 564l-117 -190h92v-43h-107v-58h107v-42h-107v-85h-55v85h-112v42h112v58h-112v43h95l-115 190h62q81 -142 98 -180h1q6 16 33 63l66 117h59z" />
<glyph glyph-name="uniE63B" unicode="&#xe63b;"
d="M0 -128h1024v1024zM826 301l-250 -282l-122 122q-9 9 -9 22t9.5 22.5t22.5 9.5t22 -9l77 -77l198 230q10 10 23 10t22 -10q10 -5 13 -16.5t-6 -21.5z" />
>>>>>>> feature/product
<glyph glyph-name="uniE63C" unicode="&#xe63c;"
d="M956 596q-50 -51 -622 -616q-5 -6 -13 -8.5t-26.5 -8t-43 -13.5t-51.5 -16.5t-53.5 -17t-47 -15.5t-34.5 -11l-14 -4q-4 -2 -9 -2q-13 0 -23 9q-13 14 -8 32q71 232 83 275q2 8 8 14q601 602 619 620q53 53 121 53q60 0 112 -50q58 -56 59 -118q1 -63 -57 -123zM86 -39
q32 10 105.5 35t93.5 31q-14 45 -47 79q-42 42 -90 54q-7 -24 -30.5 -97t-31.5 -102zM282 151q35 -34 54 -80q389 385 518 513q-10 53 -51 94q-43 44 -92 56q-185 -186 -520 -521q50 -20 91 -62zM910 791q-33 32 -68 32q-42 0 -77 -35q0 -1 -1 -2l-3 -3q48 -20 87 -59
q37 -38 57 -89l6 6q39 41 39 77q-1 35 -40 73z" />
<glyph glyph-name="uniE63D" unicode="&#xe63d;"
d="M799 456l127 127v313h-830v-609l421 -413l409 404v181l-414 -401l-288 284v426h575v-312zM671 518l-107 22l-53 100l-52 -100l-108 -22l75 -83l-14 -114l99 49l99 -49l-14 114z" />
<glyph glyph-name="uniE63E" unicode="&#xe63e;"
d="M898 225q-224 69 -271 86q46 79 69 173h-170v58h209v36h-209v96h-80q-7 0 -11 -3.5t-5 -6.5l-1 -3v-83h-196v-36h196v-58h-160v-32h325q-18 -61 -47 -114q-8 3 -29 10l-28 10q-8 2 -25 7t-27.5 7.5t-27 6t-32.5 5.5t-35 4q-49 4 -87.5 -3t-61 -21t-38 -34.5t-21.5 -38.5
t-8 -38q-7 -66 45.5 -112t137.5 -46q83 0 145 35.5t121 106.5q94 -45 320 -143zM298 150q-43 0 -73.5 12t-43 30.5t-17 35.5t-1.5 31q5 28 34 51t75 23q107 0 232 -61q-94 -122 -206 -122z" />
<glyph glyph-name="uniE63F" unicode="&#xe63f;"
d="M647 284q29 54 52 113t31 91l8 32h-12h-104h-109v85h267v37h-267v127h-121v-127h-242v-37h242v-85h-206v-36h418q0 -6 -6 -12q0 -43 -54 -152q-45 18 -86.5 31t-74 21t-63 12t-52.5 5t-43.5 -1t-34.5 -4t-27 -7t-20 -7.5t-14.5 -7.5t-9.5 -5q-42 -30 -65 -64t-26.5 -65
t3 -61t22 -54t32 -42t31.5 -27.5t21 -8.5q272 -60 455 158q6 -6 18 -6q30 -16 127 -63t179 -86l82 -39v182q-7 0 -19.5 2t-30 6.5t-34 8.5t-41.5 12t-42.5 13.5t-47.5 15t-45.5 15t-47.5 16.5zM489 229q-43 -54 -93.5 -87t-91 -43t-82 -8.5t-61.5 6.5t-36 11
q-26 7 -43.5 32.5t-21 55.5t11.5 60.5t47 45.5q54 17 108.5 19t105 -10.5t87.5 -27t81 -35.5zM489 229z" />
<glyph glyph-name="uniE640" unicode="&#xe640;"
d="M-57 853zM743 324q-16 4 -21 10.5t-2 11.5l3 6q2 1 3 3.5t4 9.5t5 14t3 17.5t-0.5 20t-6.5 20.5t-14 20q-16 15 -40.5 19.5t-49.5 0.5t-47 -10t-36 -11l-15 -7q-11 -3 -18 -4t-11 0.5t-6 3t-1.5 7.5t1 10.5t2.5 14t3 15.5q0 13 -1.5 24.5t-7 26t-16 23t-26.5 14
t-41.5 3.5t-57.5 -13q-38 -13 -78 -39t-69 -54.5t-53.5 -54.5t-37.5 -43l-12 -18q-36 -47 -54 -94.5t-17 -71.5v-23q7 -53 33 -95t62 -68t84.5 -44.5t93 -26.5t94.5 -11q81 -7 169 12.5t163.5 66.5t106.5 114q19 38 19.5 72.5t-12 56t-31.5 38t-36 24t-31 9.5zM407 -19
q-119 -5 -202.5 46.5t-83.5 131.5q0 78 83 135t203 62.5t203 -40t83 -123.5q0 -79 -84.5 -142.5t-201.5 -69.5zM375 287q-32 -3 -57.5 -15t-40 -26.5t-24.5 -32t-13.5 -34t-4.5 -30t-1 -21.5l1 -9v-4q0 -3 2 -13t6 -18.5t12.5 -18.5t21.5 -16q72 -36 135 -22t102 64
q15 18 20 46t-2 56t-24.5 51t-52.5 35.5t-80 7.5zM335 78q-7 -1 -13 -0.5t-11 2.5t-9.5 4t-8 6t-6.5 7.5t-4.5 9t-1.5 10.5q0 12 6.5 23.5t18 20t26.5 9.5q10 1 19.5 -0.5t16 -5.5t11.5 -9t7 -11.5t2 -14.5q0 -12 -7 -23t-19.5 -18.5t-26.5 -9.5zM429 158q-8 -6 -16 -5.5
t-12 7.5l-2 4q-1 3 -1 5v4q0 4 1 6l2 4q1 2 4 3l3 5q9 7 17 5.5t12 -8.5q3 -5 2.5 -10.5t-3.5 -10.5t-7 -9zM821 388q6 0 11.5 3.5t9 8.5t4.5 10q1 2 1 4q13 126 -88 143q-30 6 -55 1q-8 0 -13.5 -3.5t-9.5 -10t-4 -12.5q0 -11 8 -19t19 -8q86 20 92 -55q2 -19 -2 -35
q0 -11 8 -19t19 -8zM802 700q-49 11 -130 -5q-1 0 -3 -1l-1 -2l-1 -1q-12 -4 -19.5 -14.5t-7.5 -22.5q0 -16 11 -27t26 -11h3q2 0 5.5 1t8 1.5t9.5 2t9 3.5t15 2t27 -2t35 -8.5t38.5 -16.5t39 -27.5t33.5 -40.5q29 -65 11 -126q0 -1 -0.5 -2t-1.5 -5.5t-2 -8.5l-3 -10
q-1 -6 -1 -10q0 -10 5.5 -17t14 -9.5t19.5 -2.5q31 0 36 37q14 43 15.5 82.5t-5.5 69t-21.5 55.5t-33.5 44.5t-42 33t-44.5 23.5t-44.5 15z" />
<glyph glyph-name="uniE641" unicode="&#xe641;"
d="M971 143l-2 18l-3 17l-3 9l-2 9l-3 9l-4 10l-3 10l-4 9l-8 16l-6 14l-7 13l-5 11l-7 11l-5 9l-10 15l-12 19l-3 5l-1 2v1l2 7l3 6l2 11l2 6v6v5v5v6l-1 4l-2 10l-2 9l-3 8l-3 8l-4 7l-3 7l-3 6l-6 9l-2 3v2l-3 18l-1 11l-2 14l-3 15l-4 17l-3 9l-2 8l-3 9l-3 10l-3 9
l-4 10l-8 19l-5 9l-6 10l-5 9l-6 10l-7 10l-7 8l-8 10l-8 8l-8 8l-9 9l-5 3l-5 4l-11 7l-12 8l-12 7l-13 7l-13 6l-13 6l-14 4l-15 4l-13 4l-15 3l-13 4l-15 1l-14 2l-15 2h-15h-14h-14l-14 -1l-14 -2l-14 -2l-13 -2l-14 -3l-13 -3l-13 -4l-12 -4l-12 -4l-12 -6l-12 -5
l-10 -6l-10 -6l-10 -7l-10 -8l-8 -7l-12 -12l-10 -10l-10 -11l-9 -11l-9 -11l-7 -10l-7 -11l-4 -5l-3 -6l-7 -10l-5 -10l-5 -10l-4 -10l-4 -9l-3 -9l-3 -9l-4 -8l-4 -16l-3 -15l-1 -12l-2 -11v-8v-7v-6l-3 -3l-3 -4l-2 -4l-2 -4l-2 -9l-3 -9v-7l-1 -6v-6l-6 -8l-4 -9l-3 -8
l-2 -7l-2 -7l-2 -6v-6v-6v-5l1 -4l2 -7l1 -6l-3 -3l-9 -6l-12 -11l-7 -7l-7 -6l-5 -5l-4 -5l-9 -9l-8 -10l-7 -8l-8 -11l-7 -11l-7 -12l-7 -11l-5 -11l-5 -11l-4 -10l-4 -11l-3 -11l-3 -11l-3 -10l-2 -10l-1 -9l-2 -10l-1 -18v-17v-7l1 -7l2 -13l1 -6l2 -5l2 -6l1 -3l3 -7
l2 -2l2 -3h1h1h1h7l7 2l7 3l6 4l6 4l5 5l6 5l5 6l5 6l4 6l4 4l2 6l5 8l2 4l1 2v3l1 2h1l2 1h1v-1h1h1l3 -12l2 -10l4 -10l4 -9l4 -9l5 -8l4 -9l4 -7l5 -7l3 -6l10 -12l9 -11l8 -8l8 -7l7 -6l11 -10l4 -2l2 -2v-1l-1 -1h-1h-2l-8 -1l-7 -1l-6 -1l-7 -1l-5 -2l-6 -2l-5 -2
l-4 -3l-5 -1l-3 -3l-3 -2l-4 -3l-4 -5l-2 -3l-2 -2l-3 -6l-2 -5l-1 -5l-1 -4v-6v-3l-1 -4v-4l-1 -4v-3l1 -4l1 -4l2 -7l2 -3l2 -3l2 -3l3 -3l3 -3l2 -3l7 -5l8 -4l8 -5l9 -3l9 -4l11 -2l10 -4l11 -2l12 -2l11 -2l12 -1l24 -3h24h23h10h10h11l9 1l9 1l8 1l13 2l9 3l9 2l17 7
l8 3l7 3l12 7l10 6l8 5l6 5l9 -1l7 -1l14 -1h6h6l4 -1l4 -1l7 -3l8 -2l14 -5l15 -5l14 -4l14 -3l15 -4l15 -2l15 -2l14 -2l14 -1l15 -1h13h14h13l13 1l13 1l12 2l11 3l11 2l11 3l5 1l5 2l9 3l8 4l8 4l8 4l6 5l3 3l3 4l4 4l4 6l1 3l1 3l2 3l1 3v4l1 3l-1 5l-1 4l-2 5l-1 4
l-3 5l-3 5l-3 3l-4 4l-9 7l-10 8l-10 5l-10 6l-23 12l-6 3l-2 2l-1 1l12 11l5 6l4 5l8 12l7 11l6 11l6 10l8 20l7 16l4 12l2 4l2 3l2 2h1h1l6 -12l5 -12l4 -7l4 -5l4 -7l5 -7l4 -5l3 -2l2 -3l2 -1l3 -2l4 -2l3 -1h2h2l2 1l4 1l3 2l3 2l3 3l3 4l2 3l3 5l2 3l2 6l2 4l3 11
l2 12l2 14l1 8v6v7v9z" />
<glyph glyph-name="uniE642" unicode="&#xe642;" horiz-adv-x="1220"
d="M1068 -101l33 -111l-119 67q-86 -22 -129 -22q-101 0 -185.5 43t-133 117.5t-48.5 162t48.5 162t133 117.5t185.5 43q96 0 180.5 -43t135 -118t50.5 -162q0 -71 -40.5 -136.5t-110.5 -119.5zM734 300q-16 0 -29.5 -14t-13.5 -30.5t13.5 -30.5t29.5 -14q23 0 38.5 13.5
t15.5 31t-15.5 31t-38.5 13.5zM971 300q-16 0 -29.5 -14t-13.5 -30.5t13.5 -30.5t29.5 -14q24 0 39 13.5t15 31t-15 31t-39 13.5zM459 150q0 -46 13 -93q-22 -2 -40 -2q-16 0 -30.5 1t-32 4t-27 4.5t-32 6.5t-30.5 6l-150 -78l43 134q-173 125 -173 301q0 104 58 191
t157.5 137t216.5 50q159 0 283 -89t152 -223q-23 2 -42 2q-100 0 -184.5 -47t-133 -128t-48.5 -177zM291 623q-25 0 -45 -16t-20 -40t20 -39.5t45 -15.5t39.5 15t14.5 40t-14.5 40.5t-39.5 15.5zM593 623q-25 0 -44.5 -16t-19.5 -40t19.5 -39.5t44.5 -15.5t39.5 15t14.5 40
t-14.5 40.5t-39.5 15.5z" />
</font>
</defs></svg>
... ...
No preview for this file type
No preview for this file type
... ... @@ -16,7 +16,7 @@ var $list = $('.brands-list'),
require('../common/header');
require('../common/return-top');
lazyLoad($('.brands-list img.lazy'));
lazyLoad($('.brand-page img.lazy'));
// 品牌类别滚动事件
$(window).scroll(function() {
... ...
... ... @@ -10,7 +10,7 @@ var $ = require('yoho-jquery'),
require('../common/header');
require('../common/return-top');
lazyLoad($('#msg-list img.lazy'));
lazyLoad($('.content-msg img.lazy'));
$('.editorial-index-page').on('click', '.like-icon', function() {
var $this = $(this),
... ...
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload'),
common = require('../common'),
dialog = require('../plugins/dialog');
var _dialog = dialog.Dialog,
... ... @@ -95,11 +96,8 @@ $(function() {
// 运行此demo
// 1. 安装 npm i -g json-server
// 2. json-server --watch mock/address.json
window.add = cascadingAddress({
el: '#address',
url: 'http://localhost:3000/areas/0',
resource: 'areas'
});
common.setCookie('uid', '8050484');
window.add = cascadingAddress({el: '#address'});
});
$('.weixin').click(function() {
... ...
... ... @@ -34,6 +34,10 @@
dist: '320102' // 区县
});
或者
address.setAddress("320102");
重置地址:
address.reset();
... ...
... ... @@ -17,7 +17,7 @@ var $ = require('yoho-jquery');
// 默认配置
var settings = {
url: '',
url: '/me/address/areas/0',
containerClass: 'cascading-address',
levels: 3,
resources: 'areas',
... ... @@ -191,6 +191,27 @@ function fetchInitialData(evt, config, level) {
});
}
// 设置地址: 省,市,区县
function renderDistrict(distIds, currentLevels, config) {
// 标识需要渲染几级
var distLen = distIds.sort().length,
cursor = distLen, // 游标
areaId, // 请求areaId
defaultId, // 设置areaId
$el = $(config.el);
// 最后一个level是0
while (distLen > 1) {
// 请求从array[0], 判断值从array[1]
areaId = distIds[cursor - distLen];
defaultId = distIds[cursor - distLen + 1];
config.url = setRequestUrl(config, areaId);
$el.trigger('ca.setAddr', [config, currentLevels - 1, defaultId]);
distLen--;
currentLevels--;
}
}
// 设置地址
function setAddress(evt, config, level, areaId) {
var ajaxSettings = $.extend({}, config.ajaxSettings, {
... ... @@ -405,13 +426,8 @@ CascadingAddress.prototype.getAreaIds = function() {
CascadingAddress.prototype.setAddress = function(targetAddr) {
var key,
distIds = ['0'], // 省份请求areaId=0
distLen,
cursor, // 游标
currentLevels = $('.items-indicator>li').length, // 目前存在几级
areaId, // 请求areaId
defaultId, // 设置areaId
config = this.config,
$el = $(config.el);
config = this.config;
if (typeof targetAddr === 'object') {
for (key in targetAddr) {
... ... @@ -419,23 +435,12 @@ CascadingAddress.prototype.setAddress = function(targetAddr) {
distIds.push(targetAddr[key]);
}
}
// 标识需要渲染几级
distLen = distIds.sort().length;
cursor = distLen;
// 最后一个level是0
while (distLen > 1) {
// 请求从array[0], 判断值从array[1]
areaId = distIds[cursor - distLen];
defaultId = distIds[cursor - distLen + 1];
config.url = setRequestUrl(config, areaId);
$el.trigger('ca.setAddr', [config, currentLevels - 1, defaultId]);
distLen--;
currentLevels--;
}
renderDistrict(distIds, currentLevels, config);
} else if (typeof targetAddr === 'string' && targetAddr.length === 6) {
distIds = [0, targetAddr.substr(0, 2), targetAddr.substr(0, 4), targetAddr.substr(0, 6)];
renderDistrict(distIds, currentLevels, config);
} else {
console.error('target address must be a json object');
console.error('target address must be a json object or areaId string');
}
};
... ...
/**
* 品牌页
* @author: zxr<xiaoru.zhang@yoho.cn>
* @date: 2016/07/09
*/
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var $list = $('.brands-list'),
$gory = $('.brands-category'),
$category = $gory.find('a'),
categoryHeight = $category.height(),
categoryTop = $category.offset() ? $category.offset().top : 0;
require('../common/header');
require('../common/return-top');
lazyLoad($('.brands-list img.lazy'));
// 品牌类别滚动事件
$(window).scroll(function() {
if ($(this).scrollTop() >= categoryTop) {
$gory.addClass('category-fix');
} else {
$gory.removeClass('category-fix');
}
});
// 点击字母,页面滚动到相关区域
$category.click(function() {
var name = $(this).attr('href').split('#')[1],
targetTop = $list.find('[name=' + name + ']').offset().top - categoryHeight;
$('.category-nav').find('a').css('color', '#222');
$(this).css('color', '#379ed6');
if (!$gory.hasClass('category-fix')) {
targetTop -= categoryHeight;
}
$('html,body').animate({
scrollTop: targetTop
}, 200);
return false;
});
... ...
... ... @@ -4,6 +4,7 @@
.brands-tabs {
position: relative;
margin-bottom: 20px;
overflow: hidden;
a {
display: block;
... ... @@ -60,8 +61,7 @@
.category-nav {
border-top: 1px solid #eee;
border-bottom: 1px solid #eee;
padding-left: 16px;
width: 100%;
width: 1150px;
height: 44px;
line-height: 44px;
font-size: 12px;
... ... @@ -72,7 +72,7 @@
a {
display: inline-block;
padding: 0 7px;
padding-left: 29px;
text-align: center;
color: #222;
cursor: pointer;
... ... @@ -80,7 +80,6 @@
}
.brands-list {
dt {
height: 70px;
line-height: 70px;
... ...