|
@@ -36,7 +36,9 @@ function millisecondsToHMS(milliseconds: number) {
|
|
|
"秒"
|
|
|
);
|
|
|
}
|
|
|
+let stopSignal = false;
|
|
|
let statisticTime = 0;
|
|
|
+let downloadFailStatus = ref(false);
|
|
|
|
|
|
function openSuccessDialog() {
|
|
|
const modal = Modal.success({});
|
|
@@ -111,7 +113,7 @@ const nextColor = storePassedToNodeJs.config.watermark.nextColor || "#0000ff";
|
|
|
const otherColor = "#ddd";
|
|
|
|
|
|
const studentHandler = async (student: any, urls: any) => {
|
|
|
- if (store.downloadFailStatus) {
|
|
|
+ if (downloadFailStatus.value || stopSignal) {
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
@@ -189,7 +191,7 @@ const studentHandler = async (student: any, urls: any) => {
|
|
|
let resultImgList: any[] = [];
|
|
|
let sheetUrlsLength = (student.sheetUrls || []).length;
|
|
|
for (const sheetUrl of student.sheetUrls) {
|
|
|
- if (stopSignal || store.downloadFailStatus) return;
|
|
|
+ if (stopSignal || downloadFailStatus.value) return;
|
|
|
try {
|
|
|
const index = student.sheetUrls.indexOf(sheetUrl);
|
|
|
student.index = index + 1;
|
|
@@ -247,7 +249,7 @@ const studentHandler = async (student: any, urls: any) => {
|
|
|
window.electron.errorLogger(student, sheetUrl, error);
|
|
|
errorCount.value += 1;
|
|
|
if (config.failover) {
|
|
|
- store.downloadFailStatus = true;
|
|
|
+ downloadFailStatus.value = true;
|
|
|
throw error;
|
|
|
} else {
|
|
|
console.log(student, error);
|
|
@@ -305,7 +307,7 @@ const studentHandler = async (student: any, urls: any) => {
|
|
|
};
|
|
|
|
|
|
onMounted(async () => {
|
|
|
- store.downloadFailStatus = false;
|
|
|
+ downloadFailStatus.value = false;
|
|
|
// const storePassedToNodeJs = JSON.parse(JSON.stringify(store));
|
|
|
// const color = storePassedToNodeJs.config.watermark.color;
|
|
|
// const nextColor = storePassedToNodeJs.config.watermark.nextColor || "#0000ff";
|
|
@@ -336,7 +338,7 @@ onMounted(async () => {
|
|
|
pageNumber * 10 < totalCount.value;
|
|
|
pageNumber++
|
|
|
) {
|
|
|
- if (store.downloadFailStatus) {
|
|
|
+ if (downloadFailStatus.value || stopSignal) {
|
|
|
break;
|
|
|
}
|
|
|
const resStudents = await getStudents(
|
|
@@ -439,6 +441,5 @@ async function processPackage() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-let stopSignal = false;
|
|
|
onUnmounted(() => (stopSignal = true));
|
|
|
</script>
|