我的笔记导入

This commit is contained in:
zhaofang
2022-09-28 11:04:16 +08:00
parent b932171872
commit 4cf64e5ea8
2 changed files with 51 additions and 23 deletions

View File

@@ -26,7 +26,7 @@
<div style="border-bottom:1px solid #4444;padding-bottom:25px;" v-for="note in noteList"
:key="note.id">
<span class="mycote-time">{{note.sysCreateTime}}
<span class="sm">{{note.openType == 1?'公开':'私密'}}</span>
<span class="sm">{{note.openType == 9?'公开':'私密'}}</span>
<span class="more">
<el-dropdown>
<span class="el-dropdown-link">
@@ -248,7 +248,7 @@ export default {
// courseId: '',// 课程id
// contentId: '',//课程内容id
// courseName: '',// 课程名称
openType: 1,// 1表不公开 9表完全公开
openType: 9,// 1表不公开 9表完全公开
};
}, 2000)
}
@@ -274,7 +274,7 @@ export default {
// courseId: '',// 课程id
// contentId: '',//课程内容id
// courseName: '',// 课程名称
openType: 1,// 1表不公开 9表完全公开
openType: 9,// 1表不公开 9表完全公开
};
}, 2000)

View File

@@ -71,15 +71,19 @@
<h6>{{ item.sysUpdateTime }}</h6>
</div>
<div class="all-content">
{{ item.content }}
<img v-if="item.filePath" :src="fileBaseUrl + item.filePath" alt="">
<span v-if="item.contentType != 3">{{ item.content }}</span>
<div v-else>
<template v-for="img in item.content">
<img :src="fileBaseUrl + img" alt=""/>
</template>
</div>
</div>
<div class="all-footer">
<div>
<div class="textbut-box">
<interactBar v-if="item.type == 1" nodeWidth="60px" :readonly="true" :type="6" :data="item" :shares="false" :comments="false" :answers="true" :clickAnswer="true" :views="false"></interactBar>
<el-button @click="open(item)" style=" margin-right: 10px;" class="textbut" type="text">
<svg-icon icon-class="notedel" ></svg-icon> 删除</el-button>
<svg-icon icon-class="notedel" ></svg-icon>删除</el-button>
<el-button @click="edit(item)" class="textbut" type="text">
<svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button>
</div>
@@ -117,7 +121,7 @@
</div>
<div class="import-info-enclosure">
<label class="label" style="width:66px"><svg-icon style="font-size:16px;margin-right:5px" icon-class="enclisure"></svg-icon>附件</label>
<file-upload dir="files" :fileType="fileType" :showList="true" :value="imageShowUrl" :limit="limit" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
<file-upload dir="files" :fileType="upNoteFile.fileType" :showList="true" :value="imageShowUrl" :limit="upNoteFile.limit" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
</div>
</div>
<span slot="footer" class="dialog-footer">
@@ -192,9 +196,13 @@ export default {
fileName:'',
openType:1,
},
fileType:[],
filType:null,
limit:1,
upNoteFile:{
content:[],
fileType:[],//文件上传格式
contentType:null,
limit:1,
},
uploadFileUrl: process.env.VUE_APP_BASE_API + '/xboe/sys/xuploader/file/upload',
text:'',
importDialogVisible:false,
@@ -240,7 +248,6 @@ export default {
return item.id;
}
})
console.log(ids,'contentType');
let data = {
// name:this.userInfo.name,
// sign:'abcd',
@@ -263,14 +270,20 @@ export default {
document.body.removeChild(link);
})
}
console.log(e,'e');
},
noteSave() {
if(this.noteFile.courseName == '') {
this.$message.warning('请填写标题!');
return
}
this.noteFile.contentType =this.filType;
if(this.noteFile.filePath == '') {
this.$message.warning('您还没有上传文件!');
return
}
this.noteFile.contentType = this.upNoteFile.contentType;
if(this.upNoteFile.content.length > 0) {
this.noteFile.filePath = this.upNoteFile.content.join();
}
apiNote.save(this.noteFile).then(res=>{
if(res.status == 200) {
this.$message.success('导入笔记成功');
@@ -284,28 +297,35 @@ export default {
},
importCommand(e){
this.importDialogVisible = true;
this.filType = e;
this.upNoteFile.contentType = e;
if(e == '3') {
this.limit = 9;
this.fileType = ["png","jpg"];
this.upNoteFile.limit = 9;
this.upNoteFile.fileType = ["png","jpg"];
} else if(e == '1'){
this.fileType = ["txt"];
this.upNoteFile.fileType = ["txt"];
} else {
this.fileType = ["doc","docx"];
this.upNoteFile.fileType = ["doc","docx"];
}
},
handleRemoveSuccess(file) {
if(this.filType == 1) {
if(this.upNoteFile.contentType == 1) {
// this.upNoteFile.content.push()
// this.noteFile.filePath.replace(file.response.result.filePath+',','');
this.upNoteFile.content.forEach((item,index) => {
if(item == file.response.result.filePath) {
this.upNoteFile.content.splice(index,1);
}
});
} else {
this.noteFile.filePath ='';
this.noteFile.fileName = '';
}
},
handleUploadSuccess(file) {
if(this.filType == 3) {
if(this.upNoteFile.contentType == 3) {
this.noteFile.fileName = '图片';
this.noteFile.filePath += file.result.filePath;
this.upNoteFile.content.push(file.result.filePath);
// this.noteFile.filePath += file.result.filePath;
} else {
this.noteFile.filePath = file.result.filePath;
this.noteFile.fileName = file.result.displayName;
@@ -383,8 +403,16 @@ export default {
endTime:this.endTime,
}
apiNote.query(data).then(res=>{
this.datalist = res.result.list;
this.count = res.result.count;
if(res.status == 200) {
res.result.list.forEach((item,index)=>{
if(item.contentType == 3) {
item.content = item.content.split(',');
}
});
this.datalist = res.result.list;
this.count = res.result.count;
}
})
},