mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-18 23:36:44 +08:00
笔记导出功能
This commit is contained in:
@@ -153,7 +153,7 @@
|
||||
<div class="all-content">
|
||||
<span v-if="item.contentType != 3">{{ item.content }}</span>
|
||||
<div v-else>
|
||||
<template v-for="img in item.content">
|
||||
<template v-for="img in item.imgList">
|
||||
<img style="max-height:145px;max-width:140px" :src="fileBaseUrl + img" alt=""/>
|
||||
</template>
|
||||
</div>
|
||||
@@ -227,7 +227,7 @@ export default {
|
||||
startTime:'',
|
||||
endTime:'',
|
||||
datalist:[ ],
|
||||
exportPreData:[ ],
|
||||
exportPreData:[],
|
||||
thu:true,
|
||||
couresna:[],
|
||||
courseName:'',
|
||||
@@ -268,11 +268,19 @@ export default {
|
||||
this.$message.warning('未查询到满足条件的数据')
|
||||
return;
|
||||
}
|
||||
this.exportPreData = res.result.data;
|
||||
|
||||
if(res.result.isImage && e == 2){
|
||||
this.$message.warning('当前筛选条件下含图片类内容,无法导出Excel!')
|
||||
return;
|
||||
}
|
||||
res.result.data.forEach((item)=>{
|
||||
if(item.contentType==3){
|
||||
item.imgList=item.content.split(',');
|
||||
}else{
|
||||
item.imgList=[];
|
||||
}
|
||||
})
|
||||
this.exportPreData = res.result.data;
|
||||
this.dialogVisible = true;
|
||||
})
|
||||
},
|
||||
@@ -295,23 +303,24 @@ export default {
|
||||
author:this.userData.avatar,//this.userInfo.avatar,
|
||||
}
|
||||
if(this.exportType == '1') {
|
||||
apiNote.exportPdf(data).then(res=>{
|
||||
if(res.status) {
|
||||
this.$message.error('导出失败');
|
||||
} else {
|
||||
const link = document.createElement('a');// 创建a标签
|
||||
// let blob = new Blob([res],{type: 'application/vnd.ms-pdf;charset=UTF-8'}); // 设置文件类型
|
||||
let blob = new Blob([res],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); // 设置文件类型
|
||||
link.style.display = "none";
|
||||
link.href = URL.createObjectURL(blob); // 创建URL
|
||||
link.setAttribute("download", "我的笔记.pdf");
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
this.dialogVisible = false;
|
||||
}
|
||||
apiNote.exportPdf(data);
|
||||
// apiNote.exportPdf(data).then(res=>{
|
||||
// if(res.status) {
|
||||
// this.$message.error('导出失败');
|
||||
// } else {
|
||||
// const link = document.createElement('a');// 创建a标签
|
||||
// // let blob = new Blob([res],{type: 'application/vnd.ms-pdf;charset=UTF-8'}); // 设置文件类型
|
||||
// let blob = new Blob([res],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); // 设置文件类型
|
||||
// link.style.display = "none";
|
||||
// link.href = URL.createObjectURL(blob); // 创建URL
|
||||
// link.setAttribute("download", "我的笔记.pdf");
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// this.dialogVisible = false;
|
||||
// }
|
||||
|
||||
})
|
||||
// })
|
||||
} else {
|
||||
let data = {
|
||||
orderType:this.orderType,
|
||||
|
||||
Reference in New Issue
Block a user