新余市12345政府服务热线_Web

login.html 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  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/style.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: 22%;
  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: 78%;
  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. position: absolute;
  76. bottom: 20px;
  77. left: 0px;
  78. text-align: center;
  79. width: 100%;
  80. padding: 0px;
  81. margin: 0px;
  82. }
  83. .oauth-area .oauth-btn {
  84. display: inline-block;
  85. width: 50px;
  86. height: 50px;
  87. background-size: 30px 30px;
  88. background-position: center center;
  89. background-repeat: no-repeat;
  90. margin: 0px 20px;
  91. /*-webkit-filter: grayscale(100%); */
  92. border: solid 1px #ddd;
  93. border-radius: 25px;
  94. }
  95. .oauth-area .oauth-btn:active {
  96. border: solid 1px #aaa;
  97. }
  98. .oauth-area .oauth-btn.disabled {
  99. background-color: #ddd;
  100. }
  101. #login-form {
  102. margin-top: 0;
  103. }
  104. .mui-logo-box {
  105. text-align: center;
  106. padding-top: 51px;
  107. }
  108. .mui-logo-box img {
  109. width: 180px;
  110. }
  111. .mui-input-row{
  112. margin-top: 15px;
  113. }
  114. .mui-input-group:after {
  115. position: absolute;
  116. right: 0;
  117. bottom: 0;
  118. left: 15px;
  119. height: 1px;
  120. content: '';
  121. -webkit-transform: scaleY(.5);
  122. transform: scaleY(.5);
  123. /*background-color: #c8c7cc;*/
  124. }
  125. input{
  126. font-size: 16px;
  127. }
  128. .mui-btn-primary{
  129. border: 1px solid #00a1cb;
  130. background-color: #00a1cb;
  131. }
  132. .mui-input-group {
  133. width: 90%;
  134. margin: 0 auto;
  135. margin-bottom: 20px;
  136. }
  137. .mui-input-row{
  138. margin-bottom: 10px;
  139. }
  140. </style>
  141. </head>
  142. <body>
  143. <div class="mui-content">
  144. <form id='login-form' class="mui-input-group">
  145. <!--logo-->
  146. <div class="mui-logo-box">
  147. <div>
  148. <img src="images/logo1.png" alt="" />
  149. </div>
  150. </div>
  151. <div class="mui-input-row">
  152. <label><img src="images/peson.png" alt="" style="width: 20px;"/></label>
  153. <input id='account' type="text" class="mui-input-clear mui-input" placeholder="请输入账号">
  154. </div>
  155. <div class="mui-input-row">
  156. <label><i class="mui-icon mui-icon-locked"></i></label>
  157. <input id='password' type="password" class=" mui-input mui-input-clear" placeholder="请输入密码">
  158. </div>
  159. </form>
  160. <div class="mui-content-padded">
  161. <button id='login' class="mui-btn mui-btn-block mui-btn-primary">登录</button>
  162. <!--<div class="link-area">
  163. <!--<a id='reg'>注册账号</a> <span class="spliter">|</span>
  164. <a id='forgetPassword'>忘记密码</a>-->
  165. <!--<span class="spliter "></span> 还没有账号,
  166. <a id='reg' style="color: #00a1cb;">注册账号</a>
  167. <span class="spliter"></span>
  168. </div>-->
  169. </div>
  170. <div class="mui-content-padded oauth-area">
  171. </div>
  172. </div>
  173. <script src="js/mui.min.js"></script>
  174. <script src="js/mui.enterfocus.js"></script>
  175. <script src="js/app.js"></script>
  176. <script src="js/jquery.min.js"></script>
  177. <script src="js/jquery.md5.js"></script>
  178. <script>
  179. // (function($, doc) {
  180. // $.init({
  181. // statusBarBackground: '#f7f7f7'
  182. // });
  183. // $.plusReady(function() {
  184. // plus.screen.lockOrientation("portrait-primary");
  185. // var settings = app.getSettings();
  186. // var state = app.getState();
  187. // var mainPage = $.preload({
  188. // "id": 'main',
  189. // "url": 'main.html'
  190. // });
  191. // var main_loaded_flag = false;
  192. // mainPage.addEventListener("loaded",function () {
  193. // main_loaded_flag = true;
  194. // });
  195. // var toMain = function() {
  196. // //使用定时器的原因:
  197. // //可能执行太快,main页面loaded事件尚未触发就执行自定义事件,此时必然会失败
  198. // var id = setInterval(function () {
  199. // if(main_loaded_flag){
  200. // clearInterval(id);
  201. // $.fire(mainPage, 'show', null);
  202. // mainPage.show("pop-in");
  203. // }
  204. // },20);
  205. // };
  206. // //检查 "登录状态/锁屏状态" 开始
  207. // if (settings.autoLogin && state.token && settings.gestures) {
  208. // $.openWindow({
  209. // url: 'unlock.html',
  210. // id: 'unlock',
  211. // show: {
  212. // aniShow: 'pop-in'
  213. // },
  214. // waiting: {
  215. // autoShow: false
  216. // }
  217. // });
  218. // } else if (settings.autoLogin && state.token) {
  219. // toMain();
  220. // } else {
  221. // app.setState(null);
  222. // //第三方登录
  223. // var authBtns = ['qihoo', 'weixin', 'sinaweibo', 'qq']; //配置业务支持的第三方登录
  224. // var auths = {};
  225. // var oauthArea = doc.querySelector('.oauth-area');
  226. // plus.oauth.getServices(function(services) {
  227. // for (var i in services) {
  228. // var service = services[i];
  229. // auths[service.id] = service;
  230. // if (~authBtns.indexOf(service.id)) {
  231. // var isInstalled = app.isInstalled(service.id);
  232. // var btn = document.createElement('div');
  233. // //如果微信未安装,则为不启用状态
  234. // btn.setAttribute('class', 'oauth-btn' + (!isInstalled && service.id === 'weixin' ? (' disabled') : ''));
  235. // btn.authId = service.id;
  236. // btn.style.backgroundImage = 'url("images/' + service.id + '.png")'
  237. // oauthArea.appendChild(btn);
  238. // }
  239. // }
  240. // $(oauthArea).on('tap', '.oauth-btn', function() {
  241. // if (this.classList.contains('disabled')) {
  242. // plus.nativeUI.toast('您尚未安装微信客户端');
  243. // return;
  244. // }
  245. // var auth = auths[this.authId];
  246. // var waiting = plus.nativeUI.showWaiting();
  247. // auth.login(function() {
  248. // waiting.close();
  249. // plus.nativeUI.toast("登录认证成功");
  250. // auth.getUserInfo(function() {
  251. // plus.nativeUI.toast("获取用户信息成功");
  252. // var name = auth.userInfo.nickname || auth.userInfo.name;
  253. // app.createState(name, function() {
  254. // toMain();
  255. // });
  256. // }, function(e) {
  257. // plus.nativeUI.toast("获取用户信息失败:" + e.message);
  258. // });
  259. // }, function(e) {
  260. // waiting.close();
  261. // plus.nativeUI.toast("登录认证失败:" + e.message);
  262. // });
  263. // });
  264. // }, function(e) {
  265. // oauthArea.style.display = 'none';
  266. // plus.nativeUI.toast("获取登录认证失败:" + e.message);
  267. // });
  268. // }
  269. // // close splash
  270. // setTimeout(function() {
  271. // //关闭 splash
  272. // plus.navigator.closeSplashscreen();
  273. // }, 600);
  274. // //检查 "登录状态/锁屏状态" 结束
  275. // var loginButton = doc.getElementById('login');
  276. // var accountBox = doc.getElementById('account');
  277. // var passwordBox = doc.getElementById('password');
  278. // var autoLoginButton = doc.getElementById("autoLogin");
  279. // var regButton = doc.getElementById('reg');
  280. // var forgetButton = doc.getElementById('forgetPassword');
  281. // loginButton.addEventListener('tap', function(event) {
  282. // var loginInfo = {
  283. // account: accountBox.value,
  284. // password: passwordBox.value
  285. // };
  286. // app.login(loginInfo, function(err) {
  287. // if (err) {
  288. // plus.nativeUI.toast(err);
  289. // return;
  290. // }
  291. // toMain();
  292. // });
  293. // });
  294. // $.enterfocus('#login-form input', function() {
  295. // $.trigger(loginButton, 'tap');
  296. // });
  297. // autoLoginButton.classList[settings.autoLogin ? 'add' : 'remove']('mui-active')
  298. // autoLoginButton.addEventListener('toggle', function(event) {
  299. // setTimeout(function() {
  300. // var isActive = event.detail.isActive;
  301. // settings.autoLogin = isActive;
  302. // app.setSettings(settings);
  303. // }, 50);
  304. // }, false);
  305. // regButton.addEventListener('tap', function(event) {
  306. // $.openWindow({
  307. // url: 'reg.html',
  308. // id: 'reg',
  309. // preload: true,
  310. // show: {
  311. // aniShow: 'pop-in'
  312. // },
  313. // styles: {
  314. // popGesture: 'hide'
  315. // },
  316. // waiting: {
  317. // autoShow: false
  318. // }
  319. // });
  320. // }, false);
  321. // forgetButton.addEventListener('tap', function(event) {
  322. // $.openWindow({
  323. // url: 'forget_password.html',
  324. // id: 'forget_password',
  325. // preload: true,
  326. // show: {
  327. // aniShow: 'pop-in'
  328. // },
  329. // styles: {
  330. // popGesture: 'hide'
  331. // },
  332. // waiting: {
  333. // autoShow: false
  334. // }
  335. // });
  336. // }, false);
  337. // //
  338. // window.addEventListener('resize', function() {
  339. // oauthArea.style.display = document.body.clientHeight > 400 ? 'block' : 'none';
  340. // }, false);
  341. // //
  342. // var backButtonPress = 0;
  343. // $.back = function(event) {
  344. // backButtonPress++;
  345. // if (backButtonPress > 1) {
  346. // plus.runtime.quit();
  347. // } else {
  348. // plus.nativeUI.toast('再按一次退出应用');
  349. // }
  350. // setTimeout(function() {
  351. // backButtonPress = 0;
  352. // }, 1000);
  353. // return false;
  354. // };
  355. // });
  356. // }(mui, document));
  357. mui.init();
  358. mui.plusReady(
  359. function() {
  360. document.getElementById("login").addEventListener('tap', function() {
  361. // 内容就是 return document.getElementById();
  362. var username = document.getElementById('account').value;
  363. var password = document.getElementById('password').value;
  364. var data = {
  365. "username": username,
  366. "password": $.md5(password),
  367. " extensionphone": 1
  368. };
  369. if(!username) {
  370. plus.nativeUI.toast('输入账号');
  371. }else if(!password){
  372. plus.nativeUI.toast('密码不能为空');
  373. }else {
  374. // 调用ajax
  375. mui.ajax('http://117.158.196.116:4010/Login/login', {
  376. data: data,
  377. dataType: 'json', //服务器返回json格式数据
  378. type: 'post', //HTTP请求类型
  379. timeout: 10000, //超时时间设置为10秒;
  380. headers: {
  381. 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8'
  382. },
  383. success: function(data) {
  384. mui.openWindow({
  385. "id": 'indexs',
  386. "url": 'indexs.html',
  387. show: {
  388. aniShow: 'pop-in'
  389. },
  390. styles: {
  391. popGesture: 'hide'
  392. },
  393. waiting: {
  394. autoShow: false
  395. },
  396. extras: {
  397. name: data.data.token,
  398. //name:"5646",
  399. }
  400. });
  401. document.getElementById('account').value="";
  402. document.getElementById('password').value="";
  403. // var mainPage=mui.preload({
  404. // "id": 'main',
  405. // "url": 'main.html'
  406. // });
  407. // var main_loaded_flag = false;
  408. // mainPage.addEventListener("loaded", function() {
  409. // main_loaded_flag = true;
  410. // });
  411. // var toMain = function() {
  412. // //使用定时器的原因:
  413. // //可能执行太快,main页面loaded事件尚未触发就执行自定义事件,此时必然会失败
  414. // var id = setInterval(function() {
  415. // if(main_loaded_flag) {
  416. // clearInterval(id);
  417. // $.fire(mainPage, 'show', null);
  418. // mainPage.show("pop-in");
  419. // }
  420. // }, 20);
  421. // };
  422. },
  423. error: function(xhr, type, errorThrown) {
  424. //异常处理;
  425. }
  426. });
  427. }
  428. });
  429. }
  430. );
  431. // function postData(url, data, callback, waitingDialog) {
  432. // mui.ajax(url, {
  433. // data: 'data=' + JSON.stringify(data),
  434. // dataType: 'json',
  435. // type: 'post',
  436. // contentType: "application/x-www-form-urlencoded; charset=utf-8",
  437. // timeout: 60000,
  438. // success: callback,
  439. // error: function(xhr, type, errorThrown) {
  440. // waitingDialog.close();
  441. // mui.alert("<网络连接失败,请重新尝试一下>", "错误", "OK", null);
  442. // }
  443. // });
  444. // }
  445. </script>
  446. </body>
  447. </html>