DeepLearning101 commited on
Commit
ce341d4
·
verified ·
1 Parent(s): 6f89645

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -32
app.py CHANGED
@@ -131,14 +131,14 @@ def check_login(user, password):
131
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
132
  }
133
 
134
- # --- 🔥 [絕對定寬 + 自動換行 CSS] ---
135
  custom_css = """
136
- /* 1. 隱藏最外層的捲軸,只留內部一個 */
137
  #booking_table .wrap {
138
  overflow: hidden !important;
139
  }
140
 
141
- /* 2. 表格容器:強制開啟 X 軸捲軸 */
142
  #booking_table .table-wrap {
143
  overflow-x: auto !important;
144
  overflow-y: hidden !important;
@@ -146,20 +146,19 @@ custom_css = """
146
  }
147
 
148
  /* 3. 表格本體:
149
- min-width: 1600px -> 【關鍵】直接把表格撐到 1600px 寬。
150
- 這樣在手機上(寬度~400px)一定會超出,進而觸發捲軸。
151
- table-layout: fixed -> 嚴格遵守下方設定的欄位寬度。
152
  */
153
  #booking_table table {
154
  table-layout: fixed !important;
155
- min-width: 1600px !important;
156
  border-collapse: collapse !important;
157
  margin: 0 !important;
158
  }
159
 
160
  /* 4. 欄位通用設定:
161
- white-space: normal -> 【關鍵】允許換行,太長就變兩行。
162
- overflow-wrap: break-word -> 確保長單字也能換行。
163
  */
164
  #booking_table th, #booking_table td {
165
  display: table-cell !important;
@@ -175,39 +174,37 @@ custom_css = """
175
  line-height: 1.4 !important;
176
  }
177
 
178
- /* 5. 🔥【依照您的要求,固定每個欄位寬度】🔥
179
- 這些寬度加總起來大約是 1600px,會剛好撐滿上面的 min-width
180
- */
181
 
182
- /* #1 id: 短數字 */
183
- #booking_table th:nth-child(1), #booking_table td:nth-child(1) { width: 60px !important; }
184
 
185
- /* #2 date: 日期 */
186
- #booking_table th:nth-child(2), #booking_table td:nth-child(2) { width: 170px !important; }
187
 
188
- /* #3 time: 時間 */
189
- #booking_table th:nth-child(3), #booking_table td:nth-child(3) { width: 80px !important; }
190
 
191
- /* #4 name: 姓名 */
192
- #booking_table th:nth-child(4), #booking_table td:nth-child(4) { width: 120px !important; }
193
 
194
- /* #5 tel: 電話 */
195
- #booking_table th:nth-child(5), #booking_table td:nth-child(5) { width: 120px !important; }
196
 
197
- /* #6 email: 電子信箱 (給寬一點) */
198
- #booking_table th:nth-child(6), #booking_table td:nth-child(6) { width: 250px !important; }
199
 
200
- /* #7 pax: 人數 */
201
- #booking_table th:nth-child(7), #booking_table td:nth-child(7) { width: 50px !important; }
202
 
203
- /* #8 remarks: 備註 */
204
- #booking_table th:nth-child(8), #booking_table td:nth-child(8) { width: 180px !important; }
205
 
206
- /* #9 status: 狀態 */
207
- #booking_table th:nth-child(9), #booking_table td:nth-child(9) { width: 120px !important; }
208
 
209
- /* #10 user_id: 亂碼 (非常長) */
210
- #booking_table th:nth-child(10), #booking_table td:nth-child(10) { width: 320px !important; }
211
  """
212
 
213
  # --- 介面開始 ---
 
131
  error_msg: "<span style='color: red'>❌ 帳號或密碼錯誤</span>"
132
  }
133
 
134
+ # --- 🔥 [最終修正 CSS] 🔥 ---
135
  custom_css = """
136
+ /* 1. 殺掉外層捲軸:強制隱藏外層容器的 overflow */
137
  #booking_table .wrap {
138
  overflow: hidden !important;
139
  }
140
 
141
+ /* 2. 保留內層捲軸:只允許包覆表格的容器捲動 */
142
  #booking_table .table-wrap {
143
  overflow-x: auto !important;
144
  overflow-y: hidden !important;
 
146
  }
147
 
148
  /* 3. 表格本體:
149
+ width: max-content -> 強制撐開,不讓瀏覽器壓縮
150
+ table-layout: fixed -> 嚴格遵守下方設定的寬度
 
151
  */
152
  #booking_table table {
153
  table-layout: fixed !important;
154
+ width: max-content !important;
155
  border-collapse: collapse !important;
156
  margin: 0 !important;
157
  }
158
 
159
  /* 4. 欄位通用設定:
160
+ white-space: normal -> 【關鍵】允許換行!
161
+ word-break: break-word -> 確保長單字也能換行
162
  */
163
  #booking_table th, #booking_table td {
164
  display: table-cell !important;
 
174
  line-height: 1.4 !important;
175
  }
176
 
177
+ /* 5. 🔥【完全依照您的指示固定寬度】🔥 */
 
 
178
 
179
+ /* #1 id */
180
+ #booking_table th:nth-child(1), #booking_table td:nth-child(1) { width: 60px !important; min-width: 60px !important; }
181
 
182
+ /* #2 date */
183
+ #booking_table th:nth-child(2), #booking_table td:nth-child(2) { width: 170px !important; min-width: 170px !important; }
184
 
185
+ /* #3 time */
186
+ #booking_table th:nth-child(3), #booking_table td:nth-child(3) { width: 80px !important; min-width: 80px !important; }
187
 
188
+ /* #4 name */
189
+ #booking_table th:nth-child(4), #booking_table td:nth-child(4) { width: 120px !important; min-width: 120px !important; }
190
 
191
+ /* #5 tel */
192
+ #booking_table th:nth-child(5), #booking_table td:nth-child(5) { width: 120px !important; min-width: 120px !important; }
193
 
194
+ /* #6 email */
195
+ #booking_table th:nth-child(6), #booking_table td:nth-child(6) { width: 250px !important; min-width: 250px !important; }
196
 
197
+ /* #7 pax */
198
+ #booking_table th:nth-child(7), #booking_table td:nth-child(7) { width: 50px !important; min-width: 50px !important; }
199
 
200
+ /* #8 remarks */
201
+ #booking_table th:nth-child(8), #booking_table td:nth-child(8) { width: 180px !important; min-width: 180px !important; }
202
 
203
+ /* #9 status */
204
+ #booking_table th:nth-child(9), #booking_table td:nth-child(9) { width: 120px !important; min-width: 120px !important; }
205
 
206
+ /* #10 user_id */
207
+ #booking_table th:nth-child(10), #booking_table td:nth-child(10) { width: 320px !important; min-width: 320px !important; }
208
  """
209
 
210
  # --- 介面開始 ---