Authored by xuqi

login remember me.Review by:@xuqi

@@ -36,7 +36,7 @@ @@ -36,7 +36,7 @@
36 <span id="login-btn" class="login-btn btn">登录</span> 36 <span id="login-btn" class="login-btn btn">登录</span>
37 </li> 37 </li>
38 <li class="other-opts"> 38 <li class="other-opts">
39 - <span class="remeber-me"> 39 + <span class="remember-me">
40 <i class="iconfont">&#xe613;</i> 40 <i class="iconfont">&#xe613;</i>
41 记住登录状态 41 记住登录状态
42 </span> 42 </span>
@@ -25,6 +25,8 @@ var $emailAutoComplete = $('#email-autocomplete'); @@ -25,6 +25,8 @@ var $emailAutoComplete = $('#email-autocomplete');
25 25
26 var mailPhoneRegx = require('./mail-phone-regx'); 26 var mailPhoneRegx = require('./mail-phone-regx');
27 27
  28 +var $remember = $('.remember-me');
  29 +
28 //checkbox status unicode 30 //checkbox status unicode
29 var checkbox = { 31 var checkbox = {
30 checked: '&#xe612;', 32 checked: '&#xe612;',
@@ -232,7 +234,7 @@ $emailAutoComplete.on('click', 'li', function() { @@ -232,7 +234,7 @@ $emailAutoComplete.on('click', 'li', function() {
232 }); 234 });
233 235
234 //记住登录状态 236 //记住登录状态
235 -$('.remeber-me').on('click', function() { 237 +$remember.on('click', function() {
236 var $this = $(this); 238 var $this = $(this);
237 239
238 $this.toggleClass('checked'); 240 $this.toggleClass('checked');
@@ -266,15 +268,19 @@ $('#login-btn').on('click', function() { @@ -266,15 +268,19 @@ $('#login-btn').on('click', function() {
266 data: { 268 data: {
267 areaCode: $countryCodeHide.val().replace('+', ''), 269 areaCode: $countryCodeHide.val().replace('+', ''),
268 account: $.trim($account.val()), 270 account: $.trim($account.val()),
269 - password: $.trim($password.val()) 271 + password: $.trim($password.val()),
  272 + isRemember: $remember.hasClass('checked') ? true : false
270 }, 273 },
271 success: function(data) { 274 success: function(data) {
272 - if (data.code === 400) { 275 + if (data.code === 200) {
  276 + if (data.data) {
  277 +
  278 + //防止data.data为undefined时下行语句执行出错而导致脚本不能走到complete去处理authing
  279 + location.href = data.data.href;
  280 + }
  281 + } else {
273 $passwordTip.removeClass('hide').children('em').text(data.message); 282 $passwordTip.removeClass('hide').children('em').text(data.message);
274 $password.addClass('error'); 283 $password.addClass('error');
275 - return;  
276 - } else {  
277 - location.href = data.data.href;  
278 } 284 }
279 }, 285 },
280 complete: function() { 286 complete: function() {
@@ -60,7 +60,7 @@ $third: sprite-map("passport/third/*.png"); @@ -60,7 +60,7 @@ $third: sprite-map("passport/third/*.png");
60 } 60 }
61 } 61 }
62 62
63 - .remeber-me { 63 + .remember-me {
64 cursor: pointer; 64 cursor: pointer;
65 } 65 }
66 66