This commit is contained in:
zhaofang
2022-09-27 20:24:23 +08:00
parent 021f02ece5
commit 88c2061094
7 changed files with 490 additions and 39 deletions

View File

@@ -1,25 +1,25 @@
<template>
<div style="padding: 38px 42px;">
<div class="note-info-index" style="padding: 38px 42px;">
<div class="note-hear">
<h3>我的笔记</h3>
<div>
<el-dropdown style="margin-left:15px">
<el-dropdown style="margin-left:15px" @command="exportCommand">
<el-button>
导出<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>PDF</el-dropdown-item>
<el-dropdown-item>Excel</el-dropdown-item>
<el-dropdown-item command="1">PDF</el-dropdown-item>
<el-dropdown-item command="2">Excel</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
<el-dropdown style="margin-left:15px">
<el-dropdown style="margin-left:15px" @command="importCommand">
<el-button>
导入<i class="el-icon-arrow-down el-icon--right"></i>
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item>图片</el-dropdown-item>
<el-dropdown-item>Txt</el-dropdown-item>
<el-dropdown-item>Word</el-dropdown-item>
<el-dropdown-item command="3">图片</el-dropdown-item>
<el-dropdown-item command="1">Txt</el-dropdown-item>
<el-dropdown-item command="2">Word</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
@@ -65,8 +65,9 @@
<div class="note-all-info" v-for="(item,idx) in datalist" :key="idx">
<div class="all-title">
<h3> {{ item.courseName }} </h3>
<div v-if="item.type==2">导入</div>
<div v-if="item.playTime != ''"><img src="../../../public/images/coteplay.png" alt=""> {{ getHMS(item.playTime) }} </div>
<span style="margin-left:34px">{{item.openType == 9?'公开':'私密'}}</span>
<span style="margin-left:14px">{{item.openType == 9?'公开':'私密'}}</span>
<h6>{{ item.sysUpdateTime }}</h6>
</div>
<div class="all-content">
@@ -76,7 +77,7 @@
<div class="all-footer">
<div>
<div class="textbut-box">
<interactBar 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">
<svg-icon icon-class="notedel" ></svg-icon> 删除</el-button>
<el-button @click="edit(item)" class="textbut" type="text">
@@ -98,7 +99,32 @@
</el-pagination>
</div>
</div>
<file-upload dir="files" :showList="true" :value="imageShowUrl" :limit="5" @success="handleUploadSuccess" @remove="handleRemoveSuccess"></file-upload>
<!-- 导入 -->
<el-dialog
:visible.sync="importDialogVisible"
width="785px"
:before-close="handleClose">
<div class="import-info">
<p class="import-info-tip">导入笔记</p>
<div class="import-info-enclosure">
<label class="label"><svg-icon style="font-size:12px;margin-right:5px" icon-class="red-start"></svg-icon>标题</label>
<el-input
type="text"
placeholder="请输入内容"
v-model="noteFile.courseName"
maxlength="20"
show-word-limit/>
</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>
</div>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="importDialogVisible = false"> </el-button>
<el-button type="primary" @click="noteSave()"> </el-button>
</span>
</el-dialog>
<el-dialog
width="860px"
title="王明"
@@ -149,11 +175,29 @@
<script>
import apiNote from '@/api/phase2/note.js';
import interactBar from '@/components/Portal/interactBar.vue';
import FileUpload from '@/components/FileUpload/index.vue';
import FileUpload from '@/components/NoteUpload/index.vue';
import { mapGetters } from 'vuex';
export default {
components:{interactBar,FileUpload},
computed: {
...mapGetters(['userInfo'])
},
data(){
return{
noteFile:{
contentType:null,
type:2,
courseName:'',
filePath:'',
fileName:'',
openType:1,
},
fileType:[],
filType:null,
limit:1,
uploadFileUrl: process.env.VUE_APP_BASE_API + '/xboe/sys/xuploader/file/upload',
text:'',
importDialogVisible:false,
imageShowUrl:'',
count:0,
fileBaseUrl: process.env.VUE_APP_FILE_BASE_URL,
@@ -190,11 +234,82 @@ export default {
this.allcoures();
},
methods: {
handleRemoveSuccess() {
exportCommand(e) {
let ids = this.datalist.map(item=>{
if(item.contentType !=3) {
return item.id;
}
})
console.log(ids,'contentType');
let data = {
// name:this.userInfo.name,
// sign:'abcd',
ids:["1017809571512426496","1017807633689452544"],
// author:'/upload/2022/5/979502964375564288.png',//this.userInfo.avatar,
}
if(e == '1') {
apiNote.exportPdf(data).then(res=>{
})
} 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'}); // 设置文件类型
link.style.display = "none";
link.href = URL.createObjectURL(blob); // 创建URL
link.setAttribute("download", "我的笔记.xls");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
}
console.log(e,'e');
},
noteSave() {
if(this.noteFile.courseName == '') {
this.$message.warning('请填写标题!');
return
}
this.noteFile.contentType =this.filType;
apiNote.save(this.noteFile).then(res=>{
if(res.status == 200) {
this.$message.success('导入笔记成功');
this.importDialogVisible = false;
this.noteData(this.num);
}
})
},
handleBeforeUpload() {
},
handleUploadSuccess() {
importCommand(e){
this.importDialogVisible = true;
this.filType = e;
if(e == '3') {
this.limit = 9;
this.fileType = ["png","jpg"];
} else if(e == '1'){
this.fileType = ["txt"];
} else {
this.fileType = ["doc","docx"];
}
},
handleRemoveSuccess(file) {
if(this.filType == 1) {
// this.noteFile.filePath.replace(file.response.result.filePath+',','');
} else {
this.noteFile.filePath ='';
this.noteFile.fileName = '';
}
},
handleUploadSuccess(file) {
if(this.filType == 3) {
this.noteFile.fileName = '图片';
this.noteFile.filePath += file.result.filePath;
} else {
this.noteFile.filePath = file.result.filePath;
this.noteFile.fileName = file.result.displayName;
}
},
handleCommand(e) {
this.courseId = e;
@@ -238,6 +353,7 @@ export default {
publish(){
this.ordertime = !this.ordertime;
this.orderType = !this.orderType;
this.orderField = 'sysCreateTime';
this.noteData(this.num)
},
thumbs(){
@@ -297,6 +413,32 @@ export default {
</script>
<style lang="scss" scoped>
.note-info-index{
::v-deep .el-upload-dragger{
width: 500px;
height: 168px;
}
.import-info{
padding: 0 74px;
}
.import-info-tip{
font-size: 18px;
font-weight: 600;
color: #333333;
margin-bottom: 34px;
}
.import-info-enclosure{
display: flex;
margin-bottom: 27px;
.label{
width: 72px;
font-size: 16px;
color: #666666;
font-weight: 400;
}
}
}
.el-select-dropdown__item{
width: 140px !important;
}