Authored by biao

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -2,7 +2,7 @@
{{#each menuData}}
{{#if subsets}}
<li class="big-category cateId-{{id}}">
<li class="big-category cateId-{{id}} subsets">
<div class="plus inline-block"></div>{{text}}</li>
{{#each subsets}}
<li class="smll-category cateId-{{id}} parentId-{{parendId}}">
... ...
... ... @@ -10,7 +10,10 @@ const BackService = require('../models/back-service');
const PassportHelper = require('../models/passport-helper');
const _ = require('lodash');
const index = (req, res, next) => {
/**
* 首页
*/
const indexPage = (req, res, next) => {
BackService.indexPageDataAsync()
.then(result => {
res.display('back/index', Object.assign({
... ... @@ -23,6 +26,9 @@ const index = (req, res, next) => {
.catch(next);
};
/**
* 通过邮箱或手机号获得用户信息
*/
const validateInputAPI = (req, res, next) => {
let userInput = req.body.phoneNum || '';
let areaCode = (req.body.area || '86').replace('+', '');
... ... @@ -40,6 +46,9 @@ const validateInputAPI = (req, res, next) => {
});
};
/**
* 验证用户输入的邮箱或者手机是否合法
*/
const validateInputPage = (req, res, next) => {
let userInput = req.body.phoneNum || '';
let areaCode = (req.body.area || '86').replace('+', '');
... ... @@ -54,6 +63,9 @@ const validateInputPage = (req, res, next) => {
});
};
/**
* 通过邮箱或手机号获得用户信息
*/
const getUserInfoAPI = (req, res, next) => {
let inputInfo = req.inputInfo;
... ... @@ -64,6 +76,9 @@ const getUserInfoAPI = (req, res, next) => {
.catch(next);
};
/**
* 发送验证码到邮箱或者手机
*/
const sendCodePage = (req, res, next) => {
let inputInfo = req.inputInfo;
... ... @@ -78,6 +93,9 @@ const sendCodePage = (req, res, next) => {
.catch(next);
};
/**
* 保存状态信息到 session 中
*/
const saveInSession = (req, res) => {
switch (req.inputInfo.type) {
case 'email':
... ... @@ -96,6 +114,9 @@ const saveInSession = (req, res) => {
}
};
/**
* 发送短信验证码到手机
*/
const sendBackMobileAPI = (req, res, next) => {
let mobile = req.body.mobile || '';
let area = req.body.area || '86';
... ... @@ -107,6 +128,9 @@ const sendBackMobileAPI = (req, res, next) => {
.catch(next);
};
/**
* 验证手机号码是否合法
*/
const validateMobileAPI = (req, res, next) => {
let mobile = req.body.mobile || '';
const ERR = {code: 400, message: '验证失败'};
... ... @@ -118,6 +142,9 @@ const validateMobileAPI = (req, res, next) => {
next();
};
/**
* 验证邮箱是否在session中
*/
const validateEmailInSession = (req, res, next) => {
let email = req.session.email || '';
... ... @@ -134,6 +161,9 @@ const validateEmailInSession = (req, res, next) => {
next();
};
/**
* 发送成功邮件页面
*/
const sendEmailPage = (req, res) => {
res.display('back/send-email', Object.assign({
module: 'passport',
... ... @@ -147,6 +177,9 @@ const sendEmailPage = (req, res) => {
}));
};
/**
* 验证邮箱验证码
*/
const validateCodeByEmailPage = (req, res, next) => {
let code = req.query.code || '';
... ... @@ -165,6 +198,9 @@ const validateCodeByEmailPage = (req, res, next) => {
.catch(next);
};
/**
* 重新设置密码页面
*/
const resetPasswordPage = (req, res) => {
let code = req.query.code || '';
... ... @@ -180,6 +216,9 @@ const resetPasswordPage = (req, res) => {
}));
};
/**
* 验证手机验证码页面
*/
const verifyCodeByMobilePage = (req, res) => {
res.display('back/verification', Object.assign({
... ... @@ -196,6 +235,9 @@ const verifyCodeByMobilePage = (req, res) => {
}));
};
/**
* 验证重设密码状态
*/
const validateSuccessStatusPage = (req, res, next) => {
let successType = req.session.successType || '';
... ... @@ -207,6 +249,9 @@ const validateSuccessStatusPage = (req, res, next) => {
next();
};
/**
* 设置密码成功页面
*/
const resetPwdSuccessPage = (req, res) => {
res.display('back/reset-success', Object.assign({
module: 'passport',
... ... @@ -216,6 +261,9 @@ const resetPwdSuccessPage = (req, res) => {
}));
};
/**
* 验证手机验证码
*/
const verifyCodeByMobileAPI = (req, res) => {
let mobile = req.body.mobile || '';
let area = req.body.area || '86';
... ... @@ -241,6 +289,9 @@ const verifyCodeByMobileAPI = (req, res) => {
});
};
/**
* 验证页面是否带有验证信息
*/
const validateExistCodePage = (req, res, next) => {
let code = req.query.code || req.body.code;
... ... @@ -251,6 +302,9 @@ const validateExistCodePage = (req, res, next) => {
next();
};
/**
* 验证手机生成码
*/
const validateCodeByMobilePage = (req, res, next) => {
let code = req.query.code || req.body.code;
let mobile = req.query.mobile || req.body.mobile;
... ... @@ -276,6 +330,9 @@ const validateCodeByMobilePage = (req, res, next) => {
next();
};
/**
* 验证密码页面
*/
const validatePwdPage = (req, res, next) => {
let pwd = req.body.pwd || '';
... ... @@ -286,6 +343,9 @@ const validatePwdPage = (req, res, next) => {
next();
};
/**
* 更新密码
*/
const updatePwdAPI = (req, res, next) => {
let code = req.body.code || '';
let mobileAuth = req.mobileAuth || {};
... ... @@ -303,6 +363,9 @@ const updatePwdAPI = (req, res, next) => {
.catch(next);
};
/**
* 密码是否在 session 中
*/
const validateMobileInSession = (req, res, next) => {
req.body.mobile = req.session.mobile || '';
req.body.verifyCode = req.session.captcha || '';
... ... @@ -316,34 +379,34 @@ const validateMobileInSession = (req, res, next) => {
};
module.exports = {
index, // 首页
getUserInfoAPI, // 通过邮箱或手机号获得用户信息
sendCodePage, // 发送验证码到邮箱或者手机,然后跳转页面
saveInSession, // 保存状态到session中
indexPage,
getUserInfoAPI,
sendCodePage,
saveInSession,
sendEmailPage, // 发送邮件成功的页面
sendEmailPage,
verifyCodeByMobilePage, // 验证手机验证码的页面
verifyCodeByMobileAPI, // 验证手机验证码
sendBackMobileAPI, // 重新发送验证码到手机
verifyCodeByMobilePage,
verifyCodeByMobileAPI,
sendBackMobileAPI,
resetPasswordPage, // 重设密码页面
updatePwdAPI, // 重设密码接口
validateMobileAPI, // 验证手机号是否合法
resetPwdSuccessPage, // 重设密码成功页面
resetPasswordPage,
updatePwdAPI,
validateMobileAPI,
resetPwdSuccessPage,
validateInputAPI, // 验证用户输入的邮箱或者手机是否合法,返回是json
validateInputPage, // 验证用户输入的邮箱或者手机是否合法,跳转是页面
validateInputAPI,
validateInputPage,
validateEmailInSession, // 验证邮箱是否在session中
validateMobileInSession, // 验证手机是否在session中
validateEmailInSession,
validateMobileInSession,
validateCodeByEmailPage, // 验证邮箱验证码
validateCodeByMobilePage, // 验证手机验证码
validateCodeByEmailPage,
validateCodeByMobilePage,
validateSuccessStatusPage, // 验证重设密码状态
validateExistCodePage, // 验证参数是否存在code
validateSuccessStatusPage,
validateExistCodePage,
validatePwdPage // 验证密码是否合法
validatePwdPage
};
... ...
/**
* 第三方登录后绑定
*
* @author: jiangfeng<jeff.jiang@yoho.cn>
* @author: TaoHuang
*/
'use strict';
... ... @@ -22,6 +22,9 @@ const Sources = {
const DEFAULT_URL = 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
/**
* 首页
*/
const indexPage = (req, res) => {
let openId = req.query.openId;
let sourceType = req.query.sourceType;
... ... @@ -41,6 +44,9 @@ const indexPage = (req, res) => {
}));
};
/**
* 设置密码
*/
const bindSetPwdPage = (req, res) => {
let mobile = req.query.thirdPart.mobile;
let sourceType = req.query.thirdPart.sourceType;
... ... @@ -61,6 +67,9 @@ const bindSetPwdPage = (req, res) => {
};
/**
* 绑定确认页面
*/
const bindConfirmPage = (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
... ... @@ -90,6 +99,9 @@ const bindConfirmPage = (req, res) => {
}));
};
/**
* 绑定成功页面
*/
const bindSuccessPage = (req, res) => {
let sourceType = _.trim(req.query.sourceType);
let sourceInfo = sourceType.split('_');
... ... @@ -106,6 +118,9 @@ const bindSuccessPage = (req, res) => {
}));
};
/**
* 已绑定过手机页面
*/
const bindedPage = (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
... ... @@ -127,6 +142,9 @@ const bindedPage = (req, res) => {
}));
};
/**
* 关联成功页面
*/
const relateSuccessPage = (req, res) => {
let sourceType = _.trim(req.query.sourceType);
let sourceInfo = sourceType.split('_');
... ... @@ -143,6 +161,9 @@ const relateSuccessPage = (req, res) => {
}));
};
/**
* 关联手机号确定页面
*/
const relateConfirmPage = (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
... ... @@ -168,6 +189,9 @@ const relateConfirmPage = (req, res) => {
}));
};
/**
* 检查手机号和第三方绑定情况
*/
const bindCheck = (req, res, next) => {
let mobile = req.body.mobile;
let openId = req.body.openId;
... ... @@ -217,6 +241,9 @@ const bindCheck = (req, res, next) => {
}
};
/**
* 发送绑定短信页面
*/
const sendBindMsg = (req, res, next) => {
let mobile = req.body.mobile;
let area = req.body.area;
... ... @@ -229,6 +256,10 @@ const sendBindMsg = (req, res, next) => {
}
}).catch(next);
};
/**
* 验证绑定短信
*/
const checkBindMsg = (req, res, next) => {
let mobile = req.body.mobile;
let area = req.body.area;
... ... @@ -243,6 +274,9 @@ const checkBindMsg = (req, res, next) => {
}).catch(next);
};
/**
* 绑定第三方到手机号
*/
const bindMobile = (req, res, next) => {
let mobile = _.trim(req.body.mobile);
let area = _.trim(req.body.area) || '86';
... ... @@ -271,6 +305,9 @@ const bindMobile = (req, res, next) => {
}).catch(next);
};
/**
* 关联第三方到手机号
*/
const relateMobile = (req, res, next) => {
let mobile = req.body.mobile;
let openId = req.body.openId;
... ... @@ -299,16 +336,16 @@ const relateMobile = (req, res, next) => {
};
module.exports = {
indexPage, // 首页
bindSetPwdPage, // 设置密码页面
bindConfirmPage, // 绑定确认页面
bindSuccessPage, // 绑定成功页面
bindedPage, // 已绑定相同类型第三方的页面
relateConfirmPage, // 关联确认页面
relateSuccessPage, // 关联成功页面
bindCheck, // 检查第三方和手机号的绑定情况
sendBindMsg, // 发送绑定手机验证码
checkBindMsg, // 检查手机验证码
bindMobile, // 绑定手机号
relateMobile // 关联手机号
indexPage,
bindSetPwdPage,
bindConfirmPage,
bindSuccessPage,
bindedPage,
relateConfirmPage,
relateSuccessPage,
bindCheck,
sendBindMsg,
checkBindMsg,
bindMobile,
relateMobile
};
... ...
/**
* 图形验证码
* Created by TaoHuang on 2016/6/18.
*/
... ... @@ -7,6 +8,9 @@
const captchaService = require('../models/captcha-service');
const helpers = global.yoho.helpers;
/**
* 验证图形验证码中间件,返回JSON
*/
const requiredAPI = (req, res, next) => {
let captchaToken = req.body.verifyCode || '';
... ... @@ -20,6 +24,9 @@ const requiredAPI = (req, res, next) => {
}
};
/**
* 验证图形验证码,失败后跳转页面
*/
const requiredPage = (req, res, next) => {
let captchaToken = req.body.verifyCode || '';
... ... @@ -30,6 +37,9 @@ const requiredPage = (req, res, next) => {
}
};
/**
* 生成图形验证码
*/
const generate = (req, res) => {
let width = req.query.w || 150;
let height = req.query.h || 50;
... ... @@ -45,6 +55,9 @@ const generate = (req, res) => {
res.end(captcha.image);
};
/**
* 验证图形码
*/
const requiredPost = (req, res) => {
let captchaToken = req.body.verifyCode || '';
... ... @@ -62,8 +75,8 @@ const requiredPost = (req, res) => {
};
module.exports = {
requiredAPI, // 中间件的验证
requiredPage, // 跳转页面的验证
generate, // 生成验证码
requiredPost // 端点验证码
requiredAPI,
requiredPage,
generate,
requiredPost
};
... ...
... ... @@ -21,14 +21,16 @@ const LoginService = require('../models/login-service');
const PassportHelper = require('../models/passport-helper');
const loginPageURL = `${config.siteUrl}/passport/login`;
const blockRedirectFilter = /sign|login|passport/;
const BlockRedirectFilter = /sign|login|passport/;
// 第三方登录回调
/**
* 第三方登录回调
*/
const _doPassportCallback = (req, res, user) => {
let shoppingKey = cookie.getShoppingKey(req);
let refer = req.cookies.refer || config.siteUrl;
refer = !blockRedirectFilter.test(decodeURI(refer)) ? decodeURI(refer) : config.siteUrl;
refer = !BlockRedirectFilter.test(decodeURI(refer)) ? decodeURI(refer) : config.siteUrl;
if (user.openId && user.nickname) {
let signinByOpenID = LoginService.signinByOpenIDAsync(
... ... @@ -59,6 +61,9 @@ const _doPassportCallback = (req, res, user) => {
};
const common = {
/**
* 获得跳转前的链接
*/
beforeLogin: (req, res, next) => {
let refer = req.query.refer;
... ... @@ -70,16 +75,21 @@ const common = {
});
next();
},
/**
* 登录时,大于3次,需要图形验证码
*/
needCaptcha: (req, res, next) => {
let account = req.query.account;
let result = {code: 400, message: '', data: ''};
const MAX_ALLOW_ERROR_LOGIN = 3;
if (account) {
let errorLoginKey = 'account_errorlogin_' + account;
cache.get(errorLoginKey).then(errloginTimes => {
errloginTimes = parseInt(errloginTimes, 0) || 0;
if (!isNaN(errloginTimes) && errloginTimes >= 3) {
if (!isNaN(errloginTimes) && errloginTimes >= MAX_ALLOW_ERROR_LOGIN) {
result.data = {needCaptcha: true};
}
res.json(result);
... ... @@ -90,6 +100,9 @@ const common = {
}
};
/**
* 本地登录
*/
const local = {
loginPage: (req, res) => {
// 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie
... ... @@ -141,6 +154,7 @@ const local = {
}
});
} else {
// 同步用户数据
co(function * () {
let isRemember = req.body.isRemember === 'true';
let refer = req.cookies.refer;
... ... @@ -153,15 +167,7 @@ const local = {
}, req, res);
}
if (refer) {
refer = decodeURI(req.cookies.refer);
} else {
refer = `${config.siteUrl}`;
}
if (blockRedirectFilter.test(refer)) {
refer = `${config.siteUrl}`;
}
refer = !BlockRedirectFilter.test(decodeURI(refer)) ? decodeURI(refer) : config.siteUrl;
yield LoginService.syncUserSession(user.uid, req, res).then(() => {
res.json({
... ... @@ -171,45 +177,29 @@ const local = {
}
});
});
})();
})().catch(next);
}
})(req, res, next);
},
logout: (req, res) => {
req.session.destroy();
res.clearCookie('_UID', {
domain: config.cookieDomain
});
res.clearCookie('_TOKEN', {
domain: config.cookieDomain
});
res.clearCookie('_USERNAME', {
domain: config.cookieDomain
});
res.clearCookie('_SPK', {
domain: config.cookieDomain
});
res.clearCookie('_g', {
domain: config.cookieDomain
});
res.clearCookie('isRemember', {
domain: config.cookieDomain
});
const clearAll = (v, k) => {
console.log(k);
res.clearCookie(k, {
domain: config.cookieDomain
});
};
res.clearCookie('remem', {
domain: config.cookieDomain
});
_.forOwn(req.cookies, clearAll);
res.redirect(config.siteUrl);
}
};
/**
* 微信登录
*/
const wechat = {
login: (req, res, next) => {
req.session = req.session || {};
... ... @@ -240,6 +230,9 @@ const wechat = {
}
};
/**
* 新浪登录
*/
const sina = {
login: (req, res, next) => {
req.session = req.session || {};
... ... @@ -270,6 +263,9 @@ const sina = {
}
};
/**
* QQ登录
*/
const qq = {
login: (req, res, next) => {
req.session = req.session || {};
... ... @@ -301,6 +297,9 @@ const qq = {
}
};
/**
* 支付宝登录
*/
const alipay = {
login: (req, res, next) => {
return passport.authenticate('alipay')(req, res, next);
... ... @@ -326,9 +325,9 @@ const alipay = {
module.exports = {
common,
local, // 本地系统登录
wechat, // 微信登录
qq, // QQ登录
sina, // 新浪登录
alipay // 支付宝登录
local,
wechat,
qq,
sina,
alipay
};
... ...
... ... @@ -262,6 +262,9 @@ let mobileRegister = (req, res, next) => {
})().catch(next);
};
/**
* 成功页
*/
let success = (req, res) => {
let goUrl = req.query.next || config.siteUrl;
let goShoppingUrl = req.query.goShoppingUrl || config.siteUrl;
... ... @@ -279,13 +282,13 @@ let success = (req, res) => {
};
module.exports = {
checkCode, // 检查图形验证码中间件
checkPassword, // 检查密码格式
index, // 首页
success, // 成功页
checkMobile, // 检查手机号码是否注册过
picCaptcha, // 检查图形验证码
sendBindMsg, // 发送注册验证码
msgCaptcha, // 验证图形验证码
mobileRegister // 手机号注册
checkCode,
checkPassword,
index,
success,
checkMobile,
picCaptcha,
sendBindMsg,
msgCaptcha,
mobileRegister
};
... ...
... ... @@ -11,7 +11,7 @@ const moment = require('moment');
const helpers = global.yoho.helpers;
const api = require('./back-api');
const UserService = require('./user-service');
const LoginService = require('./user-service');
const PassportHelper = require('./passport-helper');
const BackHelper = require('./back-helper');
... ... @@ -54,8 +54,8 @@ const findUserAsync = (type, phone, area) => {
};
const findBy = {
email: UserService.findByEmailAsync,
mobile: (phone1, area1) => UserService.findByMobileAsync(area1, phone1) // 交换参数
email: LoginService.findByEmailAsync,
mobile: (phone1, area1) => LoginService.findByMobileAsync(area1, phone1) // 交换参数
};
const OK = {code: 200, message: MESSAGE.ok};
... ...
... ... @@ -13,6 +13,9 @@ const config = global.yoho.config;
const api = require('./login-api');
const UserService = require('./user-service');
/**
* 登录,包括微信和其它第三方
*/
const signinByOpenIDAsync = (nickname, openId, sourceType, shoppingKey, unionId) => {
let signinFunc = {
other: api.signinByOtherOpenIDAsync,
... ... @@ -25,6 +28,9 @@ const signinByOpenIDAsync = (nickname, openId, sourceType, shoppingKey, unionId)
return signinFunc[type](nickname, openId, sourceType, shoppingKey, unionId);
};
/**
* 同步用户信息到session
*/
const syncUserSession = (uid, req, res) => {
return UserService.profileAsync(uid).then((userInfo) => {
let token = sign.makeToken(uid);
... ... @@ -55,6 +61,9 @@ const syncUserSession = (uid, req, res) => {
});
};
/**
* 把个人信息保存在缓存
*/
const rememberAccountAsync = (accountInfo, req, res) => {
let aWeek = (new Date()).getTime() / 1000 + 504000; // 504000-一周
let rememKey = md5(md5(accountInfo.account + accountInfo.password + accountInfo.area));
... ...
... ... @@ -24,7 +24,7 @@ router.post('/login/user', back.validateInputAPI, back.getUserInfoAPI);
router.get('/logout', login.local.logout);
// 微信登录
router.get('/autosign/wechat', login.common.beforeLogin, login.wechat.login); // 微信登录, 兼容 PHP 的路径
router.get('/autosign/wechat', login.common.beforeLogin, login.wechat.login);
router.get('/login/wechat/callback', login.wechat.callback);
// sina登录
... ... @@ -78,7 +78,7 @@ router.get('/reg/success', reg.success);
* 找回密码首页信息
*/
// 找回密码首页
router.get('/back/index', back.index);
router.get('/back/index', back.indexPage);
// 实时验证输入是否正确
router.post('/back/authcode',
... ...
... ... @@ -166,7 +166,7 @@ const submit = (uid, other) => {
Object.assign(theOther, other, {
delivery_time: 2, // 平时和周末都送货
delivery_way: 1, // 普通快递
delivery_way: 2, // blk统一为顺丰
payment_id: 1, // 支付宝
payment_type: 1, // 在线支付
use_yoho_coin: other.use_yoho_coin / 100 // 有货币稀释
... ...
... ... @@ -5,26 +5,26 @@
*/
var queryId = location.search.split("=")[1] || "1";
var $cate = $(".cateId-" + queryId);
var $cate = $(".cateId-" + queryId);//当前分类
var $subsets=$(".subsets");
/**
* 目录切换
*/
$(document).on("click", ".big-category .plus", function () {
var $parent = $(this).parent();//当前一级分类
var className = $parent.attr("class").split(" ")[1];
$subsets.click(function () {
var $this = $(this);
var className = $this.attr("class").split(" ")[1];
var parentId = "parentId-" + className.split("-")[1];
var $child = $parent.parent().find("." + parentId);//当前子分类
var $child = $this.parent().find("." + parentId);//当前子分类
if ($parent.hasClass("open")) {
if ($this.hasClass("open")) {
$child.hide();
$parent.removeClass("open");
$(this).css("background-image", "url('../img/help/plus.png')");
$this.removeClass("open").children('.plus').css("background-image", "url('../img/help/plus.png')");
} else {
$child.show();
$parent.addClass("open");
$(this).css("background-image", "url('../img/help/minus.png')");
$this.addClass("open").children('.plus').css("background-image", "url('../img/help/minus.png')");
}
});
... ...
... ... @@ -261,12 +261,18 @@ exports.init = function() {
$imgCaptchaInput.on('blur', function() {
validateImgCaptcha();
$imgCaptchaInput.removeClass('focus');
}).on('focus', function() {
hideTip($imgCaptchaInput);
$imgCaptchaInput.addClass('focus');
});
$phoneNumInput.on('focus', function() {
hideTip($phoneNumInput);
$('.phone').addClass('focus');
}).on('blur', function() {
$phoneNumInput.removeClass('focus');
$('.phone').removeClass('focus');
});
$nextBtn.on('click', function() {
... ...
... ... @@ -65,6 +65,10 @@ $passwordInput.on('keyup blur', function() {
}
ep.emit('pwd', true);
}).on('focus', function() {
$passwordInput.addClass('focus');
}).on('blur', function() {
$passwordInput.removeClass('focus');
});
$repasswordInput.on('keyup blur', function() {
... ... @@ -83,6 +87,10 @@ $repasswordInput.on('keyup blur', function() {
}
ep.emit('repwd', true);
}).on('focus', function() {
$repasswordInput.addClass('focus');
}).on('blur', function() {
$repasswordInput.removeClass('focus');
});
// 监听 repwd 事件
... ...
... ... @@ -91,6 +91,9 @@ $smsCaptchaInput.on('blur', function() {
}
}).on('focus', function() {
hideTip($smsCaptchaInput);
$smsCaptchaInput.addClass('focus');
}).on('blur', function() {
$smsCaptchaInput.removeClass('focus');
});
function init() {
... ...
... ... @@ -163,6 +163,7 @@ ep.tail('phoneNum', 'img-captcha', function(phoneAuth, imgAuth) {
$phoneNumInput.on('blur', function() {
var length = $phoneNumInput.val().length;
$('#phone').removeClass('focus');
if (length === 0) {
errTip($phoneNumInput, '请输入手机号码');
ep.emit('phoneNum', false);
... ... @@ -191,11 +192,14 @@ $phoneNumInput.on('blur', function() {
}
}).on('focus', function() {
hideTip($phoneNumInput);
$('#phone').addClass('focus');
});
$imgCaptchaInput.on('blur', function() {
var length = $imgCaptchaInput.val().length;
$imgCaptchaInput.removeClass('focus');
switch (length) {
case 4 :
break;
... ... @@ -221,6 +225,7 @@ $imgCaptchaInput.on('blur', function() {
});
}).on('focus', function() {
hideTip($imgCaptchaInput);
$imgCaptchaInput.addClass('focus');
});
$imgCaptchaCtrl.on('click', function() {
... ... @@ -230,6 +235,8 @@ $imgCaptchaCtrl.on('click', function() {
$smsCaptchaInput.on('blur', function() {
var length = $smsCaptchaInput.val().length;
$smsCaptchaInput.removeClass('focus');
switch (length) {
case 4:
break;
... ... @@ -253,6 +260,7 @@ $smsCaptchaInput.on('blur', function() {
});
}).on('focus', function() {
hideTip($smsCaptchaInput);
$smsCaptchaInput.addClass('focus');
});
$smsCaptchaCtrl.on('click', function() {
... ...
... ... @@ -46,6 +46,8 @@ ep.tail('pwd', 'repwd', function(pwd, repwd) {
$passwordInput.on('keyup blur', function() {
var length = $passwordInput.val().length;
$passwordInput.removeClass('focus');
if (length === 0) {
errTip($passwordInput, '请输入密码');
ep.emit('pwd', false);
... ... @@ -67,11 +69,14 @@ $passwordInput.on('keyup blur', function() {
ep.emit('pwd', true);
}).on('focus', function() {
hideTip($passwordInput);
$passwordInput.addClass('focus');
});
$repasswordInput.on('keyup blur', function() {
var length = $repasswordInput.val().length;
$repasswordInput.removeClass('focus');
if (length === 0) {
errTip($repasswordInput, '请再次输入密码');
ep.emit('repwd', false);
... ... @@ -87,6 +92,7 @@ $repasswordInput.on('keyup blur', function() {
ep.emit('repwd', true);
}).on('focus', function() {
hideTip($repasswordInput);
$repasswordInput.addClass('focus');
});
// 下一步
... ...
... ... @@ -452,15 +452,19 @@ exports.init = function() {
// 验证手机输入
$phoneNumInput.on('keyup blur', function() {
validatePhoneNum();
$('#phone').removeClass('focus');
}).on('focus', function() {
hideTip($phoneNumInput);
$('#phone').addClass('focus');
});
// 验证图形输入
$imgCaptchaInput.on('keyup blur', function() {
validateImgCaptcha();
$imgCaptchaInput.removeClass('focus');
}).on('focus', function() {
hideTip($imgCaptchaInput);
$imgCaptchaInput.addClass('focus');
});
// 图形验证通过时,发送短信按钮可点击
... ... @@ -475,8 +479,10 @@ exports.init = function() {
// 验证短信输入
$smsCaptchaInput.on('keyup blur', function() {
validateSMSCaptcha();
$smsCaptchaInput.removeClass('focus');
}).on('focus', function() {
hideTip($smsCaptchaInput);
$smsCaptchaInput.addClass('focus');
});
// 验证密码输入
... ... @@ -488,6 +494,9 @@ exports.init = function() {
});
}).on('focus', function() {
hideTip($passwordInput);
$passwordInput.addClass('focus');
}).on('blur', function() {
$passwordInput.removeClass('focus');
});
// 服务条款
... ...
.nav {
li {
cursor: pointer;
padding: 10px 15px;
width: 200px;
font-size: 14px;
.plus {
cursor: pointer;
margin-right: 10px;
height: 14px;
width: 14px;
background-repeat: no-repeat;
background-image: resolve('help/plus.png');
background-size: 14px 14px;
}
}
.smll-category {
... ... @@ -10,15 +21,7 @@
}
}
.plus {
cursor: pointer;
margin-right: 10px;
height: 14px;
width: 14px;
background-repeat: no-repeat;
background-image: resolve('help/plus.png');
background-size: 14px 14px;
}
.mult {
margin-right: 26px;
... ...
... ... @@ -13,23 +13,15 @@
}
.country-code {
@mixin country-code ;
@mixin country-code;
}
.country-list {
@mixin region ;
@mixin region;
}
.phone {
@mixin phone ;
&.focus-gain {
border: 2px solid #000;
}
&.focus-lost {
border: 1px solid #dbdbdb;
}
@mixin phone;
}
.input {
... ... @@ -40,21 +32,13 @@
display: block;
float: left;
border: none !important;
height: 40px !important;
}
&.captcha {
width: $captcha;
float: left;
&.focus-gain {
border: 2px solid #000;
}
&.focus-lost {
border: 1px solid #dbdbdb;
}
}
}
.captcha-component {
... ...
$theme-color: #1d1d1d;
$item-height: 40px;
$item-height: 44px;
$item-width: 340px;
$bord-color: #dbdbdb;
$bord-color: #eee;
$margin-left: 15px;
$margin-top: 110px;
$red: #e01;
... ... @@ -15,7 +15,7 @@ $input-button: 125px;
$err-tips-width: 348px;
$blue: #379ed6;
$inactive-color: #555;
$option-color:#f8f8f8;
$option-color: #f8f8f8;
@define-mixin li-setting {
margin-bottom: 20px;
... ... @@ -55,19 +55,21 @@ $option-color:#f8f8f8;
@define-mixin phone {
width: 225px;
height: $item-height;
margin-left: $margin-left;
border: 1px solid $bord-color;
border: 2px solid $bord-color;
display: inline-block;
}
@define-mixin input {
height: $item-height;
width: 100%;
line-height: 43px;
line-height: @height;
font-size: 16px;
border: 1px solid $bord-color;
border: 2px solid $bord-color;
text-indent: 10px;
color: #9a9a9a;
color: #000;
font-weight: bold;
padding: 0;
}
... ...
... ... @@ -134,7 +134,7 @@
.country-select-header {
height: $item-height;
width: 100px;
border: 1px solid #eee;
border: 2px solid #eee;
font-size: 16px;
float: left;
cursor: pointer;
... ...
... ... @@ -40,6 +40,7 @@
display: block;
float: left;
border: none !important;
height: 40px !important;
}
&.captcha {
... ...
... ... @@ -20,6 +20,7 @@
&.phone-num {
width: 160px;
height: 40px !important;
display: block;
float: left;
border: none !important;
... ...
... ... @@ -6,6 +6,11 @@ $btn-height: 50px;
$btn-width: 180px;
.bind-wrapper {
.focus {
border: 2px solid #000 !important;
}
.auth-page,
.pwd-page,
.relate-success-page {
... ... @@ -84,6 +89,7 @@ $btn-width: 180px;
.input {
@mixin input;
font-weight: bold;
}
.bind-confirm-page {
... ... @@ -166,7 +172,7 @@ $mobile-phone: calc($item-width - $mobile-margin - $mobile-region - $mobile-code
}
.ctrl {
border: 1px solid $bord-color;
border: 2px solid $bord-color;
width: $mobile-mobile;
margin-left: $mobile-margin;
height: $item-height;
... ... @@ -176,12 +182,14 @@ $mobile-phone: calc($item-width - $mobile-margin - $mobile-region - $mobile-code
}
.phone-num {
width: $mobile-phone;
height: calc($item-height - 2px);
width: calc($mobile-phone - 4px);
height: calc($item-height - 4px);
border: none !important;
line-height: calc($item-height - 2px);
line-height: calc($item-height - 4px);
font-size: 16px;
padding: 0;
color: #000;
font-weight: bold;
}
}
... ... @@ -220,7 +228,7 @@ $mobile-phone: calc($item-width - $mobile-margin - $mobile-region - $mobile-code
.country-select-header {
height: $item-height;
width: 100px;
border: 1px solid #eee;
border: 2px solid #eee;
font-size: 16px;
float: left;
cursor: pointer;
... ...