Roberta2024 commited on
Commit
97abdd9
·
verified ·
1 Parent(s): 3572f18

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +41 -14
index.html CHANGED
@@ -20,13 +20,14 @@
20
  margin: 0;
21
  padding: 0;
22
  background-color: var(--light-bg);
 
23
  display: flex;
24
  justify-content: center;
25
  align-items: center;
26
  min-height: 100vh;
27
  }
28
 
29
- /* Login Container */
30
  #login-container {
31
  width: 90%;
32
  max-width: 400px;
@@ -35,7 +36,6 @@
35
  border-radius: 12px;
36
  box-shadow: 0 10px 30px var(--shadow-color);
37
  text-align: center;
38
- transition: opacity 0.5s ease-in-out;
39
  }
40
 
41
  #login-container h2 {
@@ -76,7 +76,7 @@
76
  margin-top: -10px;
77
  margin-bottom: 20px;
78
  font-weight: 500;
79
- visibility: hidden; /* 預設隱藏 */
80
  opacity: 0;
81
  transition: opacity 0.3s;
82
  }
@@ -98,10 +98,11 @@
98
  background-color: #0056b3;
99
  }
100
 
101
- /* Main Content Container (from previous design) */
102
  #main-content {
103
  display: none; /* 預設隱藏主畫面 */
104
  width: 100%;
 
105
  flex-direction: column;
106
  align-items: center;
107
  }
@@ -208,6 +209,16 @@
208
  height: 100%;
209
  border: none;
210
  }
 
 
 
 
 
 
 
 
 
 
211
  </style>
212
  </head>
213
  <body>
@@ -237,6 +248,7 @@
237
  <div class="tab-container">
238
  <button class="tab-button active" onclick="showTab('tab1')">ESG爬蟲</button>
239
  <button class="tab-button" onclick="showTab('tab2')">GEMINI 對話機器人</button>
 
240
  </div>
241
  <div class="content-container">
242
  <div id="tab1" class="iframe-wrapper active">
@@ -260,7 +272,7 @@
260
  </div>
261
 
262
  <script>
263
- // 頁籤切換邏輯 (從前一個版本繼承)
264
  function showTab(tabId) {
265
  const allIframes = document.querySelectorAll('.iframe-wrapper');
266
  allIframes.forEach(iframe => {
@@ -278,32 +290,47 @@
278
 
279
  // 登入驗證邏輯
280
  document.getElementById('loginForm').addEventListener('submit', function(event) {
281
- event.preventDefault(); // 阻止表單提交導致的頁面刷新
282
 
283
- const usernameInput = document.getElementById('username').value;
284
- const passwordInput = document.getElementById('password').value;
285
  const errorMessage = document.getElementById('error-message');
286
  const loginContainer = document.getElementById('login-container');
287
  const mainContent = document.getElementById('main-content');
288
 
289
- // 設定正確的帳號和密碼
290
  const correctUsername = 'ROOT2025';
291
  const correctPassword = '123456';
292
 
293
- if (usernameInput === correctUsername && passwordInput === correctPassword) {
294
- // 登入成功
295
  errorMessage.style.visibility = 'hidden';
296
  errorMessage.style.opacity = '0';
297
 
298
- // 隱藏登入區塊並顯示主畫面
299
  loginContainer.style.display = 'none';
300
- mainContent.style.display = 'flex'; // 使用 flex 讓內容置中
 
301
  } else {
302
- // 登入失敗
303
  errorMessage.style.visibility = 'visible';
304
  errorMessage.style.opacity = '1';
305
  }
306
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
307
  </script>
308
 
309
  </body>
 
20
  margin: 0;
21
  padding: 0;
22
  background-color: var(--light-bg);
23
+ /* 使用 Flexbox 讓內容垂直和水平居中 */
24
  display: flex;
25
  justify-content: center;
26
  align-items: center;
27
  min-height: 100vh;
28
  }
29
 
30
+ /* 登入容器 */
31
  #login-container {
32
  width: 90%;
33
  max-width: 400px;
 
36
  border-radius: 12px;
37
  box-shadow: 0 10px 30px var(--shadow-color);
38
  text-align: center;
 
39
  }
40
 
41
  #login-container h2 {
 
76
  margin-top: -10px;
77
  margin-bottom: 20px;
78
  font-weight: 500;
79
+ visibility: hidden;
80
  opacity: 0;
81
  transition: opacity 0.3s;
82
  }
 
98
  background-color: #0056b3;
99
  }
100
 
101
+ /* 主系統容器 */
102
  #main-content {
103
  display: none; /* 預設隱藏主畫面 */
104
  width: 100%;
105
+ max-width: 1200px; /* 保持與 container 一致的最大寬度 */
106
  flex-direction: column;
107
  align-items: center;
108
  }
 
209
  height: 100%;
210
  border: none;
211
  }
212
+
213
+ /* 回到登入頁面按鈕樣式 */
214
+ .tab-button-logout {
215
+ background-color: #6c757d;
216
+ color: white;
217
+ transition: background-color 0.3s;
218
+ }
219
+ .tab-button-logout:hover {
220
+ background-color: #5a6268;
221
+ }
222
  </style>
223
  </head>
224
  <body>
 
248
  <div class="tab-container">
249
  <button class="tab-button active" onclick="showTab('tab1')">ESG爬蟲</button>
250
  <button class="tab-button" onclick="showTab('tab2')">GEMINI 對話機器人</button>
251
+ <button class="tab-button tab-button-logout" onclick="goBackToLogin()">回到登入頁面</button>
252
  </div>
253
  <div class="content-container">
254
  <div id="tab1" class="iframe-wrapper active">
 
272
  </div>
273
 
274
  <script>
275
+ // 頁籤切換邏輯
276
  function showTab(tabId) {
277
  const allIframes = document.querySelectorAll('.iframe-wrapper');
278
  allIframes.forEach(iframe => {
 
290
 
291
  // 登入驗證邏輯
292
  document.getElementById('loginForm').addEventListener('submit', function(event) {
293
+ event.preventDefault();
294
 
295
+ const usernameInput = document.getElementById('username');
296
+ const passwordInput = document.getElementById('password');
297
  const errorMessage = document.getElementById('error-message');
298
  const loginContainer = document.getElementById('login-container');
299
  const mainContent = document.getElementById('main-content');
300
 
 
301
  const correctUsername = 'ROOT2025';
302
  const correctPassword = '123456';
303
 
304
+ if (usernameInput.value === correctUsername && passwordInput.value === correctPassword) {
 
305
  errorMessage.style.visibility = 'hidden';
306
  errorMessage.style.opacity = '0';
307
 
308
+ // 隱藏登入區塊
309
  loginContainer.style.display = 'none';
310
+ // 顯示主系統畫面
311
+ mainContent.style.display = 'flex';
312
  } else {
 
313
  errorMessage.style.visibility = 'visible';
314
  errorMessage.style.opacity = '1';
315
  }
316
  });
317
+
318
+ // 回到登入頁面函式
319
+ function goBackToLogin() {
320
+ const loginContainer = document.getElementById('login-container');
321
+ const mainContent = document.getElementById('main-content');
322
+ const usernameInput = document.getElementById('username');
323
+ const passwordInput = document.getElementById('password');
324
+
325
+ // 隱藏主畫面
326
+ mainContent.style.display = 'none';
327
+ // 顯示登入區塊
328
+ loginContainer.style.display = 'block';
329
+
330
+ // 清空輸入欄位
331
+ usernameInput.value = '';
332
+ passwordInput.value = '';
333
+ }
334
  </script>
335
 
336
  </body>