prepare.html 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <div id="content-container" class="container">
  2. <div class="text-center">
  3. <img src="{$userinfo.avatar}" class="img-circle" width="80" height="80" alt=""/>
  4. <div style="margin-top:15px;">{$userinfo.nickname|htmlentities}</div>
  5. </div>
  6. <div class="user-section login-section" style="margin-top:20px;">
  7. <div class="logon-tab clearfix">
  8. <a href="javascript:" data-type="bind" class="active">绑定已有账号</a>
  9. <a href="javascript:" data-type="register">创建新账号</a>
  10. </div>
  11. <div class="bind-main login-main">
  12. <form name="form" id="bind-form" class="form-vertical" method="POST" action="{:url('user/login')}">
  13. {:token()}
  14. <input type="hidden" name="platform" value="{$platform|htmlentities}"/>
  15. <input type="hidden" name="url" value="{$url|htmlentities}"/>
  16. <div class="form-group">
  17. <label class="control-label">{:__('Account')}</label>
  18. <div class="controls">
  19. <input type="text" id="account" name="account" data-rule="required" class="form-control input-lg" placeholder="{:__('Email/Mobile/Username')}">
  20. <p class="help-block"></p>
  21. </div>
  22. </div>
  23. <div class="form-group">
  24. <label class="control-label">{:__('Password')}</label>
  25. <div class="controls">
  26. <input type="password" id="password" name="password" data-rule="required;password" class="form-control input-lg" placeholder="{:__('Password must be 6 to 30 characters')}">
  27. <p class="help-block"></p>
  28. </div>
  29. </div>
  30. <div class="form-group">
  31. <button type="submit" class="btn btn-primary btn-block btn-lg">{:__('确认绑定')}</button>
  32. </div>
  33. </form>
  34. </div>
  35. <div class="register-main login-main hidden">
  36. <form name="form" id="register-form" class="form-vertical" method="POST" action="{:url('user/register')}">
  37. {:token()}
  38. <input type="hidden" name="platform" value="{$platform|htmlentities}"/>
  39. <input type="hidden" name="url" value="{$url|htmlentities}"/>
  40. <div class="form-group">
  41. <label class="control-label">{:__('Email')}</label>
  42. <div class="controls">
  43. <input type="text" id="email" name="email" data-rule="required;email" class="form-control input-lg" placeholder="{:__('Email')}">
  44. <p class="help-block"></p>
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <label class="control-label">{:__('Username')}</label>
  49. <div class="controls">
  50. <input type="text" id="username" name="username" data-rule="required;length(3~30, true)" class="form-control input-lg" placeholder="{:__('Username must be 3 to 30 characters')}">
  51. <p class="help-block"></p>
  52. </div>
  53. </div>
  54. <div class="form-group">
  55. <label class="control-label">{:__('Password')}</label>
  56. <div class="controls">
  57. <input type="password" id="password" name="password" data-rule="required;password" class="form-control input-lg" placeholder="{:__('Password must be 6 to 30 characters')}">
  58. <p class="help-block"></p>
  59. </div>
  60. </div>
  61. <div class="form-group">
  62. <label class="control-label">{:__('Mobile')}</label>
  63. <div class="controls">
  64. <input type="text" id="mobile" name="mobile" data-rule="required;mobile" class="form-control input-lg" placeholder="{:__('Mobile')}">
  65. <p class="help-block"></p>
  66. </div>
  67. </div>
  68. {if $captchaType}
  69. <div class="form-group">
  70. <label class="control-label">{:__('Captcha')}</label>
  71. <div class="controls">
  72. <div class="input-group">
  73. {include file="common/captcha" event="register" type="$captchaType" /}
  74. </div>
  75. <p class="help-block"></p>
  76. </div>
  77. </div>
  78. {/if}
  79. <div class="form-group">
  80. <button type="submit" class="btn btn-primary btn-block btn-lg">{:__('创建账号并绑定')}</button>
  81. </div>
  82. </form>
  83. </div>
  84. </div>
  85. </div>
  86. <script>
  87. require.callback = function () {
  88. define('frontend/third', ['jquery', 'bootstrap', 'frontend', 'template', 'form'], function ($, undefined, Frontend, Template, Form) {
  89. var Controller = {
  90. prepare: function () {
  91. var validatoroptions = {
  92. invalid: function (form, errors) {
  93. $.each(errors, function (i, j) {
  94. Layer.msg(j);
  95. });
  96. }
  97. };
  98. $(".user-section .logon-tab > a").on("click", function () {
  99. $(".bind-main,.register-main").addClass("hidden");
  100. $("." + $(this).data("type") + "-main").removeClass("hidden");
  101. $(".user-section .logon-tab > a").removeClass("active");
  102. $(this).addClass("active");
  103. });
  104. //本地验证未通过时提示
  105. $("#register-form").data("validator-options", validatoroptions);
  106. //为表单绑定事件
  107. Form.api.bindevent($("#bind-form"), function (data, ret) {
  108. location.href = "{$bindurl}";
  109. return false;
  110. });
  111. //为表单绑定事件
  112. Form.api.bindevent($("#register-form"), function (data, ret) {
  113. location.href = "{$bindurl}";
  114. return false;
  115. }, function (data) {
  116. $("input[name=captcha]").next(".input-group-addon").find("img").trigger("click");
  117. });
  118. }
  119. };
  120. return Controller;
  121. });
  122. }
  123. </script>