From c4245231c5eeb799464d1899eb9cf2c9ca53f330 Mon Sep 17 00:00:00 2001 From: gengxin Date: Mon, 3 Mar 2025 18:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=AF=A6=E7=BB=86=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E8=AE=B0=E5=BD=95=20-=20loading=20=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/student/OnlineClassModelStudent.vue | 9 +++++++-- src/utils/zipdownload.js | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/student/OnlineClassModelStudent.vue b/src/components/student/OnlineClassModelStudent.vue index c6ed39aa..1efa2424 100644 --- a/src/components/student/OnlineClassModelStudent.vue +++ b/src/components/student/OnlineClassModelStudent.vue @@ -92,7 +92,8 @@ - + 导出详细学习记录 @@ -329,11 +330,15 @@ function reset() { function exportStu() { window.open(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudent?type=3&&thirdType=8&pid=${searchParams.value.pid}`); } +const exportLoading = ref(false); + function exportStudy() { if(studentList.value.length == 0){ return message.warning('暂无可导出的学习记录') } - downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录') + exportLoading.value = true; + let {loading} = downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录'); + exportLoading.value = loading; } defineExpose({ searchStu, diff --git a/src/utils/zipdownload.js b/src/utils/zipdownload.js index 55d06244..3d1adcfd 100644 --- a/src/utils/zipdownload.js +++ b/src/utils/zipdownload.js @@ -1,4 +1,5 @@ import axios from 'axios' +import {ref} from 'vue' import {getCookieForName} from "@/api/method"; const mimeMap = { @@ -13,6 +14,10 @@ export function downLoadXlsx(str, filename) { headers: { 'Authorization': 'Bearer ' + getCookieForName("token") } }).then(res => { resolveBlob(res, mimeMap.xlsx,filename) + return false; + }).catch(error =>{ + console.log("downLoadXlsx error",error); + return false; }) } const baseUrl = process.env.VUE_APP_ACT_API