Merge branch 'develop' into feature/index-girls
Showing
77 changed files
with
928 additions
and
224 deletions
@@ -17,8 +17,10 @@ const path = require('path'); | @@ -17,8 +17,10 @@ const path = require('path'); | ||
17 | const bodyParser = require('body-parser'); | 17 | const bodyParser = require('body-parser'); |
18 | const cookieParser = require('cookie-parser'); | 18 | const cookieParser = require('cookie-parser'); |
19 | const favicon = require('serve-favicon'); | 19 | const favicon = require('serve-favicon'); |
20 | -const session = require('express-session'); | ||
21 | -const memcached = require('connect-memcached'); | 20 | +const session = require('yoho-express-session'); |
21 | +const memcached = require('yoho-connect-memcached'); | ||
22 | +const uuid = require('uuid'); | ||
23 | +const _ = require('lodash'); | ||
22 | const pkg = require('./package.json'); | 24 | const pkg = require('./package.json'); |
23 | 25 | ||
24 | const app = express(); | 26 | const app = express(); |
@@ -40,17 +42,35 @@ app.use(bodyParser.json()); | @@ -40,17 +42,35 @@ app.use(bodyParser.json()); | ||
40 | app.use(bodyParser.urlencoded({extended: false})); | 42 | app.use(bodyParser.urlencoded({extended: false})); |
41 | app.use(cookieParser()); | 43 | app.use(cookieParser()); |
42 | app.use(session({ | 44 | app.use(session({ |
43 | - secret: '3e5fec7deca0b8305cefe2ad9d90ff5e', | ||
44 | - name: 'PHPSESSID', | ||
45 | - prefix: 'yohobuy', | ||
46 | proxy: true, | 45 | proxy: true, |
47 | - resave: true, | 46 | + resave: false, |
48 | saveUninitialized: true, | 47 | saveUninitialized: true, |
48 | + unset: 'destroy', | ||
49 | + secret: 'nothing', // 兼容 PHP SESSION,sessionID 不加密 | ||
50 | + name: 'PHPSESSID', // 兼容 PHP SESSION | ||
51 | + genid: () => { | ||
52 | + return uuid.v4(); // 兼容 PHP SESSION | ||
53 | + }, | ||
54 | + cookie: { | ||
55 | + domain: 'yohobuy.com' | ||
56 | + }, | ||
49 | store: new MemcachedStore({ | 57 | store: new MemcachedStore({ |
50 | - hosts: config.memcache.session | 58 | + hosts: config.memcache.session, |
59 | + prefix: 'qinsessionsession:', // 兼容 PHP SESSION | ||
60 | + key: 'yohobuy_session' // 兼容 PHP SESSION | ||
51 | }) | 61 | }) |
52 | })); | 62 | })); |
53 | 63 | ||
64 | +app.use((req, res, next) => { | ||
65 | + req.user = {}; | ||
66 | + | ||
67 | + // 从 PHP 写的 SESSION 中获取到当前登录用户的 UID | ||
68 | + if (req.session && _.isNumber(req.session._LOGIN_UID)) { | ||
69 | + req.user.uid = req.session._LOGIN_UID; | ||
70 | + } | ||
71 | + next(); | ||
72 | +}); | ||
73 | + | ||
54 | // dispatcher | 74 | // dispatcher |
55 | require('./dispatch')(app); | 75 | require('./dispatch')(app); |
56 | 76 |
@@ -6,8 +6,27 @@ | @@ -6,8 +6,27 @@ | ||
6 | 6 | ||
7 | 'use strict'; | 7 | 'use strict'; |
8 | 8 | ||
9 | +const headerModel = require('../../../doraemon/models/header'); | ||
10 | +const specialModel = require('../models/special'); | ||
11 | +const _ = require('lodash'); | ||
12 | + | ||
9 | exports.special = (req, res) => { | 13 | exports.special = (req, res) => { |
10 | let id = req.params[0] || 0; | 14 | let id = req.params[0] || 0; |
15 | + let channel = req.query.channel ? req.query.channel : 'boys'; | ||
16 | + | ||
17 | + specialModel.getSpecialData(id).then((result) => { | ||
18 | + let headerData = headerModel.setHeaderData(result[0].data, channel); | ||
19 | + | ||
20 | + result[1].title = result[1].pageTitle; | ||
21 | + result[1].keywords = result[1].keyWord; | ||
22 | + result[1].description = result[1].pageDesc; | ||
11 | 23 | ||
12 | - res.send(id); | 24 | + res.render('special', _.merge({ |
25 | + module: 'index', | ||
26 | + page: 'index', | ||
27 | + footerTop: true | ||
28 | + }, headerData, result[1])); | ||
29 | + }).catch((err) => { | ||
30 | + res.send(err); | ||
31 | + }); | ||
13 | }; | 32 | }; |
@@ -13,13 +13,17 @@ var app = express(); | @@ -13,13 +13,17 @@ var app = express(); | ||
13 | // set view engin | 13 | // set view engin |
14 | var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root | 14 | var doraemon = path.join(__dirname, '../../doraemon/views'); // parent view root |
15 | 15 | ||
16 | +app.on('mount', function(parent) { | ||
17 | + delete parent.locals.settings; // 不继承父 App 的设置 | ||
18 | + Object.assign(app.locals, parent.locals); | ||
19 | +}); | ||
16 | app.set('views', path.join(__dirname, 'views/action')); | 20 | app.set('views', path.join(__dirname, 'views/action')); |
17 | app.engine('.hbs', hbs({ | 21 | app.engine('.hbs', hbs({ |
18 | extname: '.hbs', | 22 | extname: '.hbs', |
19 | defaultLayout: 'layout', | 23 | defaultLayout: 'layout', |
20 | layoutsDir: doraemon, | 24 | layoutsDir: doraemon, |
21 | partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], | 25 | partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], |
22 | - helpers: 'helpers' | 26 | + helpers: require('../../library/helpers') |
23 | })); | 27 | })); |
24 | 28 | ||
25 | // router | 29 | // router |
apps/activity/models/special.js
0 → 100644
1 | +/** | ||
2 | + * activity model | ||
3 | + * @author: wsl<shuiling.wang@yoho.cn> | ||
4 | + * @date: 2016/05/18 | ||
5 | + */ | ||
6 | +'use strict'; | ||
7 | + | ||
8 | +const ServiceAPI = require(`${global.library}/api`).ServiceAPI; | ||
9 | +const sign = require(`${global.library}/sign`); | ||
10 | +const logger = require(`${global.library}/logger`); | ||
11 | +const headerModel = require('../../../doraemon/models/header'); | ||
12 | + | ||
13 | +var api = new ServiceAPI(); | ||
14 | + | ||
15 | +const getstaticFile = (id) => { | ||
16 | + return api.get('staticFileManage/queryById', sign.apiSign({ | ||
17 | + id: id | ||
18 | + })).then(result => { | ||
19 | + if (result && result.code === 200) { | ||
20 | + return result.data; | ||
21 | + } else { | ||
22 | + logger.error(`专题活动ID: ${id} 接口返回数据错误`); | ||
23 | + return {}; | ||
24 | + } | ||
25 | + }); | ||
26 | +}; | ||
27 | + | ||
28 | +exports.getSpecialData = (id) => { | ||
29 | + return Promise.all([headerModel.requestHeaderData(), getstaticFile(id)]); | ||
30 | +}; |
apps/activity/views/action/index.hbs
deleted
100644 → 0
apps/activity/views/action/special.hbs
0 → 100644
@@ -12,12 +12,13 @@ const isTest = process.env.NODE_ENV === 'test'; | @@ -12,12 +12,13 @@ const isTest = process.env.NODE_ENV === 'test'; | ||
12 | module.exports = { | 12 | module.exports = { |
13 | port: 6002, | 13 | port: 6002, |
14 | domains: { | 14 | domains: { |
15 | - api: 'http://192.168.102.205:8080/gateway', | ||
16 | - service: 'http://testservice.yoho.cn:28077/', // 'http://service.api.yohobuy.com/', | 15 | + api: 'http://192.168.102.205:8080/gateway/', |
16 | + service: 'http://testservice.yoho.cn:28077/', | ||
17 | + // service: 'http://testservice.yoho.cn:28077/', // 'http://service.api.yohobuy.com/', | ||
17 | search: 'http://192.168.10.64:8080/yohosearch/' | 18 | search: 'http://192.168.10.64:8080/yohosearch/' |
18 | }, | 19 | }, |
19 | useOneapm: false, | 20 | useOneapm: false, |
20 | - useCache: true, | 21 | + useCache: false, |
21 | memcache: { | 22 | memcache: { |
22 | master: ['192.168.102.168:12580'], | 23 | master: ['192.168.102.168:12580'], |
23 | slave: ['192.168.102.168:12580'], | 24 | slave: ['192.168.102.168:12580'], |
@@ -52,11 +53,13 @@ module.exports = { | @@ -52,11 +53,13 @@ module.exports = { | ||
52 | if (isProduction) { | 53 | if (isProduction) { |
53 | Object.assign(module.exports, { | 54 | Object.assign(module.exports, { |
54 | appName: 'www.yohobuy.com', | 55 | appName: 'www.yohobuy.com', |
55 | - useOneapm: true | 56 | + useOneapm: true, |
57 | + useCache: true | ||
56 | }); | 58 | }); |
57 | } else if (isTest) { | 59 | } else if (isTest) { |
58 | Object.assign(module.exports, { | 60 | Object.assign(module.exports, { |
59 | appName: 'www.yohobuy.com for test', | 61 | appName: 'www.yohobuy.com for test', |
60 | - useOneapm: true | 62 | + useOneapm: true, |
63 | + useCache: true | ||
61 | }); | 64 | }); |
62 | } | 65 | } |
@@ -206,5 +206,5 @@ exports.requestHeaderData = () => { | @@ -206,5 +206,5 @@ exports.requestHeaderData = () => { | ||
206 | /* eslint-enable */ | 206 | /* eslint-enable */ |
207 | }); | 207 | }); |
208 | 208 | ||
209 | - return serviceApi.get('/operations/api/v6/category/getCategory', data, true); | 209 | + return serviceApi.get('operations/api/v6/category/getCategory', data, true); |
210 | }; | 210 | }; |
@@ -15,9 +15,9 @@ | @@ -15,9 +15,9 @@ | ||
15 | <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> | 15 | <link rel="dns-prefetch" href="//img12.static.yhbimg.com"> |
16 | <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> | 16 | <link rel="dns-prefetch" href="//img13.static.yhbimg.com"> |
17 | {{#if devEnv}} | 17 | {{#if devEnv}} |
18 | - <link rel="stylesheet" href="//localhost:5002/css/index.css"> | 18 | + <link rel="stylesheet" href="//localhost:5002/css/index.css"> |
19 | {{^}} | 19 | {{^}} |
20 | - <link rel="stylesheet" href="//cdn.yoho.cn/m-yohobuy-node/{{version}}/index.css"> | 20 | + <link rel="stylesheet" href="//cdn.yoho.cn/yohobuy-node/{{version}}/index.css"> |
21 | {{/if}} | 21 | {{/if}} |
22 | </head> | 22 | </head> |
23 | <body> | 23 | <body> |
@@ -29,9 +29,9 @@ | @@ -29,9 +29,9 @@ | ||
29 | {{/if}} | 29 | {{/if}} |
30 | {{> footer}} | 30 | {{> footer}} |
31 | {{#if devEnv}} | 31 | {{#if devEnv}} |
32 | - <script src="//localhost:5002/{{module}}.{{page}}.js"></script> | 32 | + <script src="//localhost:5002/{{module}}.{{page}}.js"></script> |
33 | {{^}} | 33 | {{^}} |
34 | - <script src="//cdn.yoho.cn/m-yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script> | 34 | + <script src="//cdn.yoho.cn/yohobuy-node/{{version}}/{{module}}.{{page}}.js"></script> |
35 | {{/if}} | 35 | {{/if}} |
36 | </body> | 36 | </body> |
37 | </html> | 37 | </html> |
@@ -15,25 +15,25 @@ | @@ -15,25 +15,25 @@ | ||
15 | <ul class="two-dim clearfix"> | 15 | <ul class="two-dim clearfix"> |
16 | <li class="left"> | 16 | <li class="left"> |
17 | {{#if devEnv}} | 17 | {{#if devEnv}} |
18 | - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-app.png"> | 18 | + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-app.png"> |
19 | {{^}} | 19 | {{^}} |
20 | - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> | 20 | + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-app.png"> |
21 | {{/if}} | 21 | {{/if}} |
22 | <p>YOHO!有货</p> | 22 | <p>YOHO!有货</p> |
23 | </li> | 23 | </li> |
24 | <li class="left"> | 24 | <li class="left"> |
25 | {{#if devEnv}} | 25 | {{#if devEnv}} |
26 | - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weixin.png"> | 26 | + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weixin.png"> |
27 | {{^}} | 27 | {{^}} |
28 | - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> | 28 | + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weibo.png"> |
29 | {{/if}} | 29 | {{/if}} |
30 | <p>微信</p> | 30 | <p>微信</p> |
31 | </li> | 31 | </li> |
32 | <li class="left"> | 32 | <li class="left"> |
33 | {{#if devEnv}} | 33 | {{#if devEnv}} |
34 | - <img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weibo.png"> | 34 | + <img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weibo.png"> |
35 | {{^}} | 35 | {{^}} |
36 | - <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png"> | 36 | + <img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/qr-weixin.png"> |
37 | {{/if}} | 37 | {{/if}} |
38 | <p>微博</p> | 38 | <p>微博</p> |
39 | </li> | 39 | </li> |
@@ -41,7 +41,7 @@ | @@ -41,7 +41,7 @@ | ||
41 | </div> | 41 | </div> |
42 | </div> | 42 | </div> |
43 | <p class="item-nav center"> | 43 | <p class="item-nav center"> |
44 | - <span class="iconfont cur" key="0"></span> | 44 | + <span class="iconfont cur" key="0"></span> |
45 | </p> | 45 | </p> |
46 | </dd> | 46 | </dd> |
47 | <dd> | 47 | <dd> |
@@ -121,9 +121,9 @@ | @@ -121,9 +121,9 @@ | ||
121 | </ul> | 121 | </ul> |
122 | </div> | 122 | </div> |
123 | <p id="feed-back-page" class="item-nav center"> | 123 | <p id="feed-back-page" class="item-nav center"> |
124 | - <span class="iconfont cur"></span> | ||
125 | - <span class="iconfont "></span> | ||
126 | - <span class="iconfont "></span> | 124 | + <span class="iconfont cur"></span> |
125 | + <span class="iconfont "></span> | ||
126 | + <span class="iconfont "></span> | ||
127 | </p> | 127 | </p> |
128 | </dd> | 128 | </dd> |
129 | <dd class="last"> | 129 | <dd class="last"> |
@@ -139,27 +139,27 @@ | @@ -139,27 +139,27 @@ | ||
139 | <li> | 139 | <li> |
140 | <a href="http://www.yohomars.com/" target="_blank"> | 140 | <a href="http://www.yohomars.com/" target="_blank"> |
141 | {{#if devEnv}} | 141 | {{#if devEnv}} |
142 | - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/mars.png"> | 142 | + <img class="lazy" data-original="http://localhost:3000/img/layout/mars.png"> |
143 | {{^}} | 143 | {{^}} |
144 | - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/mars.png"> | 144 | + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/mars.png"> |
145 | {{/if}} | 145 | {{/if}} |
146 | </a> | 146 | </a> |
147 | </li> | 147 | </li> |
148 | <li> | 148 | <li> |
149 | <a href="http://app.yohoshow.com/" target="_blank"> | 149 | <a href="http://app.yohoshow.com/" target="_blank"> |
150 | {{#if devEnv}} | 150 | {{#if devEnv}} |
151 | - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/show.png"> | 151 | + <img class="lazy" data-original="http://localhost:3000/img/layout/show.png"> |
152 | {{^}} | 152 | {{^}} |
153 | - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/show.png"> | 153 | + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/show.png"> |
154 | {{/if}} | 154 | {{/if}} |
155 | </a> | 155 | </a> |
156 | </li> | 156 | </li> |
157 | <li> | 157 | <li> |
158 | <a href="http://www.yoho.cn/product#yoho" target="_blank"> | 158 | <a href="http://www.yoho.cn/product#yoho" target="_blank"> |
159 | {{#if devEnv}} | 159 | {{#if devEnv}} |
160 | - <img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/yoho.png"> | 160 | + <img class="lazy" data-original="http://localhost:3000/img/layout/yoho.png"> |
161 | {{^}} | 161 | {{^}} |
162 | - <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/yoho.png"> | 162 | + <img class="lazy" data-original="http://cdn.yoho.cn/yohobuy-node/assets/img/layout/yoho.png"> |
163 | {{/if}} | 163 | {{/if}} |
164 | </a> | 164 | </a> |
165 | </li> | 165 | </li> |
@@ -167,7 +167,7 @@ | @@ -167,7 +167,7 @@ | ||
167 | </div> | 167 | </div> |
168 | </div> | 168 | </div> |
169 | <p class="item-nav center"> | 169 | <p class="item-nav center"> |
170 | - <span class="iconfont cur"></span> | 170 | + <span class="iconfont cur"></span> |
171 | </p> | 171 | </p> |
172 | </dd> | 172 | </dd> |
173 | </dl> | 173 | </dl> |
1 | {{# headerData}} | 1 | {{# headerData}} |
2 | - <div class="yoho-header {{headType}}"> | 2 | + <div class="yoho-header {{headtype}}"> |
3 | <div class="tool-wrapper clearfix"> | 3 | <div class="tool-wrapper clearfix"> |
4 | <div class="center-content"> | 4 | <div class="center-content"> |
5 | <div class="yoho-group-map left"> | 5 | <div class="yoho-group-map left"> |
@@ -84,8 +84,10 @@ | @@ -84,8 +84,10 @@ | ||
84 | </form> | 84 | </form> |
85 | </div> | 85 | </div> |
86 | <div class="go-cart"> | 86 | <div class="go-cart"> |
87 | - <span class="iconfont "></span> | ||
88 | - <span class="goods-num-tip">0</span> | 87 | + <a href="http://www.yohobuy.com/shopping/cart"> |
88 | + <span class="iconfont "></span> | ||
89 | + <span class="goods-num-tip">0</span> | ||
90 | + </a> | ||
89 | <div class="mini-cart-wrapper"> | 91 | <div class="mini-cart-wrapper"> |
90 | <div class="loading-cart"> | 92 | <div class="loading-cart"> |
91 | <h3>加载中,请稍后</h3> | 93 | <h3>加载中,请稍后</h3> |
@@ -19,12 +19,10 @@ const serviceApi = config.domains.service; | @@ -19,12 +19,10 @@ const serviceApi = config.domains.service; | ||
19 | const searchApi = config.domains.search; | 19 | const searchApi = config.domains.search; |
20 | 20 | ||
21 | 21 | ||
22 | -let ApiUrl; | 22 | +class Http { |
23 | 23 | ||
24 | -class API { | ||
25 | - | ||
26 | - constructor() { | ||
27 | - ApiUrl = api; | 24 | + constructor(baseUrl) { |
25 | + this.ApiUrl = baseUrl; | ||
28 | } | 26 | } |
29 | 27 | ||
30 | /** | 28 | /** |
@@ -39,39 +37,46 @@ class API { | @@ -39,39 +37,46 @@ class API { | ||
39 | */ | 37 | */ |
40 | _requestFromAPI(options, cacheOption, reqId) { | 38 | _requestFromAPI(options, cacheOption, reqId) { |
41 | let timer = new Timer(); | 39 | let timer = new Timer(); |
40 | + let method = options.method || 'get'; | ||
42 | 41 | ||
42 | + log.info(`${method} api: ${options.url}?${qs.stringify(options.qs)}`); | ||
43 | timer.put('getApi');// 统计时间开始 | 43 | timer.put('getApi');// 统计时间开始 |
44 | - | ||
45 | - log.info(`get api: ${options.url}?${qs.stringify(options.qs)}`); | ||
46 | return rp(options).then((result) => { | 44 | return rp(options).then((result) => { |
47 | let duration = timer.put('getApi');// 统计时间结束 | 45 | let duration = timer.put('getApi');// 统计时间结束 |
48 | 46 | ||
49 | - log.info(`get api success: use: ${duration}ms`); | ||
50 | - if (config.useCache && cacheOption) { | ||
51 | - reqId = reqId || this._getReqId(options); | 47 | + // 数据校验 |
48 | + if (!result || !result.code) { | ||
49 | + log.error('error: 接口返回的数据结构错误,非 JSON'); | ||
50 | + return Promise.reject({ | ||
51 | + statusCode: 500, | ||
52 | + message: '接口返回内容格式错误' | ||
53 | + }); | ||
54 | + } | ||
52 | 55 | ||
53 | - // 数据校验无误,写缓存, 否则返回 Slave 缓存服务器的数据 | ||
54 | - if (result && result.code) { | ||
55 | - let cacheTime = _.isNumber(cacheOption) ? cacheOption : 60; | 56 | + // 写缓存, 否则返回 Slave 缓存服务器的数据 |
57 | + if (config.useCache && cacheOption) { | ||
58 | + let cacheTime = _.isNumber(cacheOption) ? cacheOption : 60; | ||
56 | 59 | ||
57 | - cache.set(`apiCache:${reqId}`, result, cacheTime); | ||
58 | - cache.setSlave(`apiCache:${reqId}`, result, cacheTime); | ||
59 | - } else { | ||
60 | - return this._requestFromCache(options, true); | ||
61 | - } | 60 | + reqId = reqId || this._getReqId(options); |
61 | + cache.set(`apiCache:${reqId}`, result, cacheTime); | ||
62 | + cache.setSlave(`apiCache:${reqId}`, result, 86400); // 二级缓存存储一天 | ||
62 | } | 63 | } |
64 | + | ||
65 | + log.info(`get api success: use: ${duration}ms`); | ||
63 | return result; | 66 | return result; |
64 | - }).catch((error)=>{ | 67 | + }).catch((err)=> { |
65 | let duration = timer.put('getApi');// 统计时间结束 | 68 | let duration = timer.put('getApi');// 统计时间结束 |
66 | 69 | ||
67 | - log.error(`get api fail: use: ${duration}ms, statusCode: ${error.statusCode}, error: ${error.message}`); | 70 | + log.error(`${method} api fail: use: ${duration}ms, code:${err.statusCode}, error: ${err.message}`); |
71 | + log.error(`API: ${options.url}?${qs.stringify(options.qs)}`); | ||
68 | 72 | ||
69 | // 使用缓存的时候,读取二级缓存 | 73 | // 使用缓存的时候,读取二级缓存 |
70 | - if (config.useCache) { | 74 | + if (config.useCache && cacheOption) { |
71 | return this._requestFromCache(options, true); | 75 | return this._requestFromCache(options, true); |
72 | } | 76 | } |
73 | return Promise.reject({ | 77 | return Promise.reject({ |
74 | - error: '接口调用失败' | 78 | + code: 500, |
79 | + message: '接口调用失败' | ||
75 | }); | 80 | }); |
76 | }); | 81 | }); |
77 | } | 82 | } |
@@ -97,14 +102,22 @@ class API { | @@ -97,14 +102,22 @@ class API { | ||
97 | } | 102 | } |
98 | } | 103 | } |
99 | 104 | ||
105 | + // 读取缓存失败,并且不是二级缓存的时候,调用 API | ||
100 | if (!slave) { | 106 | if (!slave) { |
101 | return this._requestFromAPI(options, true, reqId); | 107 | return this._requestFromAPI(options, true, reqId); |
102 | } | 108 | } |
103 | }).catch(() => { | 109 | }).catch(() => { |
104 | log.error(slave ? 'get slave cache fail' : 'get master cache fail'); | 110 | log.error(slave ? 'get slave cache fail' : 'get master cache fail'); |
111 | + | ||
112 | + // 读取缓存失败,并且不是二级缓存的时候,调用 API | ||
105 | if (!slave) { | 113 | if (!slave) { |
106 | return this._requestFromAPI(options, true, reqId); | 114 | return this._requestFromAPI(options, true, reqId); |
107 | } | 115 | } |
116 | + | ||
117 | + return Promise.reject({ | ||
118 | + code: 500, | ||
119 | + message: '接口调用失败' | ||
120 | + }); | ||
108 | }); | 121 | }); |
109 | } | 122 | } |
110 | 123 | ||
@@ -117,7 +130,7 @@ class API { | @@ -117,7 +130,7 @@ class API { | ||
117 | */ | 130 | */ |
118 | get(url, data, cacheOption) { | 131 | get(url, data, cacheOption) { |
119 | let options = { | 132 | let options = { |
120 | - url: `${ApiUrl}${url}`, | 133 | + url: `${this.ApiUrl}${url}`, |
121 | qs: data, | 134 | qs: data, |
122 | json: true, | 135 | json: true, |
123 | timeout: 3000 | 136 | timeout: 3000 |
@@ -138,7 +151,7 @@ class API { | @@ -138,7 +151,7 @@ class API { | ||
138 | */ | 151 | */ |
139 | post(url, data) { | 152 | post(url, data) { |
140 | let options = { | 153 | let options = { |
141 | - url: `${ApiUrl}${url}`, | 154 | + url: `${this.ApiUrl}${url}`, |
142 | form: data, | 155 | form: data, |
143 | method: 'post', | 156 | method: 'post', |
144 | json: true, | 157 | json: true, |
@@ -151,22 +164,27 @@ class API { | @@ -151,22 +164,27 @@ class API { | ||
151 | all(list) { | 164 | all(list) { |
152 | if (_.isArray(list)) { | 165 | if (_.isArray(list)) { |
153 | return Promise.all(list); | 166 | return Promise.all(list); |
167 | + } else { | ||
168 | + return Promise.reject(Error('the parameters of api all method should be Array!')); | ||
154 | } | 169 | } |
155 | - throw Error('the parameters of api all method should be Array!'); | ||
156 | } | 170 | } |
157 | } | 171 | } |
158 | 172 | ||
159 | -class ServiceAPI extends API { | 173 | +class API extends Http { |
174 | + constructor() { | ||
175 | + super(api); | ||
176 | + } | ||
177 | +} | ||
178 | + | ||
179 | +class ServiceAPI extends Http { | ||
160 | constructor() { | 180 | constructor() { |
161 | - super(); | ||
162 | - ApiUrl = serviceApi; | 181 | + super(serviceApi); |
163 | } | 182 | } |
164 | } | 183 | } |
165 | 184 | ||
166 | -class SearchAPI extends API { | 185 | +class SearchAPI extends Http { |
167 | constructor() { | 186 | constructor() { |
168 | - super(); | ||
169 | - ApiUrl = searchApi; | 187 | + super(searchApi); |
170 | } | 188 | } |
171 | } | 189 | } |
172 | 190 |
@@ -26,12 +26,10 @@ camelCaseArray = (list) => { | @@ -26,12 +26,10 @@ camelCaseArray = (list) => { | ||
26 | }; | 26 | }; |
27 | 27 | ||
28 | camelCase = (data) => { | 28 | camelCase = (data) => { |
29 | - if (_.isObject(data)) { | ||
30 | - data = camelCaseObject(data); | ||
31 | - } | ||
32 | - | ||
33 | if (_.isArray(data)) { | 29 | if (_.isArray(data)) { |
34 | data = camelCaseArray(data); | 30 | data = camelCaseArray(data); |
31 | + } else if (_.isObject(data)) { | ||
32 | + data = camelCaseObject(data); | ||
35 | } | 33 | } |
36 | 34 | ||
37 | return data; | 35 | return data; |
library/cookie.js
0 → 100644
1 | +/** | ||
2 | + * 获取 UID | ||
3 | + * @param {[object]} req | ||
4 | + * @return {[string]} | ||
5 | + */ | ||
6 | +exports.getUid = (req) => { | ||
7 | + var _uid = 0, | ||
8 | + cookie = req.cookies._UID, | ||
9 | + cookieList; | ||
10 | + | ||
11 | + if (req.isApp) { | ||
12 | + return req.query.uid || 0; | ||
13 | + } | ||
14 | + | ||
15 | + if (cookie) { | ||
16 | + cookieList = cookie.split('::'); | ||
17 | + if (cookieList[1] && !isNaN(cookieList[1])) { | ||
18 | + _uid = cookieList[1]; | ||
19 | + } | ||
20 | + } | ||
21 | + | ||
22 | + return _uid; | ||
23 | +}; |
@@ -6,6 +6,7 @@ | @@ -6,6 +6,7 @@ | ||
6 | 'use strict'; | 6 | 'use strict'; |
7 | const querystring = require('querystring'); | 7 | const querystring = require('querystring'); |
8 | const _ = require('lodash'); | 8 | const _ = require('lodash'); |
9 | +const moment = require('moment'); | ||
9 | const config = require('../config/common'); | 10 | const config = require('../config/common'); |
10 | 11 | ||
11 | /** | 12 | /** |
@@ -29,8 +30,8 @@ exports.image = (url, width, height, mode) => { | @@ -29,8 +30,8 @@ exports.image = (url, width, height, mode) => { | ||
29 | * @param {[string]} module 模块 | 30 | * @param {[string]} module 模块 |
30 | * @return {[string]} | 31 | * @return {[string]} |
31 | */ | 32 | */ |
32 | -exports.url = (uri, qs, module) => { | ||
33 | - const subDomain = '.m.yohobuy.com'; | 33 | +exports.urlFormat = (uri, qs, module) => { |
34 | + const subDomain = '.yohobuy.com'; | ||
34 | const subName = { | 35 | const subName = { |
35 | default: config.siteUrl, | 36 | default: config.siteUrl, |
36 | guang: '//guang' + subDomain, | 37 | guang: '//guang' + subDomain, |
@@ -75,3 +76,62 @@ exports.upperCase = (str) => { | @@ -75,3 +76,62 @@ exports.upperCase = (str) => { | ||
75 | str = str || ''; | 76 | str = str || ''; |
76 | return str.toUpperCase(); | 77 | return str.toUpperCase(); |
77 | }; | 78 | }; |
79 | + | ||
80 | +/** | ||
81 | + * 时间格式化 | ||
82 | + * @param format 格式化token @see{http://momentjs.cn/docs/#/displaying/format/} | ||
83 | + * @param date 日期或者数字 | ||
84 | + * @return string | ||
85 | + * | ||
86 | + */ | ||
87 | +exports.dateFormat = (format, date) => { | ||
88 | + if (typeof format !== 'string' || typeof date === 'undefined') { | ||
89 | + return ''; | ||
90 | + } else { | ||
91 | + if (date instanceof Date) { | ||
92 | + return moment(date).format(format); | ||
93 | + } else { | ||
94 | + let d = moment.unix(date); | ||
95 | + | ||
96 | + return moment(d).utc().format(format); | ||
97 | + } | ||
98 | + } | ||
99 | +}; | ||
100 | + | ||
101 | +/** | ||
102 | + * 时间差格式化 | ||
103 | + * @param {[string]} format 格式化字符串 | ||
104 | + * @param {[number]} diff 相差值 | ||
105 | + * @param {[string]} type diff时间类型 默认ms | ||
106 | + * | ||
107 | + * Key Shorthand | ||
108 | + * years y | ||
109 | + * quarters Q | ||
110 | + * months M | ||
111 | + * weeks w | ||
112 | + * days d | ||
113 | + * hours h | ||
114 | + * minutes m | ||
115 | + * seconds s | ||
116 | + * milliseconds ms | ||
117 | + * | ||
118 | + * @example | ||
119 | + * let diff = 60 * 60 * 24 * (1.3) + 2; | ||
120 | + * | ||
121 | + * let s = helpers.dateDiffFormat('{d}天{h}小时', diff, 's'); | ||
122 | + * >>> 1天7小时 | ||
123 | + */ | ||
124 | +exports.dateDiffFormat = (format, diff, type) => { | ||
125 | + if (typeof format !== 'string' || typeof diff === 'undefined') { | ||
126 | + return ''; | ||
127 | + } else { | ||
128 | + type = type || 'ms'; | ||
129 | + let m = moment.duration(diff, type); | ||
130 | + | ||
131 | + format.match(/(\{.*?\})/g).forEach((s) => { | ||
132 | + format = format.replace(s, m.get(s.substring(1, s.length - 1))); | ||
133 | + }); | ||
134 | + | ||
135 | + return format; | ||
136 | + } | ||
137 | +}; |
@@ -25,7 +25,7 @@ class Timer { | @@ -25,7 +25,7 @@ class Timer { | ||
25 | if (labelTime) { | 25 | if (labelTime) { |
26 | let duration = process.hrtime(labelTime); | 26 | let duration = process.hrtime(labelTime); |
27 | 27 | ||
28 | - return this._round(duration[1]); | 28 | + return this._round(duration[0], duration[1]); |
29 | } else { | 29 | } else { |
30 | this.timers[label] = process.hrtime(); | 30 | this.timers[label] = process.hrtime(); |
31 | } | 31 | } |
@@ -35,8 +35,8 @@ class Timer { | @@ -35,8 +35,8 @@ class Timer { | ||
35 | * 格式化成毫秒 | 35 | * 格式化成毫秒 |
36 | * @param {Number} value 纳秒 | 36 | * @param {Number} value 纳秒 |
37 | */ | 37 | */ |
38 | - _round(value) { | ||
39 | - return Math.round(value / 10000) / 100; | 38 | + _round(seconds, nanoseconds) { |
39 | + return Math.round((seconds * 1e9 + nanoseconds) / 10000) / 100; | ||
40 | } | 40 | } |
41 | 41 | ||
42 | } | 42 | } |
1 | { | 1 | { |
2 | - "name": "m-yohobuy-node", | 2 | + "name": "yohobuy-node", |
3 | "version": "0.0.1", | 3 | "version": "0.0.1", |
4 | "private": true, | 4 | "private": true, |
5 | "description": "A New Yohobuy Project With Express", | 5 | "description": "A New Yohobuy Project With Express", |
@@ -11,33 +11,51 @@ | @@ -11,33 +11,51 @@ | ||
11 | "start": "node app.js", | 11 | "start": "node app.js", |
12 | "dev": "node_modules/.bin/nodemon -e js,hbs -i public/ app.js", | 12 | "dev": "node_modules/.bin/nodemon -e js,hbs -i public/ app.js", |
13 | "online": "NODE_ENV=\"production\" node app.js", | 13 | "online": "NODE_ENV=\"production\" node app.js", |
14 | - "debug": "DEBUG=\"express:*\" node app.js", | 14 | + "debug": "DEBUG=\"express:*\" node_modules/.bin/nodemon -e js,hbs -i public/ app.js", |
15 | "lint-js": "./node_modules/.bin/eslint -c .eslintrc --cache --fix .", | 15 | "lint-js": "./node_modules/.bin/eslint -c .eslintrc --cache --fix .", |
16 | - "lint-css": "./node_modules/.bin/stylelint --config .stylelintrc public/**/*.css", | ||
17 | - "precommit": "node lint.js" | 16 | + "lint-css": "./node_modules/.bin/stylelint --config .stylelintrc public/scss/**/*.css", |
17 | + "precommit": "node lint.js", | ||
18 | + "test": "NODE_ENV=test ./node_modules/.bin/nyc ./node_modules/.bin/ava", | ||
19 | + "posttest": "./node_modules/.bin/nyc report --reporter=html" | ||
20 | + }, | ||
21 | + "ava": { | ||
22 | + "tap": true, | ||
23 | + "require": [ | ||
24 | + "babel-register" | ||
25 | + ], | ||
26 | + "babel": { | ||
27 | + "presets": [ | ||
28 | + "es2015" | ||
29 | + ] | ||
30 | + } | ||
18 | }, | 31 | }, |
19 | "license": "MIT", | 32 | "license": "MIT", |
20 | "dependencies": { | 33 | "dependencies": { |
21 | - "bluebird": "^3.3.5", | 34 | + "bluebird": "^3.4.0", |
22 | "body-parser": "^1.15.0", | 35 | "body-parser": "^1.15.0", |
23 | - "connect-memcached": "^0.2.0", | ||
24 | "cookie-parser": "^1.4.1", | 36 | "cookie-parser": "^1.4.1", |
25 | "express": "^4.13.1", | 37 | "express": "^4.13.1", |
26 | "express-handlebars": "^3.0.0", | 38 | "express-handlebars": "^3.0.0", |
27 | - "express-session": "^1.13.0", | ||
28 | "influxdb-winston": "^1.0.1", | 39 | "influxdb-winston": "^1.0.1", |
29 | "lodash": "^4.12.0", | 40 | "lodash": "^4.12.0", |
30 | "md5": "^2.1.0", | 41 | "md5": "^2.1.0", |
31 | - "memcached": "^2.2.1", | 42 | + "memcached": "^2.2.2", |
43 | + "moment": "^2.13.0", | ||
32 | "morgan": "^1.7.0", | 44 | "morgan": "^1.7.0", |
33 | "oneapm": "^1.2.20", | 45 | "oneapm": "^1.2.20", |
34 | "request-promise": "^3.0.0", | 46 | "request-promise": "^3.0.0", |
35 | "serve-favicon": "^2.3.0", | 47 | "serve-favicon": "^2.3.0", |
48 | + "uuid": "^2.0.2", | ||
36 | "winston": "^2.2.0", | 49 | "winston": "^2.2.0", |
37 | - "winston-daily-rotate-file": "^1.0.1" | 50 | + "winston-daily-rotate-file": "^1.0.1", |
51 | + "yoho-connect-memcached": "^1.0.3", | ||
52 | + "yoho-express-session": "^1.0.2" | ||
38 | }, | 53 | }, |
39 | "devDependencies": { | 54 | "devDependencies": { |
40 | "autoprefixer": "^6.3.6", | 55 | "autoprefixer": "^6.3.6", |
56 | + "ava": "^0.14.0", | ||
57 | + "babel-preset-es2015": "^6.9.0", | ||
58 | + "babel-register": "^6.9.0", | ||
41 | "eslint": "^2.10.2", | 59 | "eslint": "^2.10.2", |
42 | "eslint-config-yoho": "^1.0.1", | 60 | "eslint-config-yoho": "^1.0.1", |
43 | "gulp": "^3.9.1", | 61 | "gulp": "^3.9.1", |
@@ -47,8 +65,8 @@ | @@ -47,8 +65,8 @@ | ||
47 | "gulp-sourcemaps": "^2.0.0-alpha", | 65 | "gulp-sourcemaps": "^2.0.0-alpha", |
48 | "gulp-util": "^3.0.7", | 66 | "gulp-util": "^3.0.7", |
49 | "husky": "^0.11.4", | 67 | "husky": "^0.11.4", |
50 | - "mocha": "^2.4.5", | ||
51 | "nodemon": "1.9.2", | 68 | "nodemon": "1.9.2", |
69 | + "nyc": "^6.4.3", | ||
52 | "postcss-assets": "^4.0.1", | 70 | "postcss-assets": "^4.0.1", |
53 | "postcss-cachebuster": "^0.1.2", | 71 | "postcss-cachebuster": "^0.1.2", |
54 | "postcss-calc": "^5.2.1", | 72 | "postcss-calc": "^5.2.1", |
@@ -57,19 +75,23 @@ | @@ -57,19 +75,23 @@ | ||
57 | "postcss-crip": "^2.0.0", | 75 | "postcss-crip": "^2.0.0", |
58 | "postcss-opacity": "^3.0.0", | 76 | "postcss-opacity": "^3.0.0", |
59 | "postcss-position": "^0.4.0", | 77 | "postcss-position": "^0.4.0", |
78 | + "postcss-pxtorem": "^3.3.1", | ||
60 | "postcss-short": "^1.4.0", | 79 | "postcss-short": "^1.4.0", |
61 | "postcss-sprites": "^3.1.2", | 80 | "postcss-sprites": "^3.1.2", |
62 | - "postcss-use": "^2.1.0", | 81 | + "postcss-use": "^2.0.2", |
63 | "precss": "^1.4.0", | 82 | "precss": "^1.4.0", |
64 | "rewire": "^2.5.1", | 83 | "rewire": "^2.5.1", |
65 | "shelljs": "^0.7.0", | 84 | "shelljs": "^0.7.0", |
66 | - "stylelint": "^6.3.3", | 85 | + "stylelint": "^6.4.1", |
67 | "stylelint-config-yoho": "^1.2.3", | 86 | "stylelint-config-yoho": "^1.2.3", |
68 | "webpack": "^1.13.0", | 87 | "webpack": "^1.13.0", |
69 | "webpack-dev-server": "^1.14.1", | 88 | "webpack-dev-server": "^1.14.1", |
70 | "webpack-stream": "^3.1.0", | 89 | "webpack-stream": "^3.1.0", |
90 | + "yoho-fastclick": "^1.0.6", | ||
91 | + "yoho-hammer": "^2.0.7", | ||
71 | "yoho-handlebars": "^4.0.5", | 92 | "yoho-handlebars": "^4.0.5", |
72 | "yoho-jquery": "^1.9.1", | 93 | "yoho-jquery": "^1.9.1", |
73 | - "yoho-jquery-lazyload": "^1.9.7" | 94 | + "yoho-jquery-lazyload": "^1.9.7", |
95 | + "yoho-swiper": "^3.3.1" | ||
74 | } | 96 | } |
75 | } | 97 | } |
1 | +/** ****/ (function(modules) { // webpackBootstrap | ||
2 | +/** ****/ // The module cache | ||
3 | +/** ****/ var installedModules = {}; | ||
4 | + | ||
5 | +/** ****/ // The require function | ||
6 | +/** ****/ function __webpack_require__(moduleId) { | ||
7 | + | ||
8 | +/** ****/ // Check if module is in cache | ||
9 | +/** ****/ if (installedModules[moduleId]) | ||
10 | +/** ****/ return installedModules[moduleId].exports; | ||
11 | + | ||
12 | +/** ****/ // Create a new module (and put it into the cache) | ||
13 | +/** ****/ var module = installedModules[moduleId] = { | ||
14 | +/** ****/ exports: {}, | ||
15 | +/** ****/ id: moduleId, | ||
16 | +/** ****/ loaded: false | ||
17 | +/** ****/ }; | ||
18 | + | ||
19 | +/** ****/ // Execute the module function | ||
20 | +/** ****/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
21 | + | ||
22 | +/** ****/ // Flag the module as loaded | ||
23 | +/** ****/ module.loaded = true; | ||
24 | + | ||
25 | +/** ****/ // Return the exports of the module | ||
26 | +/** ****/ return module.exports; | ||
27 | +/** ****/ } | ||
28 | + | ||
29 | + | ||
30 | +/** ****/ // expose the modules object (__webpack_modules__) | ||
31 | +/** ****/ __webpack_require__.m = modules; | ||
32 | + | ||
33 | +/** ****/ // expose the module cache | ||
34 | +/** ****/ __webpack_require__.c = installedModules; | ||
35 | + | ||
36 | +/** ****/ // __webpack_public_path__ | ||
37 | +/** ****/ __webpack_require__.p = ''; | ||
38 | + | ||
39 | +/** ****/ // Load entry module and return exports | ||
40 | +/** ****/ return __webpack_require__(0); | ||
41 | +/** ****/ })([ | ||
42 | +/* 0 */ | ||
43 | +/** */ function(module, exports) { | ||
44 | + | ||
45 | + console.log(1); | ||
46 | + | ||
47 | + | ||
48 | +/** */ } | ||
49 | +/** ****/ ]); |
public/dist/yohobuy-node/0.0.1/index.css
0 → 100644
1 | +a,abbr,acronym,address,applet,article,aside,audio,b,big,blockquote,body,canvas,caption,center,cite,code,dd,del,details,dfn,div,dl,dt,em,embed,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,output,p,pre,q,ruby,s,samp,section,small,span,strike,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,tt,u,ul,var,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}html{line-height:1}ol,ul{list-style:none}table{border-collapse:collapse;border-spacing:0}caption,td,th{text-align:left;font-weight:400;vertical-align:middle}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:"";content:none}a img{border:none}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,section,summary{display:block}.clearfix:after{content:'';display:block;clear:both}body{font-family:arial,Microsoft YaHei}@font-face{font-family:iconfont;src:url(../assets/font/iconfont.eot?v154cdedb881);src:url(../assets/font/iconfont.eot?v154cdedb881#iefix) format('embedded-opentype'),url(../assets/font/iconfont.woff?v154cdedb8de) format('woff'),url(../assets/font/iconfont.ttf?v154cdedb8a4) format('truetype'),url(../assets/font/iconfont.svg?v154cdedb89f#iconfont) format('svg')}.iconfont{font-family:iconfont!important;font-size:16px;font-style:normal;text-decoration:none;-webkit-font-smoothing:antialiased;-webkit-text-stroke-width:.2px;-moz-osx-font-smoothing:grayscale}.center-content{width:1150px;margin-left:auto;margin-right:auto}.min-screen .center-content{width:990px}.left,.pull-left{float:left}.pull-right,.right{float:right}.center{text-align:center}.hide{display:none!important}a:focus,input,textarea{outline:none}a{text-decoration:none;color:#000}.body-mask{position:absolute;z-index:2;background:#000;opacity:.2;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=20)";top:0;left:0}.yoho-header .tool-wrapper{width:100%;height:32px;line-height:32px;font-size:12px;background-color:#f4f4f4}.yoho-header .tool-wrapper .yoho-group-map{padding:0 5px}.yoho-header .tool-wrapper .yoho-group-map .yoho-group-list{position:absolute;display:none;width:170px;top:32px;margin-left:-5px;background-color:#f4f4f4;padding:20px 0 20px 20px;z-index:4}.yoho-header .tool-wrapper .yoho-group-map li a{color:#9196a0;font-size:14px}.yoho-header .tool-wrapper .yoho-group-map li:hover a{color:#000}.yoho-header .tool-wrapper .yoho-group-map:hover{background-color:#dcdcdc}.yoho-header .tool-wrapper .yoho-group-map:hover .yoho-group-list{display:block}.yoho-header .tool-wrapper .yoho-buy-tools li{float:left;padding-right:10px}.yoho-header .tool-wrapper .yoho-buy-tools li span{display:inline-block;vertical-align:middle;line-height:30px}.yoho-header .tool-wrapper .yoho-buy-tools li .hi{vertical-align:top}.yoho-header .tool-wrapper .yoho-buy-tools li a{color:#8e8e8e}.yoho-header .tool-wrapper .yoho-buy-tools .nick-name{color:#000}.yoho-header .tool-wrapper .yoho-buy-tools .tag-seprate{width:0;margin-top:11px;margin-right:12px;height:14px;float:left;border-left:1px solid #dcdcdc}.yoho-header .tool-wrapper .simple-user-center{top:32px;margin-left:-110px;width:300px;position:absolute;background-color:#f8f8f8;z-index:2;display:none}.yoho-header .tool-wrapper .simple-user-center .account-info-header{margin:17px auto 0;width:257px;border-bottom:1px solid #dcdcdc;text-align:center;padding-bottom:15px}.yoho-header .tool-wrapper .simple-user-center .user-img{width:63px;height:63px;margin:0 auto;border-radius:50%;overflow:hidden;background:url(../assets/img/layout/default-thumb.png?v154cdedb8a1) 50%;filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod='scale')";background-size:100% 100%;-moz-background-size:100% 100%}.yoho-header .tool-wrapper .simple-user-center .user-name{margin-top:14px;line-height:25px}.yoho-header .tool-wrapper .simple-user-center .user-level{color:#000;height:20px;line-height:20px;font-size:18px}.yoho-header .tool-wrapper .simple-user-center .user-level span{color:#8cc4f9}.yoho-header .tool-wrapper .simple-user-center .level-detail{font-size:14px;line-height:14px;padding-top:10px;padding-left:20px}.yoho-header .tool-wrapper .simple-user-center .level-view-bar{width:150px;height:14px;margin-right:5px;text-align:left;background-color:#e2e2e2;display:inline-block;vertical-align:middle;overflow:hidden}.yoho-header .tool-wrapper .simple-user-center .level-view-bar .text-span{font-size:16px;line-height:16px;padding-left:3px;position:absolute}.yoho-header .tool-wrapper .simple-user-center .level-view-bar .integrate{height:14px;background-color:#ceae64;padding-left:5px}.yoho-header .tool-wrapper .simple-user-center .account-info-content{padding:20px 30px 0;border-bottom:1px solid #dcdcdc}.yoho-header .tool-wrapper .simple-user-center .account-info-content li{float:none;font-size:16px}.yoho-header .tool-wrapper .simple-user-center .account-info-content a{font-size:14px;color:#000}.yoho-header .tool-wrapper .simple-user-center .account-info-footer{height:51px;line-height:51px;text-align:center}.yoho-header .tool-wrapper .simple-user-center .account-info-footer a{font-size:14px;color:#000}.yoho-header .tool-wrapper .myyoho:hover{background-color:#dcdcdc}.yoho-header .tool-wrapper .myyoho:hover .simple-user-center{display:block}.yoho-header .tool-wrapper .download-app-box{position:absolute;top:32px;margin-left:-100px;width:231px;height:290px;background-color:#f8f8f8;z-index:4;display:none}.yoho-header .tool-wrapper .download-app-box .qr-img{position:relative;background-image:url(../assets/img/layout/qr.png?v154cdedbbc0);background-repeat:no-repeat;background-size:100% 100%;margin:32px auto 15px;width:143px;height:147px}.yoho-header .tool-wrapper .download-app-box .qr-words{height:25px;line-height:25px;font-size:16px;text-align:center}.yoho-header .tool-wrapper .download-app-box .qr-more{margin-top:6px;line-height:25px;font-size:14px;text-align:center}.yoho-header .tool-wrapper .phoneapp:hover{background-color:#dcdcdc}.yoho-header .tool-wrapper .phoneapp:hover .download-app-box{display:block}.yoho-header .tool-wrapper .icon-hamburger{background:url(../assets/img/layout/hamburger.png?v154cdedb924) no-repeat;width:16px;height:12px;display:inline-block;vertical-align:middle}.yoho-header .tool-wrapper .icon-bottomarrow{background:url(../assets/img/layout/bottom-arrow.png?v154cdedb899) no-repeat;width:10px;height:5px;margin-top:-2px}.yoho-header .tool-wrapper .icon-papers{background:url(../assets/img/layout/paper.png?v154cdedbbb8) no-repeat;width:10px;height:14px;margin-top:-2px}.yoho-header .tool-wrapper .icon-heart{background:url(../assets/img/layout/heart.png?v154cdedb933) no-repeat;width:12px;height:11px;margin-top:-2px}.yoho-header .tool-wrapper .icon-mail{background:url(../assets/img/layout/mail.png?v154cdedbbaf) no-repeat;width:16px;height:10px;margin-top:-2px}.yoho-header .tool-wrapper .icon-phone{background:url(../assets/img/layout/iphone.png?v154cdedbb70) no-repeat;width:8px;height:14px;margin-top:-2px}.yoho-header .head-wrapper{width:100%}.yoho-header .head-wrapper .main-nav-list{display:inline-block;vertical-align:top;padding-top:45px}.yoho-header .head-wrapper .main-nav-list li{float:left;padding:8px 23px 5px}.yoho-header .head-wrapper .main-nav-list li a{font-size:12px;line-height:14px}.yoho-header .head-wrapper .main-nav-list li .name-cn a{font-size:16px}.yoho-header .head-wrapper .main-nav-list .cure{color:#fff;background-color:#3a3a3a}.yoho-header .head-wrapper .main-nav-list .cure a{color:#fff}.yoho-header .head-wrapper .main-logo{background:url(../assets/img/layout/logo-en.png?v154cdedbbaa) no-repeat 50%;width:182px;height:53px;left:42%;margin-top:22px;position:absolute;animation:logoflip 20s infinite;-moz-animation:logoflip 20s infinite;-webkit-animation:logoflip 20s infinite;-o-animation:logoflip 20s infinite}.yoho-header .head-wrapper .main-logo .main-link{display:block;width:100%;height:100%}.yoho-header .head-wrapper .func-area{float:right;width:378px;padding-right:18px;margin-top:45px}.yoho-header .head-wrapper .search-2016{width:320px;height:28px;background-color:#3a3a3a;border:1px solid #3a3a3a;display:inline-block;overflow:hidden}.yoho-header .head-wrapper .search-2016 input{width:240px;height:100%;border:none;background:#fff;box-sizing:border-box;padding:7px 0 9px 10px}.yoho-header .head-wrapper .search-2016 .search-btn{background:url(../assets/img/layout/search.png?v154cdedbbc2) no-repeat 50%;width:80px;height:28px;float:right;border:none;cursor:pointer}.yoho-header .head-wrapper .search-suggest{position:absolute;width:320px;border:1px solid #000;margin-top:29px;padding-top:20px;background-color:#fff;display:none;z-index:4}.yoho-header .head-wrapper .search-suggest .action,.yoho-header .head-wrapper .search-suggest li:hover{background-color:#eee}.yoho-header .head-wrapper .search-suggest a{display:block;padding:5px;height:25px;line-height:25px;font-size:12px}.yoho-header .head-wrapper .search-suggest .valuenum{float:right}.yoho-header .head-wrapper .go-cart{width:30px;height:30px;float:right;cursor:pointer;position:relative}.yoho-header .head-wrapper .go-cart .iconfont{font-size:26px;color:#3a3a3a}.yoho-header .head-wrapper .go-cart .goods-num-tip{position:absolute;background:url(../assets/img/layout/ic-information.png?v154cdedb963) no-repeat;width:27px;height:20px;top:-10px;right:-15px;color:#fff;text-align:center;line-height:20px;font-size:12px}.yoho-header .head-wrapper .mini-cart-wrapper{position:absolute;top:30px;right:-14px;width:378px;background:#f8f8f8 url(../assets/img/layout/empty_car.png?v154cdedb8a5) no-repeat 106px 132px;z-index:4;display:none}.yoho-header .head-wrapper .mini-cart-wrapper .empty-cart{padding:280px 0 200px;text-align:center}.yoho-header .head-wrapper .mini-cart-wrapper .loading-cart{padding:200px 0;text-align:center;background:#f8f8f8 reslove('layout/loading.gif') no-repeat center 170px}.yoho-header .head-wrapper .mini-cart-wrapper .rich-cart{background:#f8f8f8}.yoho-header .head-wrapper .mini-cart-wrapper .goods-list{padding-top:20px;margin-bottom:15px;max-height:444px;overflow-x:hidden}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item{padding:0 0 18px 18px}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item>div{font-size:14px;display:inline-block;vertical-align:top}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item p{margin-bottom:12px}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item .goods-img{width:60px}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item .goods-info{width:170px;color:#b0b0b0}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item .goods-price{min-width:90px;text-align:right}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item .title{width:170px;height:14px;font-size:14px;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.yoho-header .head-wrapper .mini-cart-wrapper .goods-item .title>a{color:#666}.yoho-header .head-wrapper .mini-cart-wrapper .activity-item{font-size:14px;margin-bottom:8px;padding-left:18px;line-height:18px}.yoho-header .head-wrapper .mini-cart-wrapper .activity-item label{width:60px;height:18px;background-color:#3a3a3a;color:#fff;text-align:center;margin-right:13px;vertical-align:top;display:inline-block}.yoho-header .head-wrapper .mini-cart-wrapper .activity-item h3{width:250px;color:#3a3a3a;font-size:12px;word-break:break-all;display:inline-block}.yoho-header .head-wrapper .mini-cart-wrapper .go-full-cart{padding:0 18px}.yoho-header .head-wrapper .mini-cart-wrapper .go-full-cart>div{height:61px;line-height:61px;border-top:1px solid #dcdcdc;text-align:center}.yoho-header .head-wrapper .on-hover .mini-cart-wrapper{display:block}.yoho-header .nav-wrapper{height:40px;width:100%;background-color:#3a3a3a;position:relative}.yoho-header .nav-wrapper .sub-nav-list{float:left}.yoho-header .nav-wrapper .sub-nav-list li{float:left;line-height:40px;padding-right:46px;box-sizing:border-box;margin-right:38px}.yoho-header .nav-wrapper .sub-nav-list .newlogo{display:block;width:26px;height:12px;background-image:url(../assets/img/layout/new.png?v154cdedbbb5);background-repeat:no-repeat;position:absolute;margin-top:-20px;margin-left:16px}.yoho-header .nav-wrapper .sub-nav-list a{color:#fff;font-size:14px;line-height:14px;display:inline-block}.yoho-header .nav-wrapper .sub-nav-list li:hover a{padding-bottom:3px;border-bottom:2px solid #fff}.yoho-header .nav-wrapper .third-nav-wrapper{width:100%;height:410px;box-sizing:border-box;position:absolute;left:0;top:38px;display:none;padding:30px 0;background-color:#f8f8f8;z-index:3}.yoho-header .nav-wrapper .third-nav-wrapper a{font-size:14px;border-bottom:none!important}.yoho-header .nav-wrapper .third-nav-wrapper dl{float:left;width:278px;height:352px;box-sizing:border-box;border-left:1px solid #ccc;padding:0 50px}.yoho-header .nav-wrapper .third-nav-wrapper dl:first-child{width:228px;border-left:0;padding-left:0}.yoho-header .nav-wrapper .third-nav-wrapper dt{width:180px;padding-bottom:10px;border-bottom:1px solid #000;line-height:18px;margin-bottom:20px}.yoho-header .nav-wrapper .third-nav-wrapper dt a{color:#000}.yoho-header .nav-wrapper .third-nav-wrapper dd{line-height:14px;height:14px;margin-bottom:24px}.yoho-header .nav-wrapper .third-nav-wrapper dd a{color:#a1a1a1}.yoho-header .nav-wrapper .third-nav-wrapper dd a:hover{text-decoration:underline}.yoho-header .nav-wrapper .third-nav-wrapper .hot{color:#e01}.yoho-header .nav-wrapper .show-detail{box-sizing:border-box;padding-left:19px;padding-right:19px;width:337px;height:250px;float:right}.yoho-header .nav-wrapper .show-detail .title{width:100%;margin-top:40px;text-align:center;font-size:14px;color:#000;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.yoho-header.girls .search-2016{background-color:#ff88ae;border-color:#ff88ae}.yoho-header.girls .cure,.yoho-header.girls .nav-wrapper{background-color:#ff88ae!important}.yoho-header.girls .go-cart .iconfont{color:#ff88ae}.yoho-header.kids .search-2016{background-color:#7bd3f9;border-color:#7bd3f9}.yoho-header.kids .cure,.yoho-header.kids .nav-wrapper{background-color:#7bd3f9!important}.yoho-header.kids .go-cart .iconfont{color:#7bd3f9}.yoho-header.lifestyle .search-2016{background-color:#5e4b3c;border-color:#5e4b3c}.yoho-header.lifestyle .cure,.yoho-header.lifestyle .nav-wrapper{background-color:#5e4b3c!important}.yoho-header.lifestyle .go-cart .iconfont{color:#5e4b3c}.min-screen .head-wrapper .main-nav-list>li{padding:8px 14px 5px}.min-screen .nav-wrapper .sub-nav-list>li{margin-right:15px}.min-screen .nav-wrapper .show-detail{width:190px;padding-right:0}.min-screen .head-wrapper .main-logo{left:39%}.yoho-footer{font-size:12px}.yoho-footer *{box-sizing:border-box}.yoho-footer .red{color:#e01}.yoho-footer .rgb6{color:#666}.yoho-footer .rgb9{color:#999}.yoho-footer .rgbf{color:#fff}.yoho-footer .index-foot{background:#eee;padding:20px 0}.yoho-footer .index-foot dd{float:left;width:370px;margin-right:20px;overflow:hidden}.yoho-footer .index-foot dd ul{margin-top:18px;padding-top:18px}.yoho-footer .index-foot dd.last{margin-right:0}.yoho-footer .foot-panel{background:#fff;padding:20px}.yoho-footer .title{position:relative;text-align:center}.yoho-footer .title-line{border-bottom:1px solid #ddd;position:absolute;top:9px;width:100%;left:0}.yoho-footer .text{position:absolute;width:100%;text-align:center;left:0;top:0}.yoho-footer .text span{background:#fff;font-size:18px;line-height:18px;padding:0 10px}.yoho-footer .item-nav{padding-top:20px}.yoho-footer .item-nav span{color:#fff;padding:0 3px;cursor:pointer;font-size:20px}.yoho-footer .item-nav .cur{color:#999}.yoho-footer .vote{line-height:24px}.yoho-footer .vote input{margin:0 5px 0 1px}.yoho-footer .vote .button{height:24px;line-height:24px;width:55px;font-size:12px;margin-top:11px;margin-right:10px;background:#222;color:#fff;display:inline-block;text-align:center;cursor:pointer}.yoho-footer .vote p{height:24px;overflow:hidden}.yoho-footer .vote textarea{width:98%;height:68px;vertical-align:middle;margin:5px 0 0;resize:none}.yoho-footer .vote-item p{float:left;width:50%}.yoho-footer .mobile{margin-right:-10px}.yoho-footer .mobile li{margin-right:10px;float:left}.yoho-footer .mobile img{display:block;width:103px;height:131px}.yoho-footer .index-banner{width:100%;margin-top:20px}.yoho-footer .two-dim{margin-right:-10px;overflow:hidden}.yoho-footer .two-dim li{border:1px solid #ddd;padding:7px;margin-right:10px}.yoho-footer .two-dim li a{display:block}.yoho-footer .two-dim li p{text-align:center;margin-top:13px;margin-bottom:3px;line-height:12px}.yoho-footer .dim-img{display:block;width:87px;height:87px}.yoho-footer .dim-hover{position:absolute}.yoho-footer .dim-hover img{width:38px;height:38px}.yoho-footer .dim-active .dim-img{opacity:1;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"}.yoho-footer .dim-active .dim-hover{display:none}.yoho-footer .footerbottom{width:100%}.yoho-footer .promise{padding:20px 0 10px;background:#000}.yoho-footer .promise .left{margin-right:60px;line-height:30px;font-size:12px;font-weight:700}.yoho-footer .promise .left .iconfont{display:inline-block;font-weight:400;font-size:22px;vertical-align:middle;margin-right:5px}.yoho-footer .promise .left:first-child .iconfont{font-size:27px}.yoho-footer .subscribe{border:1px solid #262626;width:240px}.yoho-footer .subscribe input{width:180px;height:32px;padding:0 10px;line-height:32px;border:none;margin:0;background:#000}.yoho-footer .subscribe a{display:block;float:right;margin-right:20px;font-size:20px;line-height:28px;opacity:.5;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"}.yoho-footer .footer-help{background:#000;font-size:12px;overflow:hidden}.yoho-footer .footer-help>div{padding:15px 0;border-top:1px solid #262626}.yoho-footer .footer-help ul{width:110%}.yoho-footer .footer-help p{line-height:24px}.yoho-footer .footer-help p span{color:#fff}.yoho-footer .footer-help p a{color:#666}.yoho-footer .footer-help p a:hover{text-decoration:underline}.yoho-footer .footer-help li{width:180px}.yoho-footer .footer-help .screen{border-top:1px solid #262626;padding:15px 0}.yoho-footer .footer-link{background:#000;padding:10px 0 30px;font-size:12px}.yoho-footer .footer-link .right-flag{margin-top:3px}.yoho-footer .footer-link .right-flag a{margin-right:5px}.yoho-footer .footer-link .about-us{line-height:20px;color:#666;margin-left:10px}.yoho-footer .footer-link .about-us a{color:#666}.yoho-footer .footer-link .about-us span{padding:0 10px}.yoho-footer .return-top{position:fixed;width:60px;height:60px;left:50%;margin-left:595px;text-align:center;line-height:50px;color:#fff;background:#000;opacity:.5;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";bottom:20px;cursor:pointer;z-index:1}.yoho-footer .return-top .iconfont{font-size:34px}.yoho-footer .return-top:hover{opacity:.9;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"}.yoho-footer .return-top.min{left:100%;right:20px;margin-left:auto}.min-screen .yoho-footer .index-foot dd{width:316px}.min-screen .yoho-footer .two-dim{margin-top:26px;margin-bottom:10px;overflow:hidden}.min-screen .yoho-footer .dim-img{width:69px;height:69px}.min-screen .yoho-footer .mobile{margin-top:26px;padding-bottom:15px}.min-screen .yoho-footer .mobile img{width:85px;height:108px}.min-screen .yoho-footer .promise .left{margin-right:45px}.min-screen .yoho-footer .subscribe{width:200px}.min-screen .yoho-footer .subscribe input{width:140px}.min-screen .yoho-footer .footer-help li{width:150px}.wrapper-404{padding:80px 0}.wrapper-404 .main-error{width:560px;height:240px;margin:0 auto}.wrapper-404 .main-error .text1{font-size:24px;margin-top:60px;line-height:24px}.wrapper-404 .main-error .text2{margin:18px 0 10px;line-height:12px}.wrapper-404 .main-error .text3 a{text-decoration:none;color:#666;font-size:12px;outline:none} |
This diff could not be displayed because it is too large.
1 | +/******/ (function(modules) { // webpackBootstrap | ||
2 | +/******/ // The module cache | ||
3 | +/******/ var installedModules = {}; | ||
4 | + | ||
5 | +/******/ // The require function | ||
6 | +/******/ function __webpack_require__(moduleId) { | ||
7 | + | ||
8 | +/******/ // Check if module is in cache | ||
9 | +/******/ if(installedModules[moduleId]) | ||
10 | +/******/ return installedModules[moduleId].exports; | ||
11 | + | ||
12 | +/******/ // Create a new module (and put it into the cache) | ||
13 | +/******/ var module = installedModules[moduleId] = { | ||
14 | +/******/ exports: {}, | ||
15 | +/******/ id: moduleId, | ||
16 | +/******/ loaded: false | ||
17 | +/******/ }; | ||
18 | + | ||
19 | +/******/ // Execute the module function | ||
20 | +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
21 | + | ||
22 | +/******/ // Flag the module as loaded | ||
23 | +/******/ module.loaded = true; | ||
24 | + | ||
25 | +/******/ // Return the exports of the module | ||
26 | +/******/ return module.exports; | ||
27 | +/******/ } | ||
28 | + | ||
29 | + | ||
30 | +/******/ // expose the modules object (__webpack_modules__) | ||
31 | +/******/ __webpack_require__.m = modules; | ||
32 | + | ||
33 | +/******/ // expose the module cache | ||
34 | +/******/ __webpack_require__.c = installedModules; | ||
35 | + | ||
36 | +/******/ // __webpack_public_path__ | ||
37 | +/******/ __webpack_require__.p = ""; | ||
38 | + | ||
39 | +/******/ // Load entry module and return exports | ||
40 | +/******/ return __webpack_require__(0); | ||
41 | +/******/ }) | ||
42 | +/************************************************************************/ | ||
43 | +/******/ ([ | ||
44 | +/* 0 */ | ||
45 | +/***/ function(module, exports) { | ||
46 | + | ||
47 | + | ||
48 | + | ||
49 | +/***/ } | ||
50 | +/******/ ]); |
No preview for this file type
1 | +<?xml version="1.0" standalone="no"?> | ||
2 | +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > | ||
3 | +<svg xmlns="http://www.w3.org/2000/svg"> | ||
4 | +<metadata> | ||
5 | +Created by FontForge 20120731 at Wed May 11 14:40:20 2016 | ||
6 | + By admin | ||
7 | +</metadata> | ||
8 | +<defs> | ||
9 | +<font id="iconfont" horiz-adv-x="1024" > | ||
10 | + <font-face | ||
11 | + font-family="iconfont" | ||
12 | + font-weight="500" | ||
13 | + font-stretch="normal" | ||
14 | + units-per-em="1024" | ||
15 | + panose-1="2 0 6 3 0 0 0 0 0 0" | ||
16 | + ascent="896" | ||
17 | + descent="-128" | ||
18 | + x-height="792" | ||
19 | + bbox="0 -212 1158 896" | ||
20 | + underline-thickness="50" | ||
21 | + underline-position="-100" | ||
22 | + unicode-range="U+0078-E606" | ||
23 | + /> | ||
24 | +<missing-glyph horiz-adv-x="374" | ||
25 | +d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | ||
26 | + <glyph glyph-name=".notdef" horiz-adv-x="374" | ||
27 | +d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | ||
28 | + <glyph glyph-name=".null" horiz-adv-x="0" | ||
29 | + /> | ||
30 | + <glyph glyph-name="nonmarkingreturn" horiz-adv-x="341" | ||
31 | + /> | ||
32 | + <glyph glyph-name="x" unicode="x" horiz-adv-x="1001" | ||
33 | +d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 | ||
34 | +t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 | ||
35 | +t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> | ||
36 | + <glyph glyph-name="uniE600" unicode="" horiz-adv-x="1048" | ||
37 | +d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5 | ||
38 | +t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" /> | ||
39 | + <glyph glyph-name="uniE601" unicode="" | ||
40 | +d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5 | ||
41 | +l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" /> | ||
42 | + <glyph glyph-name="uniE602" unicode="" horiz-adv-x="1048" | ||
43 | +d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42 | ||
44 | +q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26 | ||
45 | +t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z | ||
46 | +M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11zM806 282q-16 0 -27 -11t-11 -27t11 -27.5t27 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z" /> | ||
47 | + <glyph glyph-name="uniE603" unicode="" horiz-adv-x="1158" | ||
48 | +d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87 | ||
49 | +h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" /> | ||
50 | + <glyph glyph-name="uniE604" unicode="" | ||
51 | +d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5 | ||
52 | +t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" /> | ||
53 | + <glyph glyph-name="uniE605" unicode="" | ||
54 | +d="M903 577l-68 69l-388 -388l-231 230l-68 -68l299 -298l65 65z" /> | ||
55 | + <glyph glyph-name="uniE606" unicode="" | ||
56 | +d="M512 599q47 0 88 -18t72 -49t49 -72t18 -89q0 -46 -18 -87t-49 -72t-72 -49t-88 -18t-88 18t-72 49t-49 72t-18 87q0 48 18 89t49 72t72 49t88 18v0zM512 599z" /> | ||
57 | + </font> | ||
58 | +</defs></svg> |
No preview for this file type
No preview for this file type

1008 Bytes

1.62 KB

3.9 KB

946 Bytes

1.08 KB

1.23 KB

1.01 KB

7.28 KB

5.87 KB

4.81 KB

4.81 KB

1.1 KB

17.8 KB

20.3 KB

1.01 KB

30.2 KB

328 KB

201 KB

3.05 KB

1.15 KB

26.6 KB

11.4 KB

3.18 KB

3.11 KB

6.28 KB

3 KB
No preview for this file type
@@ -2,11 +2,11 @@ | @@ -2,11 +2,11 @@ | ||
2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > | 2 | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" > |
3 | <svg xmlns="http://www.w3.org/2000/svg"> | 3 | <svg xmlns="http://www.w3.org/2000/svg"> |
4 | <metadata> | 4 | <metadata> |
5 | -Created by FontForge 20120731 at Tue May 3 14:50:34 2016 | 5 | +Created by FontForge 20120731 at Wed May 11 14:40:20 2016 |
6 | By admin | 6 | By admin |
7 | </metadata> | 7 | </metadata> |
8 | <defs> | 8 | <defs> |
9 | -<font id="iconfont" horiz-adv-x="1048" > | 9 | +<font id="iconfont" horiz-adv-x="1024" > |
10 | <font-face | 10 | <font-face |
11 | font-family="iconfont" | 11 | font-family="iconfont" |
12 | font-weight="500" | 12 | font-weight="500" |
@@ -19,7 +19,7 @@ Created by FontForge 20120731 at Tue May 3 14:50:34 2016 | @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Tue May 3 14:50:34 2016 | ||
19 | bbox="0 -212 1158 896" | 19 | bbox="0 -212 1158 896" |
20 | underline-thickness="50" | 20 | underline-thickness="50" |
21 | underline-position="-100" | 21 | underline-position="-100" |
22 | - unicode-range="U+0078-E604" | 22 | + unicode-range="U+0078-E606" |
23 | /> | 23 | /> |
24 | <missing-glyph horiz-adv-x="374" | 24 | <missing-glyph horiz-adv-x="374" |
25 | d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | 25 | d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> |
@@ -33,13 +33,13 @@ d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | @@ -33,13 +33,13 @@ d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" /> | ||
33 | d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 | 33 | d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5 |
34 | t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 | 34 | t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5 |
35 | t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> | 35 | t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" /> |
36 | - <glyph glyph-name="uniE600" unicode="" | 36 | + <glyph glyph-name="uniE600" unicode="" horiz-adv-x="1048" |
37 | d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5 | 37 | d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5 |
38 | t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" /> | 38 | t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" /> |
39 | - <glyph glyph-name="uniE601" unicode="" horiz-adv-x="1024" | 39 | + <glyph glyph-name="uniE601" unicode="" |
40 | d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5 | 40 | d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5 |
41 | l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" /> | 41 | l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" /> |
42 | - <glyph glyph-name="uniE602" unicode="" | 42 | + <glyph glyph-name="uniE602" unicode="" horiz-adv-x="1048" |
43 | d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42 | 43 | d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42 |
44 | q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26 | 44 | q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26 |
45 | t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z | 45 | t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z |
@@ -47,8 +47,12 @@ M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11 | @@ -47,8 +47,12 @@ M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11 | ||
47 | <glyph glyph-name="uniE603" unicode="" horiz-adv-x="1158" | 47 | <glyph glyph-name="uniE603" unicode="" horiz-adv-x="1158" |
48 | d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87 | 48 | d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87 |
49 | h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" /> | 49 | h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" /> |
50 | - <glyph glyph-name="uniE604" unicode="" horiz-adv-x="1024" | 50 | + <glyph glyph-name="uniE604" unicode="" |
51 | d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5 | 51 | d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5 |
52 | t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" /> | 52 | t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" /> |
53 | + <glyph glyph-name="uniE605" unicode="" | ||
54 | +d="M903 577l-68 69l-388 -388l-231 230l-68 -68l299 -298l65 65z" /> | ||
55 | + <glyph glyph-name="uniE606" unicode="" | ||
56 | +d="M512 599q47 0 88 -18t72 -49t49 -72t18 -89q0 -46 -18 -87t-49 -72t-72 -49t-88 -18t-88 18t-72 49t-49 72t-18 87q0 48 18 89t49 72t72 49t88 18v0zM512 599z" /> | ||
53 | </font> | 57 | </font> |
54 | </defs></svg> | 58 | </defs></svg> |
No preview for this file type
No preview for this file type
@@ -61,7 +61,8 @@ const postcssPlugin = (et) => { | @@ -61,7 +61,8 @@ const postcssPlugin = (et) => { | ||
61 | // assets & sprites config in both dev and pro | 61 | // assets & sprites config in both dev and pro |
62 | if (et === env.pro) { | 62 | if (et === env.pro) { |
63 | assets = { | 63 | assets = { |
64 | - loadPaths: [dist.img, dist.font] | 64 | + loadPaths: [dist.img, dist.font], |
65 | + relativeTo: dist.css | ||
65 | }; | 66 | }; |
66 | 67 | ||
67 | Object.assign(sprites, { | 68 | Object.assign(sprites, { |
public/img/layout/mars.png
0 → 100644

17.8 KB
public/img/layout/qr-app.png
0 → 100644

30.2 KB
public/img/layout/qr-weibo.png
0 → 100644

328 KB
public/img/layout/qr-weixin.png
0 → 100644

201 KB
public/img/layout/show.png
0 → 100644

26.6 KB
public/img/layout/yoho.png
0 → 100644

11.4 KB
@@ -8,7 +8,6 @@ var $ = require('yoho-jquery'); | @@ -8,7 +8,6 @@ var $ = require('yoho-jquery'); | ||
8 | 8 | ||
9 | var $body = $('body'); | 9 | var $body = $('body'); |
10 | 10 | ||
11 | -require('./footer'); | ||
12 | 11 | ||
13 | function cookie(name) { | 12 | function cookie(name) { |
14 | var re = new RegExp(name + '=([^;$]*)', 'i'), | 13 | var re = new RegExp(name + '=([^;$]*)', 'i'), |
@@ -99,7 +98,7 @@ function getShoppingKey() { | @@ -99,7 +98,7 @@ function getShoppingKey() { | ||
99 | a.async = 1; | 98 | a.async = 1; |
100 | a.src = j; | 99 | a.src = j; |
101 | m.parentNode.insertBefore(a, m); | 100 | m.parentNode.insertBefore(a, m); |
102 | -})(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas'); | 101 | +}(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas')); |
103 | 102 | ||
104 | (function() { | 103 | (function() { |
105 | var uid = getUid(); | 104 | var uid = getUid(); |
@@ -177,3 +176,6 @@ window.getUid = getUid; | @@ -177,3 +176,6 @@ window.getUid = getUid; | ||
177 | window.getShoppingKey = getShoppingKey; | 176 | window.getShoppingKey = getShoppingKey; |
178 | 177 | ||
179 | window.queryString = queryString; | 178 | window.queryString = queryString; |
179 | + | ||
180 | +require('./header'); | ||
181 | +require('./footer'); |
@@ -4,10 +4,13 @@ | @@ -4,10 +4,13 @@ | ||
4 | * @date: 2015/12/01 | 4 | * @date: 2015/12/01 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | -var $ = require('yoho-jquery'); | 7 | +var $ = require('yoho-jquery'), |
8 | + lazyLoad = require('yoho-jquery-lazyload'); | ||
8 | 9 | ||
9 | var $returnTop = $('.return-top'); | 10 | var $returnTop = $('.return-top'); |
10 | 11 | ||
12 | +lazyLoad($('img.lazy')); | ||
13 | + | ||
11 | /** | 14 | /** |
12 | * 订阅 | 15 | * 订阅 |
13 | * @return {[type]} [description] | 16 | * @return {[type]} [description] |
@@ -18,8 +21,8 @@ function actionSubscription() { | @@ -18,8 +21,8 @@ function actionSubscription() { | ||
18 | emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/; | 21 | emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/; |
19 | 22 | ||
20 | var iconCode = { | 23 | var iconCode = { |
21 | - mail: '', | ||
22 | - tick: '' | 24 | + mail: '', |
25 | + tick: '' | ||
23 | }; | 26 | }; |
24 | 27 | ||
25 | $subscriberBox.focus(function() { | 28 | $subscriberBox.focus(function() { |
@@ -33,7 +36,7 @@ function actionSubscription() { | @@ -33,7 +36,7 @@ function actionSubscription() { | ||
33 | if (email !== '' && emailReg.test(email)) { | 36 | if (email !== '' && emailReg.test(email)) { |
34 | try { | 37 | try { |
35 | $.ajax({ | 38 | $.ajax({ |
36 | - url: 'http://www.yohobuy.com/common/emailSubscriber', | 39 | + url: 'http://new.yohobuy.com/common/emailsubscriber', |
37 | dataType: 'jsonp', | 40 | dataType: 'jsonp', |
38 | data: { | 41 | data: { |
39 | email: email, | 42 | email: email, |
@@ -94,7 +97,7 @@ function actionhomeFootChange() { | @@ -94,7 +97,7 @@ function actionhomeFootChange() { | ||
94 | }); | 97 | }); |
95 | 98 | ||
96 | $.ajax({ | 99 | $.ajax({ |
97 | - url: 'http://www.yohobuy.com/common/suggestFeedback', | 100 | + url: 'http://new.yohobuy.com/common/suggestfeedback', |
98 | dataType: 'jsonp', | 101 | dataType: 'jsonp', |
99 | data: { | 102 | data: { |
100 | feedback_id: _feedback || 0, | 103 | feedback_id: _feedback || 0, |
@@ -107,7 +110,7 @@ function actionhomeFootChange() { | @@ -107,7 +110,7 @@ function actionhomeFootChange() { | ||
107 | 110 | ||
108 | if (~~data.data.result === 1) { | 111 | if (~~data.data.result === 1) { |
109 | if (index === count - 1) { | 112 | if (index === count - 1) { |
110 | - alert('感谢您的参与!'); | 113 | + alert('感谢您的参与!'); // eslint-disable-line |
111 | return; | 114 | return; |
112 | } | 115 | } |
113 | 116 |
@@ -3,10 +3,8 @@ | @@ -3,10 +3,8 @@ | ||
3 | * @author: yyq<yanqing.yang@yoho.cn> | 3 | * @author: yyq<yanqing.yang@yoho.cn> |
4 | * @date: 2016/5/9 | 4 | * @date: 2016/5/9 |
5 | */ | 5 | */ |
6 | -/* eslint-disable */ | ||
7 | -var $ = require('yoho-jquery'); | ||
8 | - // handlebars = require('yoho.handlebars'), | ||
9 | - // json2 = require('json2'); | 6 | +var $ = require('yoho-jquery'), |
7 | + handlebars = require('yoho-handlebars'); | ||
10 | 8 | ||
11 | var $tool = $('.tool-wrapper'), | 9 | var $tool = $('.tool-wrapper'), |
12 | $yohoGroup = $tool.find('.yoho-group'), | 10 | $yohoGroup = $tool.find('.yoho-group'), |
@@ -21,29 +19,25 @@ var $head = $('.head-wrapper'), | @@ -21,29 +19,25 @@ var $head = $('.head-wrapper'), | ||
21 | 19 | ||
22 | var $subNav = $('.sub-nav-list .contain-third'); | 20 | var $subNav = $('.sub-nav-list .contain-third'); |
23 | 21 | ||
24 | -var apiDomain = $('#api-domain').val(), // 获取登陆状态的地址 | ||
25 | - apiBanner = 'http://new.yohobuy.com/common/getbanner', | ||
26 | - thirdLineNum = 9, | 22 | +var thirdLineNum = 9, |
27 | delayer, | 23 | delayer, |
28 | centerFn, | 24 | centerFn, |
29 | loginFn, | 25 | loginFn, |
30 | cartFn; | 26 | cartFn; |
31 | 27 | ||
32 | -$('#api-domain').remove(); // 删除地址信息 | ||
33 | - | ||
34 | // handlebars模板 | 28 | // handlebars模板 |
35 | -// centerFn = handlebars.compile($('#simple-account-info-tpl').html()); | ||
36 | -// loginFn = handlebars.compile($('#header-login-info-tpl').html()); | ||
37 | -// cartFn = handlebars.compile($('#mini-cart-tpl').html()); | 29 | +centerFn = handlebars.compile($('#simple-account-info-tpl').html()); |
30 | +loginFn = handlebars.compile($('#header-login-info-tpl').html()); | ||
31 | +cartFn = handlebars.compile($('#mini-cart-tpl').html()); | ||
38 | 32 | ||
39 | // handlebars helper | 33 | // handlebars helper |
40 | -// handlebars.registerHelper('notzero', function(v1, options) { | ||
41 | -// if (v1 !== '0') { | ||
42 | -// return options.fn(this); | ||
43 | -// } else { | ||
44 | -// return options.inverse(this); | ||
45 | -// } | ||
46 | -// }); | 34 | +handlebars.registerHelper('notzero', function(v1, options) { |
35 | + if (v1 !== '0') { | ||
36 | + return options.fn(this); | ||
37 | + } else { | ||
38 | + return options.inverse(this); | ||
39 | + } | ||
40 | +}); | ||
47 | 41 | ||
48 | // 格式化三级菜单 | 42 | // 格式化三级菜单 |
49 | function formatThirdMenu() { | 43 | function formatThirdMenu() { |
@@ -91,7 +85,7 @@ function syncLoginInfo() { | @@ -91,7 +85,7 @@ function syncLoginInfo() { | ||
91 | method: 'open.passport.get' | 85 | method: 'open.passport.get' |
92 | }; | 86 | }; |
93 | 87 | ||
94 | - $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) { | 88 | + $.getJSON('http://www.yohobuy.com/common/passport/?callback=?', param, function(jsonData) { |
95 | if (jsonData && jsonData.data && jsonData.data.result !== -1) { | 89 | if (jsonData && jsonData.data && jsonData.data.result !== -1) { |
96 | updateLoginInfo(jsonData.data.data); | 90 | updateLoginInfo(jsonData.data.data); |
97 | } else { | 91 | } else { |
@@ -110,7 +104,7 @@ function searchSuggest(key) { | @@ -110,7 +104,7 @@ function searchSuggest(key) { | ||
110 | query: key | 104 | query: key |
111 | }; | 105 | }; |
112 | 106 | ||
113 | - $.getJSON('http://search.yohobuy.com/api/suggest/?callback=?', param, function(jsonData) { | 107 | + $.getJSON('http://search.yohobuy.com/api/suggest?callback=?', param, function(jsonData) { |
114 | if (jsonData.code === 200) { | 108 | if (jsonData.code === 200) { |
115 | if (jsonData.data && jsonData.data.length) { | 109 | if (jsonData.data && jsonData.data.length) { |
116 | $searchSug.html(jsonData.data).show(); | 110 | $searchSug.html(jsonData.data).show(); |
@@ -123,72 +117,72 @@ function searchSuggest(key) { | @@ -123,72 +117,72 @@ function searchSuggest(key) { | ||
123 | 117 | ||
124 | // 同步mini购物车数据 | 118 | // 同步mini购物车数据 |
125 | function syncCratInfo(strG) { | 119 | function syncCratInfo(strG) { |
126 | - // var info, total; | ||
127 | - // | ||
128 | - // if (strG) { | ||
129 | - // window.setCookie('_g', strG, { | ||
130 | - // path: '/', | ||
131 | - // domain: '.yohobuy.com' | ||
132 | - // }); | ||
133 | - // } | ||
134 | - // if (window.cookie('_g')) { | ||
135 | - // info = json2.parse(window.cookie('_g')); | ||
136 | - // total = parseInt(info._nac) + parseInt(info._ac); | ||
137 | - // total = total > 0 ? total : 0; | ||
138 | - // $goCart.data({ | ||
139 | - // key: info._k, | ||
140 | - // num: total | ||
141 | - // }); | ||
142 | - // $goodsNum.text(total); | ||
143 | - // } | 120 | + var info, total; |
121 | + | ||
122 | + if (strG) { | ||
123 | + window.setCookie('_g', strG, { | ||
124 | + path: '/', | ||
125 | + domain: '.yohobuy.com' | ||
126 | + }); | ||
127 | + } | ||
128 | + if (window.cookie('_g')) { | ||
129 | + info = $.parseJSON(window.cookie('_g')); | ||
130 | + total = parseInt(info._nac, 10) + parseInt(info._ac, 10); | ||
131 | + total = total > 0 ? total : 0; | ||
132 | + $goCart.data({ | ||
133 | + key: info._k, | ||
134 | + num: total | ||
135 | + }); | ||
136 | + $goodsNum.text(total); | ||
137 | + } | ||
144 | } | 138 | } |
145 | 139 | ||
146 | function loadCartDetail(key) { | 140 | function loadCartDetail(key) { |
147 | - // var param = { | ||
148 | - // return_type: 'jsonp', | ||
149 | - // method: 'open.Shoppingcart.getCartData', | ||
150 | - // shopping_key: key | ||
151 | - // }; | ||
152 | - // | ||
153 | - // $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) { | ||
154 | - // var totalGoods, data; | ||
155 | - // | ||
156 | - // if (jsonData.code === 200) { | ||
157 | - // data = jsonData.data; | ||
158 | - // totalGoods = $.merge(data.main_goods, data.advance_goods); | ||
159 | - // totalGoods = $.merge(totalGoods, data.outlet_goods); | ||
160 | - // totalGoods = $.merge(totalGoods, data.gift_goods); | ||
161 | - // totalGoods = $.merge(totalGoods, data.need_pay_gifts); | ||
162 | - // if (totalGoods && totalGoods.length) { | ||
163 | - // data.totalGoods = totalGoods; | ||
164 | - // $miniCart.html(cartFn({ | ||
165 | - // carData: data | ||
166 | - // })); | ||
167 | - // } else { | ||
168 | - // $miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>'); | ||
169 | - // } | ||
170 | - // } | ||
171 | - // }); | 141 | + var param = { |
142 | + return_type: 'jsonp', | ||
143 | + method: 'open.Shoppingcart.getCartData', | ||
144 | + shopping_key: key | ||
145 | + }; | ||
146 | + | ||
147 | + $.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) { | ||
148 | + var totalGoods, data; | ||
149 | + | ||
150 | + if (jsonData.code === 200) { | ||
151 | + data = jsonData.data; | ||
152 | + totalGoods = $.merge(data.main_goods, data.advance_goods); | ||
153 | + totalGoods = $.merge(totalGoods, data.outlet_goods); | ||
154 | + totalGoods = $.merge(totalGoods, data.gift_goods); | ||
155 | + totalGoods = $.merge(totalGoods, data.need_pay_gifts); | ||
156 | + if (totalGoods && totalGoods.length) { | ||
157 | + data.totalGoods = totalGoods; | ||
158 | + $miniCart.html(cartFn({ | ||
159 | + carData: data | ||
160 | + })); | ||
161 | + } else { | ||
162 | + $miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>'); | ||
163 | + } | ||
164 | + } | ||
165 | + }); | ||
172 | } | 166 | } |
173 | 167 | ||
174 | function delCartGoods(data, callback) { | 168 | function delCartGoods(data, callback) { |
175 | - // var param = { | ||
176 | - // return_type: 'jsonp', | ||
177 | - // method: 'open.Shoppingcart.delone', | ||
178 | - // shopping_key: data.key, | ||
179 | - // id: data.id, | ||
180 | - // isreduce: data.isreduce | ||
181 | - // }; | ||
182 | - // | ||
183 | - // $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) { | ||
184 | - // var strG = ''; | ||
185 | - // | ||
186 | - // if (jsonData.code === 200) { | ||
187 | - // callback(); | ||
188 | - // strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}'; | ||
189 | - // syncCratInfo(strG); | ||
190 | - // } | ||
191 | - // }); | 169 | + var param = { |
170 | + return_type: 'jsonp', | ||
171 | + method: 'open.Shoppingcart.delone', | ||
172 | + shopping_key: data.key, | ||
173 | + id: data.id, | ||
174 | + isreduce: data.isreduce | ||
175 | + }; | ||
176 | + | ||
177 | + $.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) { | ||
178 | + var strG = ''; | ||
179 | + | ||
180 | + if (jsonData.code === 200) { | ||
181 | + strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}'; | ||
182 | + syncCratInfo(strG); | ||
183 | + return callback(); | ||
184 | + } | ||
185 | + }); | ||
192 | } | 186 | } |
193 | 187 | ||
194 | syncLoginInfo(); | 188 | syncLoginInfo(); |
@@ -240,9 +234,10 @@ $searchForm.on('keyup', '.search-key', function(e) { | @@ -240,9 +234,10 @@ $searchForm.on('keyup', '.search-key', function(e) { | ||
240 | $(this).val(val); | 234 | $(this).val(val); |
241 | searchSuggest(val); | 235 | searchSuggest(val); |
242 | } | 236 | } |
243 | - | ||
244 | - // http://search.yohobuy.com/api/suggest | ||
245 | - // searchSuggest | 237 | +}).on('blur', '.search-key', function() { |
238 | + setTimeout(function() { | ||
239 | + $searchSug.hide(); | ||
240 | + }, 200); | ||
246 | }); | 241 | }); |
247 | 242 | ||
248 | $goCart.hover(function() { | 243 | $goCart.hover(function() { |
@@ -265,7 +260,7 @@ $goCart.hover(function() { | @@ -265,7 +260,7 @@ $goCart.hover(function() { | ||
265 | $goCart.removeClass('on-hover'); | 260 | $goCart.removeClass('on-hover'); |
266 | }); | 261 | }); |
267 | 262 | ||
268 | -$goCart.on('click', '.cart-goods-del', function(e) { | 263 | +$goCart.on('click', '.cart-goods-del', function() { |
269 | var $dom = $(this), | 264 | var $dom = $(this), |
270 | data = $dom.data(), | 265 | data = $dom.data(), |
271 | callback; | 266 | callback; |
@@ -297,14 +292,14 @@ $subNav.on({ | @@ -297,14 +292,14 @@ $subNav.on({ | ||
297 | param.width = 174; | 292 | param.width = 174; |
298 | param.height = 155; | 293 | param.height = 155; |
299 | param._ = new Date(); | 294 | param._ = new Date(); |
300 | - // $.getJSON(apiBanner + '/?callback=?', param, function(JsonData) { | ||
301 | - // if (JsonData.code === 200) { | ||
302 | - // $show.addClass('show'); | ||
303 | - // $show.find('img').attr('src', JsonData.data.src); | ||
304 | - // $show.find('a').attr('href', JsonData.data.url); | ||
305 | - // $show.find('.title').text(JsonData.data.title); | ||
306 | - // } | ||
307 | - // }); | 295 | + $.getJSON('http://new.yohobuy.com/common/getbanner?callback=?', param, function(JsonData) { |
296 | + if (JsonData.code === 200) { | ||
297 | + $show.addClass('show'); | ||
298 | + $show.find('img').attr('src', JsonData.data.src); | ||
299 | + $show.find('a').attr('href', JsonData.data.url); | ||
300 | + $show.find('.title').text(JsonData.data.title); | ||
301 | + } | ||
302 | + }); | ||
308 | }, | 303 | }, |
309 | mouseleave: function() { | 304 | mouseleave: function() { |
310 | var $thirdNav = $(this).children('.third-nav-wrapper'); | 305 | var $thirdNav = $(this).children('.third-nav-wrapper'); |
@@ -315,6 +310,3 @@ $subNav.on({ | @@ -315,6 +310,3 @@ $subNav.on({ | ||
315 | $thirdNav.hide(); | 310 | $thirdNav.hide(); |
316 | } | 311 | } |
317 | }); | 312 | }); |
318 | - | ||
319 | - | ||
320 | -/* eslint-ensable */ |
@@ -48,6 +48,7 @@ | @@ -48,6 +48,7 @@ | ||
48 | span { | 48 | span { |
49 | display: inline-block; | 49 | display: inline-block; |
50 | vertical-align: middle; | 50 | vertical-align: middle; |
51 | + line-height: 30px; | ||
51 | } | 52 | } |
52 | 53 | ||
53 | .hi { | 54 | .hi { |
@@ -343,7 +344,7 @@ | @@ -343,7 +344,7 @@ | ||
343 | border: none; | 344 | border: none; |
344 | background: #fff; | 345 | background: #fff; |
345 | box-sizing: border-box; | 346 | box-sizing: border-box; |
346 | - padding: 7px 0 7px 10px; | 347 | + padding: 7px 0 9px 10px; |
347 | } | 348 | } |
348 | 349 | ||
349 | .search-btn { | 350 | .search-btn { |
@@ -415,7 +416,7 @@ | @@ -415,7 +416,7 @@ | ||
415 | top: 30px; | 416 | top: 30px; |
416 | right: -14px; | 417 | right: -14px; |
417 | width: 378px; | 418 | width: 378px; |
418 | - background: #f8f8f8 reslove('layout/empty_car.png') no-repeat 106px 132px; | 419 | + background: #f8f8f8 resolve('layout/empty_car.png') no-repeat 106px 132px; |
419 | z-index: 1000; | 420 | z-index: 1000; |
420 | display: none; | 421 | display: none; |
421 | 422 |
test/library/api.test.js
0 → 100644
1 | +/** | ||
2 | + * http api 测试 | ||
3 | + * | ||
4 | + * @author: jiangfeng<jeff.jiang@yoho.cn> | ||
5 | + * @date: 2016/05/17 | ||
6 | + */ | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const test = require('ava'); | ||
10 | +const sign = require('../../library/sign'); | ||
11 | + | ||
12 | + | ||
13 | +const API = require('../../library/api').API; | ||
14 | +const ServiceAPI = require('../../library/api').ServiceAPI; | ||
15 | +const SearchAPI = require('../../library/api').SearchAPI; | ||
16 | + | ||
17 | +const getUrl = 'operations/api/v6/category/getCategory'; | ||
18 | + | ||
19 | +test('api constructor test', (t) => { | ||
20 | + let api = new ServiceAPI(); | ||
21 | + let api2 = new API(); | ||
22 | + let api3 = new SearchAPI(); | ||
23 | + | ||
24 | + t.true(api !== null); | ||
25 | + t.true(api2 !== null); | ||
26 | + t.true(api3 !== null); | ||
27 | +}); | ||
28 | + | ||
29 | +test('api get test', t => { | ||
30 | + let api = new ServiceAPI(); | ||
31 | + | ||
32 | + return api.get(getUrl, sign.apiSign({})).then(result => { | ||
33 | + if (result && result.code) { | ||
34 | + t.pass(); | ||
35 | + } else { | ||
36 | + t.fail(); | ||
37 | + } | ||
38 | + }); | ||
39 | +}); | ||
40 | + | ||
41 | +test('api get test, api return an error', t => { | ||
42 | + let api = new ServiceAPI(); | ||
43 | + | ||
44 | + return api.get(getUrl + '/error', sign.apiSign({})).catch(err => { | ||
45 | + | ||
46 | + // 故意调用一个错误的接口 | ||
47 | + if (err && err.code === 500) { | ||
48 | + t.pass(); | ||
49 | + } else { | ||
50 | + t.fail(); | ||
51 | + } | ||
52 | + }); | ||
53 | +}); | ||
54 | + | ||
55 | +test('api get use cache test', t => { | ||
56 | + let api = new ServiceAPI(); | ||
57 | + | ||
58 | + return api.get(getUrl, sign.apiSign({}), true).then(result => { | ||
59 | + if (result && result.code) { | ||
60 | + t.pass(); | ||
61 | + } else { | ||
62 | + t.fail(); | ||
63 | + } | ||
64 | + }); | ||
65 | +}); | ||
66 | + | ||
67 | +test('api post test', t => { | ||
68 | + let api = new ServiceAPI(); | ||
69 | + | ||
70 | + return api.post(getUrl, sign.apiSign({})).then(result => { | ||
71 | + if (result && result.code) { | ||
72 | + t.pass(); | ||
73 | + } else { | ||
74 | + t.fail(); | ||
75 | + } | ||
76 | + }); | ||
77 | +}); | ||
78 | + | ||
79 | +test('api multiple call test', (t) => { | ||
80 | + let api = new ServiceAPI(); | ||
81 | + let multi = [api.get(getUrl, sign.apiSign({})), api.get(getUrl, sign.apiSign({}))]; | ||
82 | + | ||
83 | + return api.all(multi).then(result => { | ||
84 | + if (result.length === 2) { | ||
85 | + t.pass(); | ||
86 | + } else { | ||
87 | + t.fail(); | ||
88 | + } | ||
89 | + }); | ||
90 | +}); | ||
91 | + | ||
92 | +test('api multiple fail call test', (t) => { | ||
93 | + let api = new ServiceAPI(); | ||
94 | + | ||
95 | + return api.all(1).catch((e) => { | ||
96 | + if (e) { | ||
97 | + t.pass(); | ||
98 | + } else { | ||
99 | + t.fail(); | ||
100 | + } | ||
101 | + }); | ||
102 | +}); |
test/library/cache.test.js
0 → 100644
1 | +/** | ||
2 | + * cache 测试 | ||
3 | + * | ||
4 | + * @author: jf<jeff.jiang@yoho.cn> | ||
5 | + * @date: 2016/5/18 | ||
6 | + */ | ||
7 | + | ||
8 | +'use strict'; | ||
9 | + | ||
10 | +import test from 'ava'; | ||
11 | + | ||
12 | +import cache from '../../library/cache'; | ||
13 | + | ||
14 | +let testKey = 'test_unit_key:' + (new Date()).getTime(); | ||
15 | +let testValue = 'anotherValue'; | ||
16 | +let anotherKey = 'test_unit_key2:' + (new Date()).getTime(); | ||
17 | +let anotherValue = {a: 1}; | ||
18 | + | ||
19 | +let slaveTestKey = 'test_unit_key3:' + (new Date()).getTime(); | ||
20 | +let slaveTestValue = 'anotherValue3'; | ||
21 | + | ||
22 | +test.before('set test key', (t) => { | ||
23 | + cache.set(testKey, testValue); | ||
24 | + cache.set(anotherKey, anotherValue); | ||
25 | + t.pass(); | ||
26 | +}); | ||
27 | + | ||
28 | +test.after('del test key', (t) => { | ||
29 | + cache.del(testKey); | ||
30 | + cache.del(anotherKey); | ||
31 | + t.pass(); | ||
32 | +}); | ||
33 | + | ||
34 | +test('cache get test', (t) => { | ||
35 | + return cache.get(testKey).then((v) => { | ||
36 | + t.is(v, testValue); | ||
37 | + }); | ||
38 | +}); | ||
39 | + | ||
40 | +test('cache get multi test', (t) => { | ||
41 | + cache.set(anotherKey, anotherValue); | ||
42 | + return cache.getMulti([testKey, anotherKey]).then((values) => { | ||
43 | + t.is(values[testKey], testValue); | ||
44 | + t.is(values[anotherKey], JSON.stringify(anotherValue)); | ||
45 | + }); | ||
46 | +}); | ||
47 | + | ||
48 | +test('cache get from slave test', (t) => { | ||
49 | + return cache.getFromSlave(testKey).then((v) => { | ||
50 | + t.is(v, testValue); | ||
51 | + }); | ||
52 | +}); | ||
53 | + | ||
54 | +test('cache get multi from slave test', (t) => { | ||
55 | + cache.set(anotherKey, anotherValue); | ||
56 | + return cache.getMultiFromSlave([testKey, anotherKey]).then((values) => { | ||
57 | + t.is(values[testKey], testValue); | ||
58 | + t.is(values[anotherKey], JSON.stringify(anotherValue)); | ||
59 | + }); | ||
60 | +}); | ||
61 | + | ||
62 | +test('cache set to slave', (t) => { | ||
63 | + return cache.setSlave(slaveTestKey, { | ||
64 | + value: slaveTestValue | ||
65 | + }).then(() => { | ||
66 | + return cache.getFromSlave(slaveTestKey); | ||
67 | + }).then((v) => { | ||
68 | + v = JSON.parse(v); | ||
69 | + t.is(v.value, slaveTestValue); | ||
70 | + cache.del(slaveTestKey); | ||
71 | + }); | ||
72 | +}); | ||
73 | + | ||
74 | +test('cache get test, key is not a string', (t) => { | ||
75 | + return cache.get(123).then((v) => { | ||
76 | + t.notOk(v); | ||
77 | + }); | ||
78 | +}); | ||
79 | + | ||
80 | +test('cache get multi test, key is not an array', (t) => { | ||
81 | + return cache.getMulti(123).then((v) => { | ||
82 | + t.notOk(v); | ||
83 | + }); | ||
84 | +}); | ||
85 | + | ||
86 | +test('cache get from slave test, key is not a string', (t) => { | ||
87 | + return cache.getFromSlave(123).then((v) => { | ||
88 | + t.notOk(v); | ||
89 | + }); | ||
90 | +}); | ||
91 | + | ||
92 | +test('cache get multi from slave test, key is not an array', (t) => { | ||
93 | + return cache.getMultiFromSlave(123).then((v) => { | ||
94 | + t.notOk(v); | ||
95 | + }); | ||
96 | +}); | ||
97 | + | ||
98 | +test('cache set test, key is not a string', (t) => { | ||
99 | + return cache.set(123).then((v) => { | ||
100 | + t.notOk(v); | ||
101 | + }); | ||
102 | +}); | ||
103 | + | ||
104 | +test('cache set multi test, key is not an array', (t) => { | ||
105 | + return cache.setSlave(123).then((v) => { | ||
106 | + t.notOk(v); | ||
107 | + }); | ||
108 | +}); | ||
109 | + | ||
110 | +test('cache del test, key is not a string', (t) => { | ||
111 | + return cache.del(123).then((v) => { | ||
112 | + t.notOk(v); | ||
113 | + }); | ||
114 | +}); |
test/library/camel-case.test.js
0 → 100644
1 | +/** | ||
2 | + * 对象键名驼峰测试 | ||
3 | + * | ||
4 | + * @author: jiangfeng<jeff.jiang@yoho.cn> | ||
5 | + * @date: 2016/05/17 | ||
6 | + */ | ||
7 | + | ||
8 | +import {test} from 'ava'; | ||
9 | + | ||
10 | +const camelCase = require('../../library/camel-case'); | ||
11 | + | ||
12 | +test('camel case object', t => { | ||
13 | + let o = { | ||
14 | + A_B: 'ab_cd' | ||
15 | + }; | ||
16 | + | ||
17 | + t.is(camelCase(o).aB, 'ab_cd'); | ||
18 | +}); | ||
19 | + | ||
20 | +test('camel case array', t => { | ||
21 | + let arr = [{ | ||
22 | + A_B: 'ab_cd' | ||
23 | + }, { | ||
24 | + A_B: 'ab_cd' | ||
25 | + }]; | ||
26 | + | ||
27 | + t.is(camelCase(arr)[1].aB, 'ab_cd'); | ||
28 | +}); |
test/library/helpers.test.js
0 → 100644
1 | +/** | ||
2 | + * library helpers 类单元测试 | ||
3 | + * @author jeff.jiang<jeff.jiang@yoho.cn> | ||
4 | + * @date 2016/05/17 | ||
5 | + */ | ||
6 | + | ||
7 | +'use strict'; | ||
8 | + | ||
9 | +const test = require('ava'); | ||
10 | +const helpers = require('../../library/helpers'); | ||
11 | + | ||
12 | +test('qiniu image url handle', t => { | ||
13 | + let url = 'http://img11.static.yhbimg.com/yhb-img01/2016/04/18/03/016d50b20cfdec5a91c614b68546bc9d72.jpg?imageView2/{mode}/w/{width}/h/{height}'; | ||
14 | + let expected = 'http://img11.static.yhbimg.com/yhb-img01/2016/04/18/03/016d50b20cfdec5a91c614b68546bc9d72.jpg?imageView2/2/w/400/h/300'; | ||
15 | + | ||
16 | + t.is(helpers.image(url, 400, 300), expected); | ||
17 | +}); | ||
18 | + | ||
19 | +test('uri format', t => { | ||
20 | + let uri = '/test'; | ||
21 | + let qs = { name: 'yoho' }; | ||
22 | + let mod = 'list'; | ||
23 | + let expected = '//list.m.yohobuy.com/test?name=yoho'; | ||
24 | + | ||
25 | + t.is(helpers.urlFormat(uri, qs, mod), expected); | ||
26 | +}); | ||
27 | + | ||
28 | +test('upper char to lowercase', t => { | ||
29 | + let str = 'ABc'; | ||
30 | + let expected = 'abc'; | ||
31 | + | ||
32 | + t.is(helpers.lowerCase(str), expected); | ||
33 | +}); | ||
34 | + | ||
35 | +test('lower char to uppercase', t => { | ||
36 | + let str = 'abc!'; | ||
37 | + let expected = 'ABC!'; | ||
38 | + | ||
39 | + t.is(helpers.upperCase(str), expected); | ||
40 | +}); |
test/library/logger.test.js
0 → 100644
1 | +/** | ||
2 | + * logger 工具类测试 | ||
3 | + */ | ||
4 | + | ||
5 | +const test = require('ava'); | ||
6 | +const logger = require('../../library/logger'); | ||
7 | + | ||
8 | +test('logger error test', t => { | ||
9 | + logger.error('error test', () => { | ||
10 | + t.pass(); | ||
11 | + }); | ||
12 | +}); | ||
13 | + | ||
14 | +test('logger info test', t => { | ||
15 | + logger.info('info test', () => { | ||
16 | + t.pass(); | ||
17 | + }); | ||
18 | +}); |
test/library/sign.test.js
0 → 100644
1 | +/** | ||
2 | + * 签名类测试 | ||
3 | + * | ||
4 | + * @author: jiangfeng<jeff.jiang@yoho.cn> | ||
5 | + * @date: 2016/05/17 | ||
6 | + */ | ||
7 | + | ||
8 | +const test = require('ava'); | ||
9 | +const sign = require('../../library/sign'); | ||
10 | + | ||
11 | +test('app sign test', t => { | ||
12 | + let params = { | ||
13 | + client_type: 'h5', // eslint-disable-line | ||
14 | + a: 1, | ||
15 | + b: 'b' | ||
16 | + }; | ||
17 | + let signedParams = sign.apiSign(params); | ||
18 | + | ||
19 | + t.true(sign.checkSign(signedParams)); | ||
20 | +}); | ||
21 | + | ||
22 | +test('app sign test webSign', t => { | ||
23 | + let params = { | ||
24 | + uid: '123', | ||
25 | + key: '3fc5a9fcea9fea49cce5432202a167ad' | ||
26 | + }; | ||
27 | + | ||
28 | + t.true(sign.webSign(params)); | ||
29 | +}); |
1 | -let expect = require('expect.js'); | ||
2 | -let Timer = require('../../library/timer'); | 1 | +/** |
2 | + * Timer 计时类测试 | ||
3 | + * | ||
4 | + * @author: jiangfeng<jeff.jiang@yoho.cn> | ||
5 | + * @date: 2016/05/17 | ||
6 | + */ | ||
3 | 7 | ||
8 | +const test = require('ava'); | ||
9 | +const Timer = require('../../library/timer'); | ||
4 | 10 | ||
5 | -describe('/library/timer', function() { // eslint-disable-line | ||
6 | - it('延迟100ms,期望大于或等于100ms', function(done) {// eslint-disable-line | ||
7 | - let t = new Timer(); | 11 | +const sleep = (timeout) => { |
12 | + return new Promise((resolve) => { | ||
13 | + setTimeout(() => { | ||
14 | + resolve(); | ||
15 | + }, timeout); | ||
16 | + }); | ||
17 | +}; | ||
18 | + | ||
19 | +test.cb('timer class ', t => { | ||
20 | + let timer = new Timer(); | ||
8 | 21 | ||
9 | - t.put('aa'); | ||
10 | - setTimeout(function() { | ||
11 | - let time = t.put('aa'); | 22 | + timer.put('test'); |
23 | + sleep(300).then(() => { | ||
24 | + let diff = timer.put('test'); | ||
12 | 25 | ||
13 | - expect(Math.round(time) >= 100).to.be.ok(); | ||
14 | - done(); | ||
15 | - }, 100); | 26 | + t.true(diff >= 300); |
27 | + t.end(); | ||
16 | }); | 28 | }); |
17 | }); | 29 | }); |
test/run.js
deleted
100644 → 0
1 | -require('./library/timer.test'); |
-
Please register or login to post a comment