商丘12345 前端

login.html 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
  6. <title>登录</title>
  7. <meta name="keywords">
  8. <meta name="description">
  9. <meta name="renderer" content="webkit">
  10. <link rel="shortcut icon" href="img/32.ico" />
  11. <script src="./Script/Common/huayi.load.js"></script>
  12. <script src="./Script/Common/huayi.config.js"></script>
  13. <link rel="stylesheet" href="./css/init.css" />
  14. <script src="./js/jquery.md5.js"></script>
  15. <style>
  16. html {
  17. margin: 0 auto;
  18. padding: 0;
  19. height: 100%;
  20. }
  21. body {
  22. height: 100%;
  23. background: #fff;
  24. }
  25. .wrap {
  26. width: 100%;
  27. height: 100%;
  28. }
  29. .wrap_right {
  30. float: left;
  31. width: 50%;
  32. height: 100%;
  33. }
  34. .wrap_left{
  35. float: left;
  36. width: 50%;
  37. height: 100%;
  38. }
  39. .wrap_right{
  40. position: relative;
  41. }
  42. .wrap_bj {
  43. width: 100%;
  44. height: 100%;
  45. background: url(img/left_amg_01.jpg) no-repeat;
  46. background-size: 100% 100%;
  47. }
  48. .tab_box {
  49. border: 1px solid #41caf2;
  50. border-top-right-radius: 15px;
  51. border-bottom-left-radius: 15px;
  52. margin: 50px auto 65px;
  53. padding: 0;
  54. overflow: hidden;
  55. width: 410px;
  56. }
  57. .tab_box ul {
  58. list-style: none;
  59. margin: 0;
  60. padding: 0;
  61. width: 100%;
  62. height: 50px;
  63. line-height: 50px;
  64. font-size: 16px;
  65. color: #41caf2;
  66. border-bottom: 1px solid #41caf2;
  67. text-align: center;
  68. }
  69. .tab_box ul li {
  70. width: 50%;
  71. float: left;
  72. }
  73. .active {
  74. background: #41caf2;
  75. color: #fff;
  76. }
  77. .tab_content {
  78. margin: 57px 0 35px 0;
  79. }
  80. .tab_content div p {
  81. width: 80%;
  82. margin: 0 auto;
  83. height: 35px;
  84. border: 1px solid #41caf2;
  85. border-radius: 15px;
  86. margin-bottom: 25px;
  87. line-height: 30px;
  88. padding-left: 20px;
  89. }
  90. .tab_content div p input {
  91. width: 75%;
  92. border: 0;
  93. font-size: 16px;
  94. outline: none;
  95. font-family: "仿宋", "宋体";
  96. }
  97. .login_icon {
  98. display: inline-block;
  99. width: 17px;
  100. height: 19px;
  101. vertical-align: middle;
  102. margin-right: 15px;
  103. }
  104. .login_icon_user {
  105. background: url(img/login_user.png) no-repeat;
  106. }
  107. .login_icon_lock {
  108. background: url(img/login_lock.png) no-repeat;
  109. }
  110. .login_icon_hua {
  111. background: url(img/login_hua.png) no-repeat;
  112. }
  113. .login_go {
  114. text-align: center;
  115. padding: 0!important;
  116. font-size: 16px;
  117. letter-spacing: 16px;
  118. font-family: "仿宋", "宋体";
  119. color: #fff;
  120. filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#1f90ec, endcolorstr=#1cb5ef, gradientType=1);
  121. background: -webkit-gradient(li near, 0 0, 100% 0, from(#1f90ec), to(#1cb5ef));
  122. background: -webkit-linear-gradient(left, #1f90ec, #1cb5ef);
  123. background: -moz-linear-gradient(left, #1f90ec, #1cb5ef);
  124. background: -o-linear-gradient(left, #1f90ec, #1cb5ef);
  125. background: linear-gradient(left, #1f90ec, #1cb5ef);
  126. cursor: pointer;
  127. }
  128. .error {
  129. height: 13px;
  130. background: url(img/yz.png) no-repeat 0 -8px;
  131. display: none;
  132. }
  133. .errorShow {
  134. display: inline-block;
  135. }
  136. .rightCon{
  137. width: 100%;
  138. position: absolute;
  139. top: 0;
  140. bottom: 0;
  141. right: 0;
  142. left: 0;
  143. margin: auto;
  144. height: 580px;
  145. }
  146. .leftCon{
  147. width: 30%;
  148. position: absolute;
  149. top: 41%;
  150. bottom: 0;
  151. right: 0;
  152. left: 50%;
  153. margin: auto;
  154. }
  155. .leftCon img{
  156. width: 100%;
  157. }
  158. .leftCon p{
  159. font-size: 28px;
  160. letter-spacing:10px;
  161. color:#e60111;
  162. line-height: 80px;
  163. }
  164. .service{
  165. width: 100%;
  166. position: absolute;
  167. bottom: 30px;
  168. }
  169. </style>
  170. </head>
  171. <body class="signin">
  172. <div class="wrap clearfix">
  173. <div class="wrap_left" style="position: relative;">
  174. <div class="wrap_bj"></div>
  175. <div class="leftCon">
  176. <img src="img/logintext.png"/>
  177. </div>
  178. </div>
  179. <div class="wrap_right">
  180. <div class="rightCon">
  181. <div class="logo" style="width: 100%;text-align: center;">
  182. <!--<i class="logo"></i><div class="logoWord"></div>-->
  183. <img src="img/sqLogo.png" alt="" />
  184. </div>
  185. <!--<div class="row clearfix">-->
  186. <div class="tab_box">
  187. <!--col-sm-7-->
  188. <ul class="clearfix tab_ul">
  189. <li class="active">坐席登录</li>
  190. <li>用户登录</li>
  191. </ul>
  192. <div class="tab_content">
  193. <div class="tab_one">
  194. <p>
  195. <i class="login_icon login_icon_user "></i>
  196. <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
  197. <i class="login_icon error error_zx error_zx_user"></i>
  198. </p>
  199. <p>
  200. <i class="login_icon login_icon_hua "></i>
  201. <input class="zx_fj" type="text" placeholder="请输入分机号" />
  202. <i class="login_icon error error_zx error_zx_fj"></i>
  203. </p>
  204. <p>
  205. <i class="login_icon login_icon_lock "></i>
  206. <input class="zx_psw" type="password" placeholder="请输入您的密码" />
  207. <i class="login_icon error error_zx error_zx_psw"></i>
  208. </p>
  209. <p class="login_go login_zx">登录</p>
  210. </div>
  211. <div class="tab_two" style="display: none;">
  212. <p>
  213. <i class="login_icon login_icon_user "></i>
  214. <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
  215. <i class="login_icon error error_gl error_gl_user"></i>
  216. </p>
  217. <p>
  218. <i class="login_icon login_icon_lock"></i>
  219. <input class="gl_psw" type="password" placeholder="请输入您的密码" />
  220. <i class="login_icon error error_gl error_gl_psw"></i>
  221. </p>
  222. <p class="login_go login_gl">登录</p>
  223. </div>
  224. </div>
  225. </div>
  226. <!--</div>-->
  227. <div class="service" >
  228. <!--row clearfix-->
  229. <!--<div class="col-sm-7">-->
  230. <p style="color: #313c58; font-size: 12px;text-align: center;"></p>
  231. <!--</div>-->
  232. </div>
  233. </div>
  234. </div>
  235. </div>
  236. <script>
  237. $(function() {
  238. var a=0;
  239. $('.tab_ul li').click(function() {
  240. $(this).addClass("active").siblings().removeClass("active");
  241. var index = $(this).index();
  242. a=index;
  243. $('.tab_content').children('div').eq(index).show().siblings().hide();
  244. })
  245. /*cook存储数据*/
  246. if($.cookie("username")) {
  247. //取值如果存在则赋值
  248. $(".gl_user").val($.cookie("user")); //用户名
  249. $("zx_fj").val($.cookie("fj"));
  250. $(".zx_user").val($.cookie("user"));
  251. }
  252. //键盘登录事件
  253. $('input').bind('keypress', function(event) {
  254. if(event.keyCode == "13") {
  255. if(a == 0) {
  256. $('.login_zx').trigger("click");
  257. } else {
  258. $(".login_gl").trigger("click");
  259. }
  260. }
  261. });
  262. //坐席登录
  263. $('.login_zx').click(function(){
  264. var zx_user = $(".zx_user").val();
  265. var zx_fj = $(".zx_fj").val();
  266. var zx_psw = $(".zx_psw").val();
  267. if(zx_user == "" || zx_fj == "" || zx_psw == "") {
  268. $(".error_zx").addClass('errorShow');
  269. if($(".zx_user").val() == "") {
  270. $(".zx_user").focus(function() {
  271. $(".error_zx").removeClass('errorShow');
  272. });
  273. } else {
  274. $(".error_zx_user").removeClass('errorShow');
  275. }
  276. }else {
  277. /*请求后台*/
  278. $.cookie("extno",zx_fj);
  279. $.cookie("zx_user",zx_user);
  280. $.ajax({
  281. type: "post",
  282. url: huayi.config.callcenter_url + "/Login/login",
  283. dataType: 'json',
  284. async: true,
  285. data: {
  286. username: zx_user,
  287. extensionphone: zx_fj,
  288. password: $.md5(zx_psw)
  289. },
  290. success: function(data) {
  291. /*验证请求*/
  292. if(data.state == "success") {
  293. $.cookie("token", data.data.token, {
  294. expires: 7
  295. });
  296. $.cookie("extno", zx_fj, {
  297. expires: 7
  298. });
  299. $.cookie("zx_user", zx_user, {
  300. expires: 7
  301. });
  302. window.location.href = "index.html";
  303. }
  304. //else {
  305. // $(".zx_user").val('');
  306. // $(".zx_fj").val('');
  307. // $(".zx_psw").val('');
  308. //}
  309. }
  310. });
  311. }
  312. })
  313. //用户登录
  314. $('.login_gl').click(function() {
  315. var gl_user = $(".gl_user").val();
  316. var gl_psw = $(".gl_psw").val();
  317. if(gl_user == "" || gl_psw == "") {
  318. $(".error_gl").addClass('errorShow');
  319. if($(".gl_user").val() == "") {
  320. $(".gl_user").focus(function() {
  321. $(".error_gl").removeClass('errorShow');
  322. });
  323. } else {
  324. $(".error_gl_user").removeClass('errorShow');
  325. }
  326. } else {
  327. /*请求后台*/
  328. $.ajax({
  329. type: "post",
  330. url: huayi.config.callcenter_url + "/Login/login",
  331. dataType: 'json',
  332. async: true,
  333. data: {
  334. username: gl_user,
  335. password: $.md5(gl_psw)
  336. },
  337. success: function(data) {
  338. /*验证请求*/
  339. if(data.state == "success") {
  340. $.cookie("token", data.data.token, {
  341. expires: 7
  342. });
  343. $.cookie("zx_user", gl_user, {
  344. expires: 7
  345. });
  346. window.location.href = "index.html";
  347. }
  348. //else{
  349. // $(".gl_user").val('');
  350. // $(".gl_psw").val('');
  351. //}
  352. }
  353. });
  354. }
  355. })
  356. })
  357. </script>
  358. </body>
  359. </html>