- 修复目录选择为空时不更改配置的逻辑 - 将警告提示改为错误提示以提高用户体验 - 优化停止运行时的成功提示 - 增加进度列表的最大高度以显示更多内容 - 调整定时器逻辑顺序避免提前退出 - 移除重复的任务等待错误处理 - 优化代码结构和空行格式
This commit is contained in:
@@ -52,7 +52,11 @@ const addLog = (msg: string) => {
|
||||
const selectDirectory = () => {
|
||||
// ElMessage.info('请手动输入检测目录路径')
|
||||
SelectPath().then((path) => {
|
||||
checkDir.value = path
|
||||
if (path){
|
||||
checkDir.value = path
|
||||
}else {
|
||||
ElMessage.warning('未选择目录,不更改配置')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -62,11 +66,11 @@ const startRun = () => {
|
||||
// return
|
||||
// }
|
||||
if (!token.value) {
|
||||
ElMessage.warning('请输入Token')
|
||||
ElMessage.error('请输入Token')
|
||||
return
|
||||
}
|
||||
if (!checkDir.value) {
|
||||
ElMessage.warning('请选择检测目录')
|
||||
ElMessage.error('请选择检测目录')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -76,7 +80,7 @@ const startRun = () => {
|
||||
const stopRun = () => {
|
||||
addLog(`正在停止运行`)
|
||||
StopUpload().then(() => {
|
||||
ElMessage.info('已停止运行')
|
||||
ElMessage.success('已停止运行')
|
||||
})
|
||||
}
|
||||
|
||||
@@ -252,7 +256,7 @@ EventsOn("log", (msg) => {
|
||||
|
||||
.progress-list {
|
||||
margin-top: 12px;
|
||||
max-height: 160px;
|
||||
max-height: 250px;
|
||||
overflow-y: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
@@ -72,9 +72,9 @@ func StartUpload(ctx context.Context, logChan *chan string) {
|
||||
for {
|
||||
uploadData(ctx, logChan)
|
||||
select {
|
||||
case <-time.After(time.Minute):
|
||||
case <-ctx.Done():
|
||||
return
|
||||
case <-time.After(time.Minute):
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,6 +136,7 @@ func uploadData(ctx context.Context, logChan *chan string) {
|
||||
}
|
||||
|
||||
progress.Clear()
|
||||
|
||||
//添加文件上传任务参数(文件路径,文件行数)
|
||||
var tasks []Task
|
||||
for fileName, lines := range fileLines {
|
||||
@@ -182,12 +183,9 @@ func uploadData(ctx context.Context, logChan *chan string) {
|
||||
return
|
||||
default:
|
||||
// 等待所有任务完成
|
||||
if err := g.Wait(); err != nil {
|
||||
AddLog(logChan, fmt.Sprintf("任务执行出错: %v", err))
|
||||
} else {
|
||||
AddLog(logChan, "所有任务执行完成!")
|
||||
}
|
||||
g.Wait()
|
||||
|
||||
AddLog(logChan, "所有任务执行完成!")
|
||||
AddLog(logChan, fmt.Sprintf("上传完成,耗时:%s", time.Since(start).String()))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user