虞城12345_前端

login.html 7.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <!DOCTYPE html>
  2. <html class="ui-page-login">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
  6. <title></title>
  7. <link href="css/mui.min.css" rel="stylesheet" />
  8. <link href="css/iconfont.css" rel="stylesheet" />
  9. <style>
  10. body {
  11. background-color: #fff!important;
  12. }
  13. #login-form {
  14. background-color: #fff!important;
  15. }
  16. .mui-content {
  17. background: #FFF;
  18. }
  19. .area {
  20. margin: 20px auto 0px auto;
  21. }
  22. .mui-input-group {
  23. margin-top: 10px;
  24. }
  25. .mui-input-group:first-child {
  26. margin-top: 20px;
  27. }
  28. .mui-input-group label {
  29. width: 2%;
  30. text-align: right;
  31. }
  32. .mui-input-row label~input,
  33. .mui-input-row label~select,
  34. .mui-input-row label~textarea {
  35. width: 88%;
  36. }
  37. .mui-checkbox input[type=checkbox],
  38. .mui-radio input[type=radio] {
  39. top: 6px;
  40. }
  41. .mui-content-padded {
  42. margin-top: 40px;
  43. }
  44. .mui-btn {
  45. padding: 10px;
  46. }
  47. .link-area {
  48. display: block;
  49. margin-top: 130px;
  50. text-align: center;
  51. font-size: 15px;
  52. }
  53. .spliter {
  54. width: 25%;
  55. display: inline-block;
  56. color: #bbb;
  57. padding: 0px 8px;
  58. /* line-height: 20px; */
  59. vertical-align: middle;
  60. position: relative;
  61. left: -10px;
  62. }
  63. .spliter:after {
  64. position: absolute;
  65. right: 0;
  66. bottom: 0;
  67. left: 15px;
  68. height: 1px;
  69. content: '';
  70. -webkit-transform: scaleY(.5);
  71. transform: scaleY(.5);
  72. background-color: #c8c7cc;
  73. }
  74. .oauth-area {
  75. text-align: center;
  76. width: 100%;
  77. padding: 0px;
  78. margin: 0px;
  79. }
  80. .oauth-area .oauth-btn {
  81. display: inline-block;
  82. width: 50px;
  83. height: 50px;
  84. background-size: 30px 30px;
  85. background-position: center center;
  86. background-repeat: no-repeat;
  87. margin: 0px 20px;
  88. /*-webkit-filter: grayscale(100%); */
  89. border: solid 1px #ddd;
  90. border-radius: 25px;
  91. }
  92. .oauth-area .reg_href{
  93. text-align: center;
  94. display: block;
  95. width: 100%;
  96. float: left;
  97. color: #005e98;
  98. }
  99. .oauth-area .oauth-btn:active {
  100. border: solid 1px #aaa;
  101. }
  102. .oauth-area .oauth-btn.disabled {
  103. background-color: #ddd;
  104. }
  105. #login-form {
  106. margin-top: 0px;
  107. }
  108. .mui-logo-box {
  109. text-align: center;
  110. padding-top: 100px;
  111. margin-bottom: 130px;
  112. }
  113. .mui-logo-box img {
  114. width: 80%;
  115. }
  116. .mui-input-row {
  117. margin-top: 15px;
  118. }
  119. .mui-input-group:after {
  120. position: absolute;
  121. right: 0;
  122. bottom: 0;
  123. left: 15px;
  124. height: 1px;
  125. content: '';
  126. -webkit-transform: scaleY(.5);
  127. transform: scaleY(.5);
  128. /*background-color: #c8c7cc;*/
  129. }
  130. input {
  131. font-size: 14px;
  132. }
  133. .mui-btn-primary {
  134. border: 1px solid #005e98;
  135. background-color: #005e98;
  136. }
  137. .mui-input-group {
  138. width: 100%;
  139. margin: 0 auto;
  140. margin-bottom: 20px;
  141. }
  142. .mui-input-row {
  143. margin-bottom: 10px;
  144. }
  145. .mui-content-padded {
  146. width: 100%;
  147. width: 90%;
  148. margin: 0 auto;
  149. margin-top: 30px;
  150. }
  151. #login {
  152. border-radius: 20px;
  153. }
  154. .mui-input-group .mui-input-row:after {
  155. left: -5px;
  156. }
  157. .mui-input-row span {
  158. color: #787878;
  159. }
  160. .mui-input-group .mui-input-row {
  161. height: 40px;
  162. /* margin-bottom: 20px; */
  163. width: 90%;
  164. margin: 0 auto;
  165. border: 1px solid #ccc;
  166. border-radius: 20px;
  167. margin-bottom: 20px;
  168. }
  169. .mui-input-group:after {
  170. background-color: #fff;
  171. }
  172. .mui-input-group .mui-input-row:after {
  173. background-color: #fff;
  174. }
  175. </style>
  176. </head>
  177. <body>
  178. <div class="mui-content">
  179. <form id='login-form' class="mui-input-group">
  180. <!--logo-->
  181. <div class="mui-logo-box">
  182. <div>
  183. <img src="img/123.png" alt="" />
  184. </div>
  185. </div>
  186. <div class="mui-input-row">
  187. <label><span class="mui-icon iconfont icon-yonghu"></span></label>
  188. <input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入账号">
  189. </div>
  190. <div class="mui-input-row mui-password">
  191. <label><span class="mui-icon iconfont icon-suo"></span></label>
  192. <input id='password' type="password" class=" mui-input-password mui-input" placeholder="请输入密码">
  193. </div>
  194. </form>
  195. <div class="mui-content-padded">
  196. <button id='login' class="mui-btn mui-btn-block mui-btn-primary" style="font-size: 16px;">登录</button>
  197. </div>
  198. <div class="mui-content-padded oauth-area" style="width: 100%; margin-top: 70px;">
  199. <a href="User-login.html" class="reg_href" style="font-size: 14px;">我是市民</a>
  200. </div>
  201. </div>
  202. <script src="js/mui.min.js"></script>
  203. <script src="js/jquery.min.js"></script>
  204. <script src="js/jquery.md5.js"></script>
  205. <script src="js/huayi.http.js"></script>
  206. <script src="js/huayi.config.js"></script>
  207. <script>
  208. mui.init();
  209. mui.plusReady(function() {
  210. var usercode = localStorage.getItem("user"); //获取本地存储
  211. var psw = localStorage.getItem("psw"); //获取本地存储
  212. // alert(usercode);
  213. // alert(psw);
  214. if(usercode != null) //如果缓存中有数据,则加载出来
  215. {
  216. document.getElementById("account").value = usercode;
  217. document.getElementById("password").value = localStorage.getItem("psw");
  218. }
  219. document.getElementById("login").addEventListener('tap', function() {
  220. // localStorage.clear();
  221. var username = document.getElementById('account').value;
  222. var password = document.getElementById('password').value;
  223. var data = {
  224. "username": username,
  225. "password": $.md5(password),
  226. " extensionphone": 1
  227. };
  228. if(!username) {
  229. plus.nativeUI.toast('输入账号');
  230. } else if(!password) {
  231. plus.nativeUI.toast('密码不能为空');
  232. } else {
  233. if(plus.networkinfo.getCurrentType() == plus.networkinfo.CONNECTION_NONE) {
  234. mui.toast("网络连接中断!");
  235. }
  236. // 调用ajax
  237. mui.ajax(huayi.config.callcenter_url + '/Login/applogin', {
  238. data: data,
  239. dataType: 'json', //服务器返回json格式数据
  240. type: 'post', //HTTP请求类型
  241. timeout: 10000, //超时时间设置为10秒
  242. success: function(data) {
  243. if(data.state == "success") {
  244. localStorage.setItem("token", data.data.token);
  245. localStorage.setItem("user", username);
  246. localStorage.setItem("psw", password);
  247. var nwaiting = plus.nativeUI.showWaiting();
  248. webviewShow = plus.webview.create("Leader-index.html"); //后台创建webview并打开show.html
  249. //webviewShow.addEventListener("loaded", function() { //注册新webview的载入完成事件
  250. //nwaiting.close(); //新webview的载入完毕后关闭等待框
  251. //webviewShow.show("slide-in-right", 300); //把新webview窗体显示出来,显示动画效果为速度300毫秒的右侧移入动画
  252. //}, false);
  253. document.getElementById('account').value = "";
  254. document.getElementById('password').value = "";
  255. } else {
  256. mui.alert(data.message);
  257. document.getElementById('account').value = "";
  258. document.getElementById('password').value = "";
  259. }
  260. },
  261. error: function(xhr, type, errorThrown) {}
  262. });
  263. }
  264. });
  265. });
  266. //
  267. </script>
  268. </body>
  269. </html>