Authored by xuqi

Merge branch 'feature/template' into develop

... ... @@ -2,5 +2,6 @@ var yohobuyMobile;
require('./public/js/saunter');
require('./public/js/tag');
require('./public/js/template');
module.exports = yohobuyMobile;
... ...
... ... @@ -17,7 +17,9 @@
"jquery-pjax": "1.0.1",
"mlellipsis": "0.0.2",
"lazyload": "1.9.5",
"iscroll": "5.1.2"
"iscroll": "5.1.2",
"mustache": "2.0.0",
"underscore": "1.6.0"
},
"devDependencies": {
"expect.js": "0.3.1"
... ...
... ... @@ -2,7 +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>
Created by FontForge 20120731 at Tue Apr 14 13:26:42 2015
Created by FontForge 20120731 at Wed Apr 22 10:17:10 2015
By Ads
</metadata>
<defs>
... ... @@ -16,10 +16,10 @@ Created by FontForge 20120731 at Tue Apr 14 13:26:42 2015
ascent="812"
descent="-212"
x-height="792"
bbox="0 -224 1457 800"
bbox="0 -224 5637 800"
underline-thickness="50"
underline-position="-100"
unicode-range="U+0078-E605"
unicode-range="U+0078-E60A"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -51,5 +51,18 @@ d="M774 324q6 -9 9.5 -19t2.5 -20.5t-5.5 -20.5t-12.5 -18l-1 -1l-427 -428q-18 -17
<glyph glyph-name="uniE605" unicode="&#xe605;"
d="M707 748q-55 0 -105 -20.5t-90 -56.5q-40 36 -90 56.5t-105 20.5q-34 0 -67 -8t-62 -23t-54.5 -35.5t-45.5 -46.5t-34.5 -55.5t-22 -63t-7.5 -68.5q0 -110 69 -194l2 -2l344 -391q30 -33 73 -33t73 33l344 391q0 1 1 2h1q22 27 37.5 58.5t23.5 66t8 69.5q0 49 -14.5 94.5
t-42 82.5t-63.5 64.5t-80.5 43t-92.5 15.5z" />
<glyph glyph-name="uniE606" unicode="&#xe606;" horiz-adv-x="5632"
d="M4316.5 156q54.5 0 93 38.5t38.5 93.5t-38.5 93.5t-93 38.5t-93.5 -38.5t-39 -93.5t39 -93.5t93.5 -38.5zM4910 156q27 0 51.5 10.5t42.5 28t28 42t10 51.5q0 55 -38.5 93.5t-93 38.5t-93.5 -38.5t-39 -93.5t39 -93.5t93 -38.5zM5504.5 156q54.5 0 93.5 38.5t39 93.5
t-39 93.5t-93.5 38.5t-93 -38.5t-38.5 -93.5t38.5 -93.5t93 -38.5z" />
<glyph glyph-name="uniE607" unicode="&#xe607;" horiz-adv-x="1643"
d="M547 190h-1l45 -46l248 239l-45 46l-201 -194l-195 201l-46 -44z" />
<glyph glyph-name="uniE608" unicode="&#xe608;" horiz-adv-x="1821"
d="M930 135q-14 -13 -33.5 -13t-33.5 13l-252 242q-14 13 -14 32t14 32t34 13t34 -13l251 -242q6 -5 9.5 -11.5t4.5 -13.5t0 -14t-4.5 -13.5t-9.5 -11.5zM360 135q-14 13 -14 32t14 32l251 242q14 13 34 13t34 -13q6 -6 9.5 -15t3.5 -17.5t-3.5 -17t-9.5 -14.5l-252 -242
q-14 -13 -33.5 -13t-33.5 13z" />
<glyph glyph-name="uniE609" unicode="&#xe609;" horiz-adv-x="1821"
d="M930 377l-251 -242q-14 -13 -34 -13t-34 13q-9 9 -12 20.5t0 23.5t12 20l252 242q14 13 33.5 13t33.5 -13t14 -32t-14 -32zM427 441l252 -242q9 -8 12 -20t0 -23.5t-12 -20.5q-14 -13 -34 -13t-34 13l-251 242q-14 13 -14 32t14 32q6 7 15 10.5t18 3.5t18 -3.5t16 -10.5z
" />
<glyph glyph-name="uniE60A" unicode="&#xe60a;"
d="M1024 288q0 -139 -68.5 -257t-186.5 -186.5t-257 -68.5t-257 68.5t-186.5 186.5t-68.5 257t68.5 257t186.5 186.5t257 68.5t257 -68.5t186.5 -186.5t68.5 -257zM801 498l-365 -366l-156 156l-37 -37l193 -193l403 403z" />
</font>
</defs></svg>
... ...
... ... @@ -471,28 +471,30 @@ module.exports = function(flag) {
}
]
},
brands: [
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HALFGIRL',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: '黄伟文Wyman',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HIPANDA',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'holymoly',
url: ''
}
],
brands: {
list: [
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HALFGIRL',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: '黄伟文Wyman',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HIPANDA',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'holymoly',
url: ''
}
]
},
tags: [
{
name: '棒球服',
... ... @@ -571,5 +573,364 @@ module.exports = function(flag) {
}
}
];
case 'tpl':
return [
{
introduction: {
items: [
{
img: {
src: 'http://7xidk0.com1.z0.glb.clouddn.com/pic01.png',
alt: '季末终极折扣'
}
},
{
text: '清水翔太的很多作品都是词曲包办,这次由三人作曲的作品依然一听就知道是他的作品。'
},
{
brands: {
list: [
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HALFGIRL',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: '黄伟文Wyman',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'HIPANDA',
url: ''
},
{
thumb: 'http://7xidk0.com1.z0.glb.clouddn.com/logo.png',
name: 'holymoly',
url: ''
}
]
}
}
]
}
},
{
recommendation: {
recos: [
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'G-Star白色后腰拉链款男士牛仔裤',
price: 488,
salePrice: 139,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'G-Star白色后腰拉链款男士牛仔裤',
price: 488,
salePrice: 139,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'G-Star白色后腰拉链款男士牛仔裤',
price: 488,
salePrice: 139,
url: ''
}
]
}
},
{
goods: {
newPatterns: [
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'GAWS DIGI 丛林数码印花拼接卫衣',
isLike: false,
price: 1268,
salePrice: 589,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img10.static.yhbimg.com/goodsimg/2015/01/08/07/012f23fc2390ccd634082d34cc2982bf4c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'CLOTtee 撞色连帽外套',
isLike: false,
price: 488,
salePrice: 139,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/03/08/0244a127c89c1f77ab47f55891e45be1e6.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'HALFGIRL 插肩棒球服短裙套装',
isLike: true,
price: 478,
salePrice: 208,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img11.static.yhbimg.com/goodsimg/2015/03/02/09/0139514beb37bf2bf321eafd1a915117f5.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: '黄伟文Wyman X yohood联名商品YYYOHOOD连帽卫衣',
isLike: false,
price: 589,
salePrice: 148,
isSale: false,
isFew: false,
isNew: true,
url: ''
}
]
}
}
];
case 'classification':
return {
brand: [
{
name: '所有品牌',
id: 0
},
{
name: 'HARDLYEVER\'S',
id: 1
},
{
name: 'DUNKELVOLK',
id: 2
},
{
name: 'izzue',
id: 3
},
{
name: ':CHOCOOLATE',
id: 4
},
{
name: 'Life·After Life',
id: 5
},
{
name: 'JOYRICH',
id: 6
},
{
name: '5CM',
id: 7
},
{
name: 'THETHING',
id: 8
}
],
msort: [
{
name: '所有品类',
id: 0
},
{
name: '上衣',
id: 1
},
{
name: '裤装',
id: 2
},
{
name: '裙装',
id: 3
},
{
name: '鞋靴',
id: 4
},
{
name: '包类/装备',
id: 5
},
{
name: '服配',
id: 6
},
{
name: '创意生活',
id: 7
},
{
name: '内衣/泳衣',
id: 8
}
],
color: [
{
name: '所有颜色',
id: 0
},
{
name: '黑色',
id: 1
},
{
name: '红色',
id: 2
},
{
name: '灰色',
id: 3
},
{
name: '黄色',
id: 4
},
{
name: '彩色',
id: 5
},
{
name: '棕色',
id: 6
},
{
name: '银色',
id: 7
},
{
name: '橙色',
id: 8
}
],
size: [
{
name: '所有尺码',
id: 0
},
{
name: 'S',
id: 1
},
{
name: 'M',
id: 2
},
{
name: 'L',
id: 3
},
{
name: 'XL',
id: 4
},
{
name: 'XXL',
id: 5
},
{
name: 'XXXL',
id: 6
}
],
price: [
{
name: '所有价格',
id: 0
},
{
name: '¥0-300',
id: 1
},
{
name: '¥300-600',
id: 2
},
{
name: '¥600-1000',
id: 3
},
{
name: '¥1000-2000',
id: 4
},
{
name: '¥2000以上',
id: 5
}
],
discount: [
{
name: '所有折扣',
id: 0
},
{
name: '1~3折',
id: 1
},
{
name: '4~6折',
id: 2
},
{
name: '7~9折',
id: 3
}
]
};
case 'search':
return [
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/03/08/0244a127c89c1f77ab47f55891e45be1e6.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'HALFGIRL 插肩棒球服短裙套装',
isLike: true,
price: 478,
salePrice: 208,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/03/02/08/023f696cf1ae78688bc6c8edeccc480c2c.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'GAWS DIGI 丛林数码印花拼接卫衣',
isLike: false,
price: 1268,
salePrice: 589,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img12.static.yhbimg.com/goodsimg/2015/04/20/09/02ef617e5704729b9e8741831d805fac20.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'CLOTtee 撞色连帽外套',
isLike: false,
price: 488,
salePrice: 139,
isSale: true,
isFew: true,
isNew: false,
url: ''
},
{
thumb: 'http://img13.static.yhbimg.com/goodsimg/2015/04/03/07/0235b2d48417d0e92b94484d284dca06fc.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
name: 'Lee Cooper 蓝色花丛系T恤',
isLike: false,
price: 589,
salePrice: 148,
isSale: false,
isFew: false,
isNew: true,
url: ''
}
];
}
};
\ No newline at end of file
... ...
seajs.use(['jquery/1.8.3/jquery-debug','yohobuy-mobile/1.0.0/public/js/tag-debug'], function($,tag) {
seajs.use(['jquery/1.8.3/jquery-debug','yohobuy-mobile/1.0.0/public/js/tag-debug'], function($, tag) {
$("#container").removeClass('hide');
if(tag) {
... ...
/**
* 模板页js
* @author: xuqi(qi.xu@yoho.cn)
* @date;2015/4/14
*/
var $ = require('jquery'),
_ = require('underscore'),
Mustache = require('mustache'),
timer = null;
require('lazyload');
/**
* 页面加载初始化
*/
exports.init = function() {
$(function() {
var $navItem = $('#goods-nav .nav-item'),
$goodsContainer = $('#goods-content'),
$goodList = $('#goods-content > div'),
$npc = $goodList.filter('.new-patterns-container'),
$svc = $goodList.filter('.sales-volume-container'),
$pc = $goodList.filter('.price-container'),
tpl; //商品信息模板
//筛选相关变量
var curFilter = {
brand: 0,
msort: 0,
color: 0,
size: 0,
price: 0,
discount: 0
},
navInfo = {
newest: {
direction: 1, //排序方向;NOTE:最新保持升序排序
reload: false, //是否需要重新加载
deviation: $npc.children('.good-info').length,
end: false
},
sale: {
direction: 0, //销量降序排列
reload: true,
deviation: 0,
end: false
},
price: {
direction: 1,
reload: true,
deviation: 0,
end: false
}
},
classifyItemTpl = '<li class="{{^ id}}chosed{{/ id}}" data-id="{{id}}">' +
'<span class="text">{{name}}</span>' +
'<span><i class="chosed-icon iconfont">&#xe60a;</i></span>' +
'</li>',
$screen = $('#screen-content, #screen-mask'),
$prevFocusNav = $navItem.filter('.focus'), //初始化为已选项
classification; //分类数据
//加载更多
var winH = $(window).height();
//read good-info template
$.get('/tpl/readTpl', function(data) {
if (data.success) {
tpl = data.data;
Mustache.parse(tpl);
}
});
Mustache.parse(classifyItemTpl); //cache tpl
/**
* Mustache 渲染数组数据
* @params data Array 数据数组
* @return html html字符串
*/
function renderArrData(data) {
var i = 0,
html = '';
for (i = 0; i < data.length; i++) {
html += Mustache.render(classifyItemTpl, data[i]);
}
return html;
}
/**
* 获取当前选中导航的类别
* @return string/undefined
*/
function getFocusNavType() {
var type;
if ($prevFocusNav.hasClass('sales-volume-nav')) {
type = 'sale';
} else if ($prevFocusNav.hasClass('price-nav')) {
type = 'price';
} else if ($prevFocusNav.hasClass('new-patterns-nav')) {
type = 'newest';
}
return type;
}
/**
* 查找当前状态下的商品列表并填充HTML
*/
function search() {
var type = getFocusNavType(),
setting = {},
nav;
nav = navInfo[type];
//请求数据setting
$.extend(setting, curFilter, {
type: type,
direction: nav.direction,
deviation: nav.deviation
});
if (nav.reload) {
setting.deviation = 0;
} else if (nav.end) {
//不需要重新加载并且数据请求结束
return;
}
$.ajax({
type: 'GET',
url: '/tpl/search',
data: setting
}).then(function(data) {
var html = '',
$container,
res,
goods,
len,
i;
if (data.success) {
res = data.data;
goods = res.goods;
len = goods.length;
//插入HTML
switch (setting.type) {
case 'newest':
$container = $npc;
break;
case 'price':
$container = $pc;
break;
case 'sale':
$container = $svc;
break;
}
for (i = 0; i < len; i++) {
html += Mustache.render(tpl, goods[i]);
}
if (nav.reload) {
$container.html(html);
} else {
$container.append(html);
}
//lazyload
$container.find('img.lazy').lazyload();
//重置navInfo
if (res.end) {
nav.end = true;
}
nav.reload = false;
nav.deviation = setting.deviation + len;
}
});
}
//读取筛选时的分类信息
$.get('/tpl/classification', function(data) {
var c,
html;
if (data.success) {
classification = data.data;
for (c in classification) {
if(classification.hasOwnProperty(c)) {
$('#sub-' + c).html(renderArrData(classification[c]));
}
}
}
});
//img lazyload
$('img.lazy').lazyload({
skip_invisible : false
});
/**
* 切换排序
* @params $cur 当前选中nav-item
*/
function toggleSort($cur) {
var type = getFocusNavType(),
nav = navInfo[type],
direction;
$cur.find('.sort i').toggleClass('cur');
if ($cur.find('.sort .cur').hasClass('up')) {
direction = 1;
} else {
direction = 0;
}
nav.direction = direction;
nav.reload = true;
search();
}
/**
* 导航 touch/click处理句柄
*/
function navTouchEvt(e) {
var $cur = $(e.currentTarget),
type;
if ($cur.hasClass('screen-nav')) {
//筛选
$screen.toggleClass('hide');
$prevFocusNav.toggleClass('focus');
$cur.toggleClass('focus');
} else {
if ($cur.hasClass('focus')) {
if (!$cur.hasClass('new-patterns-nav')) {
//销量和价格
toggleSort($cur);
}
return;
}
$prevFocusNav = $cur;
$navItem.removeClass('focus');
$cur.addClass('focus');
type = getFocusNavType(); //当前focus项(new/sale/price)
$goodList.addClass('hide');
switch (type) {
case 'newest':
$npc.removeClass('hide');
break;
case 'sale':
$svc.removeClass('hide');
break;
case 'price':
$pc.removeClass('hide');
break;
}
if (navInfo[type].reload) {
search();
}
}
}
//切换“最新”,“销量”,“价格”以及“筛选”功能
$('#goods-nav').delegate('.nav-item', 'touchstart', function(e) {
e.preventDefault();
navTouchEvt(e);
}).delegate('.nav-item', 'click', function(e) {
navTouchEvt(e);
});
/**
* 筛选分类点击事件句柄
*/
function scTouchEvt(e) {
var $cur = $(e.currentTarget),
cs = ['brand', 'msort', 'color', 'size', 'price', 'discount'],
curType;
if ($cur.hasClass('active')) {
return;
}
$('#screen-content .c-item').removeClass('active');
$cur.addClass('active');
curType = _.filter(cs, function(c) {
return $cur.hasClass(c);
});
$('.sub-classify:not(.hide)').addClass('hide');
$('#sub-' + curType).removeClass('hide');
}
$('#screen-content').delegate('.c-item', 'touchstart', function(e) {
e.preventDefault();
scTouchEvt(e);
}).delegate('.c-item', 'click', function(e) {
scTouchEvt(e);
});
/**
* 筛选
* @params string 数据id
* @params string 数据类型
* @name string 值
* @navNam string 最新/销量/价格
* @direction int 0(降序)/1(升序)
*/
function doFilter(id, type, name, navName) {
var $shower = $('#show-' + type),
att,
req;
//更新当前过滤项
curFilter[type] = id;
//更新显示值
if (id === 0) {
$shower.addClass('default');
} else {
$shower.removeClass('default');
}
$shower.text(name);
//重置reload
for (att in navInfo) {
if (navInfo.hasOwnProperty(att)) {
navInfo[att].reload = true;
}
}
search();
}
/**
* 筛选子类点击事件句柄
*/
function subScTouchEvt(e) {
var cur = e.currentTarget,
$cur = $(cur),
$parent = $cur.closest('ul'),
id = cur.dataset.id * 1,
type = $parent[0].dataset.type,
name = $cur.children('.text').text();
$parent.children('li.chosed').removeClass('chosed');
$cur.addClass('chosed');
doFilter(id, type, name);
}
$('.sub-classify').delegate('li', 'click', function(e) {
subScTouchEvt(e);
});
//加载更多
$(document).on('touchmove', function(e) {
//当scroll到1/4$goodsContainer高度后继续请求
if ($(window).scrollTop() + winH >
$(document).height() - 0.25 * $goodsContainer.height()) {
search();
}
});
});
};
\ No newline at end of file
... ...
seajs.use(['jquery/1.8.3/jquery-debug', 'yohobuy-mobile/1.0.0/public/js/template-debug'], function($, tpl) {
$("#container").removeClass('hide');
if (tpl) {
tpl.init();
}
});
\ No newline at end of file
... ...
.brand {
float: left;
width: 158rem / $pxConvertRem;
height: 120rem / $pxConvertRem;
border-left: 1px solid #e0e0e0;
.brand-list {
padding: 30rem / $pxConvertRem 0 30rem / $pxConvertRem;
background: #fff;
a {
display: block;
text-decoration: none;
}
.brand-logo {
display: table-cell;
.brand {
float: left;
width: 158rem / $pxConvertRem;
height: 94rem / $pxConvertRem;
vertical-align:middle;
height: 120rem / $pxConvertRem;
border-left: 1px solid #e0e0e0;
img {
a {
display: block;
max-width: 158rem / $pxConvertRem;
max-height: 94rem / $pxConvertRem;
text-decoration: none;
}
.brand-logo {
display: table-cell;
width: 158rem / $pxConvertRem;
height: 94rem / $pxConvertRem;
vertical-align: middle;
margin: 0 auto;
img {
display: block;
max-width: 158rem / $pxConvertRem;
max-height: 94rem / $pxConvertRem;
vertical-align: middle;
margin: 0 auto;
}
}
.brand-name {
margin: 10rem / $pxConvertRem 0 0 0;
line-height: 24rem / $pxConvertRem;
font-size: 18rem / $pxConvertRem;
color: #babac2;
text-align: center;
text-decoration: none;
border-bottom: none;
overflow: hidden;
}
}
.brand-name {
margin: 10rem / $pxConvertRem 0 0 0;
line-height: 24rem / $pxConvertRem;
font-size: 18rem / $pxConvertRem;
color: #babac2;
text-align: center;
text-decoration: none;
border-bottom: none;
overflow: hidden;
}
}
.brand:first-child {
border-left: none;
.brand:first-child {
border-left: none;
}
}
\ No newline at end of file
... ...
@import "compass", "compass/reset";
$pxConvertRem : 40;
body {
font-family: helvetica,Arial,"黑体";
background: #f0f0f0;
}
ol, ul {
list-style: none;
}
.hide {
display: none !important;
}
/**
* 闭合浮动
* @Doc: http://nicolasgallagher.com/micro-clearfix-hack/
*/
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1; /* IE6-7 触发 hasLayout */
}
/**
* 字体图标样式
*/
@font-face {
font-family: "iconfont";
src: url('../fonts/iconfont.eot'); /* IE9*/
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/iconfont.woff') format('woff'), /* chromefirefox */
url('../fonts/iconfont.ttf') format('truetype'), /* chromefirefoxoperaSafari, Android, iOS 4.2+*/
url('../fonts/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
text-decoration: none;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.icon-sharedviewicon:before {
content: "\e60c";
}
.icon-sharedtimeicon:before {
content: "\e60d";
}
.icon-sharedlikebuttomhighlighted:before {
content: "\e60f";
}
.icon-sharedenterbuttomnormal:before {
content: "\e612";
}
... ...
$pxConvertRem : 40;
@import "compass";
@include global-reset();
@import "saunter/article-author", "saunter/article", "saunter/related-brand", "saunter/article-tag", "saunter/related-post";
body {
font-family: helvetica,Arial,"黑体";
background: #f0f0f0;
}
.hide {
display: none;
}
/**
* 闭合浮动
* @Doc: http://nicolasgallagher.com/micro-clearfix-hack/
*/
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1; /* IE6-7 触发 hasLayout */
}
/**
* 字体图标样式
*/
@font-face {font-family: "iconfont";
src: url('../fonts/iconfont.eot'); /* IE9*/
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/iconfont.woff') format('woff'), /* chromefirefox */
url('../fonts/iconfont.ttf') format('truetype'), /* chromefirefoxoperaSafari, Android, iOS 4.2+*/
url('../fonts/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.icon-sharedviewicon:before { content: "\e60c"; }
.icon-sharedtimeicon:before { content: "\e60d"; }
.icon-sharedlikebuttomhighlighted:before { content: "\e60f"; }
.icon-sharedenterbuttomnormal:before { content: "\e612"; }
@import "common/common", "saunter/article-author", "saunter/article", "saunter/related-brand", "saunter/article-tag", "saunter/related-post";
#wrapper {
position: absolute;
... ...
... ... @@ -19,8 +19,6 @@
}
.brand-list {
padding: 30rem / $pxConvertRem 0 30rem / $pxConvertRem;
background: #fff;
border-top: 1px solid #e0e0e0;
border-bottom: 1px solid #e0e0e0;
}
... ...
$pxConvertRem : 40;
@import "compass", "common/time-view-like-share";
@include global-reset();
body {
font-family: helvetica,Arial,"黑体";
background: #f0f0f0;
}
.hide {
display: none;
}
/**
* 闭合浮动
* @Doc: http://nicolasgallagher.com/micro-clearfix-hack/
*/
.clearfix:before,
.clearfix:after {
content: "";
display: table;
}
.clearfix:after {
clear: both;
}
.clearfix {
*zoom: 1; /* IE6-7 触发 hasLayout */
}
/**
* 字体图标样式
*/
@font-face {font-family: "iconfont";
src: url('../fonts/iconfont.eot'); /* IE9*/
src: url('../fonts/iconfont.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('../fonts/iconfont.woff') format('woff'), /* chromefirefox */
url('../fonts/iconfont.ttf') format('truetype'), /* chromefirefoxoperaSafari, Android, iOS 4.2+*/
url('../fonts/iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-webkit-text-stroke-width: 0.2px;
-moz-osx-font-smoothing: grayscale;
}
.icon-sharedviewicon:before { content: "\e60c"; }
.icon-sharedtimeicon:before { content: "\e60d"; }
.icon-sharedlikebuttomhighlighted:before { content: "\e60f"; }
.icon-sharedenterbuttomnormal:before { content: "\e612"; }
@import "common/common", "common/time-view-like-share";
.tag-content {
margin: 30rem / $pxConvertRem 0 0 0;
... ...
@import "common/common", "common/brands", "common/good-info";
body {
background-color: #f0f0f0;
}
.template-container .tpl-block:first-child {
border-top: none;
}
.tpl-block {
border-bottom: 1px solid #e0e0e0;
border-top: 1px solid #e0e0e0;
margin-bottom: 30rem / $pxConvertRem;
background-color: #fff;
}
.intro .img-container {
width: 100%;
height: 304rem / $pxConvertRem;
.img {
width: 100%;
height: 100%;
}
}
.intro .text {
padding: 20rem / $pxConvertRem 30rem / $pxConvertRem;
padding-bottom: 0;
line-height: 46rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
color: #444;
}
.reco .reco-good-info {
float: left;
width: 212rem / $pxConvertRem;
border-left: 1px solid #e0e0e0;
.thumb {
width: 100%;
height: 285rem / $pxConvertRem;
}
}
.reco .reco-good-info:first-child {
border-left: none;
}
.reco .reco-good-info .text-container {
padding: 10rem / $pxConvertRem 15rem / $pxConvertRem;
}
.reco .reco-good-info .name {
display: block;
line-height: 28rem / $pxConvertRem;
text-decoration: none;
font-size: 22rem / $pxConvertRem;
color: #444;
margin-bottom: 10rem / $pxConvertRem;
}
.reco .reco-good-info .price {
line-height: 22rem / $pxConvertRem;
font-size: 22rem / $pxConvertRem;
color: #b0b0b0;
text-decoration: line-through;
}
.reco .reco-good-info .sale-price {
line-height: 22rem / $pxConvertRem;
font-size: 22rem / $pxConvertRem;
color: #d62927;
}
.goods .goods-nav {
width: 100%;
padding: 20rem / $pxConvertRem 0;
border-bottom: 1px solid #e0e0e0;
}
.nav-item {
position: relative;
display: inline-block;
color: #c0c0c0;
text-align: center;
width: 140rem / $pxConvertRem;
border-left: 1px solid #e0e0e0;
font-size: 35rem / $pxConvertRem;
&:first-child {
border-left: none;
}
&.focus {
color: #444;
.iconfont {
color: #c0c0c0;
}
.iconfont.cur {
color: #444;
}
}
}
.sort {
position: absolute;
right: 0;
top: -14rem / $pxConvertRem;
width: 12px;
overflow: hidden;
vertical-align: top;
i {
font-size: 10px;
position: relative;
&.down {
top: -18rem / $pxConvertRem;
}
}
}
.goods .goods-container {
padding: 0 14rem / $pxConvertRem;
.goods-content {
position: relative;
padding-top: 30rem / $pxConvertRem;
min-height: 500rem / $pxConvertRem;
}
}
.c-item {
vertical-align: top;
.chosed {
display: inline-block;
max-width: 168rem / $pxConvertRem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
.screen-mask, .screen-content{
position: absolute;
margin: 0 -14rem / $pxConvertRem;
left: 0;
right: 0;
top: 1px;
}
.screen-mask {
height: 100%;
background-color: #000;
opacity: 0.1;
filter: Alpha(opacity=10);
}
.screen-content {
z-index: 100;
background-color: #fff;
font-size: 28rem / $pxConvertRem;
color: #000;
height: 500rem / $pxConvertRem;
.classify, .sub-classify-container {
float: left;
width: 50%;
height: 100%;
}
.classify {
background-color: #f8f8f8;
li {
height: 60rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
padding: 0 30rem / $pxConvertRem 0 20rem / $pxConvertRem;
&.active {
background-color: #fff;
}
}
}
.classify .default {
color: #999;
}
.sub-classify-container {
overflow: auto;
.sub-classify {
padding-left: 15rem / $pxConvertRem;
li {
height: 60rem / $pxConvertRem;
line-height: 60rem / $pxConvertRem;
border-bottom: 1px solid #e6e6e6;
}
}
}
}
.sub-classify .chosed-icon {
display: none;
margin-left: 10rem / $pxConvertRem;
}
.sub-classify li.chosed .chosed-icon {
display: inline-block;
}
\ No newline at end of file
... ...
... ... @@ -4,11 +4,17 @@
* @date: 2015/3/27
*/
var saunter = require('./views/controller/saunter'),
tag = require('./views/controller/tag');
tag = require('./views/controller/tag'),
template = require('./views/controller/template');
module.exports = function(app) {
app.get('/', saunter.show); //着陆页
app.get('/optimize', saunter.optimize); //优化着陆页
app.get('/tag', tag.show); //标签页
app.get('/tpl', template.show); //模板页
app.get('/tpl/readTpl', template.readTpl); //读取模板
app.get('/tpl/classification', template.readClassification); //读取分类数据
app.get('/tpl/search', template.search); //筛选查询
};
\ No newline at end of file
... ...
... ... @@ -10,7 +10,7 @@ exports.show = function(req, res) {
data: data,
layout: '../layouts/layout',
css: '../css/saunter.css',
usejs: 'saunter/saunter-footer'
usejs: 'saunter/footer'
});
};
... ... @@ -19,6 +19,6 @@ exports.optimize = function(req, res) {
data: data,
layout: '../layouts/layout',
css: '../css/saunter.css',
usejs: 'saunter/saunter-optimize-footer'
usejs: 'saunter/optimize-footer'
});
};
\ No newline at end of file
... ...
... ... @@ -10,6 +10,6 @@ exports.show = function(req, res) {
data: data,
layout: '../layouts/layout',
css: '../css/tag.css',
usejs: 'tag/tag-footer'
usejs: 'tag/footer'
});
};
\ No newline at end of file
... ...
/**
* 模板页控制器文件
* @author: xuqi(qi.xu@yoho.cn)
* @date: 2015/4/14
*/
var datas = require('../../public/js/data'),
data = datas('tpl'),
classification = datas('classification'),
search = datas('search'),
fs = require('fs'),
path = require('path'),
tplPath = path.normalize(path.join(__dirname, '../partials/common/good-info.html'));;
exports.show = function(req, res) {
res.render('pages/template', {
data: data,
layout: '../layouts/layout',
css: '../css/template.css',
usejs: 'template/footer'
});
};
exports.readTpl = function(req, res) {
fs.readFile(tplPath, 'utf8', function(err, data) {
if (err) {
res.send({
success: false
});
}
res.send({
success: true,
data: data
});
});
};
exports.readClassification = function(req, res) {
res.send({
success: true,
data: classification
});
};
exports.search = function(req, res) {
res.send({
success: true,
data: {
end: false, //数据是否结束
goods: search //商品数据
}
});
};
\ No newline at end of file
... ...
<div class="template-container">
{{# data}}
<div class="tpl-block clearfix {{# introduction}}intro{{/ introduction}}{{# recommendation}}reco{{/ recommendation}}{{# goods}}goods{{/ goods}}">
{{# introduction.items}}
{{# img}}
<div class="img-container">
<img class="img lazy" data-original="{{src}}" alt="{{alt}}">
</div>
{{/ img}}
{{# text}}
<p class="text">{{.}}</p>
{{/ text}}
{{> common/brands}}
{{/ introduction.items}}
{{# recommendation.recos}}
<div class="reco-good-info">
<div class="img-container">
<a href="{{url}}">
<img class="thumb lazy" data-original="{{thumb}}">
</a>
</div>
<div class="text-container">
<a class="name" href="{{url}}">{{name}}</a>
<div class="sale-price">
¥{{salePrice}}
</div>
<div class="price">
¥{{price}}
</div>
</div>
</div>
{{/ recommendation.recos}}
{{# goods}}
<div class="goods-container">
<ul id="goods-nav" class="goods-nav">
<li class="nav-item new-patterns-nav focus">最新</li>
<li class="nav-item sales-volume-nav">
销量
<span class="sort">
<i class="up iconfont">&#xe608;</i>
<i class="down iconfont cur">&#xe609;</i>
</span>
</li>
<li class="nav-item price-nav">
价格
<span class="sort">
<i class="up iconfont cur">&#xe608;</i>
<i class="down iconfont">&#xe609;</i>
</span>
</li>
<li class="nav-item screen-nav">筛选</li>
</ul>
<div id="goods-content" class="goods-content clearfix">
<div class="new-patterns-container">
{{# newPatterns}}
{{> common/good_info}}
{{/ newPatterns}}
</div>
<div class="sales-volume-container hide">
{{# salesVolume}}
{{> common/good_info}}
{{/ salesVolume}}
</div>
<div class="price-container hide">
{{# price}}
{{> common/good_info}}
{{/ price}}
</div>
<div id="screen-mask" class="screen-mask hide"></div>
<div id="screen-content" class="screen-content hide">
<ul class="classify">
<li class="brand c-item active">
品牌:
<h1 id="show-brand" class="chosed default">所有品牌</h1>
</li>
<li class="msort c-item">
品类:
<h1 id="show-msort" class="chosed default">所有品类</h1>
</li>
<li class="color c-item">
颜色:
<h1 id="show-color" class="chosed default">所有颜色</h1>
</li>
<li class="size c-item">
尺码:
<h1 id="show-size" class="chosed default">所有尺码</h1>
</li>
<li class="price c-item">
价格:
<h1 id="show-price" class="chosed default">所有价格</h1>
</li>
<li class="discount c-item">
折扣:
<h1 id="show-discount" class="chosed default">所有折扣</h1>
</li>
</ul>
<div class="sub-classify-container">
<ul id="sub-brand" class="sub-classify" data-type="brand"></ul>
<ul id="sub-msort" class="sub-classify hide" data-type="msort"></ul>
<ul id="sub-color" class="sub-classify hide" data-type="color"></ul>
<ul id="sub-size" class="sub-classify hide" data-type="size"></ul>
<ul id="sub-price" class="sub-classify hide" data-type="price"></ul>
<ul id="sub-discount" class="sub-classify hide" data-type="discount"></ul>
</div>
</div>
</div>
</div>
{{/ goods}}
</div>
{{/ data}}
</div>
\ No newline at end of file
... ...
{{# brands}}
<li class="brand">
<a href="{{url}}">
<div class="brand-logo">
<img class="lazy" data-original="{{thumb}}" alt="">
</div>
<p class="brand-name">{{name}}</p>
</a>
</li>
<ul class="brand-list clearfix">
{{# list}}
<li class="brand">
<a href="{{url}}">
<div class="brand-logo">
<img class="lazy" data-original="{{thumb}}" alt="">
</div>
<p class="brand-name">{{name}}</p>
</a>
</li>
{{/ list}}
</ul>
{{/ brands}}
\ No newline at end of file
... ...
<div class="related-brand">
<h2>相关品牌</h2>
<ul class="brand-list clearfix">
{{> common/brands}}
</ul>
{{> common/brands}}
</div>
\ No newline at end of file
... ...