提交我的笔记

This commit is contained in:
zhaofang
2022-09-08 20:04:29 +08:00
parent 43d5d477c1
commit 39bf0936b8
7 changed files with 111 additions and 30 deletions

View File

@@ -9,16 +9,17 @@
<div class="newcote-content" v-if="notetab == 1">
<div class="newcote-time" v-if="mynoteData.playTime != 0">
<img src="../../../public/images/coteplay.png" alt="">
8:40
{{mynoteData.playTime}}
<img src="../../../public/images/cotedetel.png" alt="">
</div>
<div class="newcote-text">
<el-input
type="textarea"
:autofocus="true"
placeholder="好记性不如烂笔头,记录些什么吧~"
v-model="mynoteData.content"
maxlength="200"
:autosize="{ minRows: 4, maxRows: 8}"
:autosize="{ minRows: 20, maxRows: 20}"
show-word-limit>
</el-input>
</div>
@@ -26,33 +27,43 @@
<!-- 我的笔记 -->
<div class="mycote-content" v-if="notetab == 2">
<div v-if="noteList.length > 0">
<div style="border-bottom:1px solid #4444;padding-bottom:25px;" >
<span class="mycote-time">2022-06-21 21:35:12 <span class="sm">私密</span> <span class="more" icon="el-icon-more"></span> </span>
<div style="margin-top:20px" class="newcote-time">
<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="more">
<el-dropdown>
<span class="el-dropdown-link">
<svg-icon style="margin-right: 0;font-size:26px;" icon-class="spot"></svg-icon>
</span>
<el-dropdown-menu slot="dropdown" class="dropdown-box" style="background:#333333;border: none;">
<el-dropdown-item command="a" style="color:#fff" @click.native="noteDel(note)"><img style="width:13px;height:18px;vertical-align: middle;" src="@/assets/images/icon/note-del.png" /> 删除</el-dropdown-item>
<el-dropdown-item command="b" style="color:#fff" @click.native="noteEdit(note)"><img style="width:13px;height:14px;margin-right:4px;vertical-align: middle;" src="@/assets/images/icon/note-edit.png" />编辑</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</span>
<div style="margin-top:20px" class="newcote-time" v-if="note.playTime">
<img src="../../../public/images/coteplay.png" alt="">
8:40
{{note.playTime}}
<img src="../../../public/images/cotedetel.png" alt="">
</div>
<div class="newcote-text">
在做策略写方案的时候都经常错套都要照着这个理论的要求来实施营销传播写PPT时也要照着这个理论的框架来写
我见划公司的在做策略写方案的时候都经常不管是什么行业企业处在什么来实施营销传播写PPT时也要照着这个理论的框架来写
{{note.content}}
</div>
</div>
<h6 class="mycote-dibu">已经到底啦</h6>
</div>
<div class="my-nonote" v-else>
<img src="../../../public/images/no-note.png" alt=""/>
<h6 style="color: #666666;font-size: 14px;">你还没有记录此课程的笔记哦</h6>
</div>
</div>
<div class="newcote-bottom" v-if="notetab == 1">
<span style="cursor: pointer;" @click="videoLocation"> <img src="../../../public/images/playtime.png" alt=""> 视频位置</span>
<el-radio v-model="mynoteData.openType" :label="1">公开</el-radio>
<el-radio v-model="mynoteData.openType" :label="2">私密</el-radio>
<el-button type="primary" size="small" :disabled="mynoteData.content == ''" @click="saveNote()">保存</el-button>
<el-button type="primary" size="small" @click="saveNote()">保存</el-button>
</div>
</div>
</div>
@@ -74,6 +85,7 @@
return {
radio:'1',
notetab:1,
autoSave:null,
mynoteData:{
type:1, //我发布的是1 我导入的是2
content:'',
@@ -84,6 +96,7 @@
openType:1,// 1表不公开 9表完全公开
},
noteList:[],
type:1, // 1自动保存 2点击保存
};
},
computed: {
@@ -92,7 +105,16 @@
mounted() {
this.mynoteData.courseId = this.data.courseId;
this.mynoteData.contentId = this.data.id;
if(localStorage.getItem("NOTE_TEXT") !=''){
this.mynoteData.content = localStorage.getItem("NOTE_TEXT");
this.notetab = 1;
}
this.getMyNote();
// this.autoSaveNote();
this.autoSave = setInterval(()=>{
localStorage.setItem("NOTE_TEXT",this.mynoteData.content);
console.log("2222222222");
},10000);
},
watch:{
intTimeNote(val) {
@@ -100,10 +122,38 @@
}
},
methods: {
onfocusEnevt(e) {
console.log(e,'e');
},
autoSaveNote() {
},
noteEdit() {
},
noteDel(note) {
this.$confirm('您确定要删除这条笔记吗?', '删除提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
apiNote.del(note.id).then(res=>{
if(res.status == 200) {
this.getMyNote();
} else {
this.$message({ type: 'error', message: res.message, offset: 50 });
}
})
})
.catch((err) => {
this.$message({ type: 'info', message: '已取消删除', offset: 50 });
});
},
getMyNote() {
apiNote.myCourse(this.mynoteData.courseId).then(res=>{
if(res.status == 200) {
this.noteList = res.result;
}
})
},
@@ -114,19 +164,30 @@
this.notetab = num;
},
saveNote() {
apiNote.save(this.mynoteData).then(res=>{
if(res.status == 200 ) {
this.$message.warning('添加成功');
this.getMyNote();
this.notetabType(2);
}
})
}
}
},
beforeDestroy() {
clearInterval(this.autoSave);
this.autoSave = null;
},
}
</script>
<style scoped lang="scss">
::v-deep .el-dropdown-menu__item:hover{
background: #333333;
}
.mynote{
// width: 100%;
margin: 35px 30px;
.newcote-time{
width: 120px;
height: 30px;
@@ -177,8 +238,9 @@
.mycote-content{
margin: 30px 0px;
box-sizing: border-box;
padding: 35px 30px;
height: 474px;
padding: 8px 30px;
height: 550px;
overflow-y: auto;
background-color: #fff;
.my-nonote{
text-align: center;
@@ -203,6 +265,10 @@
margin-left: 20px;
padding: 3px 10px;
}
.more{
margin-top: 12px;
float: right;
}
}
.mycote-dibu{
margin: 50px 38%;