导出详细学习记录 - loading 更改 5

This commit is contained in:
gengxin
2025-03-03 19:50:16 +08:00
parent bd09fd3c57
commit 0c5c3308aa
2 changed files with 15 additions and 10 deletions

View File

@@ -93,6 +93,7 @@
</a-col>
<a-col>
<a-button class="cus-btn" style="background: #4ea6ff; color: #fff; width: 150px"
:loading="exportLoading"
@click="exportStudy">
导出详细学习记录
</a-button>
@@ -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,

View File

@@ -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) {