You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

bind_phone.tmpl 3.1 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. {{template "base/head" .}}
  2. <div class="user bindphone forgot password" style="margin-top: 20px;">
  3. <div class="ui middle very relaxed page grid">
  4. <div class="column">
  5. <form class="ui form ignore-dirty" action="" method="">
  6. {{.CsrfTokenHtml}}
  7. <h2 class="ui top attached header">
  8. {{.i18n.Tr "phone.please_bind_your_mobile_number"}}
  9. </h2>
  10. <div class="ui attached segment">
  11. {{template "base/alert" .}}
  12. <div style="display:none;" class="ui negative message">
  13. <p></p>
  14. </div>
  15. {{if .EnablePhone }}
  16. <div style="display:flex;justify-content:center;">
  17. <div class="use-type" usetype="2" autofocus="true" style="width:491px;" showlabel="true" >
  18. {{template "user/auth/phone_verify" .}}
  19. </div>
  20. </div>
  21. <style>
  22. .use-type ._label-c {
  23. display: flex;
  24. }
  25. </style>
  26. {{end}}
  27. <div class="ui divider"></div>
  28. <div class="inline field">
  29. <label></label>
  30. <button class="ui blue button">{{/*.i18n.Tr "auth.send_reset_mail"*/}}提交</button>
  31. </div>
  32. </div>
  33. </form>
  34. <script>
  35. (function() {
  36. window.addEventListener('load', function () {
  37. var bindPhoneEl = $('.bindphone');
  38. bindPhoneEl.find('button.button').off('click').on('click', function(e) {
  39. var phoneNumber = bindPhoneEl.find('input.phoneNumber').val();
  40. var verifyCode = bindPhoneEl.find('input.verifyCode').val();
  41. if (phoneNumber && verifyCode) {
  42. e.preventDefault();
  43. if (!/^1[3578]\d{9}$/.test(phoneNumber)) {
  44. bindPhoneEl.find('.ui.negative.message').show().find('p').text({{.i18n.Tr "phone.please_enter_the_correct_mobile_number"}});
  45. return;
  46. }
  47. if (!/^\d{6}$/.test(verifyCode)) {
  48. bindPhoneEl.find('.ui.negative.message').show().find('p').text({{.i18n.Tr "phone.please_enter_the_correct_mobile_phone_verification_code"}});
  49. return;
  50. }
  51. $.ajax({
  52. url: '/bindPhone',
  53. type: 'post',
  54. dataType: 'json',
  55. data: {
  56. _csrf: bindPhoneEl.find('input[name="_csrf"]').val(),
  57. phone_number: phoneNumber,
  58. verify_code: verifyCode
  59. },
  60. success: function(res) {
  61. if (res && res.Code === 0) {
  62. window.location.href = '/dashboard';
  63. } else {
  64. bindPhoneEl.find('.ui.negative.message').show().find('p').text(res.Message);
  65. }
  66. },
  67. error: function(err) {
  68. console.log(err);
  69. }
  70. });
  71. }
  72. });
  73. });
  74. })();
  75. </script>
  76. </div>
  77. </div>
  78. </div>
  79. {{template "base/footer" .}}