refactor: 应用 UI 工程化

This commit is contained in:
zihluwang committed 2025-07-29 16:02:12 +08:00
1 parent 404bbdd28a
commit e23a6e0cdc
3 files changed
+19 -9

No files matched your search

+5 -9
View File
@@ -1,10 +1,6 @@
import React, { useEffect, useState } from "react"
import { invoke } from "@tauri-apps/api/core"
enum Level {
min = "min",
max = "max",
}
import { Level } from "@/types"
import * as service from "@/service"
export default function App() {
const [text, setText] = useState<string>("")
@@ -22,8 +18,8 @@ export default function App() {
setLast(text)
// 获取下一条信息
const nextMessage = await invoke<string>("get_message", { level })
setText(nextMessage)
const nextZuanMessage = await service.nextZuan(level)
setText(nextZuanMessage)
}
const showLast = () => {
@@ -43,7 +39,7 @@ export default function App() {
}
)
} else {
alert("当前浏览器不支持复制功能")
alert("暂时不支持复制功能")
}
}
+10
View File
@@ -0,0 +1,10 @@
import { invoke } from "@tauri-apps/api/core"
import { Level } from "@/types"
/**
* 从服务端获取下一条祖安语录
* @param level 祖安级别
*/
export async function nextZuan(level?: Level) {
return await invoke<string>("get_message", { level })
}
+4
View File
@@ -0,0 +1,4 @@
export enum Level {
min = "min",
max = "max"
}