Authored by htoooth

fix tips

... ... @@ -191,7 +191,7 @@ const local = {
res.clearCookie('_g');
res.clearCookie('isRemember');
res.clearCookie('remem');
res.redirect(req.get('Referer') || config.siteUrl);
res.redirect(config.siteUrl);
}
};
... ...
... ... @@ -14,9 +14,18 @@ module.exports = (req, res, next) => {
return req.protocol + '://' + req.get('host') + req.originalUrl;
};
let loginUrl = helpers.urlFormat('/passport/login', {refer: req.getUrl()});
if (_.isEmpty(req.user) || !req.user.uid) {
return res.redirect(helpers.urlFormat('/passport/login', {refer: req.getUrl()}));
}
if (req.xhr) {
return res.json({
code: 400,
message: '抱歉,您暂未登录!',
data: {refer: loginUrl}
});
}
return res.redirect(loginUrl);
}
next();
};
... ...
... ... @@ -133,7 +133,8 @@ $phoneNumInput.on('blur', function() {
// 这里只做中国区验证
if ($regionCodeText.text() === '+86') {
if ($phoneNumInput.length === 11 && phoneRegx['+86'].test($phoneNumInput.val())) {
if (length === 11 && phoneRegx['+86'].test($phoneNumInput.val())) {
ep.emit('phoneNum', true);
return;
} else {
... ...
... ... @@ -42,6 +42,9 @@ require('yoho-jquery-placeholder');
require('../../plugins/tips');
function errTip(ele, msg) {
//ele.tips('show', msg)
var topLeft = ele.offset();
$errMsg.text(msg);
... ... @@ -244,14 +247,15 @@ function validatePhoneNumLocal() {
regionCode = $regionCodeText.text();
if (length === 0) {
errTip($phone, '请输入手机号码');
return false;
}
if (/^[0-9]+$/.test($phoneNumInput.val())) {
if (/^[0-9]+$/.test(phoneNum)) {
// 这里只做中国区验证
if (regionCode === '+86') {
if (phoneNum.length === 11 && regValidate.phoneRegx['+86'].test(phoneNum.val())) {
if (length === 11 && regValidate.phoneRegx['+86'].test(phoneNum)) {
return true;
} else {
errTip($phone, '手机号码不正确,请重新输入');
... ... @@ -333,7 +337,7 @@ function validatePassword() {
function validatePasswordComplexLocal($obj) {
var pwd = $obj.val(),
level = computeComplex(pwd);
console.log(level);
switch (level) {
case 0:
$pwdParent.removeClass('red yellow green');
... ...
... ... @@ -27,7 +27,7 @@ var jQuery = require('yoho-jquery'),
} else {
_that.isInit = true;
this.append(tplFn({content: arguments[0]}));
$tips = this.find('.tips');
$tips = this.find('.tips').removeClass('hide');
$tips.css({
top: topLeft.top + this.height() - 2,
left: topLeft.left,
... ... @@ -36,7 +36,7 @@ var jQuery = require('yoho-jquery'),
});
}
return this.removeClass('hide');
return this;
},
hide: function() {
if (_that.isInit) {
... ...
.tooltip {
position: relative;
position: absolute;
font-weight: normal !important;
.content {
... ...