Authored by xuqi

new pwd

@@ -14,6 +14,8 @@ var tip = require('../../plugin/tip'); @@ -14,6 +14,8 @@ var tip = require('../../plugin/tip');
14 var trim = $.trim; 14 var trim = $.trim;
15 var showErrTip = tip.show; 15 var showErrTip = tip.show;
16 16
  17 +var $mobile = $('#mobile');
  18 +
17 api.bindEyesEvt(); 19 api.bindEyesEvt();
18 20
19 $pwd.bind('input', function() { 21 $pwd.bind('input', function() {
@@ -25,19 +27,45 @@ $pwd.bind('input', function() { @@ -25,19 +27,45 @@ $pwd.bind('input', function() {
25 }); 27 });
26 28
27 $btnOk.on('touchstart', function() { 29 $btnOk.on('touchstart', function() {
28 - var pwd = trim($pwd.val()); 30 + var pwd = trim($pwd.val()),
  31 + mobileBack = true,
  32 + setting,
  33 + url;
29 34
30 if ($btnOk.hasClass('disable')) { 35 if ($btnOk.hasClass('disable')) {
31 return; 36 return;
32 } 37 }
33 38
  39 + setting = {
  40 + password: pwd
  41 + };
  42 +
  43 + if ($mobile.length === 0) {
  44 + mobileBack = false;
  45 + }
  46 +
  47 + if (mobileBack) {
  48 + $.extend(setting, {
  49 + mobile: $mobile.val(),
  50 + areaCode: $('#areaCode').val(),
  51 + token: $('#token').val()
  52 + });
  53 +
  54 + url = '/passport/back/passwordByMobile';
  55 + } else {
  56 + $.extend(setting, {
  57 + code: $('#email-code').val()
  58 + });
  59 +
  60 + url = '/passport/back/passwordByEmail';
  61 + }
  62 +
  63 +
34 if (api.pwdValidate(pwd)) { 64 if (api.pwdValidate(pwd)) {
35 $.ajax({ 65 $.ajax({
36 type: 'POST', 66 type: 'POST',
37 url: '/passport/back/update', 67 url: '/passport/back/update',
38 - data: {  
39 - password: pwd  
40 - }, 68 + data: setting,
41 success: function(data) { 69 success: function(data) {
42 if (data.code === 200) { 70 if (data.code === 200) {
43 showErrTip('密码修改成功'); 71 showErrTip('密码修改成功');
@@ -7,5 +7,14 @@ @@ -7,5 +7,14 @@
7 </div> 7 </div>
8 <span id="btn-ok" class="btn btn-ok disable">完成</span> 8 <span id="btn-ok" class="btn btn-ok disable">完成</span>
9 </div> 9 </div>
  10 + {{#if mobile}}
  11 + <input id="mobile" type="hidden" value={{mobile}}>
  12 + <input id="area" type="hidden" value={{areaCode}}>
  13 + <input id="token" type="hidden" value={{token}}>
  14 + {{/if}}
  15 +
  16 + {{# code}}
  17 + <input id="email-code" type="hidden" value={{.}}>
  18 + {{/ code}}
10 </div> 19 </div>
11 {{> layout/footer}} 20 {{> layout/footer}}