Authored by ccbikai

Merge branch 'release/4.9.2'

... ... @@ -29,16 +29,19 @@ exports.index = (req, res, next) => {
exports.main = (req, res, next) => {
const isReplay = /^\/live\/replay\//.test(req.path);
const id = req.params.id;
const goDownload = req.query.no;
res.locals.liveRoom = id;
res.locals.module = 'activity';
res.locals.page = 'live-play';
res.locals.enableFoot = goDownload !== 1;
model.fetchInfo(id, isReplay)
.then(result => {
if (!result.data) {
return next();
}
res.render('live/play', result.data);
})
.catch(next);
... ...
... ... @@ -354,7 +354,7 @@ exports.verifystudent = (req, res, next) => {
}
} else {
if (datas[2].code === 500) {
prompt = '芝麻信用认证失败,稍后重试!';
prompt = '请重新认证!';
} else {
prompt = datas[2].message;
}
... ...
... ... @@ -13,6 +13,9 @@
<p>加载中</p>
</div>
<div class="live-loading-cover" style="background-image: url('{{pic}}');"></div>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</div>
<div id="live_touch_layer"></div>
... ... @@ -65,9 +68,6 @@
<a href="javascript:;" class="live-btn-share">
<i class="iconfont">&#xe600</i>
</a>
<a href="javascript: history.back();" class="live-btn-close">
<i class="iconfont">&#xe623</i>
</a>
</section>
</div>
{{/canPlay}}
... ... @@ -122,6 +122,7 @@
{{/notBegin}}
{{! footer}}
{{#enableFoot}}
<div class="float-layer" id="float-layer-app">
<div class="float-layer-left">
<span class="yoho-icon iconfont">&#xe60d;</span>
... ... @@ -135,6 +136,7 @@
立即下载
</a>
</div>
{{/enableFoot}}
</div>
<script>
var live_start_time = {{live_start_time}};//该直播开始时间
... ... @@ -142,7 +144,6 @@
var live_room = {{liveRoom}};//房间id,资讯id
var replay_total_likes = {{like_num}};//重播总计点赞数,取的是直播最终点赞数
var replay_user_nums = {{audience_num}};//重播观看人数,取的是直播时最终观看人数
var site_url = '';
var site_domain = 'http://api.live.yoho.cn/';
// share data
... ...
{{#unless isApp}}
<header class="yoho-header">
<a href="javascript:history.go(-1);" class="iconfont nav-back"></a>
<a href="//m.yohobuy.com/activity/student?openby:yohobuy={'action':'go.h5','params':{'islogin':'N','url':'{{http}}//m.yohobuy.com/activity/student'}}" class="iconfont nav-back"></a>
<p class="nav-title">学生身份认证</p>
</header>
{{/unless}}
... ...
... ... @@ -134,6 +134,11 @@ const _getChannelResource = (params) => {
cache: true
}).then(result => {
if (result && result.code === 200) {
for (let item of result.data.list) {
item.template_name === 'single_image' &&
item.data.length === 1 &&
(item.singleOne = true);
}
return resourcesProcess(result.data.list);
} else {
logger.error('index resouce is not 200');
... ...
... ... @@ -23,7 +23,7 @@ const indexEmailPage = (req, res) => {
page: 'back-email',
title: '找回密码-通过邮箱'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backEmail: true
... ... @@ -100,7 +100,7 @@ const backSuccessByEmailPage = (req, res) => {
page: 'back-email-success',
title: '找回密码-通过邮箱'
}, {
backUrl: helpers.urlFormat('/passport/back/email'),
// backUrl: helpers.urlFormat('/passport/back/email'),
headerText: '找回密码',
isPassportPage: true,
backEmailSuccess: true,
... ... @@ -145,7 +145,7 @@ const indexMobilePage = (req, res, next) => {
page: 'back-mobile',
title: '找回密码-通过手机号'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backMobile: true,
... ... @@ -203,7 +203,7 @@ const verifyCodeByMobilePage = (req, res) => {
page: 'back-code',
title: '找回密码-通过手机号'
}, {
backUrl: helpers.urlFormat('/passport/back/mobile'),
// backUrl: helpers.urlFormat('/passport/back/mobile'),
headerText: '找回密码',
isPassportPage: true,
backCode: true,
... ... @@ -261,7 +261,7 @@ const setNewPasswordByMobilePage = (req, res) => {
page: 'back-new-password',
title: '找回密码-输入新密码'
}, {
backUrl: SIGN_IN,
// backUrl: SIGN_IN,
headerText: '找回密码',
isPassportPage: true,
backNewPwd: true,
... ...
/* eslint no-unused-vars: ["error", { "args": "none" }] */
/**
* 登录
* @author: Bi Kai<kai.bi@yoho.cn>
... ... @@ -93,6 +94,7 @@ const local = {
backUrl: 'javascript:history.go(-1)', // eslint-disable-line
showHeaderImg: true, // 控制显示头部图片
isPassportPage: true, // 模板中模块标识
smsLoginUrl: '/passport/sms_login',
registerUrl: '/passport/reg/index', // 注册的URL链接
aliLoginUrl: '/passport/login/alipay', // 支付宝快捷登录的URL链接
weiboLoginUrl: '/passport/login/sina', // 微博登录的URL链接
... ...
/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const helpers = global.yoho.helpers;
const cookie = global.yoho.cookie;
const RegService = require('../models/reg-service');
const PhoneService = require('../models/phone-service');
const AuthHelper = require('../models/auth-helper');
// constrant
const CODE_REQUIRED = '请输入校验码';
const PASSWORD_REQUIRED = '请输入密码';
const PASSWORD_LENGTH_ERROR = '密码6-20位,请重新输入';
const BAD_PASSWORD = '密码格式不正确';
const TOO_MANY = '请求太频繁';
const LOGIN_SUCCSS = '登录成功';
const VERIFY_ERROR = '校验失败';
exports.beforeIn = (req, res, next) => {
res.set({
'Cache-Control': 'no-cache, no-store, must-revalidate',
Pragma: 'no-cache',
Expires: 0
});
if (!req.xhr && req.user.uid) {
return res.redirect(req.cookies.refer);
}
next();
};
// 短信登录 第一步: 展现页面
const _step1 = (req, res, next) => {
let template = 'sms/login';
let viewData = {
module: 'passport',
page: 'sms-login',
title: '手机短信登录',
isPassportPage: true,
headerText: '手机号码快捷登录',
areaCode: '+86', // 默认的区号
countrys: RegService.getAreaData() // 地区信息列表
};
res.render(template, viewData);
};
// 短信登录 第二步: 输入 校验码
const _step2 = (req, res, next) => {
const mobile = req.session.smsLogin.mobile;
const area = req.session.smsLogin.area;
const interval = req.session.smsLogin.interval;
const template = 'sms/check';
const viewData = {
module: 'passport',
page: 'sms-check',
title: '手机短信登录',
isPassportPage: true,
headerText: '手机号码快捷登录',
canResend: interval < Date.now(),
mobile,
area
};
res.render(template, viewData);
};
// 短信登录 第三步: 设置密码 (针对 改手机未注册用户)
const _step3 = (req, res, next) => {
const template = 'sms/password';
const viewData = {
module: 'passport',
page: 'sms-password',
title: '设置密码',
isPassportPage: true,
headerText: '设置密码'
};
res.render(template, viewData);
};
// 短信 登录
exports.loginPage = (req, res, next) => {
let step = Number(req.query.step) || 1;
let smsLoginStep = req.session.smsLoginStep || 1;
if (step === 2 && smsLoginStep !== 2) {
return res.redirect(req.path);
}
if (step === 3 && smsLoginStep !== 3) {
return res.redirect(req.path);
}
switch (step) {
case 2:
_step2(req, res, next);
break;
case 3:
_step3(req, res, next);
break;
case 1:
default:
_step1(req, res, next);
}
};
exports.tokenBefore = (req, res, next) => {
let area = req.query.area = (req.query.area || '').trim();
let mobile = req.query.mobile = (req.query.mobile || '').trim();
if (!req.xhr) {
return next(404);
}
if (req.session.smsLogin && req.session.smsLogin.interval > Date.now()) {
return res.json({
code: 429,
message: TOO_MANY
});
}
if ([area, mobile].some(val => val === '')) {
return res.json({
code: 401,
message: '请求参数,无法处理'
});
}
next();
};
// AJAX 获取验证码
exports.token = (req, res, next) => {
let area = req.query.area;
let mobile = req.query.mobile;
PhoneService.sendSMS(mobile, area, 1).then(result => {
if (result.code === 200) {
req.session.smsLogin = {
interval: Date.now() + 60 * 1000, // 重发验证码 间隔: 60s
area,
mobile
};
req.session.smsLoginStep = 2; // 进入短信登录 step2
result.redirect = '/passport/sms_login?step=2';
res.json(result);
return;
}
res.json(result);
});
};
exports.checkBefore = (req, res, next) => {
let code = req.query.code = (req.query.code || '').trim();
if (!req.xhr && req.session.smsLoginStep !== 2) {
return next(404);
}
if (!code) {
return res.json({
code: 404,
message: CODE_REQUIRED
});
}
next();
};
// AJAX 校验验证码 in step2
exports.check = (req, res, next) => {
const code = req.query.code;
const mobile = req.session.smsLogin.mobile;
const area = req.session.smsLogin.area;
const shopping_key = cookie.getShoppingKey(req); // eslint-disable-line
Promise.all([
PhoneService.checkUserPhoneExist(mobile, area),
PhoneService.verifySMS(mobile, area, code, 1)
])
.then(result => {
let r1 = result[0] || {};
let r2 = result[1] || {};
let redirect;
// 验证码 校验异常
if (r2.code !== 200) {
res.json(r2);
return;
}
// 检测 手机号 是否注册 异常
if (r1.code !== 200) {
res.json(r1);
return;
}
// 校验失败
if (r2.data.is_pass !== 'Y') {
res.json({
code: 401,
message: VERIFY_ERROR
});
return;
}
// 手机号码 没注册
if (r1.data.is_register !== 'Y') {
redirect = '/passport/sms_login?step=3';
req.session.smsLoginStep = 3;
res.json({
code: 200,
redirect
});
return;
}
// 手机号码已注册 --> 直接登录
PhoneService.autoSignin({
profile: mobile,
code: r2.data.code,
area,
shopping_key
})
.then(info => {
if (info.code !== 200) {
return Promise.reject(info);
}
return AuthHelper.syncUserSession(info.data.uid, req, res);
})
.then(() => {
res.json({
code: 200,
message: LOGIN_SUCCSS,
redirect: req.cookies.refer
});
delete req.session.smsLogin;
delete req.session.smsLoginStep;
})
.catch(error => {
res.json(error);
});
})
.catch(next);
};
// AJAX 短信登录 设置密码 in step3
exports.password = (req, res, next) => {
if (req.session.smsLoginStep !== 3) {
return next();
}
let data = {
code: '400',
message: BAD_PASSWORD
};
let smsLogin = req.session.smsLogin || {};
let mobile = smsLogin.mobile;
let area = smsLogin.area;
let password = (req.body.password || '').trim();
if (!password) {
data.message = PASSWORD_REQUIRED;
return res.json(data);
}
if (password.length < 6 || password.length > 20) {
data.message = PASSWORD_LENGTH_ERROR;
return res.json(data);
}
if (!helpers.verifyPassword(password)) {
return res.json(data);
}
// 购物车key
let shoppingKey = cookie.getShoppingKey(req);
RegService.regMobileAes(area, mobile, password, shoppingKey).then(result => {
if (!result.code || result.code !== 200) {
return Promise.reject(result);
}
if (!result.data || !result.data.uid) {
return Promise.reject(result);
}
return AuthHelper.syncUserSession(result.data.uid, req, res);
}).then(() => {
res.json({
code: 200,
message: LOGIN_SUCCSS,
redirect: req.cookies.refer
});
delete req.session.smsLogin;
delete req.session.smsLoginStep;
}).catch(next);
};
... ...
/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const API = global.yoho.API;
class PhoneService {
// 校验 手机 是否 已注册
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/校验是否是注册用户.md
static checkUserPhoneExist(mobile, area) {
return API.get('', {
method: 'app.passport.checkUserExist',
mobile,
area
});
}
// 手机号 自动登录
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/手机号自动登录.md
static autoSignin(param) {
return API.get('', {
method: 'app.passport.autoSignin',
profile: param.profile,
area: param.area,
code: param.code,
shopping_key: param.shopping_key
});
}
// 发送 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/发送验证码.md
static sendSMS(mobile, area, type) {
if (process.env.NODE_ENV === 'development') {
return new Promise((resolve, reject) => {
return resolve({
alg: 'SALT_MD5',
code: 200,
data: {},
md5: '6d729d4b35f10fc73531210bd7ecff91',
message: '发送成功.'
});
});
}
return API.get('', {
method: 'app.message.sendSms',
mobile,
area,
type
});
}
// 校验 验证码
// http://git.yoho.cn/yoho-documents/api-interfaces/blob/master/个人中心/验证码登录/验证验证码.md
static verifySMS(mobile, area, code, type) {
if (process.env.NODE_ENV === 'development') {
return new Promise((resolve, reject) => {
return resolve({
alg: 'SALT_MD5',
code: 200,
data: {
is_pass: 'Y'
},
md5: '6d729d4b35f10fc73531210bd7ecff91',
message: '发送成功.'
});
});
}
return API.get('', {
method: 'app.message.verifySmsCode',
mobile,
area,
code,
type
});
}
}
module.exports = PhoneService;
... ...
... ... @@ -12,6 +12,7 @@ const login = require(cRoot + '/login');
const back = require(cRoot + '/back');
const bind = require(cRoot + '/bind');
const reg = require(cRoot + '/reg');
const smsLogin = require(cRoot + '/sms');
const router = express.Router(); // eslint-disable-line
... ... @@ -33,6 +34,17 @@ router.get('/passport/international', login.common.beforeLogin, login.local.inte
// 本地登录
router.post('/passport/login/auth', login.local.login);
// SMS 短信
router.use('/passport/sms_login', login.common.beforeLogin, smsLogin.beforeIn);
router.get('/passport/sms_login', smsLogin.loginPage);
router.get('/passport/sms_login/token.json',
smsLogin.tokenBefore,
smsLogin.token); // only ajax;
router.get('/passport/sms_login/check.json',
smsLogin.checkBefore,
smsLogin.check); // only ajax
router.post('/passport/sms_login/password.json', smsLogin.password);
// 微信登录
router.get('/passport/login/wechat', login.common.beforeLogin, login.wechat.login);
router.get('/passport/login/wechat/callback', login.wechat.callback);
... ...
... ... @@ -10,7 +10,7 @@
</div>
<span id="btn-login" class="btn btn-login disable">登录</span>
<p class="op-container">
<a class="go-register" href={{registerUrl}}>免费注册</a>
<a class="sms-login" href={{smsLoginUrl}}>手机号码快捷登录</a>
<span id="forget-pwd" class="forget-pwd">忘记密码</span>
</p>
<div class="third-party-login">
... ... @@ -22,6 +22,10 @@
</div>
</div>
<a class="international" href={{internationalUrl}}>International Customer</a>
<div class="go-register">
<i class="iconfont">&#xe610;</i>
<a href={{registerUrl}}>注册Yoho!Family</a>
</div>
<div class="login-tip">
<div class="info-icon"></div>
Yoho!Family账号可登录Yoho!Buy有货
... ...
<div class="sms-login sms-login-check passport-page yoho-page">
{{> passport/header}}
<div class="content">
<p class="sms-login-msg">验证码已发至&nbsp;<span class="tel">+{{area}} {{mobile}}</span></p>
<div class="input-container input-group sms-input row">
<input id="sms-code" class="input" type="text" placeholder="验证码">
<div class="input-addon">
<button type="button" id="resend-sms">重发验证码</button>
</div>
<button class="clear-input" type="button"></button>
</div>
<button id="btn-next" class="btn btn-next disable row" type="button">登录</button>
</div>
<input type="hidden" name="mobile" id="mobile" value="{{mobile}}">
<input type="hidden" name="area" id="area" value="{{area}}">
</div>
<script>
var canResend = {{canResend}};
</script>
\ No newline at end of file
... ...
<div class="sms-login-page passport-page yoho-page">
{{> passport/header}}
<div class="content">
{{> passport/country_list}}
<div class="input-container phone-container row has-clear">
<span id="area-code" class="area-code">{{areaCode}}</span>
<input id="phone-num" class="input phone-num" type="text" placeholder="手机号">
<button class="clear-input" type="button"></button>
</div>
<button id="btn-next" class="btn btn-next disable row" disabled>获取短信验证码</button>
</div>
</div>
\ No newline at end of file
... ...
<div class="sms-login passport-page yoho-page">
{{> passport/header}}
<div class="content">
<p class="sms-login-msg small">你以后还可以使用手机号码 + 密码的形式登录有货哦!</p>
<div class="input-container row has-eye">
<input id="pwd" class="pwd input" type="text" placeholder="密码">
<div class="eye" id="eye"></div>
</div>
<span id="btn-next" class="btn btn-next disable row">确定</span>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -14,10 +14,8 @@ module.exports = {
port: 6001,
siteUrl: '//m.yohobuy.com',
domains: {
// api: 'http://devapi.yoho.cn:58078/',
// service: 'http://devservice.yoho.cn:58077/'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/'
},
subDomains: {
... ... @@ -93,7 +91,7 @@ if (isProduction) {
useOneapm: true,
useCache: true,
interfaceShunt: {
open: true,
open: false,
url: 'http://123.206.2.55/strategy'
}
});
... ...
{{#data}}
<div class="banner-center">
<a href="{{url}}">
<img class="lazy" data-original="{{image src 640 200}}" alt="">
</a>
<div class="banner-center banner-center-swiper">
{{#if singleOne}}
{{#data}}
<div class="banner-list">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</div>
{{/data}}
{{else}}
<ul class="banner-list swiper-wrapper clearfix">
{{#data}}
<li class="swiper-slide">
<a href="{{url}}">
<img src="{{image src 640 200}}" alt="">
</a>
</li>
{{/data}}
</ul>
{{/if}}
<div class="swiper-pagination">
<div class="pagination-inner">
</div>
</div>
{{/data}}
\ No newline at end of file
</div>
\ No newline at end of file
... ...
{
"name": "m-yohobuy-node",
"version": "4.9.20",
"version": "4.9.21",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -17,6 +17,7 @@ var prefixes = 'webkit moz ms o'.split(' '); //各浏览器前缀
var requestAnimationFrame = window.requestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame;
var site_url = STATIC_RESOURCE_PATH;
var $btn_play;
var video_width = 375;
var video_height = 667;
... ... @@ -284,9 +285,12 @@ function get_websocket_server(type) {
var arr = data.data[0].split(':');
var ip = arr[0];
var port = arr[1];
var protocol = 'ws'
// var protocol = location.protocol === 'https:' ? 'wss' :'ws'
if (is_live) {
ip = 'ws://' + ip;
ip = protocol + '://' + ip;
link_to_websocket_server(ip, port);
}
}
... ... @@ -670,7 +674,7 @@ function insert_like(obj) {
}
}
now_like_nums = num;
if (now_like_nums > 100000) {
if (now_like_nums > 10000) {
$('#like_num').text((now_like_nums / 10000).toFixed(1) + '万');
} else {
$('#like_num').text(now_like_nums);
... ...
... ... @@ -391,19 +391,9 @@ $(document).on('click', '.s-footer .checkbox', function() {
/*
* 数据提交
*/
$('.s-submit').data('isClick', true);
$(document).on('click', '.s-submit', function() {
var obj = changeSuccess(),
FAILURE_CAUSE;
var $that = $(this);
// 存cookie 记录状态
localStorage.setItem(STUDENTCOOKIES, JSON.stringify(obj.data));
if ($that.data('isClick') === false) {
return;
}
$that.data('isClick', false);
if (!obj.msg) {
$.ajax({
... ... @@ -422,15 +412,15 @@ $(document).on('click', '.s-submit', function() {
}
}, true);
}
location.href = data.data;
} else {
$that.data('isClick', true);
tip.show(data.message);
}
});
} else {
tip.show(obj.msg);
$that.data('isClick', true);
if (obj.msg.indexOf('字段为空') > -1) {
FAILURE_CAUSE = 1;
} else if (obj.msg.indexOf('认证协议') > -1) {
... ...
... ... @@ -108,6 +108,18 @@ if ($('.banner-swiper').find('li').size() > 1) {
});
}
// single_image的轮播
if ($('.banner-center-swiper').find('li').size() > 1) {
new Swiper('.banner-center-swiper', {
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
pagination: '.banner-center .pagination-inner'
});
}
// 热门品牌滑动
new Swiper('.brands-swiper', {
grabCursor: true,
... ...
... ... @@ -101,6 +101,7 @@ function bindAvatar(dom) {
avatarKey = dom.index();
if (!dom.hasClass('swiper-slide-active')) {
// if (avatarKey >= (2 * bannerLen + 1)) {
// avatarSwiperClone && avatarSwiperClone.slideTo(bannerLen + 1, 0);
// avatarSwiper.slideTo(bannerLen + 1, 0);
... ... @@ -109,8 +110,7 @@ function bindAvatar(dom) {
// avatarSwiper.slideTo(2 * bannerLen - (bannerLen - avatarKey), 0);
// } else {
// avatarSwiperClone && avatarSwiperClone.slideTo(avatarKey, 200);
avatarSwiper.slideTo(avatarKey, 200);
// avatarSwiper.slideTo(avatarKey, 200);
// }
return false;
... ...
var tip = require('plugin/tip');
var $resendBtn,
$nextBtn,
$smsCode,
$resetBtn,
mobile, area;
var page = {
disableAjax: false,
time: 60,
resendText: '重发验证码',
timerId: null,
init: function() {
this.domInit();
this.bindEvents();
if (!window.canResend) {
this.countDown();
}
},
domInit: function() {
$resendBtn = $('#resend-sms');
$nextBtn = $('#btn-next');
$resetBtn = $('.clear-input');
$smsCode = $('#sms-code');
mobile = $('#mobile').val();
area = $('#area').val();
},
bindEvents: function() {
var self = this;
$resendBtn.on('click', function() {
self.resendSMS();
});
$smsCode.on('input', function() {
var hasVal = Boolean($.trim(this.value));
$nextBtn.trigger('toggleDisable', !hasVal);
$resetBtn.toggle(hasVal);
});
$nextBtn.on('click', function() {
self.submit();
});
$resetBtn.on('click', function() {
$smsCode.val('');
$resetBtn.hide();
$nextBtn.trigger('toggleDisable');
});
$nextBtn.on('toggleDisable', function(event, bool) {
if (bool === void 0) {
bool = true;
}
$nextBtn.toggleClass('disable', bool);
$nextBtn.prop('disabled', bool);
});
},
countDown: function() {
var self = this;
var second = this.time;
if (this.timerId) {
return;
}
$resendBtn.prop('disabled', true);
$resendBtn.text('重新发送(' + second + ')');
this.timerId = setInterval(function() {
var txt = self.resendText;
second = second - 1;
if (second < 0) {
clearInterval(self.timerId);
self.timerId = null;
$resendBtn.prop('disabled', false);
} else {
txt = '重新发送(' + second + '秒)';
}
$resendBtn.text(txt);
}, 1000);
},
resendSMS: function() {
var self = this;
if ($resendBtn.prop('disabled')) {
return;
}
$.get('/passport/sms_login/token.json', {
area: area,
mobile: mobile,
})
.done(function(res) {
if (res.code === 200) {
self.countDown();
return;
}
tip.show(res.message);
})
.fail(function() {
tip.show('出错啦~休息一下');
});
},
submit: function() {
var code = $.trim($smsCode.val());
if ($nextBtn.prop('disabled')) {
return;
}
$nextBtn.prop('disabled', true);
$.get('/passport/sms_login/check.json', {
code: code
})
.done(function(res) {
if (res.code === 200) {
// $nextBtn.off();
location.href = res.redirect;
return;
}
tip.show(res.message);
})
.fail(function() {
tip.show('出错了, 请重试');
})
.always(function() {
$nextBtn.prop('disabled', false);
});
}
};
$(function() {
page.init();
});
... ...
'use strict';
var tip = require('plugin/tip');
var api = require('./api');
var $countrySelect,
$areaCode,
$nextBtn,
$resetBtn,
$phoneNum;
var page = {
init: function() {
this.domInit();
this.bindEvent();
},
domInit: function() {
$countrySelect = $('#country-select');
$areaCode = $('#area-code');
$nextBtn = $('#btn-next');
$phoneNum = $('#phone-num');
$resetBtn = $('.clear-input');
},
bindEvent: function() {
var self = this;
$countrySelect.on('change', function() {
$areaCode.text(this.value);
});
$phoneNum.on('input', function() {
self.toggleNextBtn();
});
$nextBtn.on('click', function() {
self.goNext();
});
$resetBtn.on('click', function() {
$phoneNum.val('');
$nextBtn
.prop('disabled', true)
.toggleClass('disable', true);
$resetBtn.hide();
});
},
// 切换$nextBtn disable状态
toggleNextBtn: function() {
var bool = Boolean($.trim($phoneNum.val()));
$nextBtn
.toggleClass('disable', !bool)
.prop('disabled', !bool);
$resetBtn.toggle(bool);
},
// 提交按钮
goNext: function() {
var areaCode = $countrySelect.val();
var phone = $.trim($phoneNum.val());
if ($nextBtn.prop('disabled')) {
return;
}
if (!api.phoneRegx[areaCode].test(phone)) {
tip.show('手机号码格式不正确, 请重新输入');
return;
}
$nextBtn.prop('disabled', true);
$.get('/passport/sms_login/token.json', {
area: areaCode.replace('+', ''),
mobile: phone
})
.done(function(data) {
if (data.code === 200) {
// $nextBtn.off();
location.href = data.redirect;
} else {
tip.show(data.message);
}
})
.fail(function() {
tip.show('出错了, 请重试');
})
.always(function() {
$nextBtn.prop('disabled', false);
});
}
};
$(function() {
page.init();
});
... ...
var tip = require('plugin/tip');
var $eyeBtn,
$pwd,
$nextBtn;
var page = {
init: function() {
this.domInit();
this.bindEvent();
},
domInit: function() {
$eyeBtn = $('#eye');
$pwd = $('#pwd');
$nextBtn = $('#btn-next');
},
bindEvent: function() {
var self = this;
$eyeBtn.on('click', function() {
self.togglePassword();
});
$nextBtn.on('click', function() {
self.setPasswordAndLogin();
});
$pwd.on('input', function() {
var bool = Boolean($.trim(this.value));
$nextBtn
.toggleClass('disable', !bool)
.prop('disabled', !bool);
});
},
togglePassword: function() {
var bool = $eyeBtn.hasClass('close');
$eyeBtn.toggleClass(function() {
$pwd.attr('type', !bool ? 'password' : 'text');
return 'close';
}, !bool);
},
setPasswordAndLogin: function() {
var password = $.trim($pwd.val());
if ($nextBtn.prop('disabled')) {
return;
}
$nextBtn.prop('disabled', true);
$.post('/passport/sms_login/password.json', {
password: password
})
.done(function(res) {
if (res.code === 200) {
// $nextBtn.off();
location.href = res.redirect;
return;
}
tip.show(res.message);
})
.fail(function() {
tip.show('出错了, 请重试');
})
.always(function() {
$nextBtn.prop('disabled', false);
});
}
};
$(function() {
page.init();
});
... ...
@import "live/index";
@import "student";
.receive-coupon-page {
* {
margin: 0;
... ... @@ -294,5 +296,3 @@
}
@import "student";
@import "live/index";
... ...
... ... @@ -33,28 +33,36 @@ $border: #e0e0e0;
position: absolute;
top: 30px;
left: 30px;
height: 35px;
padding: 0 10px;
border: 2px solid $white;
border-radius: 20px;
height: 70px;
padding: 0 20px;
border: 4px solid $white;
border-radius: 40px;
color: $white;
font-size: 22px;
font-size: 44px;
text-align: center;
line-height: 1.5;
line-height: 70px;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
.living {
position: absolute;
top: 30px;
left: 30px;
height: 35px;
width: 70px;
height: 70px;
width: 140px;
background: $red;
border-radius: 15px;
border-radius: 40px;
color: $white;
font-size: 22px;
font-size: 44px;
text-align: center;
line-height: 1.5;
line-height: 70px;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
&_tag {
... ... @@ -196,14 +204,18 @@ $border: #e0e0e0;
position: absolute;
top: 30px;
left: 30px;
height: 35px;
width: 70px;
height: 70px;
width: 140px;
background: $red;
border-radius: 20px;
border-radius: 40px;
color: $white;
font-size: 22px;
font-size: 44px;
text-align: center;
line-height: 1.5;
line-height: 70px;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
.main-intro {
... ... @@ -294,14 +306,18 @@ $border: #e0e0e0;
position: absolute;
top: 20px;
left: 220px;
height: 35px;
width: 70px;
border: 2px solid $black;
border-radius: 20px;
font-size: 22px;
line-height: 1.5;
height: 70px;
width: 140px;
border: 4px solid $black;
border-radius: 40px;
font-size: 44px;
line-height: 70px;
text-align: center;
color: $black;
-webkit-transform: scale(0.5);
transform: scale(0.5);
-webkit-transform-origin: 0 0;
transform-origin: 0 0;
}
.pre-time {
... ...
... ... @@ -203,8 +203,6 @@
padding-left: 1.75rem;
display: inline-block;
color: #ffffff;
border-radius: 0.3rem;
background-color: rgba(0, 0, 0, 0.32);
font-size: 0.6rem;
}
... ... @@ -224,7 +222,9 @@
font-size: 22px;
font-weight: lighter;
color: rgba(255,255,255,0.8);
background-color: rgba(0, 0, 0, 0.32);
overflow: hidden;
border-radius: 0.3rem;
}
.live-item2_2 {
... ... @@ -234,6 +234,7 @@
line-height: 1.2;
font-weight: normal;
color: #FFFFFF;
border-radius: 0.3rem;
}
.live-item2 img {
... ... @@ -242,7 +243,7 @@
top: 0;
display: inline-block;
width: 2.5rem;
height: 100%;
border-radius: 0.3rem;
}
.live-item2-head {
... ...
.banner-center {
position: relative;
margin: 30px 0 0;
height: 200px;
overflow: hidden;
img {
display: block;
width: 100%;
height: 100%;
}
.swiper-pagination {
position: absolute;
left: 0;
right: 0;
bottom: 20px;
text-align: center;
z-index: 1;
.pagination-inner {
display: inline-block;
span {
display: inline-block;
width: 14px;
height: 14px;
background: #fff;
opacity: 0.5;
margin: 0 9px;
border-radius: 50%;
&.swiper-pagination-bullet-active {
background: #fff;
opacity: 1;
}
}
}
}
}
.banner-center-swiper {
background: #fff;
width: 100%;
height: 200px;
border-top: 1px solid #e0e0e0;
overflow: hidden;
.banner-list {
position: relative;
height: 200px;
li {
float: left;
width: 100%;
height: 200px;
a {
position: relative;
display: block;
width: 100%;
height: 100%;
line-height: 200px;
font-size: 0;
}
img {
display: inline-block;
max-width: 100%;
max-height: 100%;
vertical-align: middle;
}
}
}
}
... ...
@charset "utf-8";
@import "me/index";
@import "layout/reset";
@import "layout/common";
... ... @@ -7,6 +8,7 @@
@import "layout/header";
@import "layout/footer";
@import "layout/utils";
@import "layout/form";
@import "common/index";
@import "channel/index";
@import "product/index";
... ...
... ... @@ -53,9 +53,9 @@ a {
}
@font-face {
font-family: 'iconfont';
src: resolve('iconfont.eot'); /* IE9 */
src: resolve('iconfont.eot?#iefix') format('embedded-opentype'), resolve('iconfont.woff') format('woff'), resolve('iconfont.ttf') format('truetype'), resolve('iconfont.svg#iconfont') format('svg'); /* iOS 4.1- */
font-family: "iconfont";
src: resolve("iconfont.eot"); /* IE9 */
src: resolve("iconfont.eot?#iefix") format("embedded-opentype"), resolve("iconfont.woff") format("woff"), resolve("iconfont.ttf") format("truetype"), resolve("iconfont.svg#iconfont") format("svg"); /* iOS 4.1- */
}
.iconfont {
... ...
.input-group {
display: table;
.input {
width: 100%;
}
.input,
.input-addon {
display: table-cell;
vertical-align: middle;
}
.input-addon {
width: 1%;
overflow: hidden;
}
}
... ...
... ... @@ -138,7 +138,10 @@ body.passport-body {
background-color: #36a74c;
border-radius: 5PX;
color: #fff;
&.disable {
border: none;
outline: none;
&.disable, &:disabled {
background-color: #a2a2a2;
}
}
... ... @@ -154,6 +157,9 @@ body.passport-body {
height: 16PX;
background: resolve('passport/clear-input.png') no-repeat;
background-size: 100% 100%;
outline: none;
border: none;
padding: 0; /* button has padding in default */
}
.eye {
position: absolute;
... ...
@import "common";
@import "register";
@import "login";
@import "sms-login";
@import "back";
@import "code";
@import "bind";
... ...
... ... @@ -3,7 +3,7 @@
position: absolute;
height: 31PX;
width: 26PX;
background: resolve('passport/yoho.png');
background: resolve("passport/yoho.png");
background-size: 100% 100%;
top: 10PX;
left: 15PX;
... ... @@ -20,7 +20,7 @@
text-align: left;
font-size: 16PX;
.go-register {
.sms-login {
text-decoration: underline;
color: #858585;
}
... ... @@ -57,20 +57,20 @@
}
.alipay {
background-image: resolve('passport/alipay.png');
background-image: resolve("passport/alipay.png");
}
.weibo {
background-image: resolve('passport/weibo.png');
background-image: resolve("passport/weibo.png");
}
.qq {
background-image: resolve('passport/qq.png');
background-image: resolve("passport/qq.png");
}
.wechat {
display: none;
background-image: resolve('passport/wechat.png');
background-image: resolve("passport/wechat.png");
}
}
}
... ... @@ -82,11 +82,19 @@
background-color: #333;
border: none;
border-radius: 20PX;
margin: 0 auto;
margin: 0 auto 28px;
font-size: 16PX;
color: #d8d8d8;
}
.go-register {
color: #858585;
a {
color: inherit;
}
}
.login-tip {
font-size: 16PX;
position: relative;
... ... @@ -97,7 +105,7 @@
display: inline-block;
height: 12PX;
width: 12PX;
background-image: resolve('passport/info.png');
background-image: resolve("passport/info.png");
background-size: 100% 100%;
}
}
... ...
.sms-login {
.sms-input {
margin-top: 60px;
}
#resend-sms {
background-color: transparent;
width: 148PX;
margin: 0 15PX 0 28PX;
border: 1PX solid #36a74c;
padding: 5PX 0;
border-radius: 20PX;
font-size: 16PX;
color: #36a74c;
&:disabled {
color: #a2a2a2;
border-color: #a2a2a2;
}
}
button {
border: none;
}
}
.sms-login-check {
.clear-input {
right: 175PX;
}
}
.sms-login-msg {
font-size: 28px;
color: #fff;
margin-bottom: 20px;
.tel {
color: #41cbe7;
}
&.small {
font-size: 22px;
color: #858585;
}
}
... ...
... ... @@ -42,7 +42,7 @@ module.exports = {
resolve: {
alias: {
common: path.join(__dirname, 'js/common'),
plugin: path.join(__dirname, 'js/plugins')
plugin: path.join(__dirname, 'js/plugin')
}
},
plugins: [
... ...