index.html 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>应用安装向导</title>
  7. <!-- Bootstrap CSS -->
  8. <link href="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap/5.1.3/css/bootstrap.min.css" rel="stylesheet">
  9. <!-- Font Awesome -->
  10. <link href="https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
  11. <!-- Custom CSS -->
  12. <style>
  13. :root {
  14. --primary: #7166F0;
  15. --primary-light: #8B7FF7;
  16. --primary-dark: #5B4FD9;
  17. --success: #10B981;
  18. --warning: #F59E0B;
  19. --dark: #1F2937;
  20. --light: #F8FAFC;
  21. --border-radius: 10px;
  22. --box-shadow: 0 10px 30px rgba(113, 102, 240, 0.1);
  23. --transition: all 0.3s ease;
  24. --primary-gradient: linear-gradient(135deg, #7166F0 0%, #8B7FF7 100%);
  25. --card-bg: rgba(255, 255, 255, 0.95);
  26. --border-color: rgba(113, 102, 240, 0.1);
  27. }
  28. * {
  29. margin: 0;
  30. padding: 0;
  31. box-sizing: border-box;
  32. }
  33. body {
  34. background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  35. min-height: 100vh;
  36. display: flex;
  37. align-items: center;
  38. justify-content: center;
  39. padding: 30px 15px;
  40. color: var(--dark);
  41. }
  42. .install-wrapper {
  43. width: 100%;
  44. max-width: 1000px;
  45. }
  46. .logo-section {
  47. text-align: left;
  48. padding: 1rem 2rem;
  49. background: var(--card-bg);
  50. box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
  51. backdrop-filter: blur(10px);
  52. border-bottom: 1px solid var(--border-color);
  53. position: fixed;
  54. top: 0;
  55. left: 0;
  56. right: 0;
  57. z-index: 1000;
  58. display: flex;
  59. align-items: center;
  60. gap: 1rem;
  61. }
  62. .logo-icon {
  63. animation: pulse 2s infinite;
  64. flex-shrink: 0;
  65. }
  66. .logo-icon img {
  67. width: 40px;
  68. height: 40px;
  69. border-radius: 10px;
  70. box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
  71. transition: transform 0.3s ease;
  72. }
  73. .logo-icon img:hover {
  74. transform: scale(1.05);
  75. }
  76. .logo-section h1 {
  77. font-size: 1.4rem;
  78. background: var(--primary-gradient);
  79. -webkit-background-clip: text;
  80. -webkit-text-fill-color: transparent;
  81. margin: 0;
  82. font-weight: 700;
  83. letter-spacing: 0.5px;
  84. white-space: nowrap;
  85. overflow: hidden;
  86. text-overflow: ellipsis;
  87. }
  88. .main-content {
  89. flex: 1;
  90. display: flex;
  91. align-items: center;
  92. justify-content: center;
  93. padding: 2rem;
  94. margin-top: 70px;
  95. }
  96. .install-container {
  97. background: var(--card-bg);
  98. border-radius: var(--border-radius);
  99. box-shadow: var(--box-shadow);
  100. overflow: hidden;
  101. width: 100%;
  102. backdrop-filter: blur(10px);
  103. border: 1px solid var(--border-color);
  104. }
  105. .progress-container {
  106. padding: 25px 30px 0;
  107. }
  108. .progress {
  109. height: 8px;
  110. border-radius: 50px;
  111. background-color: #F5F3FF;
  112. margin-bottom: 25px;
  113. overflow: visible;
  114. box-shadow: inset 0 1px 3px rgba(113, 102, 240, 0.1);
  115. }
  116. .progress-bar {
  117. background: var(--primary-gradient);
  118. border-radius: 50px;
  119. position: relative;
  120. transition: var(--transition);
  121. }
  122. .progress-bar::after {
  123. content: '';
  124. position: absolute;
  125. right: -4px;
  126. top: -4px;
  127. width: 16px;
  128. height: 16px;
  129. border-radius: 50%;
  130. background: white;
  131. border: 3px solid var(--primary);
  132. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  133. }
  134. .steps-container {
  135. display: flex;
  136. justify-content: space-between;
  137. position: relative;
  138. margin-bottom: 30px;
  139. }
  140. .step-item {
  141. display: flex;
  142. flex-direction: column;
  143. align-items: center;
  144. position: relative;
  145. z-index: 1;
  146. flex: 1;
  147. }
  148. .step-icon {
  149. width: 50px;
  150. height: 50px;
  151. border-radius: 50%;
  152. background: white;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. margin-bottom: 10px;
  157. border: 2px solid #F5F3FF;
  158. color: #94A3B8;
  159. transition: var(--transition);
  160. position: relative;
  161. }
  162. .step-icon i {
  163. font-size: 20px;
  164. }
  165. .step-text {
  166. font-size: 14px;
  167. font-weight: 600;
  168. color: #94A3B8;
  169. transition: var(--transition);
  170. }
  171. .step-item.active .step-icon,
  172. .step-item.completed .step-icon {
  173. border-color: var(--primary);
  174. color: white;
  175. background: var(--primary-gradient);
  176. }
  177. .step-item.active .step-text,
  178. .step-item.completed .step-text {
  179. color: var(--primary);
  180. }
  181. .step-item.completed .step-icon::after {
  182. content: '\f00c';
  183. font-family: 'Font Awesome 6 Free';
  184. font-weight: 900;
  185. position: absolute;
  186. }
  187. .content-section {
  188. padding: 30px;
  189. width: 100%;
  190. }
  191. .step-content {
  192. display: none;
  193. animation: fadeIn 0.5s ease;
  194. width: 100%;
  195. }
  196. .step-content.active {
  197. display: block;
  198. width: 100%;
  199. }
  200. @keyframes fadeIn {
  201. from { opacity: 0; transform: translateY(20px); }
  202. to { opacity: 1; transform: translateY(0); }
  203. }
  204. .step-title {
  205. font-size: 24px;
  206. font-weight: 700;
  207. margin-bottom: 25px;
  208. color: var(--primary);
  209. width: 100%;
  210. text-align: left;
  211. }
  212. .form-group {
  213. margin-bottom: 25px;
  214. position: relative;
  215. }
  216. .form-label {
  217. font-weight: 600;
  218. font-size: 14px;
  219. color: var(--dark);
  220. margin-bottom: 10px;
  221. display: block;
  222. transition: var(--transition);
  223. }
  224. .form-control {
  225. height: 50px;
  226. border-radius: var(--border-radius);
  227. border: 2px solid #F5F3FF;
  228. padding: 10px 15px 10px 50px;
  229. font-size: 15px;
  230. transition: var(--transition);
  231. background-color: #F8FAFC;
  232. color: var(--dark);
  233. }
  234. .form-control:focus {
  235. border-color: var(--primary);
  236. background-color: #fff;
  237. box-shadow: 0 0 0 4px rgba(113, 102, 240, 0.1);
  238. outline: none;
  239. }
  240. .form-control::placeholder {
  241. color: #94A3B8;
  242. }
  243. /* Custom Input Group Styles */
  244. .custom-input-group {
  245. position: relative;
  246. display: flex;
  247. align-items: center;
  248. }
  249. .custom-input-icon {
  250. position: absolute;
  251. left: 0;
  252. top: 0;
  253. width: 50px;
  254. height: 50px;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. background-color: transparent;
  259. color: #94A3B8;
  260. z-index: 5;
  261. pointer-events: none;
  262. transition: var(--transition);
  263. }
  264. .custom-input-group:hover .custom-input-icon {
  265. color: var(--primary);
  266. }
  267. .custom-input-group .form-control:focus + .custom-input-icon {
  268. color: var(--primary);
  269. }
  270. /* 添加输入框动画效果 */
  271. .form-control:focus + .custom-input-icon {
  272. transform: scale(1.1);
  273. }
  274. /* 添加输入框hover效果 */
  275. .form-control:hover {
  276. border-color: #ced4da;
  277. background-color: #fff;
  278. }
  279. /* 添加密码输入框特殊样式 */
  280. input[type="password"].form-control {
  281. letter-spacing: 2px;
  282. }
  283. /* 添加数字输入框特殊样式 */
  284. input[type="number"].form-control {
  285. -moz-appearance: textfield;
  286. }
  287. input[type="number"].form-control::-webkit-outer-spin-button,
  288. input[type="number"].form-control::-webkit-inner-spin-button {
  289. -webkit-appearance: none;
  290. margin: 0;
  291. }
  292. /* 添加输入框聚焦时的标签动画 */
  293. .form-group:focus-within .form-label {
  294. color: var(--primary);
  295. transform: translateY(-2px);
  296. }
  297. /* 添加输入框验证状态样式 */
  298. .form-control.is-valid {
  299. border-color: var(--success);
  300. background-image: none;
  301. }
  302. .form-control.is-invalid {
  303. border-color: var(--warning);
  304. background-image: none;
  305. }
  306. /* 添加输入框加载状态样式 */
  307. .form-control.is-loading {
  308. background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234361ee' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E");
  309. background-repeat: no-repeat;
  310. background-position: right 10px center;
  311. background-size: 20px;
  312. padding-right: 40px;
  313. }
  314. .btn {
  315. height: 50px;
  316. border-radius: var(--border-radius);
  317. padding: 0 25px;
  318. font-weight: 600;
  319. font-size: 15px;
  320. transition: var(--transition);
  321. display: inline-flex;
  322. align-items: center;
  323. justify-content: center;
  324. gap: 10px;
  325. }
  326. .btn-primary {
  327. background: var(--primary-gradient);
  328. border: none;
  329. color: white;
  330. transition: var(--transition);
  331. box-shadow: 0 5px 15px rgba(113, 102, 240, 0.3);
  332. }
  333. .btn-primary:hover {
  334. transform: translateY(-2px);
  335. box-shadow: 0 8px 25px rgba(113, 102, 240, 0.4);
  336. }
  337. .btn-primary:active {
  338. transform: translateY(0);
  339. }
  340. .btn-outline-primary {
  341. color: var(--primary);
  342. border-color: var(--primary);
  343. }
  344. .btn-outline-primary:hover {
  345. background: var(--primary);
  346. border-color: var(--primary);
  347. }
  348. .log-container {
  349. background: #F8FAFC;
  350. border-radius: var(--border-radius);
  351. border: 2px solid #F5F3FF;
  352. height: 300px;
  353. overflow-y: auto;
  354. padding: 20px;
  355. margin-top: 20px;
  356. width: 100%;
  357. }
  358. .log-item {
  359. padding: 15px;
  360. border-radius: var(--border-radius);
  361. background: white;
  362. margin-bottom: 15px;
  363. box-shadow: 0 2px 5px rgba(113, 102, 240, 0.05);
  364. display: flex;
  365. align-items: flex-start;
  366. gap: 15px;
  367. animation: slideIn 0.3s ease;
  368. border: 1px solid #F5F3FF;
  369. transition: var(--transition);
  370. }
  371. .log-item:hover {
  372. transform: translateY(-2px);
  373. box-shadow: 0 5px 15px rgba(113, 102, 240, 0.1);
  374. }
  375. .log-icon {
  376. width: 40px;
  377. height: 40px;
  378. border-radius: 50%;
  379. background: rgba(113, 102, 240, 0.1);
  380. display: flex;
  381. align-items: center;
  382. justify-content: center;
  383. color: var(--primary);
  384. flex-shrink: 0;
  385. transition: var(--transition);
  386. }
  387. .log-item:hover .log-icon {
  388. transform: scale(1.1);
  389. background: rgba(113, 102, 240, 0.2);
  390. }
  391. .log-content {
  392. flex-grow: 1;
  393. }
  394. .log-text {
  395. font-size: 14px;
  396. line-height: 1.6;
  397. color: var(--dark);
  398. margin-bottom: 5px;
  399. }
  400. .log-time {
  401. font-size: 12px;
  402. color: #94A3B8;
  403. }
  404. .completed-message {
  405. text-align: center;
  406. padding: 40px 20px;
  407. animation: fadeIn 0.5s ease;
  408. width: 100%;
  409. max-width: 100%;
  410. }
  411. .completed-icon {
  412. width: 100px;
  413. height: 100px;
  414. border-radius: 50%;
  415. background: rgba(113, 102, 240, 0.1);
  416. display: flex;
  417. align-items: center;
  418. justify-content: center;
  419. margin: 0 auto 30px;
  420. color: var(--primary);
  421. font-size: 40px;
  422. animation: scaleIn 0.5s ease;
  423. transition: var(--transition);
  424. }
  425. .completed-icon:hover {
  426. transform: scale(1.1);
  427. background: rgba(113, 102, 240, 0.2);
  428. }
  429. .completed-title {
  430. font-size: 28px;
  431. font-weight: 700;
  432. margin-bottom: 15px;
  433. color: var(--primary);
  434. background: var(--primary-gradient);
  435. -webkit-background-clip: text;
  436. -webkit-text-fill-color: transparent;
  437. }
  438. .completed-subtitle {
  439. font-size: 16px;
  440. color: #6c757d;
  441. margin-bottom: 30px;
  442. line-height: 1.6;
  443. max-width: 100%;
  444. padding: 0 20px;
  445. }
  446. .action-buttons {
  447. display: flex;
  448. justify-content: center;
  449. gap: 15px;
  450. width: 100%;
  451. padding: 0 20px;
  452. }
  453. .action-buttons .btn {
  454. padding: 12px 30px;
  455. font-size: 16px;
  456. border-radius: 50px;
  457. background: var(--primary-gradient);
  458. border: none;
  459. color: white;
  460. transition: var(--transition);
  461. box-shadow: 0 5px 15px rgba(113, 102, 240, 0.3);
  462. }
  463. .action-buttons .btn:hover {
  464. transform: translateY(-2px);
  465. box-shadow: 0 8px 25px rgba(113, 102, 240, 0.4);
  466. }
  467. .action-buttons .btn:active {
  468. transform: translateY(0);
  469. }
  470. @keyframes scaleIn {
  471. from { transform: scale(0); opacity: 0; }
  472. to { transform: scale(1); opacity: 1; }
  473. }
  474. @keyframes slideIn {
  475. from { transform: translateY(10px); opacity: 0; }
  476. to { transform: translateY(0); opacity: 1; }
  477. }
  478. /* Responsive adjustments */
  479. @media (max-width: 768px) {
  480. .content-section {
  481. padding: 20px;
  482. }
  483. .step-title {
  484. font-size: 20px;
  485. }
  486. .btn {
  487. height: 45px;
  488. padding: 0 20px;
  489. font-size: 14px;
  490. }
  491. .form-control {
  492. height: 45px;
  493. }
  494. .custom-input-icon {
  495. height: 45px;
  496. width: 45px;
  497. }
  498. }
  499. @media (max-width: 576px) {
  500. .steps-container {
  501. flex-direction: column;
  502. align-items: flex-start;
  503. gap: 15px;
  504. }
  505. .step-item {
  506. flex-direction: row;
  507. width: 100%;
  508. justify-content: flex-start;
  509. gap: 15px;
  510. }
  511. .step-icon {
  512. margin-bottom: 0;
  513. }
  514. .log-container {
  515. height: 250px;
  516. }
  517. .completed-icon {
  518. width: 80px;
  519. height: 80px;
  520. font-size: 32px;
  521. }
  522. .completed-title {
  523. font-size: 24px;
  524. }
  525. }
  526. /* Step 2: Installation Process Styles */
  527. #step2 {
  528. width: 100%;
  529. }
  530. #step2 .progress {
  531. width: 100%;
  532. }
  533. #step2 .log-container {
  534. width: 100%;
  535. margin: 20px 0;
  536. }
  537. /* Step 3: Installation Complete Styles */
  538. #step3 {
  539. width: 100%;
  540. }
  541. #step3 .completed-message {
  542. width: 100%;
  543. padding: 40px 0;
  544. }
  545. #step3 .completed-subtitle {
  546. width: 100%;
  547. padding: 0;
  548. margin: 0 auto 30px;
  549. }
  550. #step3 .action-buttons {
  551. width: 100%;
  552. padding: 0;
  553. }
  554. /* 确保所有步骤内容区域宽度一致 */
  555. .row {
  556. width: 100%;
  557. margin: 0;
  558. }
  559. .col-md-6 {
  560. width: 100%;
  561. padding: 0;
  562. }
  563. @media (min-width: 768px) {
  564. .col-md-6 {
  565. width: 50%;
  566. padding: 0 15px;
  567. }
  568. }
  569. </style>
  570. </head>
  571. <body>
  572. <div class="install-wrapper">
  573. <!-- Logo Section -->
  574. <div class="logo-section">
  575. <div class="logo-icon">
  576. <img src="https://saithink.top/images/logo.png" alt="Logo">
  577. </div>
  578. <h1>【{{app}}-{{version}}】安装配置向导</h1>
  579. </div>
  580. <!-- Main Install Container -->
  581. <div class="main-content">
  582. <div class="install-container">
  583. <!-- Progress Section -->
  584. <div class="progress-container">
  585. <div class="progress">
  586. <div class="progress-bar" role="progressbar" style="width: 0%"></div>
  587. </div>
  588. <div class="steps-container">
  589. <div class="step-item active" data-step="1">
  590. <div class="step-icon">
  591. <i class="fas fa-database"></i>
  592. </div>
  593. <div class="step-text">数据库配置</div>
  594. </div>
  595. <div class="step-item" data-step="2">
  596. <div class="step-icon">
  597. <i class="fas fa-cogs"></i>
  598. </div>
  599. <div class="step-text">执行安装</div>
  600. </div>
  601. <div class="step-item" data-step="3">
  602. <div class="step-icon">
  603. <i class="fas fa-check"></i>
  604. </div>
  605. <div class="step-text">安装完成</div>
  606. </div>
  607. </div>
  608. </div>
  609. <!-- Content Section -->
  610. <div class="content-section">
  611. <!-- Step 1: Database Config -->
  612. <div class="step-content active" id="step1">
  613. <h2 class="step-title">数据库配置</h2>
  614. <form id="dbConfigForm">
  615. <div class="row g-4">
  616. <div class="col-md-6">
  617. <div class="form-group">
  618. <label for="dbHost" class="form-label">数据库主机</label>
  619. <div class="custom-input-group">
  620. <input type="text" class="form-control" id="dbHost" value="127.0.0.1" required>
  621. <div class="custom-input-icon">
  622. <i class="fas fa-server"></i>
  623. </div>
  624. </div>
  625. </div>
  626. </div>
  627. <div class="col-md-6">
  628. <div class="form-group">
  629. <label for="dbPort" class="form-label">端口</label>
  630. <div class="custom-input-group">
  631. <input type="number" class="form-control" id="dbPort" value="3306" required>
  632. <div class="custom-input-icon">
  633. <i class="fas fa-plug"></i>
  634. </div>
  635. </div>
  636. </div>
  637. </div>
  638. <div class="col-md-6">
  639. <div class="form-group">
  640. <label for="dbName" class="form-label">数据库名</label>
  641. <div class="custom-input-group">
  642. <input type="text" class="form-control" id="dbName" required>
  643. <div class="custom-input-icon">
  644. <i class="fas fa-database"></i>
  645. </div>
  646. </div>
  647. </div>
  648. </div>
  649. <div class="col-md-6">
  650. <div class="form-group">
  651. <label for="dbUser" class="form-label">用户名</label>
  652. <div class="custom-input-group">
  653. <input type="text" class="form-control" id="dbUser" required>
  654. <div class="custom-input-icon">
  655. <i class="fas fa-user"></i>
  656. </div>
  657. </div>
  658. </div>
  659. </div>
  660. <div class="col-md-6">
  661. <div class="form-group">
  662. <label for="dbPassword" class="form-label">密码</label>
  663. <div class="custom-input-group">
  664. <input type="password" class="form-control" id="dbPassword" required>
  665. <div class="custom-input-icon">
  666. <i class="fas fa-key"></i>
  667. </div>
  668. </div>
  669. </div>
  670. </div>
  671. </div>
  672. <div class="d-flex justify-content-end mt-4">
  673. <button type="button" class="btn btn-primary" onclick="nextStep(1)">
  674. <span>下一步</span>
  675. <i class="fas fa-arrow-right"></i>
  676. </button>
  677. </div>
  678. </form>
  679. </div>
  680. <!-- Step 2: Installation Process -->
  681. <div class="step-content" id="step2">
  682. <h2 class="step-title">执行安装</h2>
  683. <div class="progress mb-4">
  684. <div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" style="width: 0%"></div>
  685. </div>
  686. <div class="log-container" id="installLog">
  687. <div class="log-item">
  688. <div class="log-icon">
  689. <i class="fas fa-info"></i>
  690. </div>
  691. <div class="log-content">
  692. <div class="log-text">准备开始安装...</div>
  693. <div class="log-time">刚刚</div>
  694. </div>
  695. </div>
  696. </div>
  697. </div>
  698. <!-- Step 3: Installation Complete -->
  699. <div class="step-content" id="step3">
  700. <div class="completed-message">
  701. <div class="completed-icon">
  702. <i class="fas fa-check"></i>
  703. </div>
  704. <h2 class="completed-title">安装成功</h2>
  705. <p class="completed-subtitle">恭喜!已成功安装系统,请重启webman,启动前端项目进行访问。</p>
  706. <div class="action-buttons">
  707. <a href="http://localhost:8888" class="btn btn-primary">
  708. <i class="fas fa-tachometer-alt"></i>
  709. <span>进入管理后台</span>
  710. </a>
  711. </div>
  712. </div>
  713. </div>
  714. </div>
  715. </div>
  716. </div>
  717. </div>
  718. <!-- jQuery -->
  719. <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js"></script>
  720. <!-- Bootstrap Bundle with Popper -->
  721. <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/bootstrap/5.1.3/js/bootstrap.bundle.min.js"></script>
  722. <script>
  723. // 显示通知
  724. function showNotification(type, message) {
  725. const icon = type === 'success' ? 'check-circle' : 'exclamation-circle';
  726. const color = type === 'success' ? '#4cc9f0' : '#f72585';
  727. const notification = $(`
  728. <div class="notification" style="
  729. position: fixed;
  730. top: 20px;
  731. right: 20px;
  732. background: white;
  733. padding: 15px 20px;
  734. border-radius: 10px;
  735. box-shadow: 0 5px 15px rgba(0,0,0,0.1);
  736. display: flex;
  737. align-items: center;
  738. gap: 15px;
  739. z-index: 1000;
  740. transform: translateX(120%);
  741. transition: transform 0.3s ease;
  742. ">
  743. <div style="
  744. width: 30px;
  745. height: 30px;
  746. background: ${color};
  747. color: white;
  748. border-radius: 50%;
  749. display: flex;
  750. align-items: center;
  751. justify-content: center;
  752. ">
  753. <i class="fas fa-${icon}"></i>
  754. </div>
  755. <div>${message}</div>
  756. </div>
  757. `);
  758. $('body').append(notification);
  759. setTimeout(() => {
  760. notification.css('transform', 'translateX(0)');
  761. }, 100);
  762. setTimeout(() => {
  763. notification.css('transform', 'translateX(120%)');
  764. setTimeout(() => {
  765. notification.remove();
  766. }, 300);
  767. }, 3000);
  768. }
  769. // 切换步骤
  770. function nextStep(currentStep) {
  771. if (currentStep === 1) {
  772. // 验证数据库配置
  773. if (!validateDbConfig()) {
  774. return;
  775. }
  776. // 开始安装过程
  777. startInstallation();
  778. } else {
  779. // 隐藏当前步骤,显示下一步
  780. $('.step-content').removeClass('active');
  781. $(`#step${currentStep + 1}`).addClass('active');
  782. // 更新步骤指示器
  783. $('.step-item').removeClass('active');
  784. $(`.step-item[data-step="${currentStep + 1}"]`).addClass('active');
  785. // 将之前的步骤标记为已完成
  786. for (let i = 1; i <= currentStep; i++) {
  787. $(`.step-item[data-step="${i}"]`).addClass('completed');
  788. }
  789. // 更新进度条
  790. const progress = ((currentStep + 1) / 3) * 100;
  791. $('.progress-bar').css('width', progress + '%');
  792. }
  793. }
  794. // 验证数据库配置
  795. function validateDbConfig() {
  796. const required = ['dbHost', 'dbName', 'dbUser', 'dbPassword'];
  797. for (const field of required) {
  798. if (!$(`#${field}`).val()) {
  799. showNotification('error', '请填写所有必填字段');
  800. return false;
  801. }
  802. }
  803. return true;
  804. }
  805. // 开始安装过程
  806. function startInstallation() {
  807. const dbConfig = {
  808. host: $('#dbHost').val(),
  809. port: $('#dbPort').val(),
  810. database: $('#dbName').val(),
  811. username: $('#dbUser').val(),
  812. password: $('#dbPassword').val(),
  813. prefix: $('#dbPrefix').val()
  814. };
  815. // 模拟安装过程
  816. const steps = [
  817. { icon: 'database', text: '正在创建数据库表...' },
  818. { icon: 'file-import', text: '正在导入基础数据...' },
  819. { icon: 'cogs', text: '正在配置系统参数...' },
  820. { icon: 'tachometer-alt', text: '正在优化系统性能...' }
  821. ];
  822. let currentStep = 0;
  823. const installLog = $('#installLog');
  824. const progressBar = $('.progress-bar');
  825. function runStep() {
  826. if (currentStep < steps.length) {
  827. // 获取当前时间
  828. const now = new Date();
  829. const timeString = now.getHours().toString().padStart(2, '0') + ':' +
  830. now.getMinutes().toString().padStart(2, '0') + ':' +
  831. now.getSeconds().toString().padStart(2, '0');
  832. // 添加日志
  833. const step = steps[currentStep];
  834. installLog.append(`
  835. <div class="log-item">
  836. <div class="log-icon">
  837. <i class="fas fa-${step.icon}"></i>
  838. </div>
  839. <div class="log-content">
  840. <div class="log-text">${step.text}</div>
  841. <div class="log-time">${timeString}</div>
  842. </div>
  843. </div>
  844. `);
  845. installLog.scrollTop(installLog[0].scrollHeight);
  846. // 更新进度
  847. const progress = ((currentStep + 1) / steps.length) * 100;
  848. progressBar.css('width', progress + '%');
  849. // 模拟异步操作
  850. setTimeout(() => {
  851. currentStep++;
  852. runStep();
  853. }, 1000);
  854. } else {
  855. // 安装完成
  856. setTimeout(() => {
  857. nextStep(2);
  858. }, 500);
  859. }
  860. }
  861. $.ajax({
  862. url: '/core/install/install',
  863. method: 'POST',
  864. data: dbConfig,
  865. success: function(response) {
  866. if (response.code == 200) {
  867. // 隐藏当前步骤,显示下一步
  868. $('.step-content').removeClass('active');
  869. $(`#step2`).addClass('active');
  870. // 更新步骤指示器
  871. $('.step-item').removeClass('active');
  872. $(`.step-item[data-step=2]`).addClass('active');
  873. runStep()
  874. } else {
  875. showNotification('error', '数据库连接失败:' + response.message);
  876. }
  877. },
  878. error: function() {
  879. showNotification('error', '请求失败,请检查网络连接');
  880. }
  881. });
  882. }
  883. </script>
  884. </body>
  885. </html>