1
0
mirror of https://github.com/fumiama/paper-manager.git synced 2026-06-27 14:20:29 +08:00

finish filelist progress

This commit is contained in:
源文雨
2023-03-15 17:28:11 +08:00
parent 513680bdb1
commit 6e49173b12
7 changed files with 122 additions and 98 deletions

View File

@@ -1,16 +1,43 @@
export const cardList = (() => {
const result: any[] = []
import { getFileList, getFilePercent } from '/@/api/page'
import { getFileListModel } from '/@/api/page/model/fileListModel'
function refreshFilePercent(arr: any[], i: number) {
return async () => {
const p = await getFilePercent(arr[i].id)
arr[i].percent = p.percent
if (p.percent < 100) {
setTimeout(refreshFilePercent(arr, i), 1000)
}
}
}
export const { cardList, totalSize, totalQuestions } = await (async () => {
const cardList: any[] = []
const lst = (await getFileList()) as getFileListModel
let totalSize = 0
let totalQuestions = 0
for (let i = 0; i < 100; i++) {
result.push({
id: i,
title: 'Vben Admin',
description: '基于Vue Next, TypeScript, Ant Design Vue实现的一套完整的企业级后台管理系统',
datetime: '2020-11-26 17:39',
cardList.push({
id: lst[i].id,
title: lst[i].title,
description: lst[i].description,
size: lst[i].size,
questions: lst[i].questions,
datetime: lst[i].datetime,
icon: 'bi:filetype-docx',
color: '#1890ff',
author: 'Vben',
percent: i,
author: lst[i].author,
percent: lst[i].percent,
})
if (cardList[i].percent < 100) {
setTimeout(refreshFilePercent(cardList, i), 10000)
}
totalSize += lst[i].size
totalQuestions += lst[i].questions
}
return {
cardList,
totalSize,
totalQuestions,
}
return result
})()