new train

This commit is contained in:
2026-07-28 18:06:10 +08:00
parent 44b0d6b756
commit a55d449028
13 changed files with 224 additions and 27 deletions
+4 -4
View File
@@ -27,7 +27,7 @@ const History = () => {
const [showClear, setShowClear] = useState<boolean>(false)
useEffect(() => {
if (!(window as any).go?.main?.App?.GetHistory) {
if (!(window as any).go?.backend?.App?.GetHistory) {
message.error('Wails runtime not ready')
return
}
@@ -35,7 +35,7 @@ const History = () => {
}, [])
const fetchData = async(page: number) => {
const result = await (window as any).go.main.App.GetHistory(page, pageSize)
const result = await (window as any).go.backend.App.GetHistory(page, pageSize)
if (result.code === 0) {
setHistoryList(result.data.list)
setTotal(result.data.total)
@@ -60,7 +60,7 @@ const History = () => {
message.error('currentId为空')
return
}
const result = await (window as any).go.main.App.DeleteOneHistory(currentId)
const result = await (window as any).go.backend.App.DeleteOneHistory(currentId)
if (result.code === 0) {
message.success('删除成功')
setCurrentId(null)
@@ -79,7 +79,7 @@ const History = () => {
const handleClearOk = async() => {
setShowClear(false)
const result = await (window as any).go.main.App.ClearHistory()
const result = await (window as any).go.backend.App.ClearHistory()
if (result.code === 0) {
message.success('已清空历史')
setCurrentId(null)
+1 -1
View File
@@ -11,7 +11,7 @@ const ImagePreview = ({ filename, ...props }: Props) => {
useEffect(() => {
const loadImage = async () => {
const result = await (window as any).go.main.App.GetImage(filename)
const result = await (window as any).go.backend.App.GetImage(filename)
if (result.code === 0) {
setSrc(result.data)
}
+3 -2
View File
@@ -60,7 +60,7 @@ const Main = () => {
const arrayBuffer = await processedFile.arrayBuffer()
const uint8Array = new Uint8Array(arrayBuffer)
const result = await (window as any).go.main.App.UploadImage(
const result = await (window as any).go.backend.App.UploadImage(
Array.from(uint8Array),
file.name
)
@@ -92,11 +92,12 @@ const Main = () => {
setStep(2)
setTimeout(async() => {
const result = await (window as any).go.main.App.Detect(fileSrc)
const result = await (window as any).go.backend.App.Detect(fileSrc)
if (result.code === 0) {
setDetectResult(result.data)
setStep(3)
} else if (result.code === 1) {
console.log("result.message", result.message)
message.error(result.message)
}
}, 1000)