我的笔记导入

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

View File

@@ -71,15 +71,19 @@
<h6>{{ item.sysUpdateTime }}</h6> <h6>{{ item.sysUpdateTime }}</h6>
</div> </div>
<div class="all-content"> <div class="all-content">
{{ item.content }} <span v-if="item.contentType != 3">{{ item.content }}</span>
<img v-if="item.filePath" :src="fileBaseUrl + item.filePath" alt=""> <div v-else>
<template v-for="img in item.content">
<img :src="fileBaseUrl + img" alt=""/>
</template>
</div>
</div> </div>
<div class="all-footer"> <div class="all-footer">
<div> <div>
<div class="textbut-box"> <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> <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"> <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"> <el-button @click="edit(item)" class="textbut" type="text">
<svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button> <svg-icon icon-class="noteedit" ></svg-icon> 编辑</el-button>
</div> </div>
@@ -117,7 +121,7 @@
</div> </div>
<div class="import-info-enclosure"> <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> <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>
</div> </div>
<span slot="footer" class="dialog-footer"> <span slot="footer" class="dialog-footer">
@@ -192,9 +196,13 @@ export default {
fileName:'', fileName:'',
openType:1, openType:1,
}, },
fileType:[], upNoteFile:{
filType:null, content:[],
fileType:[],//文件上传格式
contentType:null,
limit:1, limit:1,
},
uploadFileUrl: process.env.VUE_APP_BASE_API + '/xboe/sys/xuploader/file/upload', uploadFileUrl: process.env.VUE_APP_BASE_API + '/xboe/sys/xuploader/file/upload',
text:'', text:'',
importDialogVisible:false, importDialogVisible:false,
@@ -240,7 +248,6 @@ export default {
return item.id; return item.id;
} }
}) })
console.log(ids,'contentType');
let data = { let data = {
// name:this.userInfo.name, // name:this.userInfo.name,
// sign:'abcd', // sign:'abcd',
@@ -263,14 +270,20 @@ export default {
document.body.removeChild(link); document.body.removeChild(link);
}) })
} }
console.log(e,'e');
}, },
noteSave() { noteSave() {
if(this.noteFile.courseName == '') { if(this.noteFile.courseName == '') {
this.$message.warning('请填写标题!'); this.$message.warning('请填写标题!');
return 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=>{ apiNote.save(this.noteFile).then(res=>{
if(res.status == 200) { if(res.status == 200) {
this.$message.success('导入笔记成功'); this.$message.success('导入笔记成功');
@@ -284,28 +297,35 @@ export default {
}, },
importCommand(e){ importCommand(e){
this.importDialogVisible = true; this.importDialogVisible = true;
this.filType = e; this.upNoteFile.contentType = e;
if(e == '3') { if(e == '3') {
this.limit = 9; this.upNoteFile.limit = 9;
this.fileType = ["png","jpg"]; this.upNoteFile.fileType = ["png","jpg"];
} else if(e == '1'){ } else if(e == '1'){
this.fileType = ["txt"]; this.upNoteFile.fileType = ["txt"];
} else { } else {
this.fileType = ["doc","docx"]; this.upNoteFile.fileType = ["doc","docx"];
} }
}, },
handleRemoveSuccess(file) { handleRemoveSuccess(file) {
if(this.filType == 1) { if(this.upNoteFile.contentType == 1) {
// this.upNoteFile.content.push()
// this.noteFile.filePath.replace(file.response.result.filePath+',',''); // 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 { } else {
this.noteFile.filePath =''; this.noteFile.filePath ='';
this.noteFile.fileName = ''; this.noteFile.fileName = '';
} }
}, },
handleUploadSuccess(file) { handleUploadSuccess(file) {
if(this.filType == 3) { if(this.upNoteFile.contentType == 3) {
this.noteFile.fileName = '图片'; this.noteFile.fileName = '图片';
this.noteFile.filePath += file.result.filePath; this.upNoteFile.content.push(file.result.filePath);
// this.noteFile.filePath += file.result.filePath;
} else { } else {
this.noteFile.filePath = file.result.filePath; this.noteFile.filePath = file.result.filePath;
this.noteFile.fileName = file.result.displayName; this.noteFile.fileName = file.result.displayName;
@@ -383,8 +403,16 @@ export default {
endTime:this.endTime, endTime:this.endTime,
} }
apiNote.query(data).then(res=>{ apiNote.query(data).then(res=>{
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.datalist = res.result.list;
this.count = res.result.count; this.count = res.result.count;
}
}) })
}, },