Skip to content

Commit

Permalink
feat: 增加public目录上传功能
Browse files Browse the repository at this point in the history
  • Loading branch information
asforest committed Dec 10, 2024
1 parent 08a8888 commit a2c202b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/api/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ export const taskCombineRequest = () => instance.post('/task/combine', {})
export const taskTestRequest = () => instance.post('/task/test', {})

export const taskRevertRequest = () => instance.post('/task/revert', {})

export const taskUploadRequest = () => instance.post('/task/upload', {})
13 changes: 12 additions & 1 deletion src/pages/Dashboard/Log/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, {useEffect, useRef, useState} from "react";
import {Button, Input, message, Modal} from "antd";
import {taskCombineRequest, taskPackRequest, taskRevertRequest, taskTestRequest} from "@/api/task.js";
import {taskCombineRequest, taskPackRequest, taskRevertRequest, taskTestRequest, taskUploadRequest} from "@/api/task.js";
import {terminalFullRequest, terminalMoreRequest} from "@/api/terminal.js";
import {RotateCcw} from "lucide-react";
import {generateRandomStr} from "@/utils/tool.js";
Expand Down Expand Up @@ -85,6 +85,16 @@ const Index = () => {
}
}

const taskUpload = async () => {
const {code, msg, data} = await taskUploadRequest();
if (code === 1) {
messageApi.success('任务已提交.')
await terminalMore()
} else {
messageApi.error(msg)
}
}

const copy = async (item) => {
await navigator.clipboard.writeText(`${showTime(item.time)}-${item.level}-${item.content}`);
messageApi.success('复制成功!')
Expand Down Expand Up @@ -119,6 +129,7 @@ const Index = () => {
<Button type="primary" size="large" className="ml-2" onClick={taskCombine}>合并</Button>
<Button type="primary" size="large" className="ml-2" onClick={taskTest}>测试</Button>
<Button type="primary" size="large" className="ml-2" onClick={taskRevert}>回退</Button>
<Button type="primary" size="large" className="ml-2" onClick={taskUpload}>上传</Button>
</div>
<div
ref={logsRef}
Expand Down

0 comments on commit a2c202b

Please sign in to comment.