Ei kuvausta

login.html 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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. <link rel="stylesheet" href="./css/init.css" />
  12. <script src="./Script/Common/huayi.load.js"></script>
  13. <script src="./Script/Common/huayi.config.js"></script>
  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: 50%;
  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;"></div>
  183. <div class="tab_box">
  184. <ul class="clearfix tab_ul">
  185. <li class="active">坐席登录</li>
  186. <li>用户登录</li>
  187. </ul>
  188. <div class="tab_content">
  189. <div class="tab_one">
  190. <p>
  191. <i class="login_icon login_icon_user "></i>
  192. <input class="zx_user" type="text" placeholder="请输入您的管理账号" />
  193. <i class="login_icon error error_zx error_zx_user"></i>
  194. </p>
  195. <p>
  196. <i class="login_icon login_icon_hua "></i>
  197. <input class="zx_fj" type="text" placeholder="请输入分机号" />
  198. <i class="login_icon error error_zx error_zx_fj"></i>
  199. </p>
  200. <p>
  201. <i class="login_icon login_icon_lock "></i>
  202. <input class="zx_psw" type="password" placeholder="请输入您的密码" />
  203. <i class="login_icon error error_zx error_zx_psw"></i>
  204. </p>
  205. <p class="login_go login_zx">登录</p>
  206. </div>
  207. <div class="tab_two" style="display: none;">
  208. <p>
  209. <i class="login_icon login_icon_user "></i>
  210. <input class="gl_user" type="text" placeholder="请输入您的管理账号" />
  211. <i class="login_icon error error_gl error_gl_user"></i>
  212. </p>
  213. <p>
  214. <i class="login_icon login_icon_lock"></i>
  215. <input class="gl_psw" type="password" placeholder="请输入您的密码" />
  216. <i class="login_icon error error_gl error_gl_psw"></i>
  217. </p>
  218. <p class="login_go login_gl">登录</p>
  219. </div>
  220. </div>
  221. </div>
  222. <div class="service" >
  223. <p style="color: #313c58; font-size: 12px;text-align: center;"></p>
  224. </div>
  225. </div>
  226. </div>
  227. </div>
  228. <script>
  229. $(function() {
  230. var a=0;
  231. $('.tab_ul li').click(function() {
  232. $(this).addClass("active").siblings().removeClass("active");
  233. var index = $(this).index();
  234. a=index;
  235. $('.tab_content').children('div').eq(index).show().siblings().hide();
  236. })
  237. /*cook存储数据*/
  238. if($.cookie("username")) {
  239. //取值如果存在则赋值
  240. $(".gl_user").val($.cookie("user")); //用户名
  241. $("zx_fj").val($.cookie("fj"));
  242. $(".zx_user").val($.cookie("user"));
  243. }
  244. //键盘登录事件
  245. $('input').bind('keypress', function(event) {
  246. if(event.keyCode == "13") {
  247. if(a == 0) {
  248. $('.login_zx').trigger("click");
  249. } else {
  250. $(".login_gl").trigger("click");
  251. }
  252. }
  253. });
  254. //坐席登录
  255. $('.login_zx').click(function(){
  256. var zx_user = $(".zx_user").val();
  257. var zx_fj = $(".zx_fj").val();
  258. var zx_psw = $(".zx_psw").val();
  259. if(zx_user == "" || zx_fj == "" || zx_psw == "") {
  260. $(".error_zx").addClass('errorShow');
  261. if($(".zx_user").val() == "") {
  262. $(".zx_user").focus(function() {
  263. $(".error_zx").removeClass('errorShow');
  264. });
  265. } else {
  266. $(".error_zx_user").removeClass('errorShow');
  267. }
  268. }else {
  269. var currenttime=CurentTime();
  270. var datatime=currenttime.split(' ')[1].split(':').join('')
  271. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  272. var zx_psw = CryptoJS.enc.Utf8.parse($.md5(zx_psw));
  273. var encrypted = CryptoJS.AES.encrypt(zx_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  274. /*请求后台*/
  275. $.cookie("extno",zx_fj);
  276. $.cookie("zx_user",zx_user);
  277. $.ajax({
  278. type: "post",
  279. url: huayi.config.callcenter_url + "/Login/login",
  280. dataType: 'json',
  281. async: true,
  282. data: {
  283. username: zx_user,
  284. extensionphone: zx_fj,
  285. LoginTime:currenttime,
  286. password:encrypted.toString()
  287. },
  288. success: function(data) {
  289. /*验证请求*/
  290. if(data.state == "success") {
  291. $.cookie("token", data.data.token, {
  292. expires: 7
  293. });
  294. $.cookie("extno", zx_fj, {
  295. expires: 7
  296. });
  297. $.cookie("zx_user", zx_user, {
  298. expires: 7
  299. });
  300. window.location.href = "home.html";
  301. }
  302. //else {
  303. // $(".zx_user").val('');
  304. // $(".zx_fj").val('');
  305. // $(".zx_psw").val('');
  306. //}
  307. }
  308. });
  309. }
  310. })
  311. function CurentTime(){
  312. var now = new Date();
  313. var year = now.getFullYear(); //年
  314. var month = now.getMonth() + 1; //月
  315. var day = now.getDate(); //日
  316. var hh = now.getHours(); //时
  317. var mm = now.getMinutes(); //分
  318. var ss = now.getSeconds(); //秒
  319. var clock = year + "-";
  320. if(month < 10)
  321. clock += "0";
  322. clock += month + "-";
  323. if(day < 10)
  324. clock += "0";
  325. clock += day + " ";
  326. if(hh < 10)
  327. clock += "0";
  328. clock += hh + ":";
  329. if (mm < 10) clock += '0';
  330. clock += mm + ":";
  331. if (ss < 10) clock += '0';
  332. clock += ss;
  333. return(clock);
  334. }
  335. //用户登录
  336. $('.login_gl').click(function() {
  337. var gl_user = $(".gl_user").val();
  338. var gl_psw = $(".gl_psw").val();
  339. if(gl_user == "" || gl_psw == "") {
  340. $(".error_gl").addClass('errorShow');
  341. if($(".gl_user").val() == "") {
  342. $(".gl_user").focus(function() {
  343. $(".error_gl").removeClass('errorShow');
  344. });
  345. } else {
  346. $(".error_gl_user").removeClass('errorShow');
  347. }
  348. } else {
  349. var currenttime=CurentTime();
  350. var datatime=currenttime.split(' ')[1].split(':').join('')
  351. var key = CryptoJS.enc.Utf8.parse(")O[9d]6,YF}+efcaj{+8>Z'e9M"+datatime);
  352. var gl_psw = CryptoJS.enc.Utf8.parse($.md5(gl_psw));
  353. var encrypted = CryptoJS.AES.encrypt(gl_psw, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  354. // var decrypt = CryptoJS.AES.decrypt(encrypted, key, {mode:CryptoJS.mode.ECB,padding: CryptoJS.pad.Pkcs7});
  355. // console.log(CryptoJS.enc.Utf8.stringify(decrypt).toString());
  356. // return false;
  357. /*请求后台*/
  358. $.ajax({
  359. type: "post",
  360. url: huayi.config.callcenter_url + "/Login/login",
  361. dataType: 'json',
  362. async: true,
  363. data: {
  364. username: gl_user,
  365. password: encrypted.toString(),
  366. LoginTime:currenttime
  367. },
  368. success: function(data) {
  369. /*验证请求*/
  370. if(data.state == "success") {
  371. $.cookie("token", data.data.token, {
  372. expires: 7
  373. });
  374. $.cookie("zx_user", gl_user, {
  375. expires: 7
  376. });
  377. window.location.href = "home.html";
  378. }
  379. //else{
  380. // $(".gl_user").val('');
  381. // $(".gl_psw").val('');
  382. //}
  383. }
  384. });
  385. }
  386. })
  387. })
  388. </script>
  389. </body>
  390. </html>