Commit 34c9189c authored by fangshupeng's avatar fangshupeng

更新进度2020.11.26

parent eddc58b7
...@@ -2,12 +2,14 @@ import loginApi from './loginApi.js' // 登录 ...@@ -2,12 +2,14 @@ import loginApi from './loginApi.js' // 登录
import aliOssApi from './aliOssApi' // ali-oss import aliOssApi from './aliOssApi' // ali-oss
import commonApi from './commonApi' // 公共接口 import commonApi from './commonApi' // 公共接口
import education from './education' // 教务管理 import education from './education' // 教务管理
import platBaseApi from './platBaseApi' // 教务管理
import schoolBasedResourcesApi from './schoolBasedResourcesApi' // 校本资源管理API import schoolBasedResourcesApi from './schoolBasedResourcesApi' // 校本资源管理API
export default { export default {
loginApi, loginApi,
aliOssApi, aliOssApi,
commonApi, commonApi,
platBaseApi,
...education, ...education,
schoolBasedResourcesApi schoolBasedResourcesApi
} }
import http from '@/request/http.js'
export default {
// 获取组织架构
getOrganizeTreeWithUser: () => http.post('/api/Organize/OrganizeTreeWithUser'),
// 获取自定义分组
getCustomGroupWithPeople: () => http.get('/api/CustomGroup/GetCustomGroupWithPeople'),
// 获取学生端组织架构
getGradeStructureWithStudent: () => http.post('/api/Student/GradeStructureWithStudent'),
// 获取学生端组织架构(根据角色)
getGradeStructureWithStudentByPermission: params => http.post('/api/Student/GradeStructureWithStudentByPermission', params)
}
...@@ -28,5 +28,25 @@ export default { ...@@ -28,5 +28,25 @@ export default {
// 获取文档列表 // 获取文档列表
GetFileList (params) { GetFileList (params) {
return http.post('/api/Education/SchoolResource/GetFileList', JSON.stringify(params)) return http.post('/api/Education/SchoolResource/GetFileList', JSON.stringify(params))
},
// 文件分享
fileShare (params) {
return http.post('/api/Education/SchoolResource/MyResource/FileShare', JSON.stringify(params))
},
// 上传文件
uploadFile (params) {
return http.post('/api/Education/SchoolResource/FileInfo/UploadFile', JSON.stringify(params))
},
// 新增编辑个人文件夹
CreateOrUpdateFolder (params) {
return http.post('/api/Education/SchoolResource/PersonalFolderInfo/CreateOrUpdate', JSON.stringify(params))
},
// 删除个人文件夹
deleteFolder (params) {
return http.get('/api/Education/SchoolResource/PersonalFolderInfo/Delete', { params: params })
},
// 获取学校文件夹List
GetSchoolFolderList () {
return http.post('/api/Education/SchoolResource/SchoolFolderInfo/GetSchoolFolderList')
} }
} }
...@@ -47,7 +47,8 @@ const ossPaths = { ...@@ -47,7 +47,8 @@ const ossPaths = {
materialManage: `${schoolCode}/wechatManage/materialManage`, // 素材管理 materialManage: `${schoolCode}/wechatManage/materialManage`, // 素材管理
wechatSet: `${schoolCode}/wechatManage/wechatSet` wechatSet: `${schoolCode}/wechatManage/wechatSet`
}, },
message: `${schoolCode}/Message` // 短信中心 message: `${schoolCode}/Message`, // 短信中心
schoolBasedResources: `${schoolCode}/schoolBasedResources` // 校本资源
} }
......
...@@ -184,9 +184,20 @@ export default { ...@@ -184,9 +184,20 @@ export default {
} }
}, },
mounted () { mounted () {
this.currentFileList = this.fileListData.firstLevelData this.getFolderList()
}, },
methods: { methods: {
getFolderList () {
this.$api.schoolBasedResourcesApi.GetSchoolFolderList().then(res => {
this.$handleResponse(res).then(data => {
console.log(data)
// this.folderListData = data
// this.currentFileList = data
// this.breadcrumb = [{ label: '首页', listData: data, parent: { b_id: '0' }, currentIsFiLe: false }]
// this.initFromBreadcrumb(data)
})
})
},
backCrumb (index) { backCrumb (index) {
this.isFileMode = false this.isFileMode = false
let breadcrumb = this.breadcrumb let breadcrumb = this.breadcrumb
......
<template> <template>
<div class="container"> <div class="container">
<v-header :title="'我的资源'" :is-show-prev-page="isShowPrevPage"></v-header> <v-header :title="'我的资源'" :is-show-prev-page="false"></v-header>
<nav-menu :menus="menus"></nav-menu> <nav-menu :menus="menus"></nav-menu>
<keep-alive> <keep-alive>
<router-view></router-view> <router-view></router-view>
...@@ -42,32 +42,25 @@ export default { ...@@ -42,32 +42,25 @@ export default {
} }
}, },
mounted () { mounted () {
this.getFolderList() // this.getFolderList()
},
created () {
this.initDataFromRoute(this.$route)
}, },
// created () {
// this.initDataFromRoute(this.$route)
// },
watch: { watch: {
$route (to, from) { // $route (to, from) {
this.initDataFromRoute(to) // this.initDataFromRoute(to)
} // }
}, },
methods: { methods: {
getFolderList () { // initDataFromRoute (route) {
this.$api.schoolBasedResourcesApi.GetFolderList().then(res => { // /* 根据路由参数来显示对应数据 */
this.$handleResponse(res).then(data => { // if (route.query.parent_id) { // 有参数说明不是首页,显示返回上一页
console.log(data) // this.isShowPrevPage = true
}) // } else {
}) // this.isShowPrevPage = false
}, // }
initDataFromRoute (route) { // }
/* 根据路由参数来显示对应数据 */
if (route.query.parent_id) { // 有参数说明不是首页,显示返回上一页
this.isShowPrevPage = true
} else {
this.isShowPrevPage = false
}
}
} }
} }
</script> </script>
......
...@@ -29,39 +29,52 @@ ...@@ -29,39 +29,52 @@
:currentIsFiLe="currentIsFiLe" :currentIsFiLe="currentIsFiLe"
@showMenu="showMenu" @showMenu="showMenu"
@intoFolder="intoFolder" @intoFolder="intoFolder"
@uploadFile="uploadFile" @dragUploadFile="dragUploadFile"
@tableIntoFile="intoFolder"> @tableIntoFile="intoFolder">
</component> </component>
</div> </div>
<!-- 右键菜单栏 --> <!-- 右键菜单栏 -->
<myupload-ctx-menu <myupload-ctx-menu
ref="contextMenu"
:menuVisible="menuVisible" :menuVisible="menuVisible"
:currentIsFiLe="currentIsFiLe" :currentIsFiLe="currentIsFiLe"
:uploadVisible="uploadVisible" :uploadVisible="uploadVisible"
:rightMenuData="rightMenuData" :rightMenuData="rightMenuData"
:rightMenuFolder="rightMenuFolder"
:coordinate="coordinate" :coordinate="coordinate"
:menuMode="menuMode" :menuMode="menuMode"
@doShareFile="doShareFile"
@showUploadMenu="showUploadMenu" @showUploadMenu="showUploadMenu"
@menuOpenFile="intoFolder"> @selectUploadPath="selectUploadPath"
@menuOpenFile="intoFolder"
@updateOrCreateFolder="updateOrCreateFolder"
@handleDeleteFolder="handleDeleteFolder">
</myupload-ctx-menu> </myupload-ctx-menu>
<upload-file :selectFolderVisible="selectFolderVisible" @uploadSuccess="selectFolderVisible = false"></upload-file> <upload-file
:list-data="curSelectList"
:selectFolderVisible="selectFolderVisible"
@selectUploadFile="selectUploadFile"
@closeSelectFolderVisible="selectFolderVisible = false"
/>
<!-- 侧滑块查看普通文档 --> <!-- 侧滑块查看普通文档 -->
<el-drawer <el-drawer
title="查看" title="查看"
:visible.sync="documentDrawer" :visible.sync="documentDrawer"
:size="'60%'"> :size="'80%'">
<span>文档内容</span> <iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</el-drawer> </el-drawer>
<input v-show="false" type="file" ref="fileUpload" @change="uploadfileChange"/>
<!-- <button @click="getFolderList">重排</button> -->
</div> </div>
</template> </template>
<script> <script>
import { ossUpload } from '@/assets/utils/ossTool.js'
import ossPaths from '@/assets/ossPaths.js'
export default { export default {
name: 'MyUpload', name: 'MyUpload',
components: { components: {
...@@ -79,9 +92,9 @@ export default { ...@@ -79,9 +92,9 @@ export default {
menuVisible: false, // 右键菜单栏 menuVisible: false, // 右键菜单栏
menuMode: '', // 菜单根据模式显示对于内容 menuMode: '', // 菜单根据模式显示对于内容
uploadVisible: false, // 上传菜单栏 uploadVisible: false, // 上传菜单栏
documentUrl: '', // 文档在线地址
documentDrawer: false, // 查看文档抽屉 documentDrawer: false, // 查看文档抽屉
rightMenuData: {}, // 右键选中文件夹或文件数据 rightMenuData: {}, // 右键选中文件夹或文件数据
rightMenuFolder: [], // 右键空白储存当前文件夹数据
coordinate: { // 菜单栏坐标 coordinate: { // 菜单栏坐标
menuX: '0px', menuX: '0px',
menuY: '0px', menuY: '0px',
...@@ -89,33 +102,68 @@ export default { ...@@ -89,33 +102,68 @@ export default {
uploadY: '0px' uploadY: '0px'
}, },
currentFileList: [], currentFileList: [],
curSelectList: [], // 当前选择需要上传的文件夹当前路径列表
selectFolderVisible: false, // 查看文件侧滑框 selectFolderVisible: false, // 查看文件侧滑框
selectFolderList: [], // 上传文件选择文件夹列表 selectFolderList: [], // 上传文件选择文件夹列表
breadcrumb: ['首页'], // 面包屑 breadcrumb: [], // 面包屑
folderListData: [] uploadData: { // 储存待上传的文件信息
file: null,
folderId: '',
isdrag: false // 当时是否是拖拽获得文件信息
}
} }
}, },
mounted () { mounted () {
this.getFolderList() this.getFolderList()
}, },
created () { created () {
// this.initDataFromRoute(this.$route)
},
watch: {
// $route (to, from) {
// this.initDataFromRoute(to)
// }
}, },
methods: { methods: {
getFolderList () { getFolderList () {
this.$api.schoolBasedResourcesApi.GetFolderList().then(res => { this.$api.schoolBasedResourcesApi.GetFolderList().then(res => {
this.$handleResponse(res).then(data => { this.$handleResponse(res).then(data => {
this.folderListData = data // this.folderListData = data
this.currentFileList = data // this.currentFileList = data
this.breadcrumb = [{ label: '首页', listData: data }] // this.breadcrumb = [{ label: '首页', listData: data, parent: { b_id: '0' }, currentIsFiLe: false }]
this.initFromBreadcrumb(data)
}) })
}) })
}, },
initFromBreadcrumb (data) {
/* 通过面包屑初始化数据 */
this.currentIsFile = false
let breadcrumb = this.breadcrumb
if (breadcrumb.length <= 1) {
this.breadcrumb = [{ label: '首页', listData: data, parent: { b_id: '0', parent_id: '0' }, currentIsFiLe: false }]
this.currentFileList = data
} else {
let newBreadcrumb = [{ label: '首页', listData: data, parent: { b_id: '0', parent_id: '0' }, currentIsFiLe: false }]
let currentList = data
for (let i = 1; i < breadcrumb.length; i++) {
let hasThisFile = false
for (let j = 0; j < currentList.length; j++) {
if (currentList[j].b_id === breadcrumb[i].parent.b_id) {
this.currentIsFile = breadcrumb[i].currentIsFiLe
this.addCrumb(newBreadcrumb, currentList[j], breadcrumb[i].currentIsFiLe)
if (breadcrumb[i].currentIsFiLe === true) {
this.getFileList(currentList[j])
} else {
currentList = currentList[j].children
}
hasThisFile = true
break
}
}
if (hasThisFile === false) {
break
}
}
this.breadcrumb = newBreadcrumb
if (!this.currentIsFile) {
this.currentFileList = currentList
}
}
},
getFileList (file) { getFileList (file) {
const folderId = file.b_id const folderId = file.b_id
const selType = file.folder_type const selType = file.folder_type
...@@ -139,31 +187,146 @@ export default { ...@@ -139,31 +187,146 @@ export default {
this.breadcrumb = breadcrumb.slice(0, index + 1) this.breadcrumb = breadcrumb.slice(0, index + 1)
} }
}, },
addCrumb (file) { addCrumb (breadcrumb, file, currentIsFiLe) {
/* 添加面包屑 */ /* 添加面包屑 */
this.breadcrumb.push({ label: file.folder_name, listData: file.children }) breadcrumb.push({ label: file.folder_name, listData: file.children, parent: file, currentIsFiLe })
}, },
intoFolder (file) { intoFolder (file) {
/* 进入下一级文件夹 */ /* 进入下一级文件夹 */
if (file.children !== null && this.currentIsFiLe === false) { console.log(this.breadcrumb.length)
if ((file.children && file.children.length > 0 && this.currentIsFiLe === false) || (file.file_count === 0 && this.breadcrumb.length < 3)) {
// 进入文件夹 // 进入文件夹
this.currentIsFiLe = false this.currentIsFiLe = false
this.addCrumb(file) this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.currentFileList = file.children this.currentFileList = file.children
} else { } else {
// 获取当前文件夹的文档列表 // 获取当前文件夹的文档列表
if (this.currentIsFiLe === false) { if (this.currentIsFiLe === false) {
this.currentIsFiLe = true this.currentIsFiLe = true
this.addCrumb(file) this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.getFileList(file) this.getFileList(file)
} else { } else {
console.log(1111111, file)
let url = 'https://onlinepreview.vschool100.cn/onlinePreview?url=' + encodeURIComponent(file.file_path)
this.documentUrl = url
this.documentDrawer = true this.documentDrawer = true
} }
} }
}, },
uploadFile (fileData, row) { dragUploadFile (fileData, file) {
/* 文件选择上传位置 */ /* 拖拽文件选择上传位置 */
this.selectFolderVisible = true this.uploadData.isdrag = true
if (fileData.length > 1) {
this.$message({
message: '每次只能上传一个文件',
type: 'error'
})
return
}
this.uploadData.file = fileData[0]
if (file.children && file.children.length > 0) {
this.curSelectList = file.children
this.selectFolderVisible = true
} else {
this.uploadData.folderId = file.b_id
this.uploadByOss()
}
},
selectUploadPath (file) {
/* 点击上传选择上传位置 */
this.uploadData.isdrag = false
if (file.children && file.children.length > 0) {
this.curSelectList = file.children
this.selectFolderVisible = true
} else {
this.uploadData.folderId = file.b_id
this.$refs.fileUpload.click()
}
},
selectUploadFile (file) {
/* 选择本地文件 */
this.uploadData.folderId = file.b_id
this.selectFolderVisible = false
if (this.uploadData.isdrag) {
this.uploadByOss()
} else {
this.$refs.fileUpload.click()
}
},
uploadfileChange (e) {
/* 当file input选择文件改变时触发 */
let file = e.target.files[0]
this.uploadData.file = file
this.uploadByOss()
},
uploadByOss () {
/* 通过oss上传文件 */
let file = this.uploadData.file
ossUpload({
path: ossPaths.schoolBasedResources,
file,
progress: (percent) => {
console.log(percent)
}
}).then(res => {
this.uploadToApi(res)
})
},
uploadToApi (data) {
/* 将oss返回的文件信息储存到后端 */
let uploadData = {
folder_info_id: this.uploadData.folderId,
file_name: data.name,
file_path: data.url
}
this.$api.schoolBasedResourcesApi.uploadFile(uploadData).then(res => {
if (res.data.Status === true) {
this.$message({
message: '上传成功',
type: 'success'
})
this.getFolderList()
}
})
},
doShareFile (params) {
/* 分享文件 */
this.$api.schoolBasedResourcesApi.fileShare(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '分享成功',
type: 'success'
})
this.$refs.contextMenu.shareVisible = false
}
})
},
updateOrCreateFolder (params, message) {
/* 新增或编辑个人文件夹 */
this.$api.schoolBasedResourcesApi.CreateOrUpdateFolder(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: message,
type: 'success'
})
this.$refs.contextMenu.newFolderVisible = false
this.$refs.contextMenu.renameVisible = false
this.getFolderList()
}
})
},
handleDeleteFolder (params) {
/* 删除个人文件夹 */
this.$api.schoolBasedResourcesApi.deleteFolder(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '删除成功',
type: 'success'
})
this.$refs.contextMenu.deleteVisible = false
this.getFolderList()
}
})
}, },
showMenu (MouseEvent, currentIsFiLe, row) { showMenu (MouseEvent, currentIsFiLe, row) {
/* 右键文件夹或文件时触发 */ /* 右键文件夹或文件时触发 */
...@@ -175,12 +338,12 @@ export default { ...@@ -175,12 +338,12 @@ export default {
this.menuMode = 'personal' this.menuMode = 'personal'
} }
this.rightMenuData = row this.rightMenuData = row
this.rightMenuFolder = [] // this.rightMenuFolder = []
} else { } else {
// 右键空白处 // 右键空白处
this.menuMode = 'blank' this.menuMode = 'blank'
this.rightMenuFolder = this.currentFileList // this.rightMenuFolder = this.currentFileList
this.rightMenuData = {} this.rightMenuData = this.breadcrumb[this.breadcrumb.length - 1].parent
} }
this.menuVisible = false this.menuVisible = false
this.uploadVisible = false this.uploadVisible = false
......
...@@ -69,8 +69,8 @@ export default { ...@@ -69,8 +69,8 @@ export default {
fileDrop (event, file) { fileDrop (event, file) {
this.borderHover = false this.borderHover = false
let fileData = event.dataTransfer.files let fileData = event.dataTransfer.files
let row = this.file let row = file
this.$emit('uploadFile', fileData, row) this.$emit('dragUploadFile', fileData, row)
} }
} }
} }
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<div class="menus-title"> <div class="menus-title">
<span>{{ item.user_name }}</span> <span>{{ item.user_name }}</span>
<span class="upload-count" v-show="!taskMode">{{ item.total_count }}</span> <span class="upload-count" v-show="!taskMode">{{ item.total_count }}</span>
<div class="progress-ctn" v-show="taskMode"> <div class="progress-ctn" v-if="taskMode">
<div style="flex: 1;margin-top: 7px;"> <div style="flex: 1;margin-top: 7px;">
<el-progress :show-text="false" :percentage="item.upload_count / item.total_count"></el-progress> <el-progress :show-text="false" :percentage="item.upload_count / item.total_count"></el-progress>
</div> </div>
...@@ -33,7 +33,8 @@ ...@@ -33,7 +33,8 @@
v-for="(innerItem, innerIndex) of item.fileChildren" v-for="(innerItem, innerIndex) of item.fileChildren"
:key="innerIndex" :key="innerIndex"
:index="(index+1)+'-'+(innerIndex+1)" :index="(index+1)+'-'+(innerIndex+1)"
@contextmenu.native.prevent.stop="showMenu($event,item)"> @contextmenu.native.prevent.stop="showMenu($event,innerItem)"
@dblclick.native="showFileOL(innerItem)">
<span v-show="taskMode" class="point"></span>{{ innerItem.file_name }} <span v-show="taskMode" class="point"></span>{{ innerItem.file_name }}
</el-menu-item> </el-menu-item>
</el-menu-item-group> </el-menu-item-group>
...@@ -42,6 +43,7 @@ ...@@ -42,6 +43,7 @@
</div> </div>
</div> </div>
<div class="right-document"> <div class="right-document">
<iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</div> </div>
<!-- 右键菜单栏 --> <!-- 右键菜单栏 -->
...@@ -88,6 +90,7 @@ export default { ...@@ -88,6 +90,7 @@ export default {
value: 'allItem', value: 'allItem',
label: '全部学期' label: '全部学期'
}], }],
documentUrl: '', // 文档在线预览地址
deleteVisible: false, // 删除确认弹框 deleteVisible: false, // 删除确认弹框
coordinate: { // 菜单栏坐标 coordinate: { // 菜单栏坐标
menuX: '0px', menuX: '0px',
...@@ -105,6 +108,11 @@ export default { ...@@ -105,6 +108,11 @@ export default {
this.coordinate.menuY = MouseEvent.pageY + 'px' this.coordinate.menuY = MouseEvent.pageY + 'px'
document.addEventListener('click', this.foo) // 给整个document添加监听鼠标事件,点击任何位置执行foo方法 document.addEventListener('click', this.foo) // 给整个document添加监听鼠标事件,点击任何位置执行foo方法
}, },
showFileOL (file) {
/* 双击预览文档 */
let url = 'https://onlinepreview.vschool100.cn/onlinePreview?url=' + encodeURIComponent(file.file_path)
this.documentUrl = url
},
listOpen (index) { listOpen (index) {
let listIndex = parseInt(index) - 1 let listIndex = parseInt(index) - 1
this.$emit('getMaterialFile', listIndex) this.$emit('getMaterialFile', listIndex)
......
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
<ul class="menu"> <ul class="menu">
<li class="menu_item padding_35" v-show="menuMode!=='blank'" @click="clickFile">打开</li> <li class="menu_item padding_35" v-show="menuMode!=='blank'" @click="clickFile">打开</li>
<li class="menu_item padding_35" v-show="menuMode==='file'">下载</li> <li class="menu_item padding_35" v-show="menuMode==='file'">下载</li>
<li class="menu_item" @click.prevent.stop="showUploadMenu" v-show="menuMode !== 'file' && menuMode !== 'blank' || (menuMode === 'blank' && currentIsFiLe)"><span class="upload_line"><i class="el-icon-upload upload-icon"></i></span>上传材料</li> <li class="menu_item" @click.prevent.stop="showUploadMenu" v-show="(menuMode !== 'file' && menuMode !== 'blank') || (menuMode === 'blank' && currentIsFiLe) || (menuMode === 'blank' && rightMenuData.file_count === 0)"><span class="upload_line"><i class="el-icon-upload upload-icon"></i></span>上传材料</li>
<li class="menu_item padding_35" v-show="menuMode === 'personal' || menuMode === 'file'" @click="renameVisible = true">重命名</li> <li class="menu_item padding_35" v-show="(menuMode === 'personal' || menuMode === 'file') && rightMenuData.folder_type !== 1" @click="clickRenameBtn">重命名</li>
<li class="menu_item padding_35" v-show="menuMode === 'file'" @click="visible = true">分享</li> <li class="menu_item padding_35" v-show="menuMode === 'file'" @click="shareVisible = true">分享</li>
<li class="menu_item padding_35" v-show="menuMode === 'personal' || menuMode === 'file'" @click="deleteVisible = true">删除</li> <li class="menu_item padding_35" v-show="(menuMode === 'personal' || menuMode === 'file') && rightMenuData.folder_type !== 1" @click="deleteVisible = true">删除</li>
<li class="menu_item" style="text-align:center" v-show="menuMode === 'blank' && currentIsFiLe === false" @click="newFolderVisible = true">新建个人文件夹</li> <li class="menu_item" style="text-align:center" v-show="(menuMode === 'blank' && currentIsFiLe === false) && rightMenuData.folder_type !== 1" @click="newFolderVisible = true">新建个人文件夹</li>
</ul> </ul>
</div> </div>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<div v-show="uploadVisible" id="upload_menu" :style="'left:'+coordinate.uploadX+';top:'+coordinate.uploadY"> <div v-show="uploadVisible" id="upload_menu" :style="'left:'+coordinate.uploadX+';top:'+coordinate.uploadY">
<p class="upload_title">普通文档</p> <p class="upload_title">普通文档</p>
<ul class="upload_menu"> <ul class="upload_menu">
<li class="menu_item"><span class="upload_line"><i class="el-icon-document document-icon"></i></span>本地上传</li> <li class="menu_item" @click="selectUploadPath"><span class="upload_line"><i class="el-icon-document document-icon"></i></span>本地上传</li>
</ul> </ul>
<p class="upload_title">腾讯文档</p> <p class="upload_title">腾讯文档</p>
<ul class="upload_menu"> <ul class="upload_menu">
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<el-input v-model="rename" placeholder="请输入名称"></el-input> <el-input v-model="rename" placeholder="请输入名称"></el-input>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="renameVisible = false">取 消</el-button> <el-button @click="renameVisible = false">取 消</el-button>
<el-button type="primary" @click="renameVisible = false">确 定</el-button> <el-button type="primary" @click="handleUpdate">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<el-input v-model="newFolderName" placeholder="请输入文件夹名称"></el-input> <el-input v-model="newFolderName" placeholder="请输入文件夹名称"></el-input>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="newFolderVisible = false">取 消</el-button> <el-button @click="newFolderVisible = false">取 消</el-button>
<el-button type="primary" @click="newFolderVisible = false">确 定</el-button> <el-button type="primary" @click="createFolder">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<h3>删除后不可恢复,确定删除吗?</h3> <h3>删除后不可恢复,确定删除吗?</h3>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="deleteVisible = false">取 消</el-button> <el-button @click="deleteVisible = false">取 消</el-button>
<el-button type="primary" @click="deleteVisible = false">确 定</el-button> <el-button type="primary" @click="handleDelete">确 定</el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -58,37 +58,38 @@ ...@@ -58,37 +58,38 @@
<el-dialog class='share-ctn' title="分享" :visible.sync="shareVisible" width="500px"> <el-dialog class='share-ctn' title="分享" :visible.sync="shareVisible" width="500px">
<div class="header-ctn"> <div class="header-ctn">
<span>分享给:</span> <span>分享给:</span>
<el-button class="person-btn" icon="el-icon-plus" @click="teacherSelectorOptions.isBlock = true">选择教师</el-button> <el-button class="person-btn" icon="el-icon-plus" @click="userSelector.visible = true">选择教师</el-button>
<span class="person-count">已选择 <span style="color:blue">6</span></span> <span class="person-count">已选择 <span style="color:blue">{{ userSelector.list.length }}</span></span>
</div> </div>
<div class="tag-ctn"> <div class="tag-ctn">
<el-tag <el-tag
v-for="(tag, index) in tags" v-for="(people, index) in userSelector.list"
:key="index" :key="index"
effect="dark" effect="dark"
type="info" type="info"
color="#F2F2F2" color="#F2F2F2"
size="medium" size="medium"
@close="deleteUser(index)"
closable> closable>
{{tag.name}} {{people.realname}}
</el-tag> </el-tag>
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button @click="shareVisible = false">取 消</el-button> <el-button @click="shareVisible = false">取 消</el-button>
<el-button type="primary" @click="shareVisible = false">确 定</el-button> <el-button type="primary" @click="handleShare">确 定</el-button>
</div> </div>
<userselector
:mode="userSelector.mode"
:list="userSelector.list"
:visible.sync="visible"
@submit="selectUser"
/>
<!-- <teacher-selector <!-- <teacher-selector
:teacherSelectorOptions="teacherSelectorOptions" :teacherSelectorOptions="teacherSelectorOptions"
@closeTeacherSelector="teacherSelectorOptions.isBlock = false"> @closeTeacherSelector="teacherSelectorOptions.isBlock = false">
</teacher-selector> --> </teacher-selector> -->
</el-dialog> </el-dialog>
<userselector
:mode="userSelector.mode"
:list="userSelector.list"
:visible.sync="userSelector.visible"
@submit="selectUser"
/>
</div> </div>
</template> </template>
...@@ -115,19 +116,19 @@ export default { ...@@ -115,19 +116,19 @@ export default {
return {} return {}
} }
}, },
rightMenuFolder: { // 右键空白所在层的文件夹数据 // rightMenuFolder: { // 右键空白所在层的文件夹数据
type: Array, // type: Array,
default: () => { // default: () => {
return [] // return []
} // }
}, // },
coordinate: { // 右键菜单栏坐标 coordinate: { // 右键菜单栏坐标
type: Object, type: Object,
default: () => { default: () => {
return {} return {}
} }
}, },
menuMode: { // 右键的文件属于那种类型(file: 文件,personal: 个人文件夹, blank: 右键空白 ) menuMode: { // 右键的文件属于那种类型(file: 文件,personal: 文件夹, blank: 右键空白 )
type: String, type: String,
default: '' default: ''
} }
...@@ -149,28 +150,93 @@ export default { ...@@ -149,28 +150,93 @@ export default {
newFolderVisible: false, // 新建文件夹窗口 newFolderVisible: false, // 新建文件夹窗口
newFolderName: '', newFolderName: '',
deleteVisible: false, // 删除文件窗口 deleteVisible: false, // 删除文件窗口
shareVisible: false, // 分享文件窗口 shareVisible: false // 分享文件窗口
tags: [ // tags: [
{ name: '标某某' }, // { name: '标某某' },
{ name: '某某某' }, // { name: '某某某' },
{ name: '某某某' }, // { name: '某某某' },
{ name: '某某某' }, // { name: '某某某' },
{ name: '某某某' }, // { name: '某某某' },
{ name: '某某某' } // { name: '某某某' }
] // ]
} }
}, },
methods: { methods: {
showUploadMenu (event) { showUploadMenu (event) {
// event.stopPropagation()
this.$emit('showUploadMenu') this.$emit('showUploadMenu')
}, },
clickFile () { clickFile () {
let file = this.rightMenuData let file = this.rightMenuData
this.$emit('menuOpenFile', file) this.$emit('menuOpenFile', file)
}, },
selectUploadPath () {
/* 点击上传文件 */
let file = this.rightMenuData
this.$emit('selectUploadPath', file)
},
deleteUser (index) {
this.userSelector.list.splice(index, 1)
},
selectUser (list) { selectUser (list) {
console.log(111111, list) this.userSelector.list = list
},
handleShare () {
let userList = this.userSelector.list
if (userList.length === 0) {
this.$message({
message: '分享名单不能为空',
type: 'error'
})
return
}
let fileInfoId = this.rightMenuData.file_info_id
let teacherUserIds = ''
let teacherUserNames = ''
for (let i = 0; i < userList.length; i++) {
if (i === 0) {
teacherUserIds += userList[i].id
teacherUserNames += userList[i].realname
} else {
teacherUserIds += ',' + userList[i].id
teacherUserNames += ',' + userList[i].realname
}
}
let apiData = { file_info_id: fileInfoId, teacher_user_ids: teacherUserIds, teacher_user_names: teacherUserNames }
this.$emit('doShareFile', apiData)
},
createFolder () {
/* 创建个人文件夹 */
let folderName = this.newFolderName
let data = {
// b_id: this.rightMenuData.b_id,
parent_id: this.rightMenuData.b_id,
folder_name: folderName
}
this.$emit('updateOrCreateFolder', data, '创建文件夹成功')
this.newFolderName = ''
},
clickRenameBtn () {
/* 点击重命名按钮 */
this.rename = this.rightMenuData.folder_name
this.renameVisible = true
},
handleUpdate () {
/* 修改个人文件夹名称 */
let folderName = this.rename
let data = {
b_id: this.rightMenuData.b_id,
parent_id: this.rightMenuData.parent_id,
folder_name: folderName
}
this.$emit('updateOrCreateFolder', data, '修改文件夹名称成功')
this.rename = ''
},
handleDelete () {
/* 删除个人文件夹 */
let data = {
b_id: this.rightMenuData.b_id
}
this.$emit('handleDeleteFolder', data)
} }
} }
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<template slot-scope="scope"> <template slot-scope="scope">
<div class="is-folder"> <div class="is-folder">
<i :class="currentIsFiLe?'el-icon-document': 'el-icon-folder'+' file-icon'"></i> <i :class="currentIsFiLe?'el-icon-document': 'el-icon-folder'+' file-icon'"></i>
<span style="margin-left: 10px">{{ scope.row.file_name }}</span> <span style="margin-left: 10px">{{ scope.row.file_name || scope.row.folder_name }}</span>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
...@@ -22,12 +22,12 @@ ...@@ -22,12 +22,12 @@
label="类型" label="类型"
width="170"> width="170">
<template slot-scope="scope"> <template slot-scope="scope">
{{ folderTypeOptions[scope.row.file_type] }} {{ folderTypeOptions[scope.row.file_type || scope.row.folder_type] }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="mode != 'favor' && !currentIsFiLe" v-if="mode != 'favor' && !currentIsFiLe"
prop="uploadCount" prop="file_count"
label="我上传的数量" label="我上传的数量"
width="170"> width="170">
</el-table-column> </el-table-column>
......
<template> <template>
<el-dialog <el-dialog
title="请选择目标文件夹(必选)" title="请选择目标文件夹(必选)"
:visible.sync="selectFolderVisible" :visible.sync="visible"
width="500px"> width="500px">
<div class="folder-select"> <div class="folder-select" v-for="firstLevel of listData" :key="firstLevel.b_id">
<div class="folder-line select-first"> <!-- 第一层 -->
<div :class="{canSelect: !(firstLevel.children && firstLevel.children.length > 0)}" class="folder-line select-first" @click="upload(firstLevel)">
<i class="el-icon-folder folder-icon"></i> <i class="el-icon-folder folder-icon"></i>
<span class="folderName">一年级文案</span> <span class="folderName">{{ firstLevel.folder_name }}</span>
</div> </div>
<div v-for="(item, index) of 3" :key="index" class="folder-line select-second canSelect"> <div v-if="firstLevel.children && firstLevel.children.length > 0">
<i class="el-icon-folder folder-icon"></i> <!-- 第二层 -->
<span class="folderName" @click="upload">语文文案</span> <div v-for="secondLevel of firstLevel.children" :key="secondLevel.b_id" class="select-padding">
</div> <div :class="{canSelect: !(secondLevel.children && secondLevel.children.length > 0)}" class="folder-line" @click="upload(secondLevel)">
</div> <i class="el-icon-folder folder-icon"></i>
<div class="folder-select"> <span class="folderName">{{ secondLevel.folder_name }}</span>
<div class="folder-line select-first"> </div>
<i class="el-icon-folder folder-icon"></i> <div v-if="secondLevel.children && secondLevel.children.length > 0">
<span class="folderName">二年级文案</span> <!-- 第三层 -->
</div> <div v-for="thirdLevel of secondLevel.children" :key="thirdLevel.b_id" class="select-padding" @click="upload(thirdLevel)">
<div v-for="(item, index) of 3" :key="index" class="folder-line select-second canSelect"> <div class="folder-line canSelect">
<i class="el-icon-folder folder-icon"></i> <i class="el-icon-folder folder-icon"></i>
<span class="folderName" @click="upload">语文文案</span> <span class="folderName">{{ thirdLevel.folder_name }}</span>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</el-dialog> </el-dialog>
...@@ -30,23 +35,44 @@ ...@@ -30,23 +35,44 @@
export default { export default {
name: 'UploadFile', name: 'UploadFile',
props: { props: {
listData: {
type: Array,
default: () => {
return []
}
},
selectFolderVisible: { selectFolderVisible: {
type: Boolean, type: Boolean,
default: false default: false
} }
}, },
computed: {
visible: {
get () {
return this.selectFolderVisible
},
set (value) {
this.$emit('closeSelectFolderVisible')
}
}
},
data () { data () {
return { return {
} }
}, },
methods: { methods: {
upload () { upload (file) {
this.$message({ if (!(file.children && file.children.length > 0)) {
message: '上传成功', this.$emit('selectUploadFile', file)
type: 'success' }
}) // this.$message({
this.$emit('uploadSuccess') // message: '上传成功',
// type: 'success'
// })
} }
// close () {
// this.$emit('closeSelectFolderVisible')
// }
} }
} }
</script> </script>
...@@ -73,7 +99,7 @@ export default { ...@@ -73,7 +99,7 @@ export default {
padding-left: 10px; padding-left: 10px;
} }
.select-second { .select-padding {
padding-left: 60px; padding-left: 60px;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment