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

users_select_login.htm 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8" />
  5. <title>选择登录方式-{eyou:global name='web_name' /}</title>
  6. <meta name="renderer" content="webkit">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  8. <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
  9. <link href="{eyou:global name='web_cmspath' /}/favicon.ico" rel="shortcut icon" type="image/x-icon" />
  10. {eyou:static file="users/skin/css/basic.css" /}
  11. {eyou:static file="users/skin/css/eyoucms.css" /}
  12. {eyou:include file="users/skin/css/diy_css.htm" /}
  13. {eyou:static file="/public/static/common/js/jquery.min.js"/}
  14. {eyou:static file="/public/plugins/layer-v3.1.0/layer.js"/}
  15. {eyou:static file="users/skin/js/global.js" /}
  16. {eyou:static file="/public/static/common/js/mobile_global.js" /}
  17. </head>
  18. <body class="login-reg">
  19. <div class="wrapper">
  20. <input type="hidden" id="wechat_url" value="{$eyou.field.wechat_url|default=''}">
  21. <div class="hend-box">
  22. <div class="title">登录</div>
  23. <div class="desc">还没有账号,<a href="{:url('user/Users/reg')}" style="color: #ff9600;">立即注册</a></div>
  24. </div>
  25. <div class="cont-box">
  26. <div id="con_sign_1">
  27. <form action="" name='theForm' id="theForm" method="post" class="">
  28. <div class="wx-form-group">
  29. <input type="text" name="username" required class="wx-form-control" placeholder="请输入账号" autocomplete="off" />
  30. </div>
  31. <div class="wx-form-group">
  32. <input type="password" name="password" required class="wx-form-control" placeholder="请输入密码" autocomplete="off" />
  33. <span class="password-icon pass-showhide pass-hide" data-name="password"></span>
  34. </div>
  35. {eyou:eq name="$is_vertify" value="1"}
  36. <div class="wx-form-group">
  37. <div class="field">
  38. <input type="text" name="vertify" autocomplete="off" class="wx-form-control" placeholder="请输入验证码" />
  39. <img src="{eyou:url link='api/Ajax/vertify' vars='type=users_login' /}" class="chicuele" id="imgVerifys" onclick="handleVerifyRefresh('imgVerifys');" title="看不清?点击更换验证码" align="absmiddle">
  40. </div>
  41. </div>
  42. {/eyou:eq}
  43. <input type="hidden" name="referurl" value="{$referurl}" />
  44. <input type="hidden" name="website" value="website" />
  45. <input style="margin-top: 44px;" type="button" name="submit" class="btn btn-lg btn-primary btn-block" value="登录" />
  46. <div class="login-link">
  47. <a style="color: #ff9600;" id="click_sign_1" href="javascript:void(0);" onclick="showPhoneSignIn1();">使用手机号登录</a>
  48. </div>
  49. </form>
  50. </div>
  51. <div id="con_sign_2" style="display:none;">
  52. <form action="" name='theMobileForm' id="theMobileForm" method="post" class="">
  53. <div class="wx-form-group">
  54. <input type="text" name="mobile" value="" required class="wx-form-control" placeholder="请输入手机号" autocomplete="off" />
  55. </div>
  56. <div class="wx-form-group" id="vertify_div">
  57. <div class="field">
  58. <input type="text" name="mobile_vertify" autocomplete="off" class="wx-form-control" placeholder="图片验证码" />
  59. <img src="{eyou:url link='api/Ajax/vertify' vars='type=users_mobile_login' /}" class="chicuele" id="mobile_imgVerifys" onclick="mobile_fleshVerify();" title="看不清?点击更换验证码" align="absmiddle">
  60. </div>
  61. </div>
  62. <div class="wx-form-group">
  63. <div class="field">
  64. <input id="mobile_code" type="text" class="wx-form-control" name="mobile_code" placeholder="请输入动态码">
  65. <input type="button" id="mobile_code_button" onclick="send_mobile_code();" class="sento" value="获取动态码">
  66. </div>
  67. </div>
  68. <input type="hidden" name="referurl" value="{$referurl}" />
  69. <input type="hidden" name="website" value="website" />
  70. <input type="hidden" name="__mobile_1_token__" value="{$Request.token.__mobile_1_token__}" />
  71. <input style="margin-top: 44px;" type="button" onclick="checkMobileUserLogin1649732103()" class="btn btn-lg btn-primary btn-block" value="登录" />
  72. <div class="login-link">
  73. <a class="fr" style="color: #ff9600;" id="click_sign_2" href="javascript:void(0);" onclick="showPhoneSignIn2();">使用账号登录</a>
  74. </div>
  75. <script>
  76. $("input[name=mobile]").keyup(function(event){
  77. var mobile = $(this).val();
  78. if (11 == mobile.length && 32 <= event.keyCode) {
  79. $('#vertify_div').css('display','block');
  80. }
  81. });
  82. /*$("input[name=mobile_vertify]").keyup(function(event){
  83. var mobile_vertify = $(this).val();
  84. if (4 <= mobile_vertify.length && 32 <= event.keyCode) {
  85. send_mobile_code();
  86. }
  87. });*/
  88. function send_mobile_code() {
  89. var mobile = $("input[name=mobile]").val();
  90. // 手机号是否为空
  91. if (!mobile) {
  92. $("input[name=mobile]").focus();
  93. layer.msg('请输入手机号码!', {time: 1500});
  94. return false;
  95. }
  96. // 手机格式不正确
  97. var reg = /^1[0-9]{10}$/i;
  98. if (!reg.test(mobile)) {
  99. $("input[name=mobile]").focus();
  100. layer.msg('请输入正确的请输入手机号码!', {time: 1500});
  101. return false;
  102. }
  103. $('#vertify_div').css('display','block');
  104. var mobile_vertify = $("input[name=mobile_vertify]").val();
  105. if (!mobile_vertify) {
  106. return false;
  107. }
  108. // 设置为不可点击
  109. $("#mobile_code_button").val('获取中…').attr('disabled', 'disabled');
  110. var __mobile_1_token__ = $('input[name=__mobile_1_token__]').val();
  111. $.ajax({
  112. url: "{eyou:url link='api/Ajax/SendMobileCode' /}",
  113. // source:2 登录
  114. data: {type:'users_mobile_login', mobile:mobile, is_mobile:true, title:'登录', source:2,IsVertify:1, vertify:mobile_vertify, __mobile_1_token__:__mobile_1_token__},
  115. type:'post',
  116. dataType:'json',
  117. success:function(res){
  118. if (res.code == 1) {
  119. code_countdown();
  120. layer.msg(res.msg, {time: 1500});
  121. } else {
  122. $("#mobile_code_button").val('获取验证码').removeAttr("disabled");
  123. layer.alert(res.msg, {icon: 2, title: false, closeBtn: 0});
  124. }
  125. },
  126. error : function() {
  127. $("#mobile_code_button").val('获取验证码').removeAttr("disabled");
  128. layer.alert('发送失败,请尝试重新发送!', {icon: 5, title: false, closeBtn: 0});
  129. }
  130. });
  131. }
  132. function mobile_fleshVerify() {
  133. // 更新验证码
  134. handleVerifyRefresh('mobile_imgVerifys', 'users_mobile_login');
  135. // 更新token
  136. $.ajax({
  137. async:false,
  138. url: "__ROOT_DIR__/index.php?m=api&c=Ajax&a=get_token&name=__mobile_1_token__",
  139. data: {_ajax:1},
  140. type:'GET',
  141. dataType:'html',
  142. success:function(res1){
  143. $('input[name=__mobile_1_token__]').val(res1);
  144. },
  145. error : function(e) {
  146. layer.closeAll();
  147. layer.alert(e.responseText, {icon: 5, title:false});
  148. }
  149. });
  150. }
  151. function code_countdown(){
  152. // 倒计时
  153. var setTime;
  154. var time = 120;
  155. setTime = setInterval(function() {
  156. if(0 >= time) {
  157. clearInterval(setTime);
  158. return false;
  159. }
  160. time--;
  161. $("#mobile_code_button").val(time + '秒').attr('disabled', 'disabled');
  162. if(time == 0) $("#mobile_code_button").val('获取验证码').removeAttr("disabled");
  163. }, 1000);
  164. }
  165. function checkMobileUserLogin1649732103() {
  166. var mobile = $('#theMobileForm input[name=mobile]');
  167. var mobile_code = $('#theMobileForm input[name=mobile_code]');
  168. if (mobile.val() == '') {
  169. layer.msg('手机号不能为空!', {
  170. time: 1500
  171. });
  172. mobile.focus();
  173. return false;
  174. }
  175. if (mobile_code.val() == '') {
  176. layer.msg('验证码不能为空!', {
  177. time: 1500
  178. });
  179. mobile_code.focus();
  180. return false;
  181. }
  182. layer_loading('正在处理');
  183. $.ajax({
  184. url: "{eyou:url link='user/Users/mobile_login' /}",
  185. data: $('#theMobileForm').serialize(),
  186. type: 'post',
  187. dataType: 'json',
  188. success: function(res) {
  189. if (1 == res.code) {
  190. if (5 == res.data.status) {
  191. layer.alert(res.msg, {
  192. icon: 5,
  193. title: false,
  194. closeBtn: false
  195. }, function() {
  196. window.location.href = res.url;
  197. });
  198. } else {
  199. window.location.href = res.url;
  200. }
  201. } else {
  202. layer.closeAll();
  203. if ('vertify' == res.data.status) {
  204. mobile_fleshVerify();
  205. }
  206. if (2 == res.data.status) {
  207. showErrorAlert(res.msg, 4);
  208. } else {
  209. layer.msg(res.msg, {
  210. icon: 5,
  211. time: 1500
  212. });
  213. }
  214. }
  215. },
  216. error: function(e) {
  217. layer.closeAll();
  218. showErrorAlert(e.responseText);
  219. }
  220. });
  221. }
  222. </script>
  223. </form>
  224. </div>
  225. <!-- 第三方账号登录 -->
  226. {eyou:if condition="!empty($weapp_wxlogin) || !empty($weapp_qqlogin) || !empty($weapp_wblogin)"}
  227. <div class="account-login">
  228. {eyou:notempty name="$weapp_qqlogin"}
  229. <a data-href="{eyou:url link='plugins/QqLogin/login' seo_pseudo='1' seo_inlet='0' /}" class="qq-login"></a>
  230. {/eyou:notempty}
  231. {eyou:notempty name="$weapp_wxlogin"}
  232. <a data-href="{eyou:url link='plugins/WxLogin/login' seo_pseudo='1' seo_inlet='0' /}" class="wechat-login"></a>
  233. {/eyou:notempty}
  234. {eyou:notempty name="$weapp_wblogin"}
  235. <a data-href="{eyou:url link='plugins/Wblogin/login' seo_pseudo='1' seo_inlet='0' /}" class="weibo-login"></a>
  236. {/eyou:notempty}
  237. </div>
  238. {/eyou:if}
  239. <!-- 第三方账号登录 -->
  240. </div>
  241. </div>
  242. {eyou:static file="users/skin/js/users_login.js" /}
  243. <script type="text/javascript">
  244. // 使用微信登录
  245. function wechat_login() {
  246. var wechat_url = $('#wechat_url').val();
  247. if (!wechat_url) {
  248. showErrorAlert('网络失败,请刷新页面后重试');
  249. }
  250. layer_loading('正在处理');
  251. $.ajax({
  252. url: wechat_url,
  253. data: {data:0},
  254. type: 'post',
  255. dataType:'json',
  256. success:function(res){
  257. layer.closeAll();
  258. if (res.code == 1) {
  259. window.location.href = res.url;
  260. } else {
  261. layer.msg(res.msg, {time: 2000, icon: 5});
  262. }
  263. },
  264. error : function(e) {
  265. layer.closeAll();
  266. showErrorAlert(e.responseText);
  267. }
  268. });
  269. };
  270. $(function() {
  271. $('input[name=submit]').on('click', function() {
  272. // 账号判断
  273. var username = $('input[name=username]');
  274. if (username.val() == '') {
  275. username.focus();
  276. showLayerMsg('用户名不能为空');
  277. return false;
  278. }
  279. // 密码判断
  280. var password = $('input[name=password]');
  281. if (password.val() == '') {
  282. password.focus();
  283. showLayerMsg('密码不能为空');
  284. return false;
  285. }
  286. var formData = $('#theForm').serialize();
  287. // 等保插件密码复杂判断,需在(formData)变量后面
  288. {$pwdJsCode|default=''}
  289. // 提交登录
  290. showLayerLoad();
  291. $.ajax({
  292. url : eyou_basefile + "?m=user&c=Users&a=login",
  293. data: formData,
  294. type: 'post',
  295. dataType: 'json',
  296. success: function(res) {
  297. if (1 == res.code) {
  298. if (5 == res.data.status) {
  299. showLayerMsg(res.msg, 2, function() {
  300. window.location.href = res.url;
  301. });
  302. } else {
  303. window.location.href = res.url;
  304. }
  305. } else {
  306. layer.closeAll();
  307. if (2 == res.data.status) {
  308. showLayerAlert(res.msg, 4);
  309. } else {
  310. showLayerMsg(res.msg);
  311. }
  312. if ('vertify' == res.data.status) handleVerifyRefresh();
  313. }
  314. },
  315. error: function(e) {
  316. layer.closeAll();
  317. showLayerAlert(e.responseText);
  318. }
  319. });
  320. });
  321. });
  322. </script>
  323. </body>
  324. </html>