//导出我点评的标签:body,myToken,blob,myCommentParams,document,上传,fetch From: https://www.cnblogs.com/connie256/p/17098820.html
exportMyComment(){
let data = {
"pageNo": this.commentParams.pageNo,
"pageSize": this.myCommentParams.pageSize,
"param": this.myCommentParams.param,
"semesterId": this.myCommentParams.semesterId,
"teachWeek": this.myCommentParams.teachWeek
}
this.myToken=import.meta.env.MODE=='development'?this.myToken:Cookies.get('Admin-Token')
let options = {
method: "POST", //post请求
headers: {
Accept: "application/json",
"Content-Type": "application/json",
"X-Token": this.myToken,
},
body: JSON.stringify(data),
};
fetch(`${VITE_APP_BASE_API}/judge/task/activity/exportMyJudgeCoursePage`, options)
.then((res) => {
return res.blob();
})
.then((blob) => {
const a = document.createElement("a");
a.style.display = "none";
a.href = URL.createObjectURL(blob);
a.download = '我点评的' + new Date().getTime() + '.xlsx';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(a);
}).catch(err=> {
console.log(err)
}).finally(e=>{
});
},