| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- from nicegui import ui
- # 全局变量声明
- output_text = None
- def handle_check_now_node():
- """处理 'check now node' 按钮点击事件"""
- global output_text
- print("Check Now Node button clicked")
- # 模拟检测结果
- results = [
- "Node 1: OK",
- "Node 2: Failed",
- "Node 3: OK",
- "Node 4: OK",
- "Node 5: Failed",
- "Node 6: OK",
- "Node 7: OK",
- "Node 8: Failed",
- "Node 9: OK",
- "Node 10: OK"
- ]
- # 更新文本框内容
- if output_text is not None:
- output_text.value = "\n".join(results)
- else:
- print("Error: output_text is not initialized")
- def handle_switch_node():
- """处理 'switch ip' 按钮点击事件"""
- print("Switch IP button clicked")
- @ui.page('/clash_local')
- def run_clash_local():
- ui.button('返回主页', on_click=lambda: ui.navigate.to('/', new_tab=False))
- with ui.row().classes("mx-auto"):
- ui.button("Check Now Node", on_click=handle_check_now_node).classes("mt-1")
- ui.button("Switch Node", on_click=handle_switch_node).classes("mt-1")
- ui.label("Filter Node").classes("text-lg font-bold text-blue-500 mt-4")
- filter_input = ui.input(value="JP").classes("w-96")
- with ui.row().classes("w-4/5 mx-auto"):
- with ui.column().classes("w-4/5 mx-auto"):
- ui.label("Output").classes("text-lg font-bold text-blue-500 mt-8 mb-4")
- ui.textarea().classes("w-full h-96 text-sm overflow-auto")
|