login.html 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. {include file="common/meta" /}
  5. <style type="text/css">
  6. * {
  7. box-sizing: border-box;
  8. }
  9. html, body {
  10. width: 100%;
  11. height: 100%;
  12. margin: 0;
  13. padding: 0;
  14. overflow: hidden;
  15. }
  16. body.login-page {
  17. height: 100vh;
  18. min-height: 100vh;
  19. max-height: 100vh;
  20. overflow: hidden;
  21. background: #eef2f8;
  22. color: #1f2937;
  23. font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  24. display: flex;
  25. }
  26. /* ========== 左侧(背景图 / 插画图后续替换下方 url) ========== */
  27. .login-brand {
  28. position: relative;
  29. z-index: 1;
  30. flex: 1 1 68%;
  31. min-width: 0;
  32. display: flex;
  33. flex-direction: column;
  34. align-items: center;
  35. justify-content: space-between;
  36. color: #fff;
  37. /* 背景图 bj.png */
  38. background-color: #1a3a6e;
  39. background-image: url('https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/bj.png?v={$site.version|default='1.0.1'|htmlentities}');
  40. background-repeat: no-repeat;
  41. background-position: center center;
  42. background-size: cover;
  43. padding: clamp(28px, 4vh, 48px) clamp(28px, 4vw, 56px) clamp(20px, 3vh, 36px);
  44. }
  45. .login-brand::before {
  46. content: "";
  47. position: absolute;
  48. inset: 0;
  49. background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.03) 48%, rgba(15, 35, 70, 0.08) 100%);
  50. pointer-events: none;
  51. }
  52. /* 中间内容:图标标题在上,插画在下(参考图二) */
  53. .login-brand-stage {
  54. position: relative;
  55. z-index: 2;
  56. flex: 1 1 auto;
  57. min-height: 0;
  58. width: 100%;
  59. max-width: 720px;
  60. display: flex;
  61. flex-direction: column;
  62. align-items: center;
  63. justify-content: center;
  64. gap: 14px;
  65. margin: 8px 0;
  66. }
  67. .login-brand-header {
  68. position: relative;
  69. z-index: 2;
  70. display: flex;
  71. flex-direction: row;
  72. align-items: center;
  73. justify-content: center;
  74. text-align: left;
  75. gap: 16px;
  76. }
  77. .login-brand-logo {
  78. flex: 0 0 auto;
  79. width: 64px;
  80. height: 64px;
  81. border-radius: 14px;
  82. background: transparent;
  83. box-shadow: none;
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. overflow: hidden;
  88. }
  89. .login-brand-logo img {
  90. width: 100%;
  91. height: 100%;
  92. object-fit: contain;
  93. }
  94. .login-brand-text {
  95. min-width: 0;
  96. text-align: left;
  97. }
  98. .login-brand-title {
  99. margin: 0 0 6px;
  100. font-size: clamp(24px, 2.6vw, 34px);
  101. font-weight: 700;
  102. letter-spacing: 3px;
  103. line-height: 1.25;
  104. }
  105. .login-brand-sub {
  106. margin: 0;
  107. font-size: 12px;
  108. letter-spacing: 3px;
  109. color: rgba(210, 228, 255, 0.72);
  110. text-transform: uppercase;
  111. }
  112. /* 插画区域 ch.png:缩小并放在标题下方 */
  113. .login-brand-illust {
  114. position: relative;
  115. z-index: 1;
  116. flex: 0 1 auto;
  117. width: 100%;
  118. display: flex;
  119. align-items: center;
  120. justify-content: center;
  121. }
  122. .login-brand-illust img {
  123. display: block;
  124. max-width: min(360px, 46%);
  125. max-height: min(26vh, 240px);
  126. width: auto;
  127. height: auto;
  128. object-fit: contain;
  129. pointer-events: none;
  130. user-select: none;
  131. opacity: 0.96;
  132. }
  133. .login-brand-features {
  134. position: relative;
  135. z-index: 2;
  136. display: flex;
  137. align-items: center;
  138. justify-content: center;
  139. gap: 0;
  140. margin: 6px 0 0;
  141. padding: 0;
  142. list-style: none;
  143. flex-shrink: 0;
  144. }
  145. .login-brand-features li {
  146. display: flex;
  147. flex-direction: row;
  148. align-items: center;
  149. gap: 10px;
  150. min-width: 0;
  151. padding: 0 22px;
  152. font-size: 13px;
  153. color: rgba(235, 244, 255, 0.92);
  154. position: relative;
  155. white-space: nowrap;
  156. }
  157. .login-brand-features li + li::before {
  158. content: "";
  159. position: absolute;
  160. left: 0;
  161. top: 50%;
  162. transform: translateY(-50%);
  163. width: 1px;
  164. height: 22px;
  165. background: rgba(180, 210, 255, 0.28);
  166. }
  167. .login-brand-features .feat-icon {
  168. width: 30px;
  169. height: 30px;
  170. border-radius: 50%;
  171. background: rgba(255, 255, 255, 0.1);
  172. border: 1px solid rgba(210, 228, 255, 0.35);
  173. display: inline-flex;
  174. align-items: center;
  175. justify-content: center;
  176. color: #eef4ff;
  177. font-size: 13px;
  178. flex-shrink: 0;
  179. }
  180. .login-brand-footer {
  181. position: relative;
  182. z-index: 2;
  183. text-align: center;
  184. font-size: 12px;
  185. color: rgba(235, 244, 255, 0.72);
  186. }
  187. .login-brand-footer a {
  188. color: rgba(220, 235, 255, 0.58);
  189. }
  190. .login-brand-footer a:hover {
  191. color: #fff;
  192. }
  193. /* ========== 右侧登录(按设计稿红框区域) ========== */
  194. body.login-page .login-side {
  195. position: relative;
  196. z-index: 2;
  197. flex: 0 0 40% !important;
  198. width: 40% !important;
  199. min-width: 380px !important;
  200. max-width: 500px !important;
  201. height: 100vh !important;
  202. background: linear-gradient(180deg, #f8fbff 0%, #f1f5fb 100%) !important;
  203. display: flex !important;
  204. flex-direction: column !important;
  205. justify-content: stretch !important;
  206. align-items: stretch !important;
  207. padding: 0 48px !important;
  208. margin: 0 !important;
  209. box-shadow: -4px 0 24px rgba(15, 23, 42, 0.06);
  210. border-left: 1px solid #e2e8f0;
  211. }
  212. body.login-page .login-side-main {
  213. width: 100%;
  214. max-width: 340px;
  215. margin: 0 auto;
  216. flex: 1 1 auto;
  217. display: flex;
  218. flex-direction: column;
  219. justify-content: center;
  220. padding: 64px 0 28px;
  221. }
  222. body.login-page .login-side-head {
  223. margin-bottom: 36px;
  224. margin-top: 12px;
  225. text-align: center;
  226. }
  227. body.login-page .login-side-head h1 {
  228. margin: 0 0 10px;
  229. font-size: 32px !important;
  230. font-weight: 700 !important;
  231. color: #111827 !important;
  232. letter-spacing: 0.5px;
  233. line-height: 1.25;
  234. text-align: center;
  235. }
  236. body.login-page .login-side-head p {
  237. margin: 0;
  238. font-size: 13px !important;
  239. color: #9ca3af !important;
  240. line-height: 1.6;
  241. text-align: center;
  242. }
  243. body.login-page #login-form {
  244. width: 100%;
  245. margin: 0;
  246. padding: 0;
  247. background: transparent !important;
  248. box-shadow: none !important;
  249. border: none !important;
  250. }
  251. body.login-page #login-form .login-field {
  252. margin-bottom: 18px;
  253. }
  254. body.login-page #login-form .login-field-label {
  255. display: block;
  256. margin: 0 0 8px;
  257. font-size: 14px;
  258. font-weight: 500;
  259. color: #111827;
  260. line-height: 1.2;
  261. text-align: left;
  262. }
  263. body.login-page #login-form .login-input {
  264. position: relative;
  265. }
  266. body.login-page #login-form .login-input-icon {
  267. position: absolute;
  268. left: 12px;
  269. top: 50%;
  270. transform: translateY(-50%);
  271. width: 16px;
  272. height: 16px;
  273. pointer-events: none;
  274. z-index: 2;
  275. display: flex;
  276. align-items: center;
  277. justify-content: center;
  278. }
  279. body.login-page #login-form .login-input-icon img {
  280. display: block;
  281. width: 16px;
  282. height: 16px;
  283. object-fit: contain;
  284. }
  285. body.login-page #login-form .form-control {
  286. height: 40px !important;
  287. border: 1px solid #e5e7eb !important;
  288. border-radius: 8px !important;
  289. box-shadow: none !important;
  290. font-size: 13px !important;
  291. color: #111827 !important;
  292. background: #ffffff !important;
  293. padding: 8px 14px 8px 36px !important;
  294. transition: border-color .2s ease, box-shadow .2s ease;
  295. }
  296. body.login-page #login-form .login-password-wrap .form-control {
  297. padding-right: 40px !important;
  298. }
  299. body.login-page #login-form .form-control:hover {
  300. border-color: #d1d5db !important;
  301. }
  302. body.login-page #login-form .form-control:focus {
  303. border-color: #818cf8 !important;
  304. box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12) !important;
  305. background: #ffffff !important;
  306. outline: none !important;
  307. }
  308. body.login-page #login-form .form-control::placeholder {
  309. color: #c0c6d0 !important;
  310. }
  311. body.login-page #login-form .btn-toggle-password {
  312. position: absolute;
  313. right: 10px;
  314. top: 50%;
  315. transform: translateY(-50%);
  316. border: none;
  317. background: transparent;
  318. padding: 2px;
  319. cursor: pointer;
  320. line-height: 1;
  321. z-index: 2;
  322. width: 24px;
  323. height: 24px;
  324. display: flex;
  325. align-items: center;
  326. justify-content: center;
  327. }
  328. body.login-page #login-form .btn-toggle-password img {
  329. display: block;
  330. width: 16px;
  331. height: 16px;
  332. object-fit: contain;
  333. }
  334. body.login-page #login-form .btn-toggle-password:hover {
  335. opacity: 0.8;
  336. }
  337. body.login-page #login-form .login-captcha-row {
  338. display: flex;
  339. gap: 10px;
  340. align-items: stretch;
  341. }
  342. body.login-page #login-form .login-captcha-row .login-input {
  343. flex: 1 1 auto;
  344. min-width: 0;
  345. }
  346. body.login-page #login-form .login-captcha-img {
  347. flex: 0 0 auto;
  348. height: 40px;
  349. border-radius: 8px;
  350. border: 1px solid #e5e7eb;
  351. overflow: hidden;
  352. background: #fff;
  353. cursor: pointer;
  354. }
  355. body.login-page #login-form .login-captcha-img img {
  356. display: block;
  357. height: 100%;
  358. width: auto;
  359. min-width: 110px;
  360. }
  361. body.login-page .login-form-extra {
  362. display: flex;
  363. justify-content: space-between;
  364. align-items: center;
  365. margin: 4px 0 22px;
  366. font-size: 13px;
  367. }
  368. body.login-page .login-form-extra label {
  369. margin: 0 !important;
  370. font-weight: normal !important;
  371. color: #6b7280 !important;
  372. cursor: pointer;
  373. display: inline-flex;
  374. align-items: center;
  375. gap: 8px;
  376. user-select: none;
  377. }
  378. body.login-page .login-form-extra input[type="checkbox"] {
  379. margin: 0;
  380. width: 15px;
  381. height: 15px;
  382. accent-color: #4f46e5;
  383. vertical-align: middle;
  384. }
  385. body.login-page .login-form-extra .login-forgot {
  386. color: #9ca3af !important;
  387. text-decoration: none !important;
  388. }
  389. body.login-page .login-form-extra .login-forgot:hover {
  390. color: #6b7280 !important;
  391. text-decoration: underline !important;
  392. }
  393. body.login-page #login-form .form-group {
  394. margin-bottom: 0 !important;
  395. }
  396. body.login-page #login-form .btn-login-submit {
  397. height: 42px !important;
  398. width: 100% !important;
  399. border: none !important;
  400. border-radius: 8px !important;
  401. background: linear-gradient(90deg, #3b82f6 0%, #6366f1 45%, #8b5cf6 100%) !important;
  402. color: #fff !important;
  403. font-size: 16px !important;
  404. font-weight: 600 !important;
  405. letter-spacing: 3px;
  406. box-shadow: 0 12px 28px rgba(99, 102, 241, 0.32) !important;
  407. transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  408. display: inline-flex !important;
  409. align-items: center;
  410. justify-content: center;
  411. gap: 10px;
  412. text-shadow: none !important;
  413. line-height: 1 !important;
  414. }
  415. body.login-page #login-form .btn-login-submit:hover,
  416. body.login-page #login-form .btn-login-submit:focus {
  417. color: #fff !important;
  418. filter: brightness(1.05);
  419. box-shadow: 0 14px 32px rgba(99, 102, 241, 0.4) !important;
  420. transform: translateY(-1px);
  421. background: linear-gradient(90deg, #3b82f6 0%, #6366f1 45%, #8b5cf6 100%) !important;
  422. }
  423. body.login-page #login-form .btn-login-submit:active {
  424. transform: translateY(0);
  425. }
  426. body.login-page #errtips {
  427. margin-bottom: 14px;
  428. }
  429. body.login-page .login-side-register {
  430. margin-top: 22px;
  431. text-align: center;
  432. font-size: 13px;
  433. }
  434. body.login-page .login-side-register a {
  435. color: #374151 !important;
  436. text-decoration: none !important;
  437. }
  438. body.login-page .login-side-register a:hover {
  439. color: #4f46e5 !important;
  440. text-decoration: none !important;
  441. }
  442. body.login-page .login-side-company {
  443. flex: 0 0 auto;
  444. padding: 0 0 28px;
  445. text-align: center;
  446. font-size: 12px;
  447. color: #9ca3af;
  448. letter-spacing: 0.2px;
  449. }
  450. /* 覆盖 FastAdmin 默认灰色登录底 */
  451. body.login-page {
  452. background: #0a1630 !important;
  453. }
  454. body.login-page .wrapper,
  455. body.login-page .content-wrapper,
  456. body.login-page .login-box,
  457. body.login-page .login-box-body {
  458. background: transparent !important;
  459. box-shadow: none !important;
  460. margin: 0 !important;
  461. padding: 0 !important;
  462. width: auto !important;
  463. }
  464. @media (max-width: 960px) {
  465. html, body {
  466. overflow-x: hidden;
  467. overflow-y: auto;
  468. }
  469. body.login-page {
  470. height: auto;
  471. min-height: 100vh;
  472. max-height: none;
  473. flex-direction: column;
  474. overflow-x: hidden;
  475. overflow-y: auto;
  476. }
  477. .login-brand {
  478. flex: 0 0 auto;
  479. min-height: 40vh;
  480. padding: 24px 20px 16px;
  481. }
  482. .login-brand-illust {
  483. min-height: 110px;
  484. }
  485. .login-brand-illust img {
  486. max-width: min(280px, 72%);
  487. max-height: 180px;
  488. }
  489. .login-brand-features li {
  490. min-width: 88px;
  491. padding: 0 14px;
  492. font-size: 12px;
  493. }
  494. body.login-page .login-side {
  495. flex: 1 1 auto !important;
  496. width: 100% !important;
  497. max-width: none !important;
  498. min-width: 0 !important;
  499. height: auto !important;
  500. min-height: 60vh;
  501. padding: 0 24px !important;
  502. border-radius: 20px 20px 0 0;
  503. }
  504. body.login-page .login-side-main {
  505. padding: 36px 0 20px;
  506. }
  507. body.login-page .login-side-company {
  508. padding-bottom: 24px;
  509. }
  510. }
  511. @media (max-width: 480px) {
  512. .login-brand-features {
  513. display: none;
  514. }
  515. .login-side {
  516. padding: 28px 18px 24px;
  517. }
  518. .login-side-head h1 {
  519. font-size: 24px;
  520. }
  521. }
  522. </style>
  523. <script>
  524. document.addEventListener('wheel', function (e) {
  525. if (e.ctrlKey) {
  526. e.preventDefault();
  527. }
  528. }, {passive: false});
  529. document.addEventListener('gesturestart', function (e) { e.preventDefault(); });
  530. document.addEventListener('gesturechange', function (e) { e.preventDefault(); });
  531. document.addEventListener('gestureend', function (e) { e.preventDefault(); });
  532. </script>
  533. </head>
  534. <body class="login-page">
  535. <section class="login-brand">
  536. <div class="login-brand-stage">
  537. <div class="login-brand-header">
  538. <div class="login-brand-logo">
  539. <img src="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/tb.png?v={$site.version|default='1.0.1'|htmlentities}" alt="大数据协同系统"/>
  540. </div>
  541. <div class="login-brand-text">
  542. <h2 class="login-brand-title">大数据协同系统</h2>
  543. <p class="login-brand-sub">Big Data Collaborative System</p>
  544. </div>
  545. </div>
  546. <div class="login-brand-illust">
  547. <img src="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/ch.png?v={$site.version|default='1.0.1'|htmlentities}" alt=""/>
  548. </div>
  549. <ul class="login-brand-features">
  550. <li>
  551. <span class="feat-icon"><i class="glyphicon glyphicon-dashboard"></i></span>
  552. <span>数据看板</span>
  553. </li>
  554. <li>
  555. <span class="feat-icon"><i class="glyphicon glyphicon-time"></i></span>
  556. <span>流程管控</span>
  557. </li>
  558. <li>
  559. <span class="feat-icon"><i class="glyphicon glyphicon-cog"></i></span>
  560. <span>生产协同</span>
  561. </li>
  562. </ul>
  563. </div>
  564. <div class="login-brand-footer">
  565. Copyright @ 杭州可集达科技有限公司 2026-{:date('Y',time())} 版权所有
  566. {if $site.beian}<a href="https://beian.miit.gov.cn" target="_blank"> {$site.beian|htmlentities}</a>{/if}
  567. </div>
  568. </section>
  569. <aside class="login-side">
  570. <div class="login-side-main">
  571. <div class="login-side-head">
  572. <h1>欢迎回来</h1>
  573. <p>请输入账户登录大数据协同平台</p>
  574. </div>
  575. <form action="" method="post" id="login-form">
  576. <!--@AdminLoginFormBegin-->
  577. <div id="errtips" class="hide"></div>
  578. {:token()}
  579. <div class="login-field">
  580. <div class="login-input">
  581. <span class="login-input-icon">
  582. <img src="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/5.png?v={$site.version|default='1.0.1'|htmlentities}" alt=""/>
  583. </span>
  584. <input type="text" class="form-control" id="pd-form-username" placeholder="请输入账号" name="username" autocomplete="username" value="" data-rule="{:__('Username')}:required;username"/>
  585. </div>
  586. </div>
  587. <div class="login-field">
  588. <div class="login-input login-password-wrap">
  589. <span class="login-input-icon">
  590. <img src="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/6.png?v={$site.version|default='1.0.1'|htmlentities}" alt=""/>
  591. </span>
  592. <input type="password" class="form-control" id="pd-form-password" placeholder="请输入密码" name="password" autocomplete="current-password" value="" data-rule="{:__('Password')}:required;length(4~30)"/>
  593. <button type="button" class="btn-toggle-password" id="btn-toggle-password" title="显示/隐藏密码" aria-label="显示/隐藏密码"
  594. data-eye-open="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/11.png?v={$site.version|default='1.0.1'|htmlentities}"
  595. data-eye-close="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/10.png?v={$site.version|default='1.0.1'|htmlentities}">
  596. <img src="https://a-7in6-com.oss-cn-hangzhou.aliyuncs.com/xinhua/img/11.png?v={$site.version|default='1.0.1'|htmlentities}" alt="显示密码"/>
  597. </button>
  598. </div>
  599. </div>
  600. {if $Think.config.fastadmin.login_captcha}
  601. <div class="login-field">
  602. <div class="login-captcha-row">
  603. <div class="login-input">
  604. <span class="login-input-icon"><span class="glyphicon glyphicon-option-horizontal" aria-hidden="true"></span></span>
  605. <input type="text" id="pd-form-captcha" name="captcha" class="form-control" placeholder="请输入验证码" data-rule="{:__('Captcha')}:required;length({$Think.config.captcha.length})" autocomplete="off"/>
  606. </div>
  607. <span class="login-captcha-img" title="点击刷新验证码">
  608. <img src="{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha" height="40" alt="captcha" onclick="this.src = '{:rtrim('__PUBLIC__', '/')}/index.php?s=/captcha&r=' + Math.random();"/>
  609. </span>
  610. </div>
  611. </div>
  612. {/if}
  613. <div class="login-form-extra">
  614. <label>
  615. <input type="checkbox" id="remember-password" name="rememberpwd" value="1"/>
  616. 记住密码
  617. </label>
  618. <a href="javascript:;" class="login-forgot" onclick="Layer && Layer.msg ? Layer.msg('请联系管理员重置密码') : alert('请联系管理员重置密码'); return false;">忘记密码?</a>
  619. </div>
  620. <div class="form-group" style="margin-bottom:0;">
  621. <button type="submit" class="btn btn-login-submit btn-lg btn-block">
  622. 登录
  623. <span aria-hidden="true">→</span>
  624. </button>
  625. </div>
  626. <!--@AdminLoginFormEnd-->
  627. </form>
  628. </div>
  629. <div class="login-side-company">浙江新华数码印务有限公司</div>
  630. </aside>
  631. {include file="common/script" /}
  632. <script>
  633. (function () {
  634. var REMEMBER_KEY = 'xh_admin_remember_pwd';
  635. function loadRemember() {
  636. var $user = document.getElementById('pd-form-username');
  637. var $pass = document.getElementById('pd-form-password');
  638. var $cb = document.getElementById('remember-password');
  639. if (!$user || !$pass || !$cb) {
  640. return;
  641. }
  642. try {
  643. var raw = localStorage.getItem(REMEMBER_KEY);
  644. if (!raw) {
  645. return;
  646. }
  647. var data = JSON.parse(raw);
  648. if (data && data.username) {
  649. $user.value = data.username;
  650. }
  651. if (data && data.password) {
  652. $pass.value = data.password;
  653. }
  654. $cb.checked = true;
  655. } catch (e) {
  656. }
  657. }
  658. function saveRemember() {
  659. var $user = document.getElementById('pd-form-username');
  660. var $pass = document.getElementById('pd-form-password');
  661. var $cb = document.getElementById('remember-password');
  662. if (!$user || !$pass || !$cb) {
  663. return;
  664. }
  665. if ($cb.checked) {
  666. localStorage.setItem(REMEMBER_KEY, JSON.stringify({
  667. username: $user.value || '',
  668. password: $pass.value || ''
  669. }));
  670. } else {
  671. localStorage.removeItem(REMEMBER_KEY);
  672. }
  673. }
  674. loadRemember();
  675. var form = document.getElementById('login-form');
  676. if (form) {
  677. form.addEventListener('submit', function () {
  678. saveRemember();
  679. });
  680. }
  681. var cb = document.getElementById('remember-password');
  682. if (cb) {
  683. cb.addEventListener('change', function () {
  684. if (!cb.checked) {
  685. localStorage.removeItem(REMEMBER_KEY);
  686. }
  687. });
  688. }
  689. var btn = document.getElementById('btn-toggle-password');
  690. var input = document.getElementById('pd-form-password');
  691. if (!btn || !input) {
  692. return;
  693. }
  694. var eyeOpen = btn.getAttribute('data-eye-open') || '';
  695. var eyeClose = btn.getAttribute('data-eye-close') || '';
  696. btn.addEventListener('click', function () {
  697. var show = input.getAttribute('type') === 'password';
  698. input.setAttribute('type', show ? 'text' : 'password');
  699. var img = btn.querySelector('img');
  700. if (img) {
  701. img.src = show ? eyeClose : eyeOpen;
  702. img.alt = show ? '隐藏密码' : '显示密码';
  703. }
  704. });
  705. })();
  706. </script>
  707. </body>
  708. </html>