笔记代码还原

This commit is contained in:
zhaofang
2022-09-29 12:27:21 +08:00
parent 123f27d1fc
commit 06c9623e53
2 changed files with 64 additions and 16 deletions

View File

@@ -39,7 +39,7 @@
<el-button> <el-button>
全部课程<i class="el-icon-arrow-down el-icon--right"></i> 全部课程<i class="el-icon-arrow-down el-icon--right"></i>
</el-button> </el-button>
<el-dropdown-menu slot="dropdown"> <el-dropdown-menu slot="dropdown" style="height: 150px;overflow-y: auto !important;">
<el-dropdown-item v-for="cou in couresna" :command="cou.courseId">{{cou.courseName}}</el-dropdown-item> <el-dropdown-item v-for="cou in couresna" :command="cou.courseId">{{cou.courseName}}</el-dropdown-item>
</el-dropdown-menu> </el-dropdown-menu>
</el-dropdown> </el-dropdown>
@@ -107,7 +107,7 @@
<el-dialog <el-dialog
:visible.sync="importDialogVisible" :visible.sync="importDialogVisible"
width="785px" width="785px"
:before-close="handleClose"> :close-on-click-modal="false">
<div class="import-info"> <div class="import-info">
<p class="import-info-tip">导入笔记</p> <p class="import-info-tip">导入笔记</p>
<div class="import-info-enclosure"> <div class="import-info-enclosure">
@@ -132,8 +132,8 @@
<el-dialog <el-dialog
width="860px" width="860px"
title="王明" title="王明"
:visible.sync="dialogVisible" :close-on-click-modal="false"
:before-close="handleClose"> :visible.sync="dialogVisible">
<div class="Exportbox"> <div class="Exportbox">
<div class="Export-info" style="border-bottom: 1px solid #ddd;padding-bottom:30px;margin-bottom:35px"> <div class="Export-info" style="border-bottom: 1px solid #ddd;padding-bottom:30px;margin-bottom:35px">
<div class="all-title"> <div class="all-title">
@@ -276,18 +276,19 @@ export default {
this.$message.warning('请填写标题!'); this.$message.warning('请填写标题!');
return return
} }
if(this.noteFile.filePath == '') {
this.$message.warning('您还没有上传文件!');
return
}
this.noteFile.contentType = this.upNoteFile.contentType; this.noteFile.contentType = this.upNoteFile.contentType;
if(this.upNoteFile.content.length > 0) { if(this.upNoteFile.content.length > 0) {
this.noteFile.filePath = this.upNoteFile.content.join(); this.noteFile.filePath = this.upNoteFile.content.join();
} }
if(this.noteFile.filePath == '') {
this.$message.warning('您还没有上传文件!');
return
}
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('导入笔记成功');
this.importDialogVisible = false; this.importDialogVisible = false;
this.noteFile.courseName = '';
this.noteData(this.num); this.noteData(this.num);
} }
}) })
@@ -381,11 +382,6 @@ export default {
this.orderField = 'praises'; this.orderField = 'praises';
this.orderType = !this.orderType; this.orderType = !this.orderType;
this.noteData(this.num) this.noteData(this.num)
},
handleClose(done) {
}, },
edit(item){ edit(item){
this.$router.push({ path: `/user/Noteedit?id=${item.id}` }); this.$router.push({ path: `/user/Noteedit?id=${item.id}` });
@@ -441,6 +437,12 @@ export default {
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
::v-deep .note-sift{
.el-dropdown-menu{
}
}
.note-info-index{ .note-info-index{
::v-deep .el-upload-dragger{ ::v-deep .el-upload-dragger{
width: 500px; width: 500px;

View File

@@ -11,11 +11,17 @@
<h3> {{ editdata.courseName }} </h3> <h3> {{ editdata.courseName }} </h3>
<div v-if="editdata.playTime != ''"><img src="../../../public/images/coteplay.png" alt="">8:40</div> <div v-if="editdata.playTime != ''"><img src="../../../public/images/coteplay.png" alt="">8:40</div>
</div> </div>
<div class="note-text"> <div class="note-text" v-if="editdata.contentType != 3">
<!-- <input style="vertical-align:top;outline:none;" type="textarea" :rows="4" v-model="editdata.content"> --> <!-- <input style="vertical-align:top;outline:none;" type="textarea" :rows="4" v-model="editdata.content"> -->
<textarea v-model="editdata.content" name="" id="" cols="" rows="16" style="vertical-align:top;outline:none;width:100%;border:none; font-size: 14px;font-weight: 400;color: #333333;" maxlength="200" <textarea v-model="editdata.content" name="" id="" cols="" rows="16" style="vertical-align:top;outline:none;width:100%;border:none; font-size: 14px;font-weight: 400;color: #333333;" maxlength="200"
show-word-limit></textarea> show-word-limit></textarea>
</div> </div>
<div class="note-text" v-else>
<div class="img-box" v-for="(img,index) in imgContent">
<img :src="fileBaseUrl + img" alt=""/>
<span class="del-icon"><i class="el-icon-delete" @click="imgDel(index)"></i></span>
</div>
</div>
</div> </div>
<div class="edit-footer"> <div class="edit-footer">
<el-radio-group v-model="editdata.openType"> <el-radio-group v-model="editdata.openType">
@@ -40,9 +46,14 @@
</div> </div>
<span class="pointer" @click="restore(item)"> <i class="el-icon-refresh-left"></i> 还原</span> <span class="pointer" @click="restore(item)"> <i class="el-icon-refresh-left"></i> 还原</span>
</div> </div>
<div class="hist-text"> <div class="hist-text" v-if="editdata.contentType != 3">
{{ item.beforeContent }} {{ item.beforeContent }}
</div> </div>
<div class="hist-text" v-else>
<template class="img-box" v-for="(before,index) in item.beforeContent">
<img style="width:40px;height:65px;margin-right:10px" :src="fileBaseUrl + before" alt=""/>
</template>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -54,6 +65,8 @@ import apiNote from '@/api/phase2/note.js'
export default { export default {
data () { data () {
return { return {
imgContent:[],
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
isShowList:false, isShowList:false,
isShowTip:'', isShowTip:'',
radio: '1', radio: '1',
@@ -75,14 +88,21 @@ export default {
},30000 *10); },30000 *10);
}, },
methods:{ methods:{
imgDel(index) {
this.imgContent.splice(index,1);
},
comeback(){ comeback(){
this.$router.go(-1); this.$router.go(-1);
}, },
notedetail(){ notedetail(){
apiNote.detail(this.id).then(res=>{ apiNote.detail(this.id).then(res=>{
if(res.result.contentType == 3 && res.result.content != '') {
this.imgContent = res.result.content.split(',');
}
this.editdata = res.result; this.editdata = res.result;
this.editdata.openTypeBackups = res.result.openType; this.editdata.openTypeBackups = res.result.openType;
this.histId = res.result.id; this.histId = res.result.id;
this.hist(); this.hist();
}) })
}, },
@@ -92,7 +112,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.editdata.content = item.beforeContent; this.imgContent = item.beforeContent;
}).catch(() => { }).catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
@@ -111,6 +131,12 @@ export default {
}, },
hist(){ hist(){
apiNote.history(this.histId).then(res=>{ apiNote.history(this.histId).then(res=>{
if(this.editdata.contentType == 3) {
res.result.forEach(item=>{
item.beforeContent = item.beforeContent.split(',');
})
}
this.histdata = res.result this.histdata = res.result
}) })
}, },
@@ -124,6 +150,9 @@ export default {
} }
if(num == 1) { if(num == 1) {
this.editdata.isAuto = true; this.editdata.isAuto = true;
}
if(this.imgContent.length > 0) {
this.editdata.content = this.imgContent.join();
} }
apiNote.update(this.editdata).then(res=>{ apiNote.update(this.editdata).then(res=>{
if(res.status == 200) { if(res.status == 200) {
@@ -256,6 +285,23 @@ export default {
font-size: 14px; font-size: 14px;
font-weight: 400; font-weight: 400;
color: #333333; color: #333333;
display: flex;
flex-wrap: wrap;
.img-box{
position: relative;
// display: flex;
.del-icon{
display: inline-block;
position: absolute;
top:0;
right:20px;
}
}
img{
width: 140px;
height: 175px;
margin-right: 23px;
}
input{ input{
border: none; border: none;
font-size: 14px; font-size: 14px;