|
@@ -93,6 +93,7 @@ onMounted(async () => {
|
|
|
subjectCodeIn: config.subjectCode ?? "",
|
|
|
});
|
|
|
totalCount.value = res.data;
|
|
|
+ let totalImageDownloadTime = 0;
|
|
|
|
|
|
for (
|
|
|
let pageNumber = 0;
|
|
@@ -127,11 +128,15 @@ onMounted(async () => {
|
|
|
const index = student.sheetUrls.indexOf(sheetUrl);
|
|
|
student.index = index + 1;
|
|
|
student.examId = store.env.examId;
|
|
|
- const filePath = window.electron.join(
|
|
|
+ // const filePath = window.electron.join(
|
|
|
+ // config.dir,
|
|
|
+ // mustache.render(config.template, student)
|
|
|
+ // );
|
|
|
+ const filePath = [
|
|
|
config.dir,
|
|
|
- mustache.render(config.template, student)
|
|
|
- );
|
|
|
- if (config.append && window.electron.existsSync(filePath)) {
|
|
|
+ mustache.render(config.template, student),
|
|
|
+ ];
|
|
|
+ if (config.append && window.electron.existsImage(filePath)) {
|
|
|
console.log(filePath + " already exists");
|
|
|
// 执行到这里时,可能图片已经cache了
|
|
|
urls.splice(urls.indexOf(sheetUrl), 1);
|
|
@@ -140,12 +145,14 @@ onMounted(async () => {
|
|
|
}
|
|
|
|
|
|
console.debug("start ", sheetUrl);
|
|
|
+ const imageDownloadStartTime = Date.now();
|
|
|
const imageRes = await httpApp.get(sheetUrl, {
|
|
|
responseType: "blob",
|
|
|
headers: {
|
|
|
"Cache-Control": "no-cache",
|
|
|
},
|
|
|
});
|
|
|
+ totalImageDownloadTime += Date.now() - imageDownloadStartTime;
|
|
|
|
|
|
const [width, height] = await getImageDim(imageRes.data);
|
|
|
const arrayBuffer = await imageRes.data.arrayBuffer();
|
|
@@ -180,7 +187,12 @@ onMounted(async () => {
|
|
|
finishedCount.value += 1;
|
|
|
}
|
|
|
}
|
|
|
- console.log("all end ", Date.now());
|
|
|
+ console.log(
|
|
|
+ "all end at ",
|
|
|
+ Date.now(),
|
|
|
+ " totalImageDownloadTime: ",
|
|
|
+ totalImageDownloadTime
|
|
|
+ );
|
|
|
} else if (config.type === "2") {
|
|
|
await processPackage();
|
|
|
}
|
|
@@ -217,11 +229,8 @@ async function processPackage() {
|
|
|
try {
|
|
|
const index = i + 1;
|
|
|
p.index = index;
|
|
|
- const filePath = window.electron.join(
|
|
|
- config.dir,
|
|
|
- mustache.render(config.template, p)
|
|
|
- );
|
|
|
- if (config.append && window.electron.existsSync(filePath)) {
|
|
|
+ const filePath = [config.dir, mustache.render(config.template, p)];
|
|
|
+ if (config.append && window.electron.existsImage(filePath)) {
|
|
|
console.log(filePath + " already exists");
|
|
|
urls.splice(urls.indexOf(p.urls[i]), 1);
|
|
|
continue;
|