Authored by htoooth

修复重复绑定的问题。

... ... @@ -111,7 +111,7 @@ const _setDefaultStatus = (type) => {
};
return resData;
}
};
const _setReturnStatus = (list, half) => {
let resData = {};
... ...
... ... @@ -31,7 +31,8 @@ router.get('/cancelOrder', order.cancelOrder);
router.get('/getCancelOrderReason', order.getCancelOrderReason);
router.get('/getExpressInfo', order.getExpressInfo);
router.get('/editOrder', order.editOrder);
//router.get('/reAdd', order.reAddCart);
// router.get('/reAdd', order.reAddCart);
// 退换货
router.get('/return', returns.index);
... ...
... ... @@ -21,6 +21,8 @@ const Sources = {
douban: '豆瓣'
};
const DEFAULT_URL = 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
const bind = {
indexPage: (req, res) => {
let openId = req.query.openId;
... ... @@ -61,8 +63,6 @@ const bind = {
bindConfirmPage: (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
const DEFAULT_URL = 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
let avatar = user.headImg || DEFAULT_URL;
res.display('bind/bind-confirm', Object.assign({
... ... @@ -105,6 +105,27 @@ const bind = {
}));
},
bindedPage: (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
let avatar = user.headImg || DEFAULT_URL;
res.display('bind/bind-done', Object.assign({
module: 'passport',
page: 'bind-success',
title: '绑定手机号',
defaultHeader: false
}, {
avatar: avatar,
name: user.username || '咸鸭蛋',
loginUrl: helpers.urlFormat('/passport/login'),
bindUrl: helpers.urlFormat('/passport/thirdlogin/index', {
openId: thirdPart.openId,
sourceType: thirdPart.sourceType
})
}));
},
relateSuccessPage: (req, res) => {
let sourceType = _.trim(req.query.sourceType);
let sourceInfo = sourceType.split('_');
... ... @@ -123,8 +144,6 @@ const bind = {
relateConfirmPage: (req, res) => {
let thirdPart = req.query.thirdPart;
let user = req.query.user;
const DEFAULT_URL = 'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100';
let avatar = user.headImg || DEFAULT_URL;
res.display('bind/relate-confirm', Object.assign({
... ...
... ... @@ -53,6 +53,9 @@ router.get('/thirdlogin/bindSuccess', bind.bindSuccessPage);
router.get('/thirdlogin/relateConfirm', bind.relateConfirmPage);
router.get('/thirdlogin/relateSuccess', bind.relateSuccessPage);
// 第三方已经绑定
router.get('/thirdlogin/binded', bind.bindedPage);
// 第三方登录api
router.post('/autouserinfo/bindMobile', bind.bindMobile);
router.post('/autouserinfo/bindCheck', bind.bindCheck);
... ...
{{> sign-header}}
<div class="bind-wrapper">
<div id="bindConfirmPage" class="bind-confirm-page">
<ul>
<li class="clearfix big-width">
<div class="center">
{{#if avatar}}
<img id="avatar" class="avatar" src="{{avatar}}">
{{^}}
<img id="avatar" class="avatar"
src="http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100">
{{/if}}
</div>
</li>
<li>
<div id="name" class="title center small">
{{#if name}}
<span>{{name}}</span>
{{^}}
<span>咸鸭蛋</span>
{{/if}}
</div>
</li>
<li class="clearfix">
<div id="confirmInfo">
<div class="desc center">手机号{{mobile}}已经被以上用户注册,请确认是否归您本人所有</div>
<div class="desc center"></div>
<div class="desc center">您可以使用该手机号直接登录或者更换一个新的手机号绑定该帐号</div>
</div>
</li>
<li style="margin: -10px 0">
</li>
<li>
<div>
<a id="next" class="btn btn-fixed-height" href="{{bindUrl}}">绑定其他手机号</a>
</div>
</li>
<li>
<div class="quick-link center">
<a class="blue" href="{{loginUrl}}">使用手机号登录</a>
</div>
</li>
</ul>
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -127,4 +127,17 @@
<input class="headImg" name="user[headImg]" type="hidden" value>
</form>
<form id="bindedPage" class="hide" action="/passport/thirdlogin/bindedPage" method="get">
<input class="openId" name='thirdPart[openId]' type="hidden" value="">
<input class="sourceType" name='thirdPart[sourceType]' type="hidden" value="">
<input class="refer" name='thirdPart[refer]' type="hidden" value="">
<input class="mobile" name='thirdPart[mobile]' type="hidden" value="">
<input class="area" name="thirdPart[area]" type="hidden" value="">
<input class="verifyCode" name="thirdPart[verifyCode]" type="hidden" value="">
<input class="code" name="thirdPart[code]" type="hidden" value>
<input class="username" name="user[username]" type="hidden" value="">
<input class="headImg" name="user[headImg]" type="hidden" value>
</form>
</div>
\ No newline at end of file
... ...
... ... @@ -17,7 +17,8 @@ var $regionCodeText = $('#region-code'),
var $bindsetpwdForm = $('#bindsetpwd'),
$bindConfirmForm = $('#bindConfirm'),
$relateConfirmForm = $('#relateConfirm');
$relateConfirmForm = $('#relateConfirm'),
$bindedForm = $('#bindedPage');
var $openId = $('#openId');
var $sourceType = $('#sourceType');
... ... @@ -255,6 +256,12 @@ function relateConfirmPage(thirdPart, user) {
$relateConfirmForm.submit();
}
function bindedPage(thirdPart, user) {
setThirdPartInfo(thirdPart);
setUserInfo(user);
$bindedForm.submit();
}
function nextPage() {
var thirdPart = {
mobile: $phoneNumInput.val(),
... ... @@ -282,7 +289,6 @@ function nextPage() {
setPwdPage(thirdPart);
break;
case 201:
case 205:
// 已注册绑定过其他的第三方,绑定确定页面
bindConfirmPage(thirdPart, result.data.user);
break;
... ... @@ -290,6 +296,10 @@ function nextPage() {
// 关联帐号,关联页面
relateConfirmPage(thirdPart, result.data.user);
break;
case 205:
// 已经绑定过同类型第三方的页面
bindedPage(thirdPart, result.data.user);
break;
default:
// 出错
errTip($nextBtn, '输入错误,请重新输入!');
... ...
... ... @@ -64,7 +64,7 @@ $passwordInput.on('keyup blur', function() {
}
ep.emit('pwd', true);
}).on('focus',function(){
}).on('focus', function() {
hideTip($passwordInput);
});
... ...
... ... @@ -45,7 +45,7 @@ $btn-width: 180px;
.relate-success-page {
@mixin passport-page;
width:380px !important;
width: 380px !important;
}
li {
... ...