From c6ed4769e00eb663a04745e85965246df7de4793 Mon Sep 17 00:00:00 2001 From: gengxin Date: Mon, 3 Mar 2025 20:00:00 +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?= =?UTF-8?q?=205?= 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 | 6 ++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/components/student/OnlineClassModelStudent.vue b/src/components/student/OnlineClassModelStudent.vue index 34b6c72c..a9c7bbec 100644 --- a/src/components/student/OnlineClassModelStudent.vue +++ b/src/components/student/OnlineClassModelStudent.vue @@ -93,7 +93,7 @@ 导出详细学习记录 @@ -332,14 +332,15 @@ 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) +const exportDisabled = ref(false) const exportStudy = async () => { if(studentList.value.length == 0){ return message.warning('暂无可导出的学习记录') } - exportLoading.value = true; - downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录',exportLoading); + exportDisabled.value = true; + await downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录',exportLoading); + exportDisabled.value = false; } defineExpose({ searchStu, diff --git a/src/utils/zipdownload.js b/src/utils/zipdownload.js index 539ccbd9..5196632c 100644 --- a/src/utils/zipdownload.js +++ b/src/utils/zipdownload.js @@ -1,12 +1,12 @@ import axios from 'axios' import {getCookieForName} from "@/api/method"; -import { ref } from 'vue'; + const mimeMap = { xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', zip: 'application/zip' } -export const downLoadXlsx = async (str, filename,exportLoading) => { +export const downLoadXlsx = async (str, filename) => { const res = await axios({ method: 'get', url: str, @@ -14,8 +14,6 @@ export const downLoadXlsx = async (str, filename,exportLoading) => { headers: { 'Authorization': 'Bearer ' + getCookieForName("token") } }); resolveBlob(res, mimeMap.xlsx,filename) - exportLoading.value = false; - return { exportLoading }; } const baseUrl = process.env.VUE_APP_ACT_API export function downLoadZip(str, filename) {