Skip to content

Commit

Permalink
improvement: 改进下载页进度条
Browse files Browse the repository at this point in the history
fix: 安装时默认 UserAgent 错误
  • Loading branch information
Yingyya committed Aug 7, 2024
1 parent e3f9454 commit f81419c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/Install.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const systemConfig = reactive<InstallSystemConfig>({
fixed_key: '',
key_last_time: '300',
normal_cookie: '',
parse_ua: 'netdisk',
parse_ua: 'netdisk;',
real_url_last_time: '1800',
requires_key: 'dynamic'
});
Expand Down
9 changes: 5 additions & 4 deletions src/pages/Parsed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ const stop = () => {
blocked.value = false;
starting.value = false;
dialogStore.interceptUnload = false;
progress.value = 0;
};
const onWorkerMessage = async (m: WorkerResponse) => {
Expand All @@ -152,9 +153,9 @@ const onWorkerMessage = async (m: WorkerResponse) => {
return;
}
if (m.type === 'progress') {
const low = (m.max ? m.max : 1) - (m.n ? m.n : 0) + 1;
const single = 100 / low;
progress.value = Math.floor(single);
const max = m.max || 1;
const n = m.n || 0
progress.value = Math.round(n / max * 100);
return;
}
if (m.type === 'success') {
Expand Down Expand Up @@ -282,7 +283,7 @@ worker.setCallback(onWorkerMessage);
</template>
</Fieldset>
<Fieldset legend="准备下载">
<ProgressBar :mode="!starting ? 'indeterminate' : 'determinate'"
<ProgressBar :mode="starting && progress === 0 ? 'indeterminate' : 'determinate'" v-if="starting"
:value="progress"></ProgressBar>
<Divider/>
<ButtonGroup>
Expand Down

0 comments on commit f81419c

Please sign in to comment.