Authored by 姜枫

add bind page

... ... @@ -9,6 +9,7 @@
const helpers = require(global.library + '/helpers');
const RegService = require('../models/reg-service');
const BindService = require('../models/bind-service');
const _ = require('lodash');
const Sources = {
... ... @@ -32,7 +33,7 @@ const bind = {
let sourceType = req.query.sourceType;
res.render('bind/index', {
bindIndex: true, //js标识
bindIndex: true, // js标识
backUrl: helpers.urlFormat('/signin.html'), // 返回的URL链接
showHeaderImg: true, // 控制显示头部图片
isPassportPage: true, // 模板中模块标识
... ... @@ -40,9 +41,9 @@ const bind = {
platform: Sources[sourceType],
isWechatLogin: sourceType === 'wechat',
openId: openId, // openId
areaCode: '+86', //默认区号
countrys: RegService.getAreaData(), //国别码
serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', //在线客服
areaCode: '+86', // 默认区号
countrys: RegService.getAreaData(), // 国别码
serviceUrl: 'http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409&info=', // 在线客服
module: 'passport',
page: 'bind',
title: '绑定手机号'
... ... @@ -79,8 +80,37 @@ const bind = {
let areaCode = req.body.areaCode || '86';
let sourceType = req.body.sourceType;
if (!(_.isNumber(parseInt(phoneNum, 0)) && openId && areaCode && sourceType)) {
if (_.isNumber(parseInt(phoneNum, 0)) && openId && areaCode && sourceType) {
BindService.bindCheck(phoneNum, openId, sourceType, areaCode).then(result => {
let data = {
code: result.code,
message: result.message,
data: {}
};
if (result.code === 200) {
let nextUrl = helpers.urlFormat('/passport/bind/code', {
isReg: res.data.is_register, // esline-disable-line
openId: openId,
sourceType: sourceType,
areaCode: areaCode,
phoneNum: phoneNum
});
data.data.isReg = res.data.is_register;
data.data.next = nextUrl;
} else {
data.data = result.data;
}
res.json(data);
});
} else {
res.json({
code: 400,
message: '',
data: ''
});
}
}
};
... ...
... ... @@ -12,7 +12,7 @@ const api = new API();
class RegService {
static bindCheck(mobile, openId, sourceType, area){
static bindCheck(mobile, openId, sourceType, area) {
let params = {
method: 'app.passport.signCheck',
area: area,
... ...
... ... @@ -8,7 +8,6 @@
'use strict';
const API = require(`${global.library}/api`).API;
const sign = require(`${global.library}/sign`);
const api = new API();
class RegService {
... ... @@ -73,7 +72,7 @@ class RegService {
mobile: mobile
};
return api.post('', sign.apiSign(params));
return api.post('', params);
}
static validMobileCode(area, mobile, code) {
... ... @@ -84,7 +83,7 @@ class RegService {
code: code
};
return api.post('', sign.apiSign(params));
return api.post('', params);
}
static regMobile(area, mobile, password, shoppingKey) {
... ... @@ -99,7 +98,7 @@ class RegService {
params.shopping_key = shoppingKey; // esline-disable-line
}
return api.post('', sign.apiSign(params));
return api.post('', params);
}
}
... ...
... ... @@ -15,6 +15,7 @@ module.exports = {
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/'
// api: 'http://testapi.yoho.cn:28078/',
// service: 'http://testservice.yoho.cn:28077/'
},
... ...
... ... @@ -47,7 +47,7 @@ function nextStep(url, mobileNo, areaCode) {
// 统计代码:用于统计从哪个渠道登录
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
'loginRefer' : $sourceType.val()
loginRefer: $sourceType.val()
}, false);
}
... ... @@ -106,14 +106,14 @@ $btnNext.on('touchstart', function() {
// console.log(res);
//res : {
// res : {
// code: 'xxx',
// data: {
// isReg: 0,
// next: 'xxxx'
// },
// message: 'xxxx',
//}
// }
if (res.code === 200) {
... ...
... ... @@ -34,27 +34,27 @@ function startBind(password) {
password: password,
code: code
},
success: function(res) {
success: function (res) {
if (res.code === 200) {
tip.show('登录成功');
setTimeout(function() {
setTimeout(function () {
location.href = res.data.refer;
}, 2000);
} else {
tip.show(res.message);
}
},
error: function(err) {
error: function () {
tip.show('登录失败,请重试!');
}
});
}
api.bindEyesEvt({
status: 'open' //默认眼睛打开
status: 'open' // 默认眼睛打开
});
$pwd.bind('input', function() {
$pwd.bind('input', function () {
if (trim($pwd.val()) === '') {
$btnSure.addClass('disable');
} else {
... ... @@ -62,7 +62,7 @@ $pwd.bind('input', function() {
}
});
$btnSure.on('touchstart', function() {
$btnSure.on('touchstart', function () {
var pwd = trim($pwd.val());
if ($btnSure.hasClass('disable')) {
... ...