Showing
3 changed files
with
212 additions
and
89 deletions
@@ -2328,7 +2328,7 @@ $channelLink.on('touchstart', function() { | @@ -2328,7 +2328,7 @@ $channelLink.on('touchstart', function() { | ||
2328 | }); | 2328 | }); |
2329 | 2329 | ||
2330 | }); | 2330 | }); |
2331 | -define("js/passport/entry", ["jquery"], function(require, exports, module){ | 2331 | +define("js/passport/entry", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){ |
2332 | /** | 2332 | /** |
2333 | * 注册、登录、密码找回打包入口 | 2333 | * 注册、登录、密码找回打包入口 |
2334 | * @author: xuqi<qi.xu@yoho.cn> | 2334 | * @author: xuqi<qi.xu@yoho.cn> |
@@ -2350,6 +2350,9 @@ require("js/passport/back/code"); | @@ -2350,6 +2350,9 @@ require("js/passport/back/code"); | ||
2350 | require("js/passport/back/email"); | 2350 | require("js/passport/back/email"); |
2351 | require("js/passport/back/email-success"); | 2351 | require("js/passport/back/email-success"); |
2352 | require("js/passport/back/new-password"); | 2352 | require("js/passport/back/new-password"); |
2353 | + | ||
2354 | +// 绑定手机号 | ||
2355 | +require("js/passport/bind/bind"); | ||
2353 | }); | 2356 | }); |
2354 | define("js/passport/register/register", ["jquery"], function(require, exports, module){ | 2357 | define("js/passport/register/register", ["jquery"], function(require, exports, module){ |
2355 | /** | 2358 | /** |
@@ -3309,6 +3312,210 @@ $btnOk.on('touchstart', function() { | @@ -3309,6 +3312,210 @@ $btnOk.on('touchstart', function() { | ||
3309 | } | 3312 | } |
3310 | }); | 3313 | }); |
3311 | }); | 3314 | }); |
3315 | +define("js/passport/bind/bind", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){ | ||
3316 | +/** | ||
3317 | + * 注册 | ||
3318 | + * @author: xuqi<qi.xu@yoho.cn> | ||
3319 | + * @date: 2015/10/8 | ||
3320 | + */ | ||
3321 | +var $ = require("jquery"); | ||
3322 | + | ||
3323 | +var $phoneNum = $('#phone-num'), | ||
3324 | + $countrySelect = $('#country-select'), | ||
3325 | + $areaCode = $('#area-code'), | ||
3326 | + $openId = $('#openId'), | ||
3327 | + $nickname = $('#nickname'), | ||
3328 | + $sourceType = $('#sourceType'), | ||
3329 | + $btnNext = $('#btn-next'); | ||
3330 | + | ||
3331 | +var api = require("js/passport/api"), | ||
3332 | + tip = require("js/plugin/tip"), | ||
3333 | + dialog = require("js/me/dialog"); | ||
3334 | + | ||
3335 | +var trim = $.trim; | ||
3336 | +var showErrTip = tip.show; | ||
3337 | + | ||
3338 | +function nextStep(url, mobileNo, areaCode) { | ||
3339 | + $.ajax({ | ||
3340 | + type: 'POST', | ||
3341 | + url: '/passport/bind/sendBindMsg', | ||
3342 | + data: { | ||
3343 | + phoneNum: mobileNo, | ||
3344 | + areaCode: areaCode.replace('+', '') | ||
3345 | + }, | ||
3346 | + success: function(res) { | ||
3347 | + console.log(res.data); | ||
3348 | + location.href = url; | ||
3349 | + }, | ||
3350 | + error: function() { | ||
3351 | + tip.show('出错了,请重试!'); | ||
3352 | + } | ||
3353 | + }); | ||
3354 | +} | ||
3355 | + | ||
3356 | +api.selectCssHack($('#country-select')); | ||
3357 | + | ||
3358 | +api.bindClearEvt(); | ||
3359 | + | ||
3360 | +$phoneNum.bind('input', function() { | ||
3361 | + if (trim($phoneNum.val()) === '') { | ||
3362 | + $btnNext.addClass('disable'); | ||
3363 | + } else { | ||
3364 | + $btnNext.removeClass('disable'); | ||
3365 | + } | ||
3366 | +}); | ||
3367 | + | ||
3368 | +$countrySelect.change(function() { | ||
3369 | + $areaCode.text($countrySelect.val()); | ||
3370 | +}); | ||
3371 | + | ||
3372 | +$btnNext.on('touchstart', function() { | ||
3373 | + var pn = trim($phoneNum.val()), | ||
3374 | + openId = trim($openId.val()), | ||
3375 | + nickname = trim($nickname.val()), | ||
3376 | + sourceType = trim($sourceType.val()), | ||
3377 | + areaCode = $countrySelect.val(); | ||
3378 | + | ||
3379 | + if ($btnNext.hasClass('disable')) { | ||
3380 | + return; | ||
3381 | + } | ||
3382 | + | ||
3383 | + if (api.phoneRegx[areaCode].test(pn)) { | ||
3384 | + $.ajax({ | ||
3385 | + url: '/passport/bind/bindCheck', | ||
3386 | + type: 'POST', | ||
3387 | + data: { | ||
3388 | + areaCode: areaCode.replace('+', ''), | ||
3389 | + phoneNum: pn, | ||
3390 | + openId: openId, | ||
3391 | + sourceType: sourceType, | ||
3392 | + nickname: nickname | ||
3393 | + }, | ||
3394 | + success: function(res) { | ||
3395 | + console.log(res); | ||
3396 | + | ||
3397 | + //res : { | ||
3398 | + // code: 'xxx', | ||
3399 | + // data: { | ||
3400 | + // isReg: 0, | ||
3401 | + // next: 'xxxx' | ||
3402 | + // }, | ||
3403 | + // message: 'xxxx', | ||
3404 | + //} | ||
3405 | + | ||
3406 | + | ||
3407 | + if (res.code === 200) { | ||
3408 | + if (res.data.isReg === 1) { | ||
3409 | + dialog.showDialog({ | ||
3410 | + dialogText: '该手机号已注册过有货\n' + pn + ',确定绑定吗?', | ||
3411 | + hasFooter: { | ||
3412 | + leftBtnText: '更换号码', | ||
3413 | + rightBtnText: '继续绑定' | ||
3414 | + } | ||
3415 | + }, function() { | ||
3416 | + nextStep(res.data.next, pn, areaCode); | ||
3417 | + }); | ||
3418 | + } else { | ||
3419 | + nextStep(res.data.next, pn, areaCode); | ||
3420 | + } | ||
3421 | + } else { | ||
3422 | + showErrTip(res.message); | ||
3423 | + } | ||
3424 | + } | ||
3425 | + }); | ||
3426 | + } else { | ||
3427 | + showErrTip('手机号格式不正确,请重新输入'); | ||
3428 | + } | ||
3429 | +}); | ||
3430 | + | ||
3431 | +}); | ||
3432 | +define("js/me/dialog", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){ | ||
3433 | +/* | ||
3434 | + * @Description: dialog | ||
3435 | + * @Time: 2015/11/18 | ||
3436 | + * @author: chenglong.wang | ||
3437 | + */ | ||
3438 | + | ||
3439 | +var $ = require("jquery"), | ||
3440 | + Handlebars = require("handlebars"), | ||
3441 | + Hammer = require("hammer"); | ||
3442 | + | ||
3443 | +var $dialogWrapper, | ||
3444 | + dialogTpl, | ||
3445 | + dialogTemplate; | ||
3446 | + | ||
3447 | + | ||
3448 | +dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' + | ||
3449 | + '<div class="dialog-box">' + | ||
3450 | + '{{# hasHeader}}' + | ||
3451 | + '{{/ hasHeader}}' + | ||
3452 | + '<div class="dialog-content">{{dialogText}}</div>' + | ||
3453 | + '{{# hasFooter}}' + | ||
3454 | + '<div class="dialog-footer">' + | ||
3455 | + '{{# leftBtnText}}' + | ||
3456 | + '<span class="dialog-left-btn">{{.}}</span>' + | ||
3457 | + '{{/ leftBtnText}}' + | ||
3458 | + '{{# rightBtnText}}' + | ||
3459 | + '<span class="dialog-right-btn">{{.}}</span>' + | ||
3460 | + '{{/ rightBtnText}}' + | ||
3461 | + '</div>' + | ||
3462 | + '{{/ hasFooter}}' + | ||
3463 | + '</div>' + | ||
3464 | + '</div>'; | ||
3465 | + | ||
3466 | +dialogTemplate = Handlebars.compile(dialogTpl); | ||
3467 | + | ||
3468 | +exports.showDialog = function(data, callback) { | ||
3469 | + | ||
3470 | + var dialogStr = dialogTemplate(data), | ||
3471 | + $dialogBox, | ||
3472 | + defaultHideDuraton, | ||
3473 | + dialogWrapperHammer; | ||
3474 | + | ||
3475 | + $('.dialog-wrapper').remove(); | ||
3476 | + | ||
3477 | + $('body').append($(dialogStr)); | ||
3478 | + | ||
3479 | + $dialogBox = $('.dialog-box'); | ||
3480 | + $dialogWrapper = $('.dialog-wrapper'); | ||
3481 | + dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper')); | ||
3482 | + | ||
3483 | + // 显示 | ||
3484 | + if (data.fast) { | ||
3485 | + $dialogWrapper.css({ | ||
3486 | + display: 'block' | ||
3487 | + }); | ||
3488 | + } else { | ||
3489 | + $dialogWrapper.fadeIn(); | ||
3490 | + } | ||
3491 | + | ||
3492 | + $dialogBox.css({ | ||
3493 | + top: '50%', | ||
3494 | + marginTop: -($dialogBox.height() / 2) | ||
3495 | + }); | ||
3496 | + | ||
3497 | + //隐藏 | ||
3498 | + if (data.autoHide) { | ||
3499 | + defaultHideDuraton = 1000; | ||
3500 | + if (data.autoHide > 1) { | ||
3501 | + defaultHideDuraton = data.autoHide; | ||
3502 | + } | ||
3503 | + setTimeout(function() { | ||
3504 | + $dialogWrapper.fadeOut(); | ||
3505 | + }, defaultHideDuraton); | ||
3506 | + } | ||
3507 | + | ||
3508 | + dialogWrapperHammer.on('tap', function(event) { | ||
3509 | + | ||
3510 | + if ($(event.target).hasClass('dialog-left-btn')) { | ||
3511 | + $dialogWrapper.fadeOut(); | ||
3512 | + } else if ($(event.target).hasClass('dialog-right-btn')) { | ||
3513 | + callback(); | ||
3514 | + } | ||
3515 | + }); | ||
3516 | +}; | ||
3517 | + | ||
3518 | +}); | ||
3312 | define("js/product/entry", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ | 3519 | define("js/product/entry", ["jquery","swiper","lazyload","hammer","index"], function(require, exports, module){ |
3313 | /** | 3520 | /** |
3314 | * 产品打包入口 | 3521 | * 产品打包入口 |
@@ -5940,93 +6147,6 @@ $(window).scroll(function() { | @@ -5940,93 +6147,6 @@ $(window).scroll(function() { | ||
5940 | getOrders(); | 6147 | getOrders(); |
5941 | 6148 | ||
5942 | }); | 6149 | }); |
5943 | -define("js/me/dialog", ["jquery","handlebars","source-map","hammer"], function(require, exports, module){ | ||
5944 | -/* | ||
5945 | - * @Description: dialog | ||
5946 | - * @Time: 2015/11/18 | ||
5947 | - * @author: chenglong.wang | ||
5948 | - */ | ||
5949 | - | ||
5950 | -var $ = require("jquery"), | ||
5951 | - Handlebars = require("handlebars"), | ||
5952 | - Hammer = require("hammer"); | ||
5953 | - | ||
5954 | -var $dialogWrapper, | ||
5955 | - dialogTpl, | ||
5956 | - dialogTemplate; | ||
5957 | - | ||
5958 | - | ||
5959 | -dialogTpl = '<div id="dialog-wrapper" class="dialog-wrapper">' + | ||
5960 | - '<div class="dialog-box">' + | ||
5961 | - '{{# hasHeader}}' + | ||
5962 | - '{{/ hasHeader}}' + | ||
5963 | - '<div class="dialog-content">{{dialogText}}</div>' + | ||
5964 | - '{{# hasFooter}}' + | ||
5965 | - '<div class="dialog-footer">' + | ||
5966 | - '{{# leftBtnText}}' + | ||
5967 | - '<span class="dialog-left-btn">{{.}}</span>' + | ||
5968 | - '{{/ leftBtnText}}' + | ||
5969 | - '{{# rightBtnText}}' + | ||
5970 | - '<span class="dialog-right-btn">{{.}}</span>' + | ||
5971 | - '{{/ rightBtnText}}' + | ||
5972 | - '</div>' + | ||
5973 | - '{{/ hasFooter}}' + | ||
5974 | - '</div>' + | ||
5975 | - '</div>'; | ||
5976 | - | ||
5977 | -dialogTemplate = Handlebars.compile(dialogTpl); | ||
5978 | - | ||
5979 | -exports.showDialog = function(data, callback) { | ||
5980 | - | ||
5981 | - var dialogStr = dialogTemplate(data), | ||
5982 | - $dialogBox, | ||
5983 | - defaultHideDuraton, | ||
5984 | - dialogWrapperHammer; | ||
5985 | - | ||
5986 | - $('.dialog-wrapper').remove(); | ||
5987 | - | ||
5988 | - $('body').append($(dialogStr)); | ||
5989 | - | ||
5990 | - $dialogBox = $('.dialog-box'); | ||
5991 | - $dialogWrapper = $('.dialog-wrapper'); | ||
5992 | - dialogWrapperHammer = new Hammer(document.getElementById('dialog-wrapper')); | ||
5993 | - | ||
5994 | - // 显示 | ||
5995 | - if (data.fast) { | ||
5996 | - $dialogWrapper.css({ | ||
5997 | - display: 'block' | ||
5998 | - }); | ||
5999 | - } else { | ||
6000 | - $dialogWrapper.fadeIn(); | ||
6001 | - } | ||
6002 | - | ||
6003 | - $dialogBox.css({ | ||
6004 | - top: '50%', | ||
6005 | - marginTop: -($dialogBox.height() / 2) | ||
6006 | - }); | ||
6007 | - | ||
6008 | - //隐藏 | ||
6009 | - if (data.autoHide) { | ||
6010 | - defaultHideDuraton = 1000; | ||
6011 | - if (data.autoHide > 1) { | ||
6012 | - defaultHideDuraton = data.autoHide; | ||
6013 | - } | ||
6014 | - setTimeout(function() { | ||
6015 | - $dialogWrapper.fadeOut(); | ||
6016 | - }, defaultHideDuraton); | ||
6017 | - } | ||
6018 | - | ||
6019 | - dialogWrapperHammer.on('tap', function(event) { | ||
6020 | - | ||
6021 | - if ($(event.target).hasClass('dialog-left-btn')) { | ||
6022 | - $dialogWrapper.fadeOut(); | ||
6023 | - } else if ($(event.target).hasClass('dialog-right-btn')) { | ||
6024 | - callback(); | ||
6025 | - } | ||
6026 | - }); | ||
6027 | -}; | ||
6028 | - | ||
6029 | -}); | ||
6030 | define("js/me/order-detail", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){ | 6150 | define("js/me/order-detail", ["jquery","lazyload","hammer","handlebars","source-map"], function(require, exports, module){ |
6031 | /** | 6151 | /** |
6032 | * 订单详情页 | 6152 | * 订单详情页 |
This diff could not be displayed because it is too large.
@@ -18,4 +18,7 @@ require('./back/mobile'); | @@ -18,4 +18,7 @@ require('./back/mobile'); | ||
18 | require('./back/code'); | 18 | require('./back/code'); |
19 | require('./back/email'); | 19 | require('./back/email'); |
20 | require('./back/email-success'); | 20 | require('./back/email-success'); |
21 | -require('./back/new-password'); | ||
21 | +require('./back/new-password'); | ||
22 | + | ||
23 | +// 绑定手机号 | ||
24 | +require('./bind/bind'); |
-
Please register or login to post a comment