Authored by 姜枫

merge common-lib

@@ -17,6 +17,7 @@ const path = require('path'); @@ -17,6 +17,7 @@ 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 yohoLib = require('yoho-node-lib');
20 const session = require('express-session'); 21 const session = require('express-session');
21 const memcached = require('connect-memcached'); 22 const memcached = require('connect-memcached');
22 const hbs = require('express-handlebars'); 23 const hbs = require('express-handlebars');
@@ -29,12 +30,14 @@ const MemcachedStore = memcached(session); @@ -29,12 +30,14 @@ const MemcachedStore = memcached(session);
29 app.locals.devEnv = app.get('env') === 'development'; 30 app.locals.devEnv = app.get('env') === 'development';
30 app.locals.version = pkg.version; 31 app.locals.version = pkg.version;
31 32
  33 +// 全局注册library
  34 +yohoLib.global(config);
  35 +
32 // 指定libray目录 36 // 指定libray目录
33 -global.library = path.resolve('./library/');  
34 global.middleware = path.resolve('./doraemon/middleware'); 37 global.middleware = path.resolve('./doraemon/middleware');
35 global.utils = path.resolve('./utils'); 38 global.utils = path.resolve('./utils');
36 39
37 -const logger = require(global.library + '/logger'); 40 +const logger = global.yoho.logger;
38 41
39 app.set('view engine', '.hbs'); 42 app.set('view engine', '.hbs');
40 app.set('views', './doraemon/views'); 43 app.set('views', './doraemon/views');
@@ -43,7 +46,7 @@ app.engine('.hbs', hbs({ @@ -43,7 +46,7 @@ app.engine('.hbs', hbs({
43 defaultLayout: 'layout', 46 defaultLayout: 'layout',
44 layoutsDir: './doraemon/views', 47 layoutsDir: './doraemon/views',
45 partialsDir: './doraemon/views/partial', 48 partialsDir: './doraemon/views/partial',
46 - helpers: require(`${global.library}/helpers`) 49 + helpers: global.yoho.helpers
47 })); 50 }));
48 51
49 app.use(favicon(path.join(__dirname, '/public/favicon.ico'))); 52 app.use(favicon(path.join(__dirname, '/public/favicon.ico')));
@@ -98,6 +101,7 @@ try { @@ -98,6 +101,7 @@ try {
98 // YOHO 后置中间件 101 // YOHO 后置中间件
99 app.use(errorHanlder.serverError()); 102 app.use(errorHanlder.serverError());
100 } catch (err) { 103 } catch (err) {
  104 + console.error(err);
101 logger.error(err); 105 logger.error(err);
102 } 106 }
103 107
@@ -23,7 +23,7 @@ app.engine('.hbs', hbs({ @@ -23,7 +23,7 @@ app.engine('.hbs', hbs({
23 defaultLayout: 'layout', 23 defaultLayout: 'layout',
24 layoutsDir: doraemon, 24 layoutsDir: doraemon,
25 partialsDir: ['./views/partial', `${doraemon}/partial`], 25 partialsDir: ['./views/partial', `${doraemon}/partial`],
26 - helpers: require(`${global.library}/helpers`) 26 + helpers: global.yoho.helpers
27 })); 27 }));
28 28
29 // router 29 // router
@@ -4,10 +4,10 @@ @@ -4,10 +4,10 @@
4 * @date: 2016/05/09 4 * @date: 2016/05/09
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const library = '../../../library';  
8 const _ = require('lodash'); 7 const _ = require('lodash');
9 const channelModel = require('../models/channel'); 8 const channelModel = require('../models/channel');
10 -const helpers = require(`${library}/helpers`); 9 +
  10 +const helpers = global.yoho.helpers;
11 11
12 const renderData = { 12 const renderData = {
13 module: 'channel', 13 module: 'channel',
@@ -24,7 +24,7 @@ app.engine('.hbs', hbs({ @@ -24,7 +24,7 @@ app.engine('.hbs', hbs({
24 defaultLayout: 'layout', 24 defaultLayout: 'layout',
25 layoutsDir: doraemon, 25 layoutsDir: doraemon,
26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
27 - helpers: require(`${global.library}/helpers`) 27 + helpers: global.yoho.helpers
28 })); 28 }));
29 29
30 // router 30 // router
@@ -4,18 +4,15 @@ @@ -4,18 +4,15 @@
4 * @date: 2016/05/09 4 * @date: 2016/05/09
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const library = '../../../library';  
8 const utils = '../../../utils'; 7 const utils = '../../../utils';
9 const contentCodeConfig = require('../../../config/content-code'); 8 const contentCodeConfig = require('../../../config/content-code');
10 const _ = require('lodash'); 9 const _ = require('lodash');
11 -const ServiceAPI = require(`${library}/api`).ServiceAPI;  
12 -const sign = require(`${library}/sign`);  
13 -const camelCase = require(`${library}/camel-case`);  
14 -const logger = require(`${library}/logger`); 10 +const api = global.yoho.ServiceAPI;
  11 +const sign = global.yoho.sign;
  12 +const camelCase = global.yoho.camelCase;
  13 +const logger = global.yoho.logger;
15 const resourcesProcess = require(`${utils}/resources-process`); 14 const resourcesProcess = require(`${utils}/resources-process`);
16 15
17 -const api = new ServiceAPI();  
18 -  
19 16
20 /** 17 /**
21 * 性别数据 18 * 性别数据
@@ -24,7 +24,7 @@ app.engine('.hbs', hbs({ @@ -24,7 +24,7 @@ app.engine('.hbs', hbs({
24 defaultLayout: 'layout', 24 defaultLayout: 'layout',
25 layoutsDir: doraemon, 25 layoutsDir: doraemon,
26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
27 - helpers: require(`${global.library}/helpers`) 27 + helpers: global.yoho.helpers
28 })); 28 }));
29 29
30 // router 30 // router
@@ -4,19 +4,16 @@ @@ -4,19 +4,16 @@
4 * @date: 2016/05/30 4 * @date: 2016/05/30
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const library = '../../../library';  
8 const utils = '../../../utils'; 7 const utils = '../../../utils';
9 const contentCodeConfig = require('../../../config/content-code'); 8 const contentCodeConfig = require('../../../config/content-code');
10 const resourcesProcess = require(`${utils}/resources-process`); 9 const resourcesProcess = require(`${utils}/resources-process`);
11 -const ServiceAPI = require(`${library}/api`).ServiceAPI;  
12 -const API = require(`${library}/api`).API;  
13 -const sign = require(`${library}/sign`);  
14 -const logger = require(`${library}/logger`);  
15 -const camelCase = require(`${library}/camel-case`);  
16 -const helpers = require(`${library}/helpers`); 10 +const sign = global.yoho.sign;
  11 +const logger = global.yoho.logger;
  12 +const camelCase = global.yoho.camelCase;
  13 +const helpers = global.yoho.helpers;
17 const _ = require('lodash'); 14 const _ = require('lodash');
18 -const serviceAPI = new ServiceAPI();  
19 -const api = new API(); 15 +const serviceAPI = global.yoho.ServiceAPI;
  16 +const api = global.yoho.API;
20 17
21 const contentCode = contentCodeConfig.guang; 18 const contentCode = contentCodeConfig.guang;
22 19
@@ -16,10 +16,10 @@ const AlipayStrategy = require('./models/passport-alipay').Strategy; @@ -16,10 +16,10 @@ const AlipayStrategy = require('./models/passport-alipay').Strategy;
16 const _ = require('lodash'); 16 const _ = require('lodash');
17 const md5 = require('md5'); 17 const md5 = require('md5');
18 18
19 -const config = require('../../config/common');  
20 -const logger = require(global.library + '/logger');  
21 -const helpers = require(global.library + '/helpers');  
22 -const cookie = require(global.library + '/cookie'); 19 +const config = global.yoho.config;
  20 +const logger = global.yoho.logger;
  21 +const helpers = global.yoho.helpers;
  22 +const cookie = global.yoho.cookie;
23 23
24 const AuthHelper = require('./models/auth-helper'); 24 const AuthHelper = require('./models/auth-helper');
25 25
@@ -7,8 +7,7 @@ @@ -7,8 +7,7 @@
7 7
8 const _ = require('lodash'); 8 const _ = require('lodash');
9 9
10 -const library = '../../../library';  
11 -const helpers = require(`${library}/helpers`); 10 +const helpers = global.yoho.helpers;
12 11
13 const service = require('../models/back-service'); 12 const service = require('../models/back-service');
14 13
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const helpers = require(global.library + '/helpers'); 10 +const helpers = global.yoho.helpers;
11 const RegService = require('../models/reg-service'); 11 const RegService = require('../models/reg-service');
12 const BindService = require('../models/bind-service'); 12 const BindService = require('../models/bind-service');
13 const AuthHelper = require('../models/auth-helper'); 13 const AuthHelper = require('../models/auth-helper');
@@ -5,14 +5,13 @@ @@ -5,14 +5,13 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
8 -const library = '../../../library';  
9 const passport = require('passport'); 8 const passport = require('passport');
10 const md5 = require('md5'); 9 const md5 = require('md5');
11 const uuid = require('uuid'); 10 const uuid = require('uuid');
12 -const cookie = require(`${library}/cookie`);  
13 -const helpers = require(`${library}/helpers`);  
14 -const log = require(`${library}/logger`);  
15 -const config = require('../../../config/common'); 11 +const cookie = global.yoho.cookie;
  12 +const helpers = global.yoho.helpers;
  13 +const log = global.yoho.logger;
  14 +const config = global.yoho.config;
16 const AuthHelper = require('../models/auth-helper'); 15 const AuthHelper = require('../models/auth-helper');
17 16
18 const loginPage = `${config.siteUrl}/passport/login/index`; 17 const loginPage = `${config.siteUrl}/passport/login/index`;
@@ -8,9 +8,9 @@ @@ -8,9 +8,9 @@
8 'use strict'; 8 'use strict';
9 9
10 const _ = require('lodash'); 10 const _ = require('lodash');
11 -const helpers = require(global.library + '/helpers');  
12 -const sign = require(global.library + '/sign');  
13 -const cookie = require(global.library + '/cookie'); 11 +const helpers = global.yoho.helpers;
  12 +const sign = global.yoho.sign;
  13 +const cookie = global.yoho.cookie;
14 const RegService = require('../models/reg-service'); 14 const RegService = require('../models/reg-service');
15 const AuthHelper = require('../models/auth-helper'); 15 const AuthHelper = require('../models/auth-helper');
16 16
@@ -26,7 +26,7 @@ app.engine('.hbs', hbs({ @@ -26,7 +26,7 @@ app.engine('.hbs', hbs({
26 defaultLayout: 'layout', 26 defaultLayout: 'layout',
27 layoutsDir: doraemon, 27 layoutsDir: doraemon,
28 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 28 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
29 - helpers: require(`${global.library}/helpers`) 29 + helpers: global.yoho.helpers
30 })); 30 }));
31 31
32 32
1 'use strict'; 1 'use strict';
2 2
3 -const library = '../../../library';  
4 -const API = require(`${library}/api`).API;  
5 -const sign = require(`${library}/sign`);  
6 -const api = new API(); 3 +const sign = global.yoho.sign;
  4 +const api = global.yoho.API;
7 5
8 class Auth { 6 class Auth {
9 7
@@ -4,11 +4,8 @@ @@ -4,11 +4,8 @@
4 4
5 'use strict'; 5 'use strict';
6 6
7 -var API = require('../../../library/api').API;  
8 -const library = '../../../library';  
9 -const sign = require(`${library}/sign`);  
10 -  
11 -var api = new API(); 7 +const sign = global.yoho.sign;
  8 +const api = global.yoho.API;
12 9
13 const YOHOBUY_URL = 'http://www.yohobuy.com/'; 10 const YOHOBUY_URL = 'http://www.yohobuy.com/';
14 11
@@ -7,8 +7,7 @@ @@ -7,8 +7,7 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const API = require(`${global.library}/api`).API;  
11 -const api = new API(); 10 +const api = global.yoho.API;
12 11
13 class RegService { 12 class RegService {
14 13
@@ -7,8 +7,7 @@ @@ -7,8 +7,7 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const API = require(`${global.library}/api`).API;  
11 -const api = new API(); 10 +const api = global.yoho.API;
12 11
13 class RegService { 12 class RegService {
14 13
@@ -48,7 +47,7 @@ class RegService { @@ -48,7 +47,7 @@ class RegService {
48 name: '英国' 47 name: '英国'
49 }, { 48 }, {
50 areaCode: '+86', 49 areaCode: '+86',
51 - selected: true, 50 + selected: true, // default choose
52 name: '中国' 51 name: '中国'
53 }, { 52 }, {
54 areaCode: '+853', 53 areaCode: '+853',
@@ -24,7 +24,7 @@ app.engine('.hbs', hbs({ @@ -24,7 +24,7 @@ app.engine('.hbs', hbs({
24 defaultLayout: 'layout', 24 defaultLayout: 'layout',
25 layoutsDir: doraemon, 25 layoutsDir: doraemon,
26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`], 26 partialsDir: [path.join(__dirname, 'views/partial'), `${doraemon}/partial`],
27 - helpers: require(`${global.library}/helpers`) 27 + helpers: global.yoho.helpers
28 })); 28 }));
29 29
30 // router 30 // router
@@ -6,12 +6,9 @@ @@ -6,12 +6,9 @@
6 6
7 'use strict'; 7 'use strict';
8 8
9 -const library = '../../../library';  
10 -const API = require(`${library}/api`).API; 9 +const api = global.yoho.API;
11 const _ = require('lodash'); 10 const _ = require('lodash');
12 -const helpers = require(`${library}/helpers`);  
13 -  
14 -const api = new API(); 11 +const helpers = global.yoho.helpers;
15 12
16 /** 13 /**
17 * 处理品牌关联店铺信息 14 * 处理品牌关联店铺信息
@@ -7,13 +7,11 @@ @@ -7,13 +7,11 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const library = '../../../library';  
11 -const API = require(`${library}/api`).API;  
12 const _ = require('lodash'); 10 const _ = require('lodash');
13 11
14 // const log = require(`${library}/logger`); 12 // const log = require(`${library}/logger`);
15 13
16 -var api = new API(); 14 +var api = global.yoho.API;
17 15
18 /** 16 /**
19 * 商品尺码信息处理 17 * 商品尺码信息处理
@@ -5,22 +5,18 @@ @@ -5,22 +5,18 @@
5 */ 5 */
6 'use strict'; 6 'use strict';
7 7
8 -const library = '../../../library';  
9 const utils = '../../../utils'; 8 const utils = '../../../utils';
10 const contentCodeConfig = require('../../../config/content-code'); 9 const contentCodeConfig = require('../../../config/content-code');
11 10
12 const _ = require('lodash'); 11 const _ = require('lodash');
13 -const ServiceAPI = require(`${library}/api`).ServiceAPI;  
14 -const API = require(`${library}/api`).API;  
15 -const sign = require(`${library}/sign`); 12 +const sign = global.yoho.sign;
16 13
17 -const camelCase = require(`${library}/camel-case`);  
18 -const resourcesProcess = require(`${utils}/resources-process`);  
19 -const log = require(`${library}/logger`);  
20 -  
21 -const serviceApi = new ServiceAPI();  
22 -const api = new API(); 14 +const camelCase = global.yoho.camelCase;
  15 +const log = global.yoho.logger;
  16 +const serviceApi = global.yoho.ServiceAPI;
  17 +const api = global.yoho.API;
23 18
  19 +const resourcesProcess = require(`${utils}/resources-process`);
24 20
25 const dateFormate = (str) =>{ 21 const dateFormate = (str) =>{
26 var time = new Date(str * 1000); 22 var time = new Date(str * 1000);
@@ -7,13 +7,11 @@ @@ -7,13 +7,11 @@
7 7
8 'use strict'; 8 'use strict';
9 9
10 -const library = '../../../library';  
11 const utils = '../../../utils'; 10 const utils = '../../../utils';
12 -const API = require(`${library}/api`).API;  
13 -const sign = require(`${library}/sign`); 11 +const api = global.yoho.API;
  12 +const sign = global.yoho.sign;
14 const _ = require('lodash'); 13 const _ = require('lodash');
15 const productProcess = require(`${utils}/product-process`); 14 const productProcess = require(`${utils}/product-process`);
16 -var api = new API();  
17 15
18 module.exports = (data) => { 16 module.exports = (data) => {
19 var finalResult; 17 var finalResult;
@@ -4,21 +4,18 @@ @@ -4,21 +4,18 @@
4 * @date: 2016/05/17 4 * @date: 2016/05/17
5 */ 5 */
6 'use strict'; 6 'use strict';
7 -const library = '../../../library';  
8 const utils = '../../../utils'; 7 const utils = '../../../utils';
9 const contentCodeConfig = require('../../../config/content-code'); 8 const contentCodeConfig = require('../../../config/content-code');
10 9
11 -const API = require(`${library}/api`).API;  
12 -const ServiceAPI = require(`${library}/api`).ServiceAPI;  
13 -const sign = require(`${library}/sign`);  
14 -const logger = require(`${library}/logger`);  
15 -const camelCase = require(`${library}/camel-case`); 10 +const sign = global.yoho.sign;
  11 +const logger = global.yoho.logger;
  12 +const camelCase = global.yoho.camelCase;
16 const resourcesProcess = require(`${utils}/resources-process`); 13 const resourcesProcess = require(`${utils}/resources-process`);
17 const productProcess = require(`${utils}/product-process`); 14 const productProcess = require(`${utils}/product-process`);
18 const processTime = require(`${utils}/time-process`); 15 const processTime = require(`${utils}/time-process`);
19 const _ = require('lodash'); 16 const _ = require('lodash');
20 -const api = new API();  
21 -const serviceAPI = new ServiceAPI(); 17 +const api = global.yoho.API;
  18 +const serviceAPI = global.yoho.ServiceAPI;
22 19
23 20
24 21
1 const _ = require('lodash'); 1 const _ = require('lodash');
2 -const cookie = require('../../library/cookie'); 2 +const cookie = global.yoho.cookie;
3 3
4 module.exports = () => { 4 module.exports = () => {
5 return (req, res, next) => { 5 return (req, res, next) => {
@@ -55,6 +55,7 @@ @@ -55,6 +55,7 @@
55 "serve-favicon": "^2.3.0", 55 "serve-favicon": "^2.3.0",
56 "uuid": "^2.0.2", 56 "uuid": "^2.0.2",
57 "winston": "^2.2.0", 57 "winston": "^2.2.0",
  58 + "yoho-node-lib": "0.0.3",
58 "winston-daily-rotate-file": "^1.1.4" 59 "winston-daily-rotate-file": "^1.1.4"
59 }, 60 },
60 "devDependencies": { 61 "devDependencies": {
@@ -20,7 +20,7 @@ var tip = require('../../plugin/tip'); @@ -20,7 +20,7 @@ var tip = require('../../plugin/tip');
20 var trim = $.trim; 20 var trim = $.trim;
21 var showErrTip = tip.show; 21 var showErrTip = tip.show;
22 22
23 -//登录按钮状态切换 23 +// 登录按钮状态切换
24 function switchLoginBtnStatus() { 24 function switchLoginBtnStatus() {
25 if (pnPass && pwdPass) { 25 if (pnPass && pwdPass) {
26 $loginBtn.removeClass('disable'); 26 $loginBtn.removeClass('disable');
@@ -29,13 +29,13 @@ function switchLoginBtnStatus() { @@ -29,13 +29,13 @@ function switchLoginBtnStatus() {
29 } 29 }
30 } 30 }
31 31
32 -//Android-UC下显示select的direction:rtl无效的临时解决办法 32 +// Android-UC下显示select的direction:rtl无效的临时解决办法
33 api.selectCssHack($countrySelect); 33 api.selectCssHack($countrySelect);
34 34
35 -//显示隐藏密码 35 +// 显示隐藏密码
36 api.bindEyesEvt(); 36 api.bindEyesEvt();
37 37
38 -//清空手机号码 38 +// 清空手机号码
39 api.bindClearEvt(); 39 api.bindClearEvt();
40 40
41 $phoneNum.bind('input', function() { 41 $phoneNum.bind('input', function() {
@@ -98,14 +98,14 @@ $loginBtn.on('touchstart', function() { @@ -98,14 +98,14 @@ $loginBtn.on('touchstart', function() {
98 success: function() { 98 success: function() {
99 clearTimeout(time); 99 clearTimeout(time);
100 100
101 - //Cookie写入成功后,1s后跳转页面 101 + // Cookie写入成功后,1s后跳转页面
102 setTimeout(function() { 102 setTimeout(function() {
103 location.href = res.href; 103 location.href = res.href;
104 }, 1000); 104 }, 1000);
105 } 105 }
106 }); 106 });
107 107
108 - //3秒后强制跳转 108 + // 3秒后强制跳转
109 time = setTimeout(function() { 109 time = setTimeout(function() {
110 location.href = res.href; 110 location.href = res.href;
111 }, 3000); 111 }, 3000);
@@ -128,6 +128,6 @@ $loginBtn.on('touchstart', function() { @@ -128,6 +128,6 @@ $loginBtn.on('touchstart', function() {
128 } 128 }
129 }); 129 });
130 130
131 -//对初始有默认值的情况去初始化登录按钮状态 131 +// 对初始有默认值的情况去初始化登录按钮状态
132 $phoneNum.trigger('input'); 132 $phoneNum.trigger('input');
133 -$pwd.trigger('input');  
  133 +$pwd.trigger('input');
@@ -21,7 +21,7 @@ var tip = require('../../plugin/tip'); @@ -21,7 +21,7 @@ var tip = require('../../plugin/tip');
21 var trim = $.trim; 21 var trim = $.trim;
22 var showErrTip = tip.show; 22 var showErrTip = tip.show;
23 23
24 -//登录按钮状态切换 24 +// 登录按钮状态切换
25 function switchLoginBtnStatus() { 25 function switchLoginBtnStatus() {
26 if (accPass && pwdPass) { 26 if (accPass && pwdPass) {
27 $loginBtn.removeClass('disable'); 27 $loginBtn.removeClass('disable');
@@ -30,22 +30,22 @@ function switchLoginBtnStatus() { @@ -30,22 +30,22 @@ function switchLoginBtnStatus() {
30 } 30 }
31 } 31 }
32 32
33 -//显示找回密码面板 33 +// 显示找回密码面板
34 function showRetrivePanel() { 34 function showRetrivePanel() {
35 $mask.show(); 35 $mask.show();
36 $ways.show(); 36 $ways.show();
37 } 37 }
38 38
39 -//隐藏找回密码面板 39 +// 隐藏找回密码面板
40 function hideRetrivePanel() { 40 function hideRetrivePanel() {
41 $mask.hide(); 41 $mask.hide();
42 $ways.hide(); 42 $ways.hide();
43 } 43 }
44 44
45 -//密码显示与隐藏 45 +// 密码显示与隐藏
46 api.bindEyesEvt(); 46 api.bindEyesEvt();
47 47
48 -//清空账号输入框 48 +// 清空账号输入框
49 api.bindClearEvt(); 49 api.bindClearEvt();
50 50
51 $account.bind('input', function() { 51 $account.bind('input', function() {
@@ -78,7 +78,7 @@ $loginBtn.on('touchstart', function() { @@ -78,7 +78,7 @@ $loginBtn.on('touchstart', function() {
78 78
79 $loginBtn.text('正在登录...').addClass('disable'); 79 $loginBtn.text('正在登录...').addClass('disable');
80 80
81 - //验证账号(数字或者邮箱)和密码合理性 81 + // 验证账号(数字或者邮箱)和密码合理性
82 if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) { 82 if ((/^[0-9]+$/.test(acc) || api.emailRegx.test(acc)) && api.pwdValidate(pwd)) {
83 $.ajax({ 83 $.ajax({
84 type: 'POST', 84 type: 'POST',
@@ -126,6 +126,6 @@ $('#cancel-retrive').on('touchstart', function(e) { @@ -126,6 +126,6 @@ $('#cancel-retrive').on('touchstart', function(e) {
126 hideRetrivePanel(); 126 hideRetrivePanel();
127 }); 127 });
128 128
129 -//对初始有默认值的情况去初始化登录按钮状态 129 +// 对初始有默认值的情况去初始化登录按钮状态
130 $account.trigger('input'); 130 $account.trigger('input');
131 $pwd.trigger('input'); 131 $pwd.trigger('input');
1 'use strict'; 1 'use strict';
2 const _ = require('lodash'); 2 const _ = require('lodash');
3 -const camelCase = require('../library/camel-case');  
4 -const helpers = require('../library/helpers'); 3 +const camelCase = global.yoho.camelCase;
  4 +const helpers = global.yoho.helpers;
5 5
6 /** 6 /**
7 * 根据性别来决定 默认图片获取字段 如果是 2、3 7 * 根据性别来决定 默认图片获取字段 如果是 2、3
1 const _ = require('lodash'); 1 const _ = require('lodash');
2 -const camelCase = require('../library/camel-case'); 2 +const camelCase = global.yoho.camelCase;
3 3
4 /** 4 /**
5 * 处理楼层数据 5 * 处理楼层数据
@@ -4,8 +4,7 @@ @@ -4,8 +4,7 @@
4 4
5 'use strict'; 5 'use strict';
6 6
7 -const library = '../library';  
8 -const helpers = require(`${library}/helpers`); 7 +const helpers = global.yoho.helpers;
9 8
10 const timeFormat = { 9 const timeFormat = {
11 d: '剩{d}天', 10 d: '剩{d}天',