mirror of
https://github.com/putyy/res-downloader.git
synced 2026-01-12 06:04:55 +08:00
feat: add loading check
This commit is contained in:
@@ -84,7 +84,11 @@
|
||||
"win_install_tip": "For the first time using this software, please right-click and select 'Run as administrator'",
|
||||
"download_queued": "Download has been added to the queue, current queue length:{count}",
|
||||
"search": "Search",
|
||||
"search_description": "Keyword Search..."
|
||||
"search_description": "Keyword Search...",
|
||||
"start_err_tip": "Error Message",
|
||||
"start_err_content": "The current startup process has encountered an issue. Do you want to reset the application?",
|
||||
"start_err_positiveText": "Clear cache and restart",
|
||||
"start_err_negativeText": "Close the software"
|
||||
},
|
||||
"setting": {
|
||||
"restart_tip": "Keep default if unsure, please restart software after modification",
|
||||
|
||||
@@ -84,7 +84,11 @@
|
||||
"win_install_tip": "首次启用本软件,请使用鼠标右键选择以管理员身份运行",
|
||||
"download_queued": "下载已加入队列,当前队列长度:{count}",
|
||||
"search": "搜索",
|
||||
"search_description": "关键字搜索..."
|
||||
"search_description": "关键字搜索...",
|
||||
"start_err_tip": "错误提示",
|
||||
"start_err_content": "当前启动过程遇到了问题,是否重置应用?",
|
||||
"start_err_positiveText": "清理缓存并重启",
|
||||
"start_err_negativeText": "关闭软件"
|
||||
},
|
||||
"setting": {
|
||||
"restart_tip": "如果不清楚保持默认就行,修改后请重启软件",
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
</template>
|
||||
{{ t('index.cancel_down') }}
|
||||
</NButton>
|
||||
<NButton tertiary type="warning" @click.stop="batchExport" class="my-1">
|
||||
<NButton tertiary type="warning" @click.stop="batchExport()" class="my-1">
|
||||
<template #icon>
|
||||
<n-icon>
|
||||
<ArrowRedoCircleOutline/>
|
||||
@@ -136,9 +136,14 @@ import {
|
||||
Apps,
|
||||
TrashOutline, CloseOutline
|
||||
} from "@vicons/ionicons5"
|
||||
import { useDialog } from 'naive-ui'
|
||||
import * as bind from "../../wailsjs/go/core/Bind"
|
||||
import {Quit} from "../../wailsjs/runtime"
|
||||
import {DialogOptions} from "naive-ui/es/dialog/src/DialogProvider"
|
||||
|
||||
const {t} = useI18n()
|
||||
const eventStore = useEventStore()
|
||||
const dialog = useDialog()
|
||||
const isProxy = computed(() => {
|
||||
return store.isProxy
|
||||
})
|
||||
@@ -382,6 +387,7 @@ const showPassword = ref(false)
|
||||
const downloadQueue = ref<appType.MediaInfo[]>([])
|
||||
let activeDownloads = 0
|
||||
let isOpenProxy = false
|
||||
let isInstall = false
|
||||
|
||||
onMounted(() => {
|
||||
try {
|
||||
@@ -390,8 +396,16 @@ onMounted(() => {
|
||||
})
|
||||
loading.value = true
|
||||
handleInstall().then((is: boolean) => {
|
||||
isInstall = true
|
||||
loading.value = false
|
||||
})
|
||||
|
||||
checkLoading()
|
||||
watch(showPassword, ()=>{
|
||||
if (!showPassword.value){
|
||||
checkLoading()
|
||||
}
|
||||
})
|
||||
} catch (e) {
|
||||
window.$message?.error(JSON.stringify(e), {duration: 5000})
|
||||
}
|
||||
@@ -607,12 +621,11 @@ const batchCancel = () =>{
|
||||
return
|
||||
}
|
||||
|
||||
data.value.forEach((item, index) => {
|
||||
data.value.forEach(async (item, index) => {
|
||||
if (checkedRowKeysValue.value.includes(item.Id) && item.Status === "running") {
|
||||
appApi.cancel({id: item.Id}).then((res)=>{
|
||||
item.Status = 'ready'
|
||||
item.SavePath = ''
|
||||
})
|
||||
appApi.cancel({id: item.Id})
|
||||
data.value[index].Status = 'ready'
|
||||
data.value[index].SavePath = ''
|
||||
}
|
||||
})
|
||||
checkedRowKeysValue.value = []
|
||||
@@ -847,6 +860,29 @@ const handleInstall = async () => {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
const checkLoading = ()=>{
|
||||
setTimeout(()=>{
|
||||
if (loading.value && !isInstall && !showPassword.value) {
|
||||
dialog.warning({
|
||||
title: t("index.start_err_tip"),
|
||||
content: t("index.start_err_content"),
|
||||
positiveText: t("index.start_err_positiveText"),
|
||||
negativeText: t("index.start_err_negativeText"),
|
||||
draggable: false,
|
||||
closeOnEsc: false,
|
||||
closable: false,
|
||||
maskClosable: false,
|
||||
onPositiveClick: () => {
|
||||
bind.ResetApp()
|
||||
},
|
||||
onNegativeClick: () => {
|
||||
Quit()
|
||||
}
|
||||
} as DialogOptions)
|
||||
}
|
||||
}, 6000)
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.ellipsis-2 {
|
||||
|
||||
2
frontend/wailsjs/go/core/Bind.d.ts
vendored
2
frontend/wailsjs/go/core/Bind.d.ts
vendored
@@ -5,3 +5,5 @@ import {core} from '../models';
|
||||
export function AppInfo():Promise<core.ResponseData>;
|
||||
|
||||
export function Config():Promise<core.ResponseData>;
|
||||
|
||||
export function ResetApp():Promise<void>;
|
||||
|
||||
@@ -9,3 +9,7 @@ export function AppInfo() {
|
||||
export function Config() {
|
||||
return window['go']['core']['Bind']['Config']();
|
||||
}
|
||||
|
||||
export function ResetApp() {
|
||||
return window['go']['core']['Bind']['ResetApp']();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user