Selaa lähdekoodia

youhua

master
suyanyan 3 kuukautta sitten
vanhempi
commit
8a7d19a019
2 muutettua tiedostoa jossa 13 lisäystä ja 4 poistoa
  1. +8
    -1
      SafeCampus.WEB/src/api/request/instance.ts
  2. +5
    -3
      SafeCampus.WEB/src/views/violation/analysis/index.vue

+ 8
- 1
SafeCampus.WEB/src/api/request/instance.ts Näytä tiedosto

@@ -22,6 +22,7 @@ import { checkStatus } from "../helper/checkStatus";
import { useUserStore } from "@/stores/modules";
import { AxiosCanceler } from "../helper/axiosCancel";
import router from "@/routers";
import { i } from "vite/dist/node/types.d-jgA8ss1A";

// 自定义 AxiosRequestConfig 接口,增加 noLoading 属性
export interface CustomAxiosRequestConfig extends InternalAxiosRequestConfig {
@@ -109,6 +110,8 @@ export default class RequestHttp {
*/
this.service.interceptors.response.use(
(response: AxiosResponse) => {
console.log(response, "........");

// 检查并存储授权信息
this.checkAndStoreAuthentication(response);
const { data, config } = response;
@@ -140,7 +143,11 @@ export default class RequestHttp {
});
}
// 成功请求(在页面上除非特殊情况,否则不用处理失败逻辑)
return data;
if (`${config.baseURL}${config.url}` == "/api/violation/analysis/reportExport") {
return response;
} else {
return data;
}
},
async (error: AxiosError) => {
const { response } = error;


+ 5
- 3
SafeCampus.WEB/src/views/violation/analysis/index.vue Näytä tiedosto

@@ -93,10 +93,12 @@ const onTimeSubmit = ()=>{
startTime: timeForm.dateArr[0],
endTime: timeForm.dateArr[1],
}).then((res:any) => {
console.log(res,"....");
console.log(res,"....UTF-8''");
const filename:any = ref()
filename.value = window.decodeURI(res.headers["content-disposition"].split("=")[1]);
let blobUrl = window.URL.createObjectURL(res);
filename.value = window.decodeURI(res.headers["content-disposition"].split("=")[2]);
filename.value = filename.value.slice(7,-1)
let blobUrl = window.URL.createObjectURL(res.data);
const a = document.createElement('a');
a.style.display = 'none';
a.setAttribute("target", "_blank");


Ladataan…
Peruuta
Tallenna