diff --git a/src/api/ajax.js b/src/api/ajax.js index 780cccf1..11881980 100644 --- a/src/api/ajax.js +++ b/src/api/ajax.js @@ -141,6 +141,19 @@ const postJson=function(baseURL,url,postData){ }) } +// 导出文件请求定义 +const postJsonToFile=function(baseURL,url,postData){ + return request({ + baseURL, + url: url, + method: 'post', + data:postData, + headers:{'Content-Type':'application/json;charset=utf-8'}, + responseType: 'blob' + }) +} + + /** * put请求 */ @@ -174,6 +187,7 @@ export default { get, post, postJson, + postJsonToFile, put, putJson, } diff --git a/src/api/phase2/note.js b/src/api/phase2/note.js index 1c69aa7c..fef48e8e 100644 --- a/src/api/phase2/note.js +++ b/src/api/phase2/note.js @@ -110,7 +110,7 @@ const ids=function (data){ * } * */ const exportExcel=function (data){ - return ajax.postJson(baseURL,'/xboe/subgroup/m/noteinfo/exportExcel',data); + return ajax.postJsonToFile(baseURL,'/xboe/subgroup/m/noteinfo/exportExcel',data); } /** diff --git a/src/views/user/Mynotes.vue b/src/views/user/Mynotes.vue index ed68aa81..5c5f3539 100644 --- a/src/views/user/Mynotes.vue +++ b/src/views/user/Mynotes.vue @@ -22,7 +22,7 @@ Word - +
@@ -34,7 +34,7 @@ type="daterange" start-placeholder="开始" end-placeholder="结束"> - + 全部课程 @@ -44,12 +44,12 @@ - 发布时间 + 修改时间 - 点赞次数 + 点赞次数 @@ -84,7 +84,7 @@ 删除 - + 编辑
@@ -202,7 +202,7 @@ export default { contentType:null, limit:1, }, - + uploadFileUrl: process.env.VUE_APP_BASE_API + '/xboe/sys/xuploader/file/upload', text:'', importDialogVisible:false, @@ -234,7 +234,7 @@ export default { orderpiss:true, Filtertime:[], } - + }, mounted(){ @@ -261,7 +261,7 @@ export default { } else { apiNote.exportExcel(ids).then(res=>{ const link = document.createElement('a');// 创建a标签 - let blob = new Blob([res],{type: 'application/vnd.ms-excel;charset=UTF-8'}); // 设置文件类型 + let blob = new Blob([res],{type: 'application/vnd.ms-excel;charset=UTF-8'}); // 设置文件类型 link.style.display = "none"; link.href = URL.createObjectURL(blob); // 创建URL link.setAttribute("download", "我的笔记.xls"); @@ -275,15 +275,15 @@ export default { if(this.noteFile.courseName == '') { this.$message.warning('请填写标题!'); return - } - this.noteFile.contentType = this.upNoteFile.contentType; - if(this.upNoteFile.content.length > 0) { - this.noteFile.filePath = this.upNoteFile.content.join(); } 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('导入笔记成功'); @@ -357,14 +357,14 @@ export default { this.$message({ type: 'info', message: '已取消删除' - }); + }); }); }, couresitem(item){ this.courseId = item.courseId; this.noteData(this.num) }, - + allcoures(){ apiNote.course().then(res=>{ this.couresna = res.result @@ -383,9 +383,9 @@ export default { this.noteData(this.num) }, handleClose(done) { - - + + }, edit(item){ this.$router.push({ path: `/user/Noteedit?id=${item.id}` }); @@ -412,7 +412,7 @@ export default { this.datalist = res.result.list; this.count = res.result.count; } - + }) }, @@ -463,7 +463,7 @@ export default { font-size: 16px; color: #666666; font-weight: 400; - + } } } @@ -473,7 +473,7 @@ export default { .el-input--medium .el-input__inner{ height: 40px; line-height: 40px; -} +} .el-dropdown-menu--medium .el-dropdown-menu__item{ width: 100% !important; // height: 30px !important; @@ -490,7 +490,7 @@ export default { li{ text-align: center; } - + } .el-popper{ margin-top: 5px; @@ -573,7 +573,7 @@ export default { font-size: 12px; font-weight: 400; color: #6E7B84 !important; - + } .note-all{ width: 100%; @@ -598,7 +598,7 @@ export default { margin-right: 23px; } } - + } } .tabcontent{ @@ -674,4 +674,4 @@ export default { } } } - \ No newline at end of file + diff --git a/src/views/user/Noteedit.vue b/src/views/user/Noteedit.vue index 8d91f281..67c61bf3 100644 --- a/src/views/user/Noteedit.vue +++ b/src/views/user/Noteedit.vue @@ -11,17 +11,11 @@

{{ editdata.courseName }}

8:40
-
+
-
-
- - -
-
还原 -
+
{{ item.beforeContent }}
-
- -
@@ -65,8 +54,6 @@ import apiNote from '@/api/phase2/note.js' export default { data () { return { - imgContent:[], - fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL, isShowList:false, isShowTip:'', radio: '1', @@ -88,21 +75,14 @@ export default { },30000 *10); }, methods:{ - imgDel(index) { - this.imgContent.splice(index,1); - }, comeback(){ this.$router.go(-1); }, notedetail(){ 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.openTypeBackups = res.result.openType; this.histId = res.result.id; - this.hist(); }) }, @@ -112,7 +92,7 @@ export default { cancelButtonText: '取消', type: 'warning' }).then(() => { - this.imgContent = item.beforeContent; + this.editdata.content = item.beforeContent; }).catch(() => { this.$message({ type: 'info', @@ -131,12 +111,6 @@ export default { }, hist(){ apiNote.history(this.histId).then(res=>{ - if(this.editdata.contentType == 3) { - res.result.forEach(item=>{ - item.beforeContent = item.beforeContent.split(','); - }) - - } this.histdata = res.result }) }, @@ -150,9 +124,6 @@ export default { } if(num == 1) { this.editdata.isAuto = true; - } - if(this.imgContent.length > 0) { - this.editdata.content = this.imgContent.join(); } apiNote.update(this.editdata).then(res=>{ if(res.status == 200) { @@ -285,23 +256,6 @@ export default { font-size: 14px; font-weight: 400; 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{ border: none; font-size: 14px;