Nav apraksta

login.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  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. <script src="./js/aes/crypto-js.js"></script>
  16. <style>
  17. html {
  18. margin: 0 auto;
  19. padding: 0;
  20. height: 100%;
  21. }
  22. body {
  23. height: 100%;
  24. background: #fff;
  25. }
  26. .wrap {
  27. width: 100%;
  28. height: 100%;
  29. }
  30. .wrap_right {
  31. float: left;
  32. width: 50%;
  33. height: 100%;
  34. }
  35. .wrap_left{
  36. float: left;
  37. width: 50%;
  38. height: 100%;
  39. }
  40. .wrap_right{
  41. position: relative;
  42. }
  43. .wrap_bj {
  44. width: 100%;
  45. height: 100%;
  46. background: url(img/left_amg_01.jpg) no-repeat;
  47. background-size: 100% 100%;
  48. }
  49. .tab_box {
  50. border: 1px solid #41caf2;
  51. border-top-right-radius: 15px;
  52. border-bottom-left-radius: 15px;
  53. margin: 50px auto 65px;
  54. padding: 0;
  55. overflow: hidden;
  56. width: 410px;
  57. }
  58. .tab_box ul {
  59. list-style: none;
  60. margin: 0;
  61. padding: 0;
  62. width: 100%;
  63. height: 50px;
  64. line-height: 50px;
  65. font-size: 16px;
  66. color: #41caf2;
  67. border-bottom: 1px solid #41caf2;
  68. text-align: center;
  69. }
  70. .tab_box ul li {
  71. width: 100%;
  72. float: left;
  73. }
  74. .active {
  75. background: #41caf2;
  76. color: #fff;
  77. }
  78. .tab_content {
  79. margin: 57px 0 35px 0;
  80. }
  81. .tab_content div p {
  82. width: 80%;
  83. margin: 0 auto;
  84. height: 35px;
  85. border: 1px solid #41caf2;
  86. border-radius: 15px;
  87. margin-bottom: 25px;
  88. line-height: 30px;
  89. padding-left: 20px;
  90. }
  91. .tab_content div p input {
  92. width: 75%;
  93. border: 0;
  94. font-size: 16px;
  95. outline: none;
  96. font-family: "仿宋", "宋体";
  97. }
  98. .login_icon {
  99. display: inline-block;
  100. width: 17px;
  101. height: 19px;
  102. vertical-align: middle;
  103. margin-right: 15px;
  104. }
  105. .login_icon_user {
  106. background: url(img/login_user.png) no-repeat;
  107. }
  108. .login_icon_lock {
  109. background: url(img/login_lock.png) no-repeat;
  110. }
  111. .login_icon_hua {
  112. background: url(img/login_hua.png) no-repeat;
  113. }
  114. .login_go {
  115. text-align: center;
  116. padding: 0!important;
  117. font-size: 16px;
  118. letter-spacing: 16px;
  119. font-family: "仿宋", "宋体";
  120. color: #fff;
  121. filter: progid:DXImageTransform.Microsoft.gradient(startcolorstr=#1f90ec, endcolorstr=#1cb5ef, gradientType=1);
  122. background: -webkit-gradient(li near, 0 0, 100% 0, from(#1f90ec), to(#1cb5ef));
  123. background: -webkit-linear-gradient(left, #1f90ec, #1cb5ef);
  124. background: -moz-linear-gradient(left, #1f90ec, #1cb5ef);
  125. background: -o-linear-gradient(left, #1f90ec, #1cb5ef);
  126. background: linear-gradient(left, #1f90ec, #1cb5ef);
  127. cursor: pointer;
  128. }
  129. .error {
  130. height: 13px;
  131. background: url(img/yz.png) no-repeat 0 -8px;
  132. display: none;
  133. }
  134. .errorShow {
  135. display: inline-block;
  136. }
  137. .rightCon{
  138. width: 100%;
  139. position: absolute;
  140. top: 0;
  141. bottom: 0;
  142. right: 0;
  143. left: 0;
  144. margin: auto;
  145. height: 580px;
  146. }
  147. .leftCon{
  148. width: 30%;
  149. position: absolute;
  150. top: 41%;
  151. bottom: 0;
  152. right: 0;
  153. left: 50%;
  154. margin: auto;
  155. }
  156. .leftCon img{
  157. width: 100%;
  158. }
  159. .leftCon p{
  160. font-size: 28px;
  161. letter-spacing:10px;
  162. color:#e60111;
  163. line-height: 80px;
  164. }
  165. .service{
  166. width: 100%;
  167. position: absolute;
  168. bottom: 30px;
  169. }
  170. </style>
  171. </head>
  172. <body class="signin">
  173. <div class="wrap clearfix">
  174. <div class="wrap_left" style="position: relative;">
  175. <div class="wrap_bj"></div>
  176. <div class="leftCon">
  177. <img src="img/logintext.png"/>
  178. </div>
  179. </div>
  180. <div class="wrap_right">
  181. <div class="rightCon">
  182. <div class="logo" style="width: 100%;text-align: center;">
  183. <!--<i class="logo"></i><div class="logoWord"></div>-->
  184. <!--<img src="img/sqLogo.png" alt="" />-->
  185. </div>
  186. <!--<div class="row clearfix">-->
  187. <div class="tab_box">
  188. <!--col-sm-7-->
  189. <ul class="clearfix tab_ul">
  190. <!--<li class="active">坐席登录</li>-->
  191. <li class="active">用户登录</li>
  192. </ul>
  193. <div class="tab_content">
  194. <div class="tab_one" style="display: none;">
  195. <p>
  196. <i class="login_icon login_icon_user "></i>
  197. <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
  198. <i class="login_icon error error_zx error_zx_user"></i>
  199. </p>
  200. <p>
  201. <i class="login_icon login_icon_hua "></i>
  202. <input class="zx_fj" type="text" placeholder="请输入分机号" />
  203. <i class="login_icon error error_zx error_zx_fj"></i>
  204. </p>
  205. <p>
  206. <i class="login_icon login_icon_lock "></i>
  207. <input class="zx_psw" type="password" placeholder="请输入您的密码" />
  208. <i class="login_icon error error_zx error_zx_psw"></i>
  209. </p>
  210. <p class="login_go login_zx">登录</p>
  211. </div>
  212. <div class="tab_two" style="display: block;">
  213. <p>
  214. <i class="login_icon login_icon_user "></i>
  215. <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
  216. <i class="login_icon error error_gl error_gl_user"></i>
  217. </p>
  218. <p>
  219. <i class="login_icon login_icon_lock"></i>
  220. <input class="gl_psw" type="password" placeholder="请输入您的密码" />
  221. <i class="login_icon error error_gl error_gl_psw"></i>
  222. </p>
  223. <p class="login_go login_gl">登录</p>
  224. </div>
  225. </div>
  226. </div>
  227. <!--</div>-->
  228. <div class="service" >
  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. // })
  246. /*cook存储数据*/
  247. if($.cookie("username")) {
  248. //取值如果存在则赋值
  249. $(".gl_user").val($.cookie("user")); //用户名
  250. $("zx_fj").val($.cookie("fj"));
  251. $(".zx_user").val($.cookie("user"));
  252. }
  253. //键盘登录事件
  254. $('input').bind('keypress', function(event) {
  255. if(event.keyCode == "13") {
  256. $(".login_gl").trigger("click");
  257. }
  258. });
  259. //坐席登录
  260. $('.login_zx').click(function(){
  261. var zx_user = $(".zx_user").val();
  262. var zx_fj = $(".zx_fj").val();
  263. var zx_psw = $(".zx_psw").val();
  264. if(zx_user == "" || zx_fj == "" || zx_psw == "") {
  265. $(".error_zx").addClass('errorShow');
  266. if($(".zx_user").val() == "") {
  267. $(".zx_user").focus(function() {
  268. $(".error_zx").removeClass('errorShow');
  269. });
  270. } else {
  271. $(".error_zx_user").removeClass('errorShow');
  272. }
  273. }else {
  274. var currenttime=CurentTime();
  275. var datatime=currenttime.split(' ')[1].split(':').join('')
  276. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  277. var zx_psw = CryptoJS.enc.Utf8.parse($.md5(zx_psw));
  278. var encrypted = CryptoJS.AES.encrypt(zx_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  279. /*请求后台*/
  280. $.cookie("extno",zx_fj);
  281. $.cookie("zx_user",zx_user);
  282. $.ajax({
  283. type: "post",
  284. url: huayi.config.callcenter_url + "/Login/login",
  285. dataType: 'json',
  286. async: true,
  287. data: {
  288. username: zx_user,
  289. extensionphone: zx_fj,
  290. LoginTime:currenttime,
  291. password:encrypted.toString()
  292. },
  293. success: function(data) {
  294. console.log("data", data)
  295. debugger;
  296. /*验证请求*/
  297. if(data.state == "success") {
  298. debugger
  299. $.cookie("token", data.data.token, {
  300. expires: 7
  301. });
  302. $.cookie("extno", zx_fj, {
  303. expires: 7
  304. });
  305. $.cookie("zx_user", zx_user, {
  306. expires: 7
  307. });
  308. window.location.href = "home.html";
  309. }
  310. //else {
  311. // $(".zx_user").val('');
  312. // $(".zx_fj").val('');
  313. // $(".zx_psw").val('');
  314. //}
  315. }
  316. });
  317. }
  318. })
  319. function CurentTime(){
  320. var now = new Date();
  321. var year = now.getFullYear(); //年
  322. var month = now.getMonth() + 1; //月
  323. var day = now.getDate(); //日
  324. var hh = now.getHours(); //时
  325. var mm = now.getMinutes(); //分
  326. var ss = now.getSeconds(); //秒
  327. var clock = year + "-";
  328. if(month < 10)
  329. clock += "0";
  330. clock += month + "-";
  331. if(day < 10)
  332. clock += "0";
  333. clock += day + " ";
  334. if(hh < 10)
  335. clock += "0";
  336. clock += hh + ":";
  337. if (mm < 10) clock += '0';
  338. clock += mm + ":";
  339. if (ss < 10) clock += '0';
  340. clock += ss;
  341. return(clock);
  342. }
  343. //用户登录
  344. $('.login_gl').click(function() {
  345. var gl_user = $(".gl_user").val();
  346. var gl_psw = $(".gl_psw").val();
  347. if(gl_user == "" || gl_psw == "") {
  348. $(".error_gl").addClass('errorShow');
  349. if($(".gl_user").val() == "") {
  350. $(".gl_user").focus(function() {
  351. $(".error_gl").removeClass('errorShow');
  352. });
  353. } else {
  354. $(".error_gl_user").removeClass('errorShow');
  355. }
  356. } else {
  357. var currenttime=CurentTime();
  358. var datatime=currenttime.split(' ')[1].split(':').join('')
  359. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  360. var gl_psw = CryptoJS.enc.Utf8.parse($.md5(gl_psw));
  361. var encrypted = CryptoJS.AES.encrypt(gl_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  362. // var decrypt = CryptoJS.AES.decrypt(encrypted, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  363. // console.log(CryptoJS.enc.Utf8.stringify(decrypt).toString());
  364. // return false;
  365. /*请求后台*/
  366. $.ajax({
  367. type: "post",
  368. url: huayi.config.callcenter_url + "/Login/login",
  369. dataType: 'json',
  370. async: true,
  371. data: {
  372. username: gl_user,
  373. password: encrypted.toString(),
  374. LoginTime:currenttime
  375. },
  376. success: function(data) {
  377. console.log("data", data)
  378. debugger;
  379. /*验证请求*/
  380. if(data.state == "success") {
  381. $.cookie("token", data.data.token, {
  382. expires: 7
  383. });
  384. $.cookie("zx_user", gl_user, {
  385. expires: 7
  386. });
  387. window.location.href = "home.html";
  388. }
  389. //else{
  390. // $(".gl_user").val('');
  391. // $(".gl_psw").val('');
  392. //}
  393. }
  394. });
  395. }
  396. })
  397. })
  398. </script>
  399. </body>
  400. </html>