- 简化响应体关闭逻辑,移除不必要的nil检查 - 调整后台状态推送频率,从500ms改为250ms - 修复前端事件监听器注册顺序 - 移除未使用的进度变量 - 优化goroutine中的任务执行逻辑 - 改进文件路径显示,统一使用文件名而非完整路径 - 添加waitgroup等待确保资源正确释放
This commit is contained in:
+10
-15
@@ -14,7 +14,6 @@ const concurrentFiles = ref(1)
|
||||
const uploadThreads = ref(1)
|
||||
const autoStart = ref(false)
|
||||
|
||||
const progress = ref(0)
|
||||
const isRunning = ref(false)
|
||||
const logOutput = ref<string[]>([])
|
||||
const logContentRef = ref<HTMLElement>()
|
||||
@@ -45,7 +44,7 @@ const sortedProgressList = computed(() => {
|
||||
const addLog = (msg: string) => {
|
||||
logOutput.value.push(`[${new Date().toLocaleString()}]` + msg)
|
||||
nextTick(() => {
|
||||
if (logContentRef.value && logRoll.value){
|
||||
if (logContentRef.value && logRoll.value) {
|
||||
logContentRef.value.scrollTop = logContentRef.value.scrollHeight
|
||||
}
|
||||
})
|
||||
@@ -71,19 +70,15 @@ const startRun = () => {
|
||||
ElMessage.warning('请选择检测目录')
|
||||
return
|
||||
}
|
||||
isRunning.value = true
|
||||
progress.value = 0
|
||||
|
||||
StartUpload()
|
||||
}
|
||||
|
||||
const stopRun = () => {
|
||||
if (isRunning.value) {
|
||||
isRunning.value = false
|
||||
addLog(`正在停止运行`)
|
||||
StopUpload().then(() => {
|
||||
ElMessage.info('已停止运行')
|
||||
})
|
||||
}
|
||||
addLog(`正在停止运行`)
|
||||
StopUpload().then(() => {
|
||||
ElMessage.info('已停止运行')
|
||||
})
|
||||
}
|
||||
|
||||
const clearLog = () => {
|
||||
@@ -133,14 +128,14 @@ watch(autoStart, () => {
|
||||
WriteConfig("is-run-on-start", autoStart.value)
|
||||
})
|
||||
|
||||
EventsOn("log", (msg) => {
|
||||
addLog(msg)
|
||||
EventsOn("is-run", (run) => {
|
||||
isRunning.value = run
|
||||
})
|
||||
EventsOn("progress", (progress) => {
|
||||
progressList.value = progress
|
||||
})
|
||||
EventsOn("is-run", (run) => {
|
||||
isRunning.value = run
|
||||
EventsOn("log", (msg) => {
|
||||
addLog(msg)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user