diff --git a/src/utils/zipdownload.js b/src/utils/zipdownload.js index 5196632c..a7c6f798 100644 --- a/src/utils/zipdownload.js +++ b/src/utils/zipdownload.js @@ -2,6 +2,7 @@ import axios from 'axios' import {getCookieForName} from "@/api/method"; + const mimeMap = { xlsx: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', zip: 'application/zip' @@ -36,6 +37,14 @@ export function downLoadZipManage(str, filename,fun) { responseType: 'blob', headers: { 'Authorization': 'Bearer ' + getCookieForName("token") } }).then(res => { + console.log("downLoadZipManage res nginx ==> ",res) + console.log("downLoadZipManage res res.headers.ecode ==> ",res.headers.ecode) + if(res.headers.ecode == 4){ + console.log("downLoadZipManage res res.headers.ecode 进入 ==> ",res.headers.ecode) + //TODO1-1 弹出框 + if(fun) fun(res.headers.ecode) + return; + } resolveBlob(res, mimeMap.xlsx,filename) if(fun) fun() }) diff --git a/src/views/report/TrainingNewManager.vue b/src/views/report/TrainingNewManager.vue index 7aa79012..fdaeb0a4 100644 --- a/src/views/report/TrainingNewManager.vue +++ b/src/views/report/TrainingNewManager.vue @@ -15,11 +15,16 @@ import { computed,onMounted,ref } from "vue"; import { useStore } from "vuex"; import { reportOrgs } from "@/api/indexProject"; import {downLoadZipManage} from "@/utils/zipdownload"; +import { message } from "ant-design-vue"; const downReport = () => { spinning.value = true if(uploadAdmin('training-admin')){ - downLoadZipManage(`/admin/project/report/data`,'新任管理者培训数据',function(){ - spinning.value = false + downLoadZipManage(`/admin/project/report/data`,'新任管理者培训数据',function(code){ + if(code == 4){ + spinning.value = false; + message.error("权限不足!"); + } + }) return }