From 0c5c3308aa72d47c4168ee9ff1bbc9ebbb73611d Mon Sep 17 00:00:00 2001 From: gengxin Date: Mon, 3 Mar 2025 19:50:16 +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 --- .../student/OnlineClassModelStudent.vue | 7 +++++-- src/utils/zipdownload.js | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/components/student/OnlineClassModelStudent.vue b/src/components/student/OnlineClassModelStudent.vue index e9d7dcff..34b6c72c 100644 --- a/src/components/student/OnlineClassModelStudent.vue +++ b/src/components/student/OnlineClassModelStudent.vue @@ -93,6 +93,7 @@ 导出详细学习记录 @@ -331,12 +332,14 @@ 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 exportStudy = async () => { if(studentList.value.length == 0){ return message.warning('暂无可导出的学习记录') } - console.log("开始执行 gx 刷新"); - downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录'); + exportLoading.value = true; + downLoadXlsx(`${process.env.VUE_APP_BASE_API}/admin/student/exportOnlineStudentDetail?type=4&&thirdType=8&pid=${searchParams.value.pid}`,'在线课学员学习记录',exportLoading); } defineExpose({ searchStu, diff --git a/src/utils/zipdownload.js b/src/utils/zipdownload.js index 59cd11ab..539ccbd9 100644 --- a/src/utils/zipdownload.js +++ b/src/utils/zipdownload.js @@ -1,19 +1,21 @@ 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 function downLoadXlsx(str, filename) { - await axios({ - method: 'get', - url: str, - responseType: 'blob', - headers: { 'Authorization': 'Bearer ' + getCookieForName("token") } - }).then(res => { +export const downLoadXlsx = async (str, filename,exportLoading) => { + const res = await axios({ + method: 'get', + url: str, + responseType: 'blob', + 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) {