login.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <!DOCTYPE html>
  2. <html lang="zh-cn">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="format-detection" content="email=no" />
  6. <meta name="format-detection" content="telephone=no" />
  7. <title>登录</title>
  8. <link rel="stylesheet" href="../css/reset.css">
  9. <link rel="stylesheet" href="../css/style.css">
  10. <script src="../script/flexible.js"></script>
  11. <style>
  12. html,body{
  13. height: 100%;
  14. overflow: hidden;
  15. background-color: #f3f3f3;
  16. }
  17. .flex-wrap{
  18. display: -webkit-box;
  19. display: -webkit-flex;
  20. display: flex;
  21. }
  22. .flex-con{
  23. -webkit-box-flex: 1;
  24. -webkit-flex: 1;
  25. flex: 1;
  26. }
  27. body{
  28. display: -webkit-box;
  29. display: -webkit-flex;
  30. display: flex;
  31. -webkit-box-orient: vertical;
  32. -webkit-flex-flow: column;
  33. flex-flow: column;
  34. }
  35. header{
  36. min-height: 1.4rem;
  37. line-height: 1.4rem;
  38. background-color: #096a6c;
  39. }
  40. header h2{
  41. width: 100%;
  42. height: 100%;
  43. font-size: .5rem;
  44. color: #fff;
  45. font-weight: normal;
  46. text-align: center;
  47. position: relative;
  48. }
  49. main{
  50. height: calc(100% - 1.3rem);
  51. /*background: url("../image/BG.jpg") no-repeat 100%/100%;*/
  52. }
  53. .newBack{
  54. width: 100%;
  55. height: 1.2rem;
  56. }
  57. .logoHead{
  58. background-color: #55b539;
  59. }
  60. .banner{
  61. width: 2.4rem;
  62. height: 2.4rem;
  63. margin: .8rem auto .1rem;
  64. }
  65. .banner img{
  66. display: block;
  67. width: 100%;
  68. height: 100%;
  69. }
  70. .appName{
  71. margin-top: .18rem;
  72. font-size: .52rem;
  73. text-align: center;
  74. color: #096a6c;
  75. }
  76. .tab span{
  77. display: inline-block;
  78. height: 1.4rem;
  79. line-height: 1.3rem;
  80. text-align: center;
  81. color: #fff;
  82. font-size: .42rem;
  83. position: relative;
  84. }
  85. .tab span.active:after{
  86. display: block;
  87. content: "";
  88. width: 0;
  89. height: 0;
  90. border-width: .16rem;
  91. border-style: solid;
  92. border-color: transparent transparent white transparent;
  93. position: absolute;
  94. left: calc(50% - .11rem);
  95. bottom: 0;
  96. }
  97. .inputDiv{
  98. background-color: #fff;
  99. }
  100. .inputDiv label{
  101. display: block;
  102. height: 1.3rem;
  103. line-height: 1.4rem;
  104. padding-left: .42rem;
  105. }
  106. .inputDiv label:last-of-type{
  107. border-bottom: 1px solid #f0f0f0;
  108. }
  109. .inputDiv label:last-of-type input{
  110. padding-left: .9rem;
  111. }
  112. label>input{
  113. width: 100%;
  114. height: 100%;
  115. color: #818181;
  116. background-color: rgba(0,0,0,0);
  117. border: none;
  118. outline: none;
  119. font-size: .38rem;
  120. padding-left: .8rem;
  121. }
  122. label:first-of-type>input{
  123. border-bottom: 1px solid #f0f0f0;
  124. }
  125. .userName{
  126. background: url("../image/login1.png") no-repeat 5%/5%;
  127. }
  128. .password{
  129. background: url("../image/login2.png") no-repeat 5%/4.5%;
  130. }
  131. .loginBtn{
  132. width: 90%;
  133. height: 1.2rem;
  134. line-height: 1.2rem;
  135. text-align: center;
  136. font-size: .48rem;
  137. color: #55b539;
  138. background-color: #fff;
  139. border: 1px solid #55b539;
  140. border-radius: .66rem;
  141. margin: .41rem auto .5rem;
  142. }
  143. .other{
  144. font-size: .35rem;
  145. color:#b3b3b3;
  146. text-align: center;
  147. }
  148. ::-webkit-input-placeholder{
  149. color: #d0d0d0;
  150. }
  151. </style>
  152. </head>
  153. <body>
  154. <!--<header>
  155. <h2>登录</h2>
  156. </header>-->
  157. <main class="flex-con">
  158. <div class="logoHead">
  159. <div class="newBack"></div>
  160. <div class="banner"><img src="../image/new_logo.png" alt=""></div>
  161. <div class="tab flex-wrap"><span class="znms flex-con active">智能检修</span></div>
  162. </div>
  163. <div class="inputDiv">
  164. <form action="#">
  165. <label class="userName"><input type="text" id="username" placeholder="请输入手机号码" value="123456"></label>
  166. <label class="password"><input type="password" id="password" placeholder="请输入密码" value="123123"></label>
  167. </form>
  168. </div>
  169. <div class="loginBtn">登&nbsp;&nbsp;录</div>
  170. <div class="other clearFix">
  171. <!--<span class="left register">立即注册</span>-->
  172. <span class="findPW">忘记密码?</span>
  173. </div>
  174. </main>
  175. <script src="../script/cryptoJs.js"></script>
  176. <script src="../script/publicData.js"></script>
  177. <script src="../script/jqueryMin.js"></script>
  178. <script src="../script/api.js"></script>
  179. <script>
  180. apiready=function () {
  181. api.ajax({
  182. url: pageUrl+"/index/login/admin-phone",
  183. method: 'get',
  184. timeout: 30,
  185. dataType: 'text',
  186. returnAll: false,
  187. data: {
  188. values: {}
  189. }
  190. }, function (data, err) {
  191. var data=JSON.parse(data);
  192. $api.setStorage("admin",data)
  193. });
  194. $(".tab span").click(function () {
  195. $(this).addClass("active").siblings().removeClass("active")
  196. })
  197. $api.setStorage("imgOpen",null);
  198. $(".loginBtn").on('click',function () {
  199. if(!$("#username").val()){
  200. api.toast({
  201. msg: '账号不能为空1',
  202. duration: 1000,
  203. location: 'bottom'
  204. });
  205. return;
  206. }
  207. if(!$("#password").val()){
  208. api.toast({
  209. msg: '密码不能为空',
  210. duration: 1000,
  211. location: 'bottom'
  212. });
  213. return;
  214. }
  215. api.toast({
  216. msg: '正在登录中...',
  217. duration: 1000,
  218. location: 'bottom'
  219. });
  220. var data={
  221. phone:$("#username").val(),
  222. pwd:$("#password").val()
  223. }
  224. function Encrypt() {
  225. var para = JSON.stringify(data);
  226. var pwd="a20f9c17c542ec22b4b968b47985c294";
  227. var iv = CryptoJS.enc.Utf8.parse('1234567812345678');
  228. var mipassword = CryptoJS.AES.encrypt(para, pwd, { iv: iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding});
  229. return {
  230. phone:$("#username").val(),
  231. pwd:mipassword.toString(),
  232. jiamicode:para,
  233. _token:"gLhRQY00Zgpv3eNV987uFQ0G2ymQLt5DUYBAT3To"
  234. }
  235. }
  236. api.ajax({
  237. url: pageUrl+"/index/login/index",
  238. method: 'post',
  239. timeout: 30,
  240. dataType: 'text',
  241. returnAll: false,
  242. data: {
  243. values: Encrypt()
  244. }
  245. }, function (data, err) {
  246. data=JSON.parse(data)
  247. console.log(JSON.stringify(data))
  248. if(data.status){
  249. $(".loginBtn").off('click').text("登录成功...");
  250. $api.setStorage("user",data.user);
  251. $api.rmStorage("luIndex");
  252. $api.rmStorage("luIndex2");
  253. var jsfun3 = 'toFrame(0)';
  254. api.execScript({
  255. name:"root",
  256. script: jsfun3
  257. });
  258. var jsfun = 'setData();';
  259. api.execScript({
  260. name: 'root',
  261. frameName: 'home',
  262. script: jsfun
  263. });
  264. setTimeout(function () {
  265. api.closeToWin({
  266. name: 'root',
  267. animation: {
  268. type: 'reveal',
  269. subType: 'from_left',
  270. duration: 400
  271. },
  272. delay:200
  273. });
  274. },2500)
  275. }else {
  276. api.toast({
  277. msg: data.msg,
  278. duration: 2000,
  279. location: 'bottom'
  280. });
  281. }
  282. api.execScript({
  283. name: 'root',
  284. script: 'totalTime(0);'
  285. });
  286. });
  287. })
  288. $(".findPW").click(function () {
  289. api.openWin({
  290. name: 'findPW',
  291. url: './findPW.html',
  292. animation: {
  293. type: 'movein',
  294. subType: 'from_bottom',
  295. duration: 400
  296. },
  297. delay:200
  298. });
  299. })
  300. var backSecond = 0;
  301. api.addEventListener({
  302. name: 'keyback'
  303. }, function(ret, err) {
  304. var curSecond = new Date().getSeconds();
  305. if (Math.abs(curSecond - backSecond) > 2) {
  306. backSecond = curSecond;
  307. api.toast({
  308. msg: '双击退出应用',
  309. duration: 2000,
  310. location: 'bottom'
  311. });
  312. } else {
  313. api.removePrefs({
  314. key: 'mesOpen'
  315. });
  316. api.removePrefs({
  317. key: 'taskOpen'
  318. });
  319. api.closeWidget({
  320. id: 'A6934101949817', //这里改成自己的应用ID
  321. retData: {
  322. name: 'closeWidget'
  323. },
  324. silent: true
  325. });
  326. }
  327. });
  328. }
  329. </script>
  330. </body>
  331. </html>