login.html 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. {php define('MUI', true);}
  2. {template 'common/header'}
  3. <script>
  4. $(function(){
  5. $(document).on('input propertychange', '.js-mobile-val', function(){
  6. var mobile_value = $(this).val();
  7. if (mobile_value.length == '11') {
  8. $.post("{php echo url('auth/login/mobile_exist')}", {'mobile' : mobile_value}, function(data) {
  9. data = $.parseJSON(data);
  10. if (data.message.errno == '1') {
  11. $('.js-check-mobile').addClass('send-code');
  12. } else if (data.message.errno == '2'){
  13. $('.js-check-mobile').removeClass('send-code');
  14. util.toast('手机号不存在', '', 'error');
  15. return;
  16. }
  17. });
  18. } else {
  19. $('.js-check-mobile').removeClass('send-code');
  20. }
  21. });
  22. $(document).on('click', '.login-code', function() {
  23. var username = $('#login-code input[name="username"]').val();
  24. var password = $('#login-code input[name="password"]').val();
  25. $.post(location.href, {'username' : username, 'password' : password, 'mode' : 'code'},function(data) {
  26. data = $.parseJSON(data);
  27. if(data.type != 'success') {
  28. util.toast(data.message, '', 'error');
  29. } else {
  30. util.toast('登录成功');
  31. location.reload();
  32. }
  33. })
  34. })
  35. $(document).on('click', '.send-code', function(){
  36. var username = $('#login-code input[name="username"]').val();
  37. option = {
  38. 'btnElement' : $('.send-code'),
  39. 'showElement' : $('.js-timer'),
  40. 'btnTips' : '<a class="send-code">重新获取验证码</a>',
  41. 'successCallback' : function(ret, message){
  42. if (ret == '0') {
  43. util.toast(message);
  44. $('.js-sendcode').hide();
  45. $('.js-codeverify').show();
  46. } else {
  47. util.toast(message);
  48. $('.js-sendcode').show();
  49. $('.js-codeverify').hide();
  50. return;
  51. }
  52. }
  53. };
  54. util.sendCode(username, option);
  55. });
  56. });
  57. </script>
  58. <div class="mui-content mc-login">
  59. <div class="avatar mui-text-center">
  60. <img src="{if tomedia('headimg_'.$_W['acid'].'.jpg')}{php echo tomedia('headimg_'.$_W['acid'].'.jpg');}{else}resource/images/MicroEngine.ico{/if}" class="mui-img-circle"/>
  61. </div>
  62. {if $type == 'email'}
  63. {if ($item == 'mobile' && $ltype !== 'code') || ($item == 'email') || ($item == 'random')}
  64. <form action="{url 'auth/login/basic'}" method="post" enctype="multipart/form-data" class="js-ajax-form">
  65. <div class="mui-control-content mui-active" id="login-basic">
  66. <div class="mui-input-group">
  67. <div class="mui-input-row">
  68. <label class="mui-label-icon"><i class="fa fa-user"></i></label>
  69. <input name ="username" type="text" placeholder="{if $item == 'mobile'}手机号{elseif $item == 'email'}邮箱{else}手机号/邮箱{/if}{if !empty($uc_setting) && $uc_setting['status'] == '1'}/{$uc_setting['title']}账号{/if}"/>
  70. </div>
  71. <div class="mui-input-row mui-help">
  72. <label class="mui-label-icon"><i class="fa fa-lock"></i></label>
  73. <input name="password" type="password" placeholder="密码"/>
  74. <div class="mui-help-info mui-text-right"><a href="{url 'auth/forget' array('forward' => $_GPC['forward'])}">忘记密码</a></div>
  75. </div>
  76. </div>
  77. </div>
  78. <div class="mui-content-padded">
  79. <input type="hidden" name="mode" value="basic">
  80. <input type="hidden" name="token" value="{$_W['token']}" />
  81. <button class="mui-btn mui-btn-success mui-btn-block login-basic" type="submit" name="submit" value="提交">登录</button>
  82. </div>
  83. </form>
  84. {/if}
  85. {/if}
  86. {if $type == 'mobile' || ($item == 'mobile' && $ltype == 'code')}
  87. <div class="mui-active mc-login-code" id="login-code">
  88. <div class="js-sendcode">
  89. <div class="mui-content-padded mui-text-muted">请输入手机号,以收取验证码</div>
  90. <div class="mui-input-group mui-mt15">
  91. <div class="mui-input-row">
  92. <label class="mui-label-icon"><i class="fa fa-user"></i></label>
  93. <input name="username" class="js-mobile-val" type="text" placeholder="手机号"/>
  94. </div>
  95. </div>
  96. <div class="mui-content-padded mui-text-center">
  97. <button class="mui-btn mui-btn-success mui-btn-block js-check-mobile" uniacid="{$_W['uniacid']}">下一步</button>
  98. </div>
  99. </div>
  100. <div style="display:none;" class="js-codeverify">
  101. <div class="mui-content-padded mui-text-muted">您的手机号<span class="mui-text-success" ng-bind="ret.code.username"></span>会收到一条含有6位数字验证码的短信息</div>
  102. <div class="mui-input-group mui-mt15">
  103. <div class="mui-input-row">
  104. <label class="mui-label-icon"><i class="fa fa-key"></i></label>
  105. <input name="password" type="text" placeholder="验证码"/>
  106. </div>
  107. </div>
  108. <div class="mui-content-padded mui-text-center">
  109. <button class="mui-btn mui-btn-success mui-btn-block login-code" type="submit">确认</button>
  110. <div class="mui-mt15 mui-text-center">
  111. <span class="mui-text-muted js-timer">
  112. </span>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. {/if}
  118. <div class="mui-content-padded">
  119. <div class="mui-text-center mui-mt15">
  120. {if $ltype != 'code' && $audit == '1'}
  121. <a href="{url 'auth/register' array('type' => $item, 'forward' => $_GPC['forward'])}">注册账号</a>
  122. {else}
  123. <a href="{url 'auth/register' array('forward' => $_GPC['forward'])}">注册账号</a>
  124. {/if}
  125. {if $type == 'email'}
  126. {if ($item == 'mobile' && ($ltype =='hybird')) || ($item == 'random' && ($ltype !== 'password'))}
  127. <span class="mui-ml5 mui-mr5 mui-text-muted">|</span>
  128. <a href="{url 'auth/login' array('forward' => $_GPC['forward'], 'type' => 'mobile')}#wechat_redirect">无密码登录
  129. </a>
  130. {/if}
  131. {else}
  132. <span class="mui-ml5 mui-mr5 mui-text-muted">|</span>
  133. <a href="{url 'auth/login' array('forward' => $_GPC['forward'], 'type' => 'email')}#wechat_redirect">邮箱登录
  134. </a>
  135. {/if}
  136. </div>
  137. </div>
  138. </div>