Commit 7b2a9c12 authored by 赵炳峰's avatar 赵炳峰
parents a74dc3aa 61b5d3e2
......@@ -2,12 +2,14 @@ import loginApi from './loginApi.js' // 登录
import aliOssApi from './aliOssApi' // ali-oss
import commonApi from './commonApi' // 公共接口
import education from './education' // 教务管理
import platBaseApi from './platBaseApi' // 教务管理
import schoolBasedResourcesApi from './schoolBasedResourcesApi' // 校本资源管理API
export default {
loginApi,
aliOssApi,
commonApi,
platBaseApi,
...education,
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,49 @@ export default {
// 获取文档列表
GetFileList (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 })
},
// 删除文件
deleteFile (params) {
return http.get('/api/Education/SchoolResource/FileInfo/DeleteFile', { params: params })
},
// 修改文件名称
updateFileName (params) {
return http.get('/api/Education/SchoolResource/FileInfo/UpdateFileName', { params: params })
},
// 获取学校文件夹List
GetSchoolFolderList () {
return http.get('/api/Education/SchoolResource/SchoolFolderInfo/GetSchoolFolderList')
},
// 新增编辑学校文件夹
createOrUpdateSchool (params) {
return http.post('/api/Education/SchoolResource/SchoolFolderInfo/CreateOrUpdate', JSON.stringify(params))
},
// 获取校内资源文件夹List
getSchoolResourceFolderList () {
return http.get('/api/Education/SchoolResource/GetFolderList')
},
// 删除学校文件夹
deleteSchoolFolder (params) {
return http.get('/api/Education/SchoolResource/SchoolFolderInfo/Delete', { params: params })
},
// 获取学校文件夹对象
getSchoolFolderInfo (params) {
return http.get('/api/Education/SchoolResource/SchoolFolderInfo/Get', { params: params })
}
}
......@@ -47,7 +47,8 @@ const ossPaths = {
materialManage: `${schoolCode}/wechatManage/materialManage`, // 素材管理
wechatSet: `${schoolCode}/wechatManage/wechatSet`
},
message: `${schoolCode}/Message` // 短信中心
message: `${schoolCode}/Message`, // 短信中心
schoolBasedResources: `${schoolCode}/schoolBasedResources` // 校本资源
}
......
......@@ -8,7 +8,7 @@
v-for="(breadcrumbItem, index) of breadcrumb"
:key="index"
@click.native="backCrumb(index)">
{{ breadcrumbItem.name }}
{{ breadcrumbItem.label }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
......@@ -18,7 +18,9 @@
<div class="smallCtn">
<small-folder
:file-list="currentFileList"
:currentIsFiLe="currentIsFiLe"
:manage-mode="true"
:mode="'school'"
@showMenu="showMenu"
@tableIntoFile="intoFolder">
</small-folder>
......@@ -27,21 +29,25 @@
<!-- 右键菜单栏 -->
<manage-ctx-menu
ref="contextMenu"
:menuVisible="menuVisible"
:rightMenuData="rightMenuData"
:rightMenuFolder="rightMenuFolder"
:currentIsFiLe="currentIsFiLe"
:coordinate="coordinate"
:menuMode="menuMode"
@menuOpenFile="intoFolder">
@menuOpenFile="intoFolder"
@createOrUpdateFolder="createOrUpdateFolder"
@handleDeleteFolder="handleDeleteSchoolFolder">
</manage-ctx-menu>
<!-- 侧滑块查看普通文档 -->
<el-drawer
title="查看"
:visible.sync="documentDrawer"
:size="'60%'">
<span>文档内容</span>
:size="'80%'">
<iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</el-drawer>
<button v-show="false" ref="btn" @click="currentIsFiLe = true">设置当前页面为文件模式</button>
</div>
</template>
......@@ -57,173 +63,171 @@ export default {
return {
menuVisible: false, // 右键菜单栏
menuMode: '', // 菜单根据模式显示对于内容
documentDrawer: false, // 查看文档抽屉
rightMenuData: {}, // 右键选中文件夹或文件数据
rightMenuFolder: [], // 右键空白储存当前文件夹数据
currentIsFiLe: false, // 当前层次是否为文档列表
coordinate: { // 菜单栏坐标
menuX: '0px',
menuY: '0px'
},
breadcrumb: [ // 面包屑
{
name: '首页',
isFolder: true,
folderName: 'firstLevelData'
}
],
breadcrumb: [],
currentFileList: [],
fileListData: {
firstLevelData: [
{
id: 1201,
name: '教案文件夹',
typeName: '任务文件夹',
type: 'folder',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
documentCount: '1000',
private: '不公开',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
documentUrl: '', // 文档在线地址
documentDrawer: false, // 查看文档抽屉
paginationQuery: { // 分页信息
amount: 0,
pageSize: 50,
pageIndex: 1
}
}
},
{
id: 1202,
name: '教案文件夹',
typeName: '常规文件夹',
type: 'folder',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
documentCount: '220',
private: '对所有教师公开',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
mounted () {
this.getFolderList()
},
{
id: 1203,
name: '教案文件夹',
typeName: '常规文件夹',
type: 'folder',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
documentCount: '80',
private: '对所有教师公开',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
}
],
secondLevelData: [
{
id: 1001,
name: '第二级文件夹',
typeName: '常规文件夹',
type: 'folder',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
documentCount: '80',
private: '对所有教师公开',
isFocus: false,
isFolder: true,
folderData: 'thirdLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
methods: {
getFolderList () {
this.$api.schoolBasedResourcesApi.GetSchoolFolderList().then(res => {
this.$handleResponse(res).then(data => {
this.initFromBreadcrumb(data)
})
})
},
{
id: 1002,
name: '第二级文件夹',
typeName: '教案文件夹',
type: 'folder',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
documentCount: '80',
private: '对所有教师公开',
isFocus: false,
isFolder: true,
folderData: 'thirdLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
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) {
let isFile = (!currentList[j].children || currentList[j].children.length === 0) && currentList[j].file_count > 0
this.currentIsFile = isFile
this.addCrumb(newBreadcrumb, currentList[j], isFile)
if (isFile) {
this.getFileList(currentList[j])
} else {
currentList = currentList[j].children
}
hasThisFile = true
break
}
],
thirdLevelData: [
{
id: 1101,
name: '第三级文件.txt',
typeName: '文件',
type: 'folder',
icon: 'el-icon-document',
descript: '我上传了10个文档',
documentCount: '80',
private: '对所有教师公开',
isFocus: false,
isFolder: false,
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
}
]
if (hasThisFile === false) {
break
}
}
this.breadcrumb = newBreadcrumb
if (!this.currentIsFile) {
this.currentFileList = currentList
}
}
},
mounted () {
this.currentFileList = this.fileListData.firstLevelData
getFileList (file) {
/* 根据文件夹ID获取对应文件列表 */
this.$refs.btn.click()
const folderId = file.b_id
const selType = file.folder_type
let data = {
data: { folder_id: folderId, sel_type: selType },
PageSize: this.paginationQuery.pageSize,
PageNumber: this.paginationQuery.pageIndex
}
this.$api.schoolBasedResourcesApi.GetFileList(data).then(res => {
this.$handleResponse(res).then(data => {
this.currentFileList = data.Data
this.paginationQuery.amount = data.TotalRecords
})
})
},
methods: {
backCrumb (index) {
this.isFileMode = false
/* 点击面包屑返回前几级 */
let breadcrumb = this.breadcrumb
let item = breadcrumb[index]
this.currentIsFiLe = false
if (index < breadcrumb.length - 1) {
let folderName = breadcrumb[index].folderName
this.currentFileList = this.fileListData[folderName]
this.currentFileList = item.listData
this.breadcrumb = breadcrumb.slice(0, index + 1)
}
},
addCrumb (breadcrumb, file, currentIsFiLe) {
/* 添加面包屑 */
breadcrumb.push({ label: file.folder_name, listData: file.children, parent: file, currentIsFiLe })
},
intoFolder (file) {
/* 进入下一级文件夹 */
if (file.isFolder) {
// 双击文件夹
let breadcrumbData = {
name: file.name,
isFolder: file.isFolder,
folderName: file.folderData
}
this.breadcrumb.push(breadcrumbData)
this.currentFileList = this.fileListData[file.folderData]
if ((file.children && file.children.length > 0 && this.currentIsFiLe === false) || (file.file_count === 0 && this.breadcrumb.length < 3)) {
// 进入文件夹
this.currentIsFiLe = false
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.currentFileList = file.children || []
} else {
// 双击文件
// 获取当前文件夹的文档列表
if (this.currentIsFiLe === false) {
this.currentIsFiLe = true
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.getFileList(file)
} else {
let url = 'https://onlinepreview.vschool100.cn/onlinePreview?url=' + encodeURIComponent(file.file_path)
this.documentUrl = url
this.documentDrawer = true
}
}
},
showMenu (MouseEvent, type, row) {
createOrUpdateFolder (params) {
/* 新增编辑学校文件夹 */
this.$api.schoolBasedResourcesApi.createOrUpdateSchool(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '操作成功',
type: 'success'
})
this.$refs.contextMenu.newFolderVisible = false
this.getFolderList()
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
handleDeleteSchoolFolder (params) {
this.$api.schoolBasedResourcesApi.deleteSchoolFolder(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '删除成功',
type: 'success'
})
this.$refs.contextMenu.deleteVisible = false
this.getFolderList()
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
showMenu (MouseEvent, currentIsFiLe, row) {
/* 右键文件夹或文件时触发 */
if (type) {
if (row) {
// 右键文件夹或者文件
this.menuMode = type
if (currentIsFiLe) {
this.menuMode = ''
} else {
this.menuMode = 'personal'
}
this.rightMenuData = row
this.rightMenuFolder = []
// this.rightMenuFolder = []
} else {
// 右键空白处
this.menuMode = 'blank'
this.rightMenuFolder = this.currentFileList
this.rightMenuData = {}
this.rightMenuData = this.breadcrumb[this.breadcrumb.length - 1].parent
}
this.menuVisible = false
this.menuVisible = true
......@@ -244,7 +248,6 @@ export default {
<style lang="less" scoped>
.container {
.headerNav {
display: flex;
justify-content: space-between;
......
......@@ -4,17 +4,17 @@
<div v-show="menuVisible" id="menu" :style="'left:'+coordinate.menuX+';top:'+coordinate.menuY">
<ul class="menu" style="width:120px">
<li class="menu_item padding_35" v-show="menuMode !== 'blank'" @click="clickFile">打开</li>
<li class="menu_item padding_35" v-show="menuMode !== 'blank'">编辑</li>
<li class="menu_item padding_35" v-show="menuMode !== 'blank'" @click="deleteVisible = true">删除</li>
<li class="menu_item" style="text-align:center" v-show="menuMode === 'blank' && rightMenuFolder[0].isFolder" @click="newFolderVisible = true">新建文件夹</li>
<li class="menu_item padding_35" v-show="menuMode !== 'blank' && !currentIsFiLe" @click="handleEdit">编辑</li>
<li class="menu_item padding_35" v-show="menuMode !== 'blank' && !currentIsFiLe" @click="deleteVisible = true">删除</li>
<li class="menu_item" style="text-align:center" v-show="menuMode === 'blank' && !currentIsFiLe" @click="newFolderVisible = true">新建文件夹</li>
</ul>
<ul class="menu" style='width:230px' v-show="menuMode === 'blank' && !rightMenuFolder[0].isFolder">
<!-- <ul class="menu" style='width:230px' v-show="menuMode === 'blank' && currentIsFiLe">
<li class="menu_item" style="text-align:center">合并所有文档到新文件夹</li>
</ul>
</ul> -->
</div>
<!-- 新建文件夹窗口 -->
<el-dialog title="新建个人文件夹" class="newfile-dialog" :visible.sync="newFolderVisible" width="700px" :close-on-click-modal="false">
<el-dialog title="新建个人文件夹" class="newfile-dialog" :visible.sync="newFolderVisible" width="750px" :close-on-click-modal="false">
<el-form :model="ruleForm" :rules="ruleForm.folderType === 'usual'?usualRules:taskRules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="文件夹名称" prop="name">
<el-input placeholder="请输入..." v-model="ruleForm.name"></el-input>
......@@ -37,22 +37,23 @@
<el-radio label="private">不公开</el-radio>
<el-radio label="publicToAll">对所有教师公开</el-radio>
<el-radio label="publickToPart">对部分教师公开</el-radio>
<span style="display:inline-block" class="add-teacher-ctn" v-if="ruleForm.private === 'publickToPart'">
<el-button class="person-btn" icon="el-icon-plus" @click="teacherSelectorOptions.isBlock = true">添加教师</el-button>
</span>
</el-radio-group>
<span style="display:inline-block;margin:0 10px;" class="add-teacher-ctn" v-if="ruleForm.private === 'publickToPart'">
<el-button class="person-btn" icon="el-icon-plus" @click="handleSelect('publicTeacher')">添加教师</el-button>
<span class="person-count">已选择 <span style="color:blue">{{ ruleForm.publicTeacher.length }}</span></span>
</span>
</el-form-item>
<el-form-item class="limit-ctn" v-if="ruleForm.folderType === 'task'" label="每人上传数" prop="limitCount">
<el-radio-group v-model="ruleForm.limitCount">
<el-radio label="limit">限制数量</el-radio>
<span style="display:inline-block;width:100px" v-if="ruleForm.limitCount === 'limit'"><el-input v-model="input" placeholder="请输入..."></el-input></span>
<span style="display:inline-block;width:100px" v-if="ruleForm.limitCount === 'limit'"><el-input type="number" v-model="ruleForm.limitCountNumber" placeholder="请输入..."></el-input></span>
<el-radio label="noLimit">不限制数量</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="管理者" prop="manager">
<div class="header-ctn">
<el-button class="person-btn" icon="el-icon-plus" @click="teacherSelectorOptions.isBlock = true">添加教师</el-button>
<span class="person-count">已选择 <span style="color:blue">2</span></span>
<el-button class="person-btn" icon="el-icon-plus" @click="handleSelect('manager')">添加教师</el-button>
<span class="person-count">已选择 <span style="color:blue">{{ ruleForm.manager.length }}</span></span>
</div>
<div class="tag-ctn">
<el-tag
......@@ -62,17 +63,18 @@
type="info"
color="#F2F2F2"
size="medium"
@close="deleteManagerUser(index)"
closable>
{{tag.name}}
{{tag.realname}}
</el-tag>
</div>
</el-form-item>
<el-form-item v-if="ruleForm.folderType === 'task'" label="教师" prop="uploadTeacher">
<el-form-item v-if="ruleForm.folderType === 'task'" label="上传教师" prop="uploadTeacher">
<div class="header-ctn">
<el-button class="person-btn" icon="el-icon-plus" @click="teacherSelectorOptions.isBlock = true">添加教师</el-button>
<span class="person-count">已选择 <span style="color:blue">2</span></span>
<el-button class="person-btn" icon="el-icon-plus" @click="handleSelect('uploadTeacher')">添加教师</el-button>
<span class="person-count">已选择 <span style="color:blue">{{ ruleForm.uploadTeacher.length }}</span></span>
</div>
<div class="tag-ctn">
<!-- <div class="tag-ctn">
<el-tag
v-for="(tag, index) in ruleForm.uploadTeacher"
:key="index"
......@@ -83,26 +85,28 @@
closable>
{{tag.name}}
</el-tag>
</div>
</div> -->
</el-form-item>
<el-form-item class="submit-ctn">
<el-button size="medium" type="primary" @click="newFolderVisible = false">保存</el-button>
<el-button size="medium" type="primary" @click="hanlderCreateOrUpdate('ruleForm')">保存</el-button>
</el-form-item>
</el-form>
<teacher-selector
:teacherSelectorOptions="teacherSelectorOptions"
@closeTeacherSelector="teacherSelectorOptions.isBlock = false">
</teacher-selector>
</el-dialog>
<!-- 删除文件窗口 -->
<el-dialog title="删除确认" :visible.sync="deleteVisible" width="500px">
<h3>删除后不可恢复,确定删除吗?</h3>
<h3>删除文件夹同时会将文件夹下的所有资源全部删除,请谨慎操作!</h3>
<div slot="footer" class="dialog-footer">
<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>
</el-dialog>
<userselector
:mode="userSelector.mode"
:list="userSelector.list"
:visible.sync="userSelector.visible"
@submit="selectUser"
/>
</div>
</template>
......@@ -115,6 +119,10 @@ export default {
type: Boolean,
default: false
},
currentIsFiLe: { // 当前层次是否为文档列表
type: Boolean,
default: false
},
rightMenuData: { // 右键文件的数据
type: Object,
default: () => {
......@@ -139,14 +147,16 @@ export default {
}
},
components: {
TeacherSelector: () => import('@/common/TeacherSelector')
userselector: () => import('@/common/userSelector/UserSelector')
},
data () {
return {
teacherSelectorOptions: {
isBlock: false,
isShow: true
userSelector: {
mode: 'teacherCheckbox',
list: [],
visible: false
},
seletorListName: '', // 当前需要选人的用户列表名
newFolderVisible: false,
newFolderName: '',
deleteVisible: false,
......@@ -160,15 +170,11 @@ export default {
folderType: 'usual',
private: 'private',
limitCount: 'limit',
limitCountNumber: 0,
uploadCount: '',
manager: [
{ name: '标某某' },
{ name: '某某某' }
],
uploadTeacher: [
{ name: '标某某' },
{ name: '某某某' }
]
publicTeacher: [],
manager: [],
uploadTeacher: []
},
usualRules: {
name: [
......@@ -199,6 +205,87 @@ export default {
clickFile () {
let file = this.rightMenuData
this.$emit('menuOpenFile', file)
},
handleSelect (listName) {
/* 根据选择教师按钮类型来定义接收list的值 */
this.seletorListName = listName
this.userSelector.list = this.ruleForm[listName]
this.userSelector.visible = true
},
deleteManagerUser (index) {
this.ruleForm.manager.splice(index, 1)
},
selectUser (list) {
this.ruleForm[this.seletorListName] = list
},
handleEdit () {
let params = { b_id: this.rightMenuData.b_id }
this.$api.schoolBasedResourcesApi.getSchoolFolderInfo(params).then(res => {
this.$handleResponse(res).then(data => {
console.log(data)
})
})
},
hanlderCreateOrUpdate (formName) {
/* 新建或修改学校文件夹 */
this.$refs[formName].validate((valid) => {
if (valid) {
let data
let form = this.ruleForm
let folderType = form.folderType === 'usual' ? 1 : 2
let isPublic = form.private === 'private' ? 1 : (form.private === 'publicToAll' ? 2 : 3)
let publicTeacher = this.userListToString(form.publicTeacher)
let manager = this.userListToString(form.manager)
let uploadTeacher = this.userListToString(form.uploadTeacher)
let uploadCount = folderType === 1 ? 0 : (form.limitCount === 'limit' ? 1 : 2)
data = {
b_id: undefined,
parent_id: this.rightMenuData.b_id,
step_number: this.rightMenuData.step_number + 1 || 1,
folder_name: form.name,
folder_type: folderType,
is_public: isPublic,
public_user_ids: isPublic === 3 ? publicTeacher.userIds : undefined,
public_user_names: isPublic === 3 ? publicTeacher.userNames : undefined,
manage_user_ids: manager.userIds,
manage_user_names: manager.userNames,
upload_count: uploadCount,
limit_count: uploadCount === 1 ? parseInt(form.limitCountNumber) : undefined,
teacher_user_ids: folderType === 2 ? uploadTeacher.userIds : undefined,
teacher_user_names: folderType === 2 ? uploadTeacher.userNames : undefined
}
this.$emit('createOrUpdateFolder', data)
} else {
console.log('error submit!!')
return false
}
})
},
userListToString (userList) {
let data = {
userIds: '',
userNames: ''
}
for (let i = 0; i < userList.length; i++) {
if (i === 0) {
data.userIds += userList[i].id
data.userNames += userList[i].realname
} else {
data.userIds += ',' + userList[i].id
data.userNames += ',' + userList[i].realname
}
}
return data
},
handleDelete () {
/* 删除学校文件夹 */
let data = {}
if (!this.currentIsFiLe) {
data = {
b_id: this.rightMenuData.b_id
}
this.$emit('handleDeleteFolder', data)
}
}
}
}
......@@ -268,7 +355,7 @@ export default {
/deep/ .submit-ctn {
.el-button {
margin-left: 145px;
margin-left: 220px;
margin-top: 50px;
}
}
......
<template>
<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>
<keep-alive>
<router-view></router-view>
......@@ -42,32 +42,25 @@ export default {
}
},
mounted () {
this.getFolderList()
},
created () {
this.initDataFromRoute(this.$route)
// this.getFolderList()
},
// created () {
// this.initDataFromRoute(this.$route)
// },
watch: {
$route (to, from) {
this.initDataFromRoute(to)
}
// $route (to, from) {
// this.initDataFromRoute(to)
// }
},
methods: {
getFolderList () {
this.$api.schoolBasedResourcesApi.GetFolderList().then(res => {
this.$handleResponse(res).then(data => {
console.log(data)
})
})
},
initDataFromRoute (route) {
/* 根据路由参数来显示对应数据 */
if (route.query.parent_id) { // 有参数说明不是首页,显示返回上一页
this.isShowPrevPage = true
} else {
this.isShowPrevPage = false
}
}
// initDataFromRoute (route) {
// /* 根据路由参数来显示对应数据 */
// if (route.query.parent_id) { // 有参数说明不是首页,显示返回上一页
// this.isShowPrevPage = true
// } else {
// this.isShowPrevPage = false
// }
// }
}
}
</script>
......
......@@ -6,12 +6,20 @@
<el-breadcrumb-item
v-for="(breadcrumbItem, index) of breadcrumb"
:key="index"
@click.native="backCrumb(breadcrumbItem, index)">
@click.native="backCrumb(index)">
{{ breadcrumbItem.label }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="rightNav">
<el-select style="margin:2px 15px 0 0" class="timer-select" v-show="currentIsFiLe" v-model="timeSelect" placeholder="请选择">
<el-option
v-for="item in termOptions"
:key="item.ID"
:label="item.TeamName"
:value="item.ID">
</el-option>
</el-select>
<search></search>
<div class="feature" v-show="!currentIsFiLe">
<div :class="{'icon-sel': bigMode}" class="icon-ctn" @click="bigMode = true">
......@@ -27,41 +35,57 @@
<component :is="(bigMode && currentIsFiLe === false)?'big-folder':'small-folder'"
:file-list="currentFileList"
:currentIsFiLe="currentIsFiLe"
:pagination-query="paginationQuery"
@showMenu="showMenu"
@intoFolder="intoFolder"
@uploadFile="uploadFile"
@tableIntoFile="intoFolder">
@dragUploadFile="dragUploadFile"
@tableIntoFile="intoFolder"
@getSizeChange="handleSizeChange"
@getCurrentPage="handleCurrentChange">
</component>
</div>
<!-- 右键菜单栏 -->
<myupload-ctx-menu
ref="contextMenu"
:menuVisible="menuVisible"
:currentIsFiLe="currentIsFiLe"
:uploadVisible="uploadVisible"
:rightMenuData="rightMenuData"
:rightMenuFolder="rightMenuFolder"
:coordinate="coordinate"
:menuMode="menuMode"
@doShareFile="doShareFile"
@showUploadMenu="showUploadMenu"
@menuOpenFile="intoFolder">
@selectUploadPath="selectUploadPath"
@menuOpenFile="intoFolder"
@updateOrCreateFolder="updateOrCreateFolder"
@handleDeleteFolder="handleDeleteFolder">
</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
title="查看"
:visible.sync="documentDrawer"
:size="'60%'">
<span>文档内容</span>
:size="'80%'">
<iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</el-drawer>
<input v-show="false" type="file" ref="fileUpload" @change="uploadfileChange"/>
<button v-show="false" ref="btn" @click="currentIsFiLe = true">设置当前页面为文件模式</button>
</div>
</template>
<script>
import { ossUpload } from '@/assets/utils/ossTool.js'
import ossPaths from '@/assets/ossPaths.js'
export default {
name: 'MyUpload',
components: {
......@@ -76,12 +100,17 @@ export default {
currentComponent: 'BigFolder', // BigFolder 大图标模式,SmallFolder 小图标模式
bigMode: true, // 文件夹大小图标模式
currentIsFiLe: false, // 当前层次是否为文档列表
timeSelect: 'allItem', // 学期选择框数据
termOptions: [{ // 学期选择options
value: 'allItem',
label: '全部学期'
}],
menuVisible: false, // 右键菜单栏
menuMode: '', // 菜单根据模式显示对于内容
uploadVisible: false, // 上传菜单栏
documentUrl: '', // 文档在线地址
documentDrawer: false, // 查看文档抽屉
rightMenuData: {}, // 右键选中文件夹或文件数据
rightMenuFolder: [], // 右键空白储存当前文件夹数据
coordinate: { // 菜单栏坐标
menuX: '0px',
menuY: '0px',
......@@ -89,81 +118,281 @@ export default {
uploadY: '0px'
},
currentFileList: [],
curSelectList: [], // 当前选择需要上传的文件夹当前路径列表
selectFolderVisible: false, // 查看文件侧滑框
selectFolderList: [], // 上传文件选择文件夹列表
breadcrumb: ['首页'], // 面包屑
folderListData: []
breadcrumb: [], // 面包屑
uploadData: { // 储存待上传的文件信息
file: null,
folderId: '',
isdrag: false // 当时是否是拖拽获得文件信息
},
paginationQuery: { // 分页信息
amount: 0,
pageSize: 50,
pageIndex: 1
}
}
},
mounted () {
this.getFolderList()
this.getTermList()
},
created () {
// this.initDataFromRoute(this.$route)
},
watch: {
// $route (to, from) {
// this.initDataFromRoute(to)
// }
},
methods: {
getFolderList () {
this.$api.schoolBasedResourcesApi.GetFolderList().then(res => {
this.$handleResponse(res).then(data => {
this.folderListData = data
this.currentFileList = data
this.breadcrumb = [{ label: '首页', listData: data }]
this.initFromBreadcrumb(data)
})
})
},
getTermList () {
/* 获取学期列表 */
this.$api.commonApi.getTermInfoList().then(res => {
this.$handleResponse(res).then(data => {
this.termOptions = data
this.timeSelect = data[0].ID
})
})
},
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) {
let isFile = (!currentList[j].children || currentList[j].children.length === 0) && currentList[j].file_count > 0
this.currentIsFile = isFile
this.addCrumb(newBreadcrumb, currentList[j], isFile)
if (isFile) {
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) {
this.$refs.btn.click()
const folderId = file.b_id
const selType = file.folder_type
let data = {
data: { folder_id: folderId, sel_type: selType },
PageSize: 50,
PageNumber: 1
PageSize: this.paginationQuery.pageSize,
PageNumber: this.paginationQuery.pageIndex
}
this.$api.schoolBasedResourcesApi.GetFileList(data).then(res => {
this.$handleResponse(res).then(data => {
this.currentFileList = data.Data
this.paginationQuery.amount = data.TotalRecords
})
})
},
backCrumb (item, index) {
backCrumb (index) {
/* 点击面包屑返回前几级 */
let breadcrumb = this.breadcrumb
let item = breadcrumb[index]
this.currentIsFiLe = false
if (index < breadcrumb.length - 1) {
this.currentFileList = item.listData
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) {
/* 进入下一级文件夹 */
if (file.children !== null && this.currentIsFiLe === false) {
if ((file.children && file.children.length > 0 && this.currentIsFiLe === false) || (file.file_count === 0 && this.breadcrumb.length < 3)) {
// 进入文件夹
this.currentIsFiLe = false
this.addCrumb(file)
this.currentFileList = file.children
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.currentFileList = file.children || []
} else {
// 获取当前文件夹的文档列表
if (this.currentIsFiLe === false) {
this.currentIsFiLe = true
this.addCrumb(file)
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.getFileList(file)
} else {
let url = 'https://onlinepreview.vschool100.cn/onlinePreview?url=' + encodeURIComponent(file.file_path)
this.documentUrl = url
this.documentDrawer = true
}
}
},
uploadFile (fileData, row) {
/* 文件选择上传位置 */
dragUploadFile (fileData, file) {
/* 拖拽文件选择上传位置 */
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()
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
doShareFile (params) {
/* 分享文件 */
this.$api.schoolBasedResourcesApi.fileShare(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '分享成功',
type: 'success'
})
this.$refs.contextMenu.shareVisible = false
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
updateOrCreateFolder (isFile, params, message) {
/* 新增或编辑个人文件夹 */
let updateApi
if (isFile) { // 对象是文件
updateApi = this.$api.schoolBasedResourcesApi.updateFileName
params.folder_info_id = this.breadcrumb[this.breadcrumb.length - 1].parent.b_id
} else { // 对象是文件夹
updateApi = this.$api.schoolBasedResourcesApi.CreateOrUpdateFolder
}
updateApi(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()
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
handleDeleteFolder (isFile, params) {
/* 删除文件或文件夹 */
let deleteApi
if (isFile) { // 对象是文件
deleteApi = this.$api.schoolBasedResourcesApi.deleteFile
} else { // 对象是文件夹
deleteApi = this.$api.schoolBasedResourcesApi.deleteFolder
}
deleteApi(params).then(res => {
if (res.data.Status === true) {
this.$message({
message: '删除成功',
type: 'success'
})
if (isFile && this.currentFileList.length === 1) {
this.backCrumb(this.breadcrumb.length - 2)
}
this.$refs.contextMenu.deleteVisible = false
this.getFolderList()
} else {
this.$message({
message: res.data.ResponseError.LongMessage,
type: 'error'
})
}
})
},
showMenu (MouseEvent, currentIsFiLe, row) {
/* 右键文件夹或文件时触发 */
......@@ -175,12 +404,12 @@ export default {
this.menuMode = 'personal'
}
this.rightMenuData = row
this.rightMenuFolder = []
// this.rightMenuFolder = []
} else {
// 右键空白处
this.menuMode = 'blank'
this.rightMenuFolder = this.currentFileList
this.rightMenuData = {}
// this.rightMenuFolder = this.currentFileList
this.rightMenuData = this.breadcrumb[this.breadcrumb.length - 1].parent
}
this.menuVisible = false
this.uploadVisible = false
......@@ -200,6 +429,14 @@ export default {
},
showUploadMenu () {
this.uploadVisible = !this.uploadVisible
},
handleSizeChange (val) {
this.paginationQuery.pageSize = val
this.getFileList(this.breadcrumb[this.breadcrumb.length - 1].parent)
},
handleCurrentChange (val) {
this.paginationQuery.pageIndex = val
this.getFileList(this.breadcrumb[this.breadcrumb.length - 1].parent)
}
}
}
......
......@@ -69,8 +69,8 @@ export default {
fileDrop (event, file) {
this.borderHover = false
let fileData = event.dataTransfer.files
let row = this.file
this.$emit('uploadFile', fileData, row)
let row = file
this.$emit('dragUploadFile', fileData, row)
}
}
}
......
......@@ -20,7 +20,7 @@
<div class="menus-title">
<span>{{ item.user_name }}</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;">
<el-progress :show-text="false" :percentage="item.upload_count / item.total_count"></el-progress>
</div>
......@@ -33,7 +33,8 @@
v-for="(innerItem, innerIndex) of item.fileChildren"
:key="innerIndex"
: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 }}
</el-menu-item>
</el-menu-item-group>
......@@ -42,6 +43,7 @@
</div>
</div>
<div class="right-document">
<iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</div>
<!-- 右键菜单栏 -->
......@@ -88,6 +90,7 @@ export default {
value: 'allItem',
label: '全部学期'
}],
documentUrl: '', // 文档在线预览地址
deleteVisible: false, // 删除确认弹框
coordinate: { // 菜单栏坐标
menuX: '0px',
......@@ -105,6 +108,11 @@ export default {
this.coordinate.menuY = MouseEvent.pageY + 'px'
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) {
let listIndex = parseInt(index) - 1
this.$emit('getMaterialFile', listIndex)
......
......@@ -5,11 +5,11 @@
<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==='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 padding_35" v-show="menuMode === 'personal' || menuMode === 'file'" @click="renameVisible = true">重命名</li>
<li class="menu_item padding_35" v-show="menuMode === 'file'" @click="visible = true">分享</li>
<li class="menu_item padding_35" v-show="menuMode === 'personal' || menuMode === 'file'" @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" @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') && rightMenuData.folder_type !== 1" @click="clickRenameBtn">重命名</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') && rightMenuData.folder_type !== 1" @click="deleteVisible = 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>
</div>
......@@ -17,7 +17,7 @@
<div v-show="uploadVisible" id="upload_menu" :style="'left:'+coordinate.uploadX+';top:'+coordinate.uploadY">
<p class="upload_title">普通文档</p>
<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>
<p class="upload_title">腾讯文档</p>
<ul class="upload_menu">
......@@ -32,7 +32,7 @@
<el-input v-model="rename" placeholder="请输入名称"></el-input>
<div slot="footer" class="dialog-footer">
<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>
</el-dialog>
......@@ -41,16 +41,16 @@
<el-input v-model="newFolderName" placeholder="请输入文件夹名称"></el-input>
<div slot="footer" class="dialog-footer">
<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>
</el-dialog>
<!-- 删除文件窗口 -->
<el-dialog title="删除确认" :visible.sync="deleteVisible" width="500px">
<h3>删除后不可恢复,确定删除吗?</h3>
<h3>删除文件夹同时会将文件夹下的所有资源全部删除,请谨慎操作!</h3>
<div slot="footer" class="dialog-footer">
<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>
</el-dialog>
......@@ -58,37 +58,38 @@
<el-dialog class='share-ctn' title="分享" :visible.sync="shareVisible" width="500px">
<div class="header-ctn">
<span>分享给:</span>
<el-button class="person-btn" icon="el-icon-plus" @click="teacherSelectorOptions.isBlock = true">选择教师</el-button>
<span class="person-count">已选择 <span style="color:blue">6</span></span>
<el-button class="person-btn" icon="el-icon-plus" @click="userSelector.visible = true">选择教师</el-button>
<span class="person-count">已选择 <span style="color:blue">{{ userSelector.list.length }}</span></span>
</div>
<div class="tag-ctn">
<el-tag
v-for="(tag, index) in tags"
v-for="(people, index) in userSelector.list"
:key="index"
effect="dark"
type="info"
color="#F2F2F2"
size="medium"
@close="deleteUser(index)"
closable>
{{tag.name}}
{{people.realname}}
</el-tag>
</div>
<div slot="footer" class="dialog-footer">
<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>
<userselector
:mode="userSelector.mode"
:list="userSelector.list"
:visible.sync="visible"
@submit="selectUser"
/>
<!-- <teacher-selector
:teacherSelectorOptions="teacherSelectorOptions"
@closeTeacherSelector="teacherSelectorOptions.isBlock = false">
</teacher-selector> -->
</el-dialog>
<userselector
:mode="userSelector.mode"
:list="userSelector.list"
:visible.sync="userSelector.visible"
@submit="selectUser"
/>
</div>
</template>
......@@ -115,19 +116,19 @@ export default {
return {}
}
},
rightMenuFolder: { // 右键空白所在层的文件夹数据
type: Array,
default: () => {
return []
}
},
// rightMenuFolder: { // 右键空白所在层的文件夹数据
// type: Array,
// default: () => {
// return []
// }
// },
coordinate: { // 右键菜单栏坐标
type: Object,
default: () => {
return {}
}
},
menuMode: { // 右键的文件属于那种类型(file: 文件,personal: 个人文件夹, blank: 右键空白 )
menuMode: { // 右键的文件属于那种类型(file: 文件,personal: 文件夹, blank: 右键空白 )
type: String,
default: ''
}
......@@ -149,28 +150,115 @@ export default {
newFolderVisible: false, // 新建文件夹窗口
newFolderName: '',
deleteVisible: false, // 删除文件窗口
shareVisible: false, // 分享文件窗口
tags: [
{ name: '标某某' },
{ name: '某某某' },
{ name: '某某某' },
{ name: '某某某' },
{ name: '某某某' },
{ name: '某某某' }
]
shareVisible: false // 分享文件窗口
// tags: [
// { name: '标某某' },
// { name: '某某某' },
// { name: '某某某' },
// { name: '某某某' },
// { name: '某某某' },
// { name: '某某某' }
// ]
}
},
methods: {
showUploadMenu (event) {
// event.stopPropagation()
this.$emit('showUploadMenu')
},
clickFile () {
let file = this.rightMenuData
this.$emit('menuOpenFile', file)
},
selectUploadPath () {
/* 点击上传文件 */
let file = this.rightMenuData
this.$emit('selectUploadPath', file)
},
deleteUser (index) {
this.userSelector.list.splice(index, 1)
},
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,
step_number: this.rightMenuData.step_number + 1 || undefined
}
this.$emit('updateOrCreateFolder', false, data, '创建文件夹成功')
this.newFolderName = ''
},
clickRenameBtn () {
/* 点击重命名按钮 */
this.rename = this.rightMenuData.folder_name || this.rightMenuData.file_name
this.renameVisible = true
},
handleUpdate () {
/* 修改个人文件夹名称 */
let data = {}
if (this.currentIsFiLe) {
/* 修改文件名称 */
data = {
b_id: this.rightMenuData.file_info_id,
file_name: this.rename
}
this.$emit('updateOrCreateFolder', true, data, '修改文件名称成功')
} else {
/* 修改文件名称 */
data = {
b_id: this.rightMenuData.b_id,
parent_id: this.rightMenuData.parent_id,
folder_name: this.rename,
step_number: this.rightMenuData.step_number
}
this.$emit('updateOrCreateFolder', false, data, '修改文件夹名称成功')
}
this.rename = ''
},
handleDelete () {
/* 删除个人文件夹 */
let data = {}
if (this.currentIsFiLe) {
/* 删除文件 */
data = {
b_id: this.rightMenuData.file_info_id
}
this.$emit('handleDeleteFolder', true, data)
} else {
/* 删除文件夹 */
data = {
b_id: this.rightMenuData.b_id
}
this.$emit('handleDeleteFolder', false, data)
}
}
}
}
......
......@@ -13,7 +13,7 @@
<template slot-scope="scope">
<div class="is-folder">
<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>
</template>
</el-table-column>
......@@ -22,24 +22,26 @@
label="类型"
width="170">
<template slot-scope="scope">
{{ folderTypeOptions[scope.row.file_type] }}
{{ folderTypeOptions[scope.row.file_type || scope.row.folder_type] }}
</template>
</el-table-column>
<el-table-column
v-if="mode != 'favor' && !currentIsFiLe"
prop="uploadCount"
prop="file_count"
label="我上传的数量"
width="170">
</el-table-column>
<el-table-column
v-if="manageMode"
prop="private"
label="公开/不公开"
width="180">
<template slot-scope="scope">
{{ scope.row.is_public == 1 ? '不公开': (scope.row.is_public == 2 ? '对所有教师公开': '对部分教师公开')}}
</template>
</el-table-column>
<el-table-column
v-if="manageMode"
prop="documentCount"
prop="file_count"
label="文档数量"
width="150">
</el-table-column>
......@@ -54,8 +56,14 @@
min-width="220">
</el-table-column>
</el-table>
<div class="pagination" v-if="!(fileList[0] && fileList[0].isFolder)">
<pagination :amount="50"></pagination>
<div class="pagination" v-if="currentIsFiLe">
<pagination
:amount="paginationQuery.amount"
:page-size="paginationQuery.pageSize"
:page-index="paginationQuery.pageIndex"
@getCurrentPage="handleCurrentChange"
@getSizeChange="handleSizeChange"
/>
</div>
</div>
</template>
......@@ -84,12 +92,19 @@ export default {
manageMode: { // 是否为我管理的页面使用
type: Boolean,
default: false
},
paginationQuery: {
type: Object,
default: () => {
return { amount: 0, pageSize: 50, pageIndex: 1 }
}
}
},
computed: {
folderTypeOptions () {
/* 根据foderType来判断显示哪种options */
const uploadType = { 1: '学校文件夹', 2: '个人文件夹' }
const school = { 1: '常规文件夹', 2: '任务文件夹' }
const favorType = { 1: '我收藏的', 2: '我分享的', 3: '分享给我的' }
let folderTypeOptions = {}
switch (this.mode) {
......@@ -99,6 +114,9 @@ export default {
case 'favor':
folderTypeOptions = favorType
break
case 'school':
folderTypeOptions = school
break
}
return folderTypeOptions
}
......@@ -117,10 +135,10 @@ export default {
this.$emit('tableIntoFile', row)
},
handleSizeChange (val) {
console.log(`每页 ${val} 条`)
this.$emit('getSizeChange', val)
},
handleCurrentChange (val) {
console.log(`当前页: ${val}`)
this.$emit('getCurrentPage', val)
}
}
}
......
<template>
<el-dialog
title="请选择目标文件夹(必选)"
:visible.sync="selectFolderVisible"
:visible.sync="visible"
width="500px">
<div class="folder-select">
<div class="folder-line select-first">
<div class="folder-select" v-for="firstLevel of listData" :key="firstLevel.b_id">
<!-- 第一层 -->
<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>
<span class="folderName">一年级文案</span>
<span class="folderName">{{ firstLevel.folder_name }}</span>
</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">
<!-- 第二层 -->
<div v-for="secondLevel of firstLevel.children" :key="secondLevel.b_id" class="select-padding">
<div :class="{canSelect: !(secondLevel.children && secondLevel.children.length > 0)}" class="folder-line" @click="upload(secondLevel)">
<i class="el-icon-folder folder-icon"></i>
<span class="folderName" @click="upload">语文文案</span>
<span class="folderName">{{ secondLevel.folder_name }}</span>
</div>
</div>
<div class="folder-select">
<div class="folder-line select-first">
<div v-if="secondLevel.children && secondLevel.children.length > 0">
<!-- 第三层 -->
<div v-for="thirdLevel of secondLevel.children" :key="thirdLevel.b_id" class="select-padding" @click="upload(thirdLevel)">
<div class="folder-line canSelect">
<i class="el-icon-folder folder-icon"></i>
<span class="folderName">二年级文案</span>
<span class="folderName">{{ thirdLevel.folder_name }}</span>
</div>
</div>
</div>
</div>
<div v-for="(item, index) of 3" :key="index" class="folder-line select-second canSelect">
<i class="el-icon-folder folder-icon"></i>
<span class="folderName" @click="upload">语文文案</span>
</div>
</div>
</el-dialog>
......@@ -30,23 +35,44 @@
export default {
name: 'UploadFile',
props: {
listData: {
type: Array,
default: () => {
return []
}
},
selectFolderVisible: {
type: Boolean,
default: false
}
},
computed: {
visible: {
get () {
return this.selectFolderVisible
},
set (value) {
this.$emit('closeSelectFolderVisible')
}
}
},
data () {
return {
}
},
methods: {
upload () {
this.$message({
message: '上传成功',
type: 'success'
})
this.$emit('uploadSuccess')
upload (file) {
if (!(file.children && file.children.length > 0)) {
this.$emit('selectUploadFile', file)
}
// this.$message({
// message: '上传成功',
// type: 'success'
// })
}
// close () {
// this.$emit('closeSelectFolderVisible')
// }
}
}
</script>
......@@ -73,7 +99,7 @@ export default {
padding-left: 10px;
}
.select-second {
.select-padding {
padding-left: 60px;
}
}
......
......@@ -16,7 +16,7 @@ export default {
},
data () {
return {
isShowPrevPage: true,
isShowPrevPage: false,
menus: [
{
name: '校内资源',
......@@ -28,24 +28,8 @@ export default {
}
},
methods: {
initDataFromRoute (route) {
/* 根据路由参数来显示对应数据 */
if (route.query.folderName) { // 有参数说明不是首页,显示返回上一页
this.isShowPrevPage = true
} else {
this.isShowPrevPage = false
}
}
},
mounted () {
},
created () {
this.initDataFromRoute(this.$route)
},
watch: {
$route (to, from) {
this.initDataFromRoute(to)
}
}
}
......
......@@ -7,17 +7,17 @@
v-for="(breadcrumbItem, index) of breadcrumb"
:key="index"
@click.native="backCrumb(index)">
{{ breadcrumbItem }}
{{ breadcrumbItem.label }}
</el-breadcrumb-item>
</el-breadcrumb>
</div>
<div class="rightNav">
<el-select v-if="!(currentFileList[0] && currentFileList[0].isFolder)" class="timer-select" v-model="timeSelect" placeholder="请选择">
<el-select v-show="currentIsFiLe" class="timer-select" v-model="timeSelect" placeholder="请选择">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
v-for="item in termOptions"
:key="item.ID"
:label="item.TeamName"
:value="item.ID">
</el-option>
</el-select>
<search></search>
......@@ -27,7 +27,11 @@
<div class="smallCtn">
<small-folder
:file-list="currentFileList"
:currentIsFiLe="currentIsFiLe"
:pagination-query="paginationQuery"
@tableIntoFile="intoFolder"
@getSizeChange="handleSizeChange"
@getCurrentPage="handleCurrentChange"
>
</small-folder>
</div>
......@@ -37,10 +41,12 @@
<el-drawer
title="查看"
:visible.sync="documentDrawer"
:size="'60%'">
<span>文档内容</span>
:size="'80%'">
<iframe :src="documentUrl" width="100%" height= "100%" name="topFrame" noresize="noresize" frameborder="0" id="topFrame"></iframe>
</el-drawer>
<button v-show="false" ref="btn" @click="currentIsFiLe = true">设置当前页面为文件模式</button>
</div>
</template>
......@@ -55,157 +61,139 @@ export default {
data () {
return {
timeSelect: 'allItem', // 学期选择框数据
options: [{
termOptions: [{ // 学期选择options
value: 'allItem',
label: '全部学期'
}],
documentDrawer: false, // 查看文档抽屉
currentIsFiLe: false, // 当前层次是否为文档列表
currentFileList: [],
selectFolderVisible: false, // 查看文件侧滑框
breadcrumb: ['首页'], // 面包屑
fileListData: {
firstLevelData: [
{
id: 991,
name: '第一级文件夹',
typeName: '学校文件夹',
type: 'school',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: true,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
breadcrumb: [], // 面包屑
documentUrl: '', // 文档在线地址
paginationQuery: { // 分页信息
amount: 0,
pageSize: 20,
pageIndex: 1
}
}
},
{
id: 992,
name: '第一级文件夹',
typeName: '个人文件夹',
type: 'personal',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: true,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
mounted () {
this.getFolderList()
this.getTermList()
},
{
id: 993,
name: '第一级文件夹',
typeName: '个人文件夹',
type: 'personal',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
isFocus: false,
isFolder: true,
folderData: 'secondLevelData',
nextIsFolder: true,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
}
],
secondLevelData: [
{
id: 1001,
name: '第二级文件夹',
typeName: '学校文件夹',
type: 'school',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
isFocus: false,
isFolder: true,
folderData: 'thirdLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
watch: {
},
{
id: 1002,
name: '第二级文件夹',
typeName: '学校文件夹',
type: 'school',
icon: 'el-icon-folder',
descript: '我上传了10个文档',
isFocus: false,
isFolder: true,
folderData: 'thirdLevelData',
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
methods: {
getFolderList () {
this.$api.schoolBasedResourcesApi.getSchoolResourceFolderList().then(res => {
this.$handleResponse(res).then(data => {
this.initFromBreadcrumb(data)
})
})
},
getTermList () {
/* 获取学期列表 */
this.$api.commonApi.getTermInfoList().then(res => {
this.$handleResponse(res).then(data => {
this.termOptions = data
this.timeSelect = data[0].ID
})
})
},
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) {
let isFile = (!currentList[j].children || currentList[j].children.length === 0) && currentList[j].file_count > 0
this.currentIsFile = isFile
this.addCrumb(newBreadcrumb, currentList[j], isFile)
if (isFile) {
this.getFileList(currentList[j])
} else {
currentList = currentList[j].children
}
],
thirdLevelData: [
{
id: 1101,
name: '第三级文件.txt',
typeName: '文件',
type: 'file',
icon: 'el-icon-document',
descript: '我上传了10个文档',
isFocus: false,
isFolder: false,
nextIsFolder: false,
uploadCount: '10',
author: '张三',
updateTime: '2020-08-22 12:00'
hasThisFile = true
break
}
]
}
if (hasThisFile === false) {
break
}
}
this.breadcrumb = newBreadcrumb
if (!this.currentIsFile) {
this.currentFileList = currentList
}
}
},
methods: {
initDataFromRoute (route) {
/* 根据路由参数初始化数据 */
if (route.query.folderName) {
this.currentFileList = this.fileListData[route.query.folderName]
this.breadcrumb = JSON.parse(route.query.breadcrumb)
} else {
this.currentFileList = this.fileListData.firstLevelData
this.breadcrumb = ['首页']
getFileList (file) {
this.$refs.btn.click()
const folderId = file.b_id
const selType = file.folder_type
let data = {
data: { folder_id: folderId, sel_type: selType },
PageSize: this.paginationQuery.pageSize,
PageNumber: this.paginationQuery.pageIndex
}
this.$api.schoolBasedResourcesApi.GetFileList(data).then(res => {
this.$handleResponse(res).then(data => {
this.currentFileList = data.Data
this.paginationQuery.amount = data.TotalRecords
})
})
},
backCrumb (index) {
/* 点击面包屑返回前几级 */
if (index < this.breadcrumb.length - 1) {
let backPageCount = index - this.breadcrumb.length + 1
this.$router.go(backPageCount)
let breadcrumb = this.breadcrumb
let item = breadcrumb[index]
this.currentIsFiLe = false
if (index < breadcrumb.length - 1) {
this.currentFileList = item.listData
this.breadcrumb = breadcrumb.slice(0, index + 1)
}
},
addCrumb (breadcrumb, file, currentIsFiLe) {
/* 添加面包屑 */
breadcrumb.push({ label: file.folder_name, listData: file.children, parent: file, currentIsFiLe })
},
intoFolder (file) {
/* 进入下一级文件夹 */
if (file.isFolder) {
if ((file.children && file.children.length > 0 && this.currentIsFiLe === false) || (file.file_count === 0 && this.breadcrumb.length < 3)) {
// 进入文件夹
this.breadcrumb.push(file.name)
this.$router.push({
path: '/education/schoolResources/index',
query: {
folderName: file.folderData,
breadcrumb: JSON.stringify(this.breadcrumb)
}
})
this.currentIsFiLe = false
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.currentFileList = file.children
} else {
// 获取当前文件夹的文档列表
if (this.currentIsFiLe === false) {
this.currentIsFiLe = true
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.getFileList(file)
} else {
// 查看文件
let url = 'https://onlinepreview.vschool100.cn/onlinePreview?url=' + encodeURIComponent(file.file_path)
this.documentUrl = url
this.documentDrawer = true
}
}
},
mounted () {
},
created () {
this.initDataFromRoute(this.$route)
handleSizeChange (val) {
this.paginationQuery.pageSize = val
this.getFileList(this.breadcrumb[this.breadcrumb.length - 1].parent)
},
watch: {
$route (to, from) {
this.initDataFromRoute(to)
handleCurrentChange (val) {
this.paginationQuery.pageIndex = val
this.getFileList(this.breadcrumb[this.breadcrumb.length - 1].parent)
}
}
}
......
......@@ -4,6 +4,7 @@ import loginApi from './loginApi' // 登录
import aliOssApi from './aliOssApi' // ali-oss
import homeApi from './homeApi'
import commonApi from './commonApi'
import schoolBasedResourcesApi from './schoolBasedResourcesApi'
import education from './education' // 教务管理
......@@ -15,5 +16,6 @@ export default {
wxCommonApi,
aliOssApi,
homeApi,
schoolBasedResourcesApi,
...education
}
import http from '@/request/http.js'
export default {
// 获取学校文件夹和个人文件夹List
GetFolderList () {
return http.get('/api/Education/SchoolResource/MyResource/GetFolderList')
},
// 获取我的收藏分享列表
GetCollectShareList (params) {
return http.post('/api/Education/SchoolResource/MyResource/GetCollectShareList', params)
},
// 获取文档列表
GetFileList (params) {
return http.post('/api/Education/SchoolResource/GetFileList', params)
},
// 文件分享
fileShare (params) {
return http.post('/api/Education/SchoolResource/MyResource/FileShare', params)
},
// 删除文件
deleteFile (params) {
return http.get('/api/Education/SchoolResource/FileInfo/DeleteFile', { params: params })
},
// 修改文件名称
updateFileName (params) {
return http.get('/api/Education/SchoolResource/FileInfo/UpdateFileName', { params: params })
},
// 获取学校文件夹List
GetSchoolFolderList () {
return http.get('/api/Education/SchoolResource/SchoolFolderInfo/GetSchoolFolderList')
},
// 获取学校文件夹对象
getSchoolFolderInfo (params) {
return http.get('/api/Education/SchoolResource/SchoolFolderInfo/Get', { params: params })
},
// 根据文件ID获取分享信息
GetFileShareInfoByFileId (params) {
return http.get('/api/Education/SchoolResource/MyResource/GetFileShareInfoByFileId', { params: params })
}
}
......@@ -29,6 +29,9 @@ import fundebugVue from 'fundebug-vue' // 导入api接口
// import VConsole from 'vconsole'
// new VConsole()
const bus = new Vue() // eventBus 事件总线
Vue.prototype.$EventBus = bus // 将事件总线挂载到vue的原型上
Vue.prototype.$api = api
Vue.prototype.$common = common // 将common挂载到vue的原型上
Vue.prototype.$handleResponse = handleResponse
......
<template>
<div class="container">
<div class="container" style="position: relative;">
<v-header :title="title" :isShowPrevPage="isShowPrevPage">
<span slot="action" class="header-slot pull-right"></span>
</v-header>
......@@ -9,6 +9,7 @@
<router-view></router-view>
</div>
</div>
<action-menu v-show="!currentIsFirstLevel"/>
<tab-bar :menus="tabBarMenus"></tab-bar>
</div>
</template>
......@@ -20,13 +21,15 @@ export default {
components: {
VHeader: () => import('@/common/header/VHeader'),
Tabs: () => import('@/common/tab/Tabs'),
TabBar: () => import('@/common/tabBar/TabBar')
TabBar: () => import('@/common/tabBar/TabBar'),
ActionMenu: () => import('./components/ActionMenu')
},
data () {
return {
title: '标题',
isShowPrevPage: true,
showTabs: false, // 是否显示Tabs组件
title: '校本资源',
isShowPrevPage: false,
currentIsFirstLevel: true, // 当前列表是不是第一层文件夹
showTabs: true, // 是否显示Tabs组件
tabsMenus: [
{
label: '我上传的',
......@@ -56,42 +59,49 @@ export default {
scroll: ''
}
},
methods: {
initDataFromRoute (route) {
/* 根据路由参数来显示对应数据 */
this.tabBarMenus[0].belongTo = route.meta.belongTo
console.log(this.tabBarMenus[0].belongTo)
if (route.meta.showTabs) {
this.showTabs = true
} else {
this.showTabs = false
}
if (route.meta.hidePrevPage) {
this.isShowPrevPage = false
} else {
this.isShowPrevPage = true
}
if (route.query.title) {
this.title = route.query.title
} else {
this.title = route.meta.title
}
}
},
mounted () {
this.$nextTick(() => {
this.scroll = new BScroll(this.$refs.contentWrapper, {
click: true
})
})
this.$EventBus.$on('intoLayer', this.folderIntoLayer)
},
created () {
this.initDataFromRoute(this.$route)
// this.initDataFromRoute(this.$route)
},
watch: {
$route (to, from) {
this.initDataFromRoute(to)
// $route (to, from) {
// this.initDataFromRoute(to)
// }
},
methods: {
folderIntoLayer (currentIsFirstLevel, title) {
/* 当页面进入对应层次文件夹进行改变操作 */
this.title = title
this.showTabs = currentIsFirstLevel
this.currentIsFirstLevel = currentIsFirstLevel
}
// initDataFromRoute (route) {
// /* 根据路由参数来显示对应数据 */
// this.tabBarMenus[0].belongTo = route.meta.belongTo
// console.log(this.tabBarMenus[0].belongTo)
// if (route.meta.showTabs) {
// this.showTabs = true
// } else {
// this.showTabs = false
// }
// if (route.meta.hidePrevPage) {
// this.isShowPrevPage = false
// } else {
// this.isShowPrevPage = true
// }
// if (route.query.title) {
// this.title = route.query.title
// } else {
// this.title = route.meta.title
// }
// }
}
}
</script>
......
......@@ -3,14 +3,26 @@
<div class="search-ctn">
<searchs></searchs>
</div>
<div v-for="(folderListItem, folderListIndex) of currentList" :key="folderListIndex">
<folder-list
v-for="(folderListItem, folderListIndex) of currentList"
:key="folderListIndex"
:list="folderListItem.list"
:list-title="folderListItem.listTitle"
v-if="!currentIsFiLe"
:list="folderListItem"
:list-title="currentIsFirstLevel?fistLevelFolderTitile[folderListIndex]:''"
@folderClick="intoFolder">
</folder-list>
</div>
<file-list
ref="fileList"
:mode="'myUpload'"
:list="currentList"
v-if="currentIsFiLe"
@handleClickItem="toggleShowBtn"
@handleOpen="openFile"
@handleShare="shareFile"
@handleDeleteFile="handleDeleteFile"
@updateFileName="updateFileName">
</file-list>
</div>
</template>
<script>
......@@ -18,103 +30,198 @@ export default {
name: 'MyUpload',
components: {
Searchs: () => import('./components/Searchs'),
FolderList: () => import('./components/FolderList')
FolderList: () => import('./components/FolderList'),
FileList: () => import('./components/FileList')
},
data () {
return {
currentList: {},
listData: {
firstLevel: [
{
listTitle: '个人文件夹 (2)',
list: [
{
title: '乱七八糟文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
},
{
title: '不三不四文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
currentList: [],
currentIsFirstLevel: true, // 当前列表是不是第一层文件夹
currentIsFiLe: false, // 当前层次是否为文档列表
breadcrumb: [], // 面包屑
fistLevelFolderTitile: ['个人文件夹', '学校文件夹']
}
},
{
title: '不三不四文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
mounted () {
this.getFolderList()
this.$EventBus.$on('backLayer', this.backLayer)
},
{
title: '不三不四文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
}
]
methods: {
getFolderList () {
/* 获取文件夹列表 */
this.$api.schoolBasedResourcesApi.GetFolderList().then(res => {
if (res.data.Status) {
let data = res.data.Data
this.initFromBreadcrumb(data)
}
})
},
{
listTitle: '学校文件夹 (20)',
list: [
{
title: '教案文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
initFromBreadcrumb (data) {
/* 通过面包屑初始化数据 */
this.currentIsFile = false
let breadcrumb = this.breadcrumb
if (breadcrumb.length <= 1) {
this.breadcrumb = this.initFirstLevelData(data)
this.$EventBus.$emit('intoLayer', true, '校本资源')
} else {
let newBreadcrumb = this.initFirstLevelData(data)
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) {
let isFile = (!currentList[j].children || currentList[j].children.length === 0) && currentList[j].file_count > 0
this.currentIsFile = isFile
this.addCrumb(newBreadcrumb, currentList[j], isFile)
if (isFile) {
this.getFileList(currentList[j])
} else {
currentList = currentList[j].children
}
hasThisFile = true
break
}
}
if (hasThisFile === false) {
break
}
}
this.breadcrumb = newBreadcrumb
this.$EventBus.$emit('intoLayer', false, this.breadcrumb[this.breadcrumb.length - 1].label)
if (!this.currentIsFile) {
this.currentList = [currentList]
}
}
},
{
title: '工作计划文件夹',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
getFileList (file) {
/* 获取文件列表 */
const folderId = file.b_id
const selType = file.folder_type
let data = {
data: { folder_id: folderId, sel_type: selType },
PageSize: 999,
PageNumber: 1
}
this.$api.schoolBasedResourcesApi.GetFileList(data).then(res => {
if (res.data.Status) {
let data = res.data.Data.Data
data.forEach(item => {
item.showFunBtn = false
})
this.currentList = data
}
})
},
{
title: '总结',
descript: '我上传了10个文档',
isFolder: true,
nextIsFolder: true,
folderData: 'secondLevel'
initFirstLevelData (data) {
/* 初始化文件夹第一层数据结构 */
let list = [[], []]
for (let i = 0; i < data.length; i++) {
if (data[i].folder_type === 1) {
list[0].push(data[i]) // 需注释
list[1].push(data[i])
} else {
list[0].push(data[i])
}
]
}
]
let breadcrumb = [{ label: '校本资源', listData: list, parent: { b_id: '0', parent_id: '0' }, currentIsFiLe: false }]
this.currentList = list
return breadcrumb
},
backLayer (layer) {
if (layer === 0) {
this.backCrumb(0)
} else {
this.backCrumb(this.breadcrumb.length - 2)
}
},
backCrumb (index) {
/* 点击面包屑返回前几级 */
let breadcrumb = this.breadcrumb
let item = breadcrumb[index]
this.currentIsFiLe = false
if (index < breadcrumb.length - 1 && breadcrumb.length > 1) {
this.currentList = item.listData
this.breadcrumb = breadcrumb.slice(0, index + 1)
if (this.breadcrumb.length === 1) {
this.currentIsFirstLevel = true
this.$EventBus.$emit('intoLayer', true, '校本资源')
} else {
this.$EventBus.$emit('intoLayer', false, item.parent.folder_name)
}
}
},
methods: {
intoFolder (item) {
/* 点击文件夹进入下一级 */
if (item.isFolder) {
let routerName
let routerPath
if (item.nextIsFolder) {
routerPath = '/education/myResources/myUpload/folderLevel'
routerName = 'myUploadFolderLevel'
addCrumb (breadcrumb, file, currentIsFiLe) {
/* 添加面包屑 */
breadcrumb.push({ label: file.folder_name, listData: [file.children], parent: file, currentIsFiLe })
},
intoFolder (file) {
/* 进入下一级文件夹或文件 */
this.currentIsFirstLevel = false
this.$EventBus.$emit('intoLayer', this.currentIsFirstLevel, file.folder_name)
if ((file.children && file.children.length > 0 && this.currentIsFiLe === false) || (file.file_count === 0 && this.breadcrumb.length < 3)) {
// 进入文件夹
this.currentIsFiLe = false
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.currentList = [file.children] || []
} else {
routerPath = '/education/myResources/myUpload/fileLevel'
routerName = 'myUploadFileLevel'
// 获取当前文件夹的文档列表
if (this.currentIsFiLe === false) {
this.currentIsFiLe = true
this.addCrumb(this.breadcrumb, file, this.currentIsFiLe)
this.getFileList(file)
}
}
},
toggleShowBtn (item) {
/* 显示功能按钮 */
item.showFunBtn = !item.showFunBtn
},
openFile (item) {
/* 打开文档 */
// this.$router.push({
// path: '/education/documentDetail'
// })
},
shareFile (item) {
/* 分享文档 */
this.$router.push({
name: routerName,
path: routerPath,
query: {
folder: item.folderData,
title: item.title
path: `/education/share?file_id=${item.file_info_id}`
})
},
updateFileName (params) {
/* 修改文件名称 */
this.$api.schoolBasedResourcesApi.updateFileName(params).then(res => {
if (res.data.Status === true) {
this.$vux.toast.show({
text: '修改名称成功'
})
this.$refs.fileList.renameDialog = false
this.getFolderList()
} else {
this.$vux.toast.show({
text: res.data.ResponseError.LongMessage,
type: 'cancel'
})
}
})
},
handleDeleteFile (params) {
/* 删除文件 */
this.$api.schoolBasedResourcesApi.deleteFile(params).then(res => {
if (res.data.Status === true) {
this.$vux.toast.show({
text: '删除成功'
})
this.$refs.fileList.deleteDialog = false
this.getFolderList()
} else {
this.$vux.toast.show({
text: res.data.ResponseError.LongMessage,
type: 'cancel'
})
}
})
}
},
mounted () {
this.currentList = this.listData.firstLevel
}
}
</script>
......
......@@ -8,21 +8,27 @@
<x-button class="add-btn" plain @click.native="teacherSelectorShow = true"><i class="iconfont">&#xe862;</i> 添加分享教师</x-button>
<div class="share-header">
<span class="dashed"></span>
<span class="person-count">已分享名单(100人)</span>
<span class="person-count">已分享名单({{ shareList.length }}人)</span>
<span class="dashed"></span>
</div>
<div class="search-ctn">
<searchs></searchs>
</div>
<div class="share-list">
<x-button class="person" v-for="(person, index) of 10" :key="index" mini>
<x-button class="person" v-for="(person, index) of shareList" :key="index" mini>
<div class="name-ctn">
<span class="name">张飞</span>
<i class="iconfont">&#xe827;</i>
<span class="name">{{ person.realname }}</span>
<!-- <i class="iconfont">&#xe827;</i> -->
</div>
</x-button>
</div>
<teacher-selector :show="teacherSelectorShow" @handleSubmit="teacherSelectorShow = false"></teacher-selector>
<teacher-selector
:is-multiple="true"
:userlist="shareList"
:show="teacherSelectorShow"
@handleSubmit="changeAndShare"
@close="teacherSelectorShow = false"
/>
</div>
</div>
</div>
......@@ -43,19 +49,90 @@ export default {
return {
title: '分享文档',
scroll: '',
teacherSelectorShow: false
shareList: [],
teacherSelectorShow: false,
fileId: '' // 文件id
}
},
methods: {
},
created () {
},
mounted () {
this.fileId = this.$route.query.file_id
this.getShareList()
this.$nextTick(() => {
this.scroll = new BScroll(this.$refs.contentWrapper, {
click: true
})
})
},
methods: {
getShareList () {
/* 获取该文件已经分享的名单 */
let data = {
file_info_id: this.fileId
}
this.$api.schoolBasedResourcesApi.GetFileShareInfoByFileId(data).then(res => {
if (res.data.Status) {
let data = res.data.Data
if (data && data.teacher_user_ids) {
let teacherList = this.stringToUserList(data.teacher_user_ids, data.teacher_user_names)
this.shareList = teacherList
} else {
this.shareList = []
}
}
})
},
changeAndShare (list) {
/* 选人并分享 */
let userList = this.userListToString(list)
let params = {
file_info_id: this.fileId,
teacher_user_ids: userList.userIds,
teacher_user_names: userList.userNames
}
this.$api.schoolBasedResourcesApi.fileShare(params).then(res => {
if (res.data.Status === true) {
this.$vux.toast.show({
text: '分享成功'
})
this.getShareList()
} else {
this.$vux.toast.show({
text: res.data.ResponseError.LongMessage,
type: 'cancel'
})
}
})
this.teacherSelectorShow = false
},
userListToString (userList) {
/* 把分享用户数组转为字符串 */
let data = {
userIds: '',
userNames: ''
}
for (let i = 0; i < userList.length; i++) {
if (i === 0) {
data.userIds += userList[i].id
data.userNames += userList[i].realname
} else {
data.userIds += ',' + userList[i].id
data.userNames += ',' + userList[i].realname
}
}
return data
},
stringToUserList (ids, names) {
/* 把分享用户字符串转为数组 */
let idsStr = ids.split(',')
let namesStr = names.split(',')
let userList = []
for (let i = 0; i < idsStr.length; i++) {
userList.push({ id: idsStr[i], realname: namesStr[i] })
}
return userList
}
}
}
</script>
......@@ -116,7 +193,11 @@ export default {
align-items: center;
.name {
padding-top: 2px;
font-size: 15px;
font-size: 14px;
width: 100%;
overflow: hidden;
// text-overflow:ellipsis;
// white-space: nowrap;
}
.iconfont {
font-size: 17px;
......
<template>
<div class="action-popover" style="position:fixed;bottom:60px">
<popover placement="top" style="margin: 20px;">
<div class="popover-ctn popover-demo-content" slot="content">
<div class="action-in-content" style="margin-bottom: 5px" @click="backLayer(1)">
<div class="action-item-ctn">
<i class="iconfont">&#xe143;</i>
</div>
<p>返回上一级目录</p>
</div>
<div class="action-in-content" @click="backLayer(0)">
<div class="action-item-ctn">
<i class="iconfont">&#xe16b;</i>
</div>
<p>回到主界面</p>
</div>
</div>
<div class="fixed-menu btn btn-default">
<i class="iconfont">&#xe16b;</i>
</div>
</popover>
</div>
</template>
<script>
import { Popover, Icon } from 'vux'
export default {
name: 'Popovers',
components: {
Popover,
Icon
},
data () {
return {
value: ''
}
},
methods: {
backLayer (layer) {
this.$EventBus.$emit('backLayer', layer)
}
}
}
</script>
<style lang="less" scoped>
.popover-ctn {
background: rgb(252, 252, 252);
box-shadow: 5px 5px 5px #888888;
padding: 15px 5px 5px 5px;
.action-in-content {
display: flex;
.action-item-ctn {
width:35px;
height:35px;
padding:5px;
border-radius: 50px;
background: #59acfa;
text-align: center;
i {
font-size: 20px;
line-height: 25px;
color: white
}
}
p {
line-height: 35px;
margin-left: 5px;
}
}
}
.fixed-menu {
width:40px;
height:40px;
border: none;
margin:0 0 0 40px;
padding:5px;
border-radius: 50px;
background: #59acfa;
i {
font-size: 23px;
line-height: 30px;
color: white;
}
}
</style>
......@@ -10,16 +10,16 @@
<span class="radio-item">分享给我的</span> -->
</div>
<group class="cellgroup-ctn">
<cell v-show="mode !== 'favorShare' || radioValue === 'all' || item.fileType === radioValue" v-for="(item, index) of list" :key="index" :title="item.name" @click.native="showBtns(item)">
<cell v-show="mode !== 'favorShare' || radioValue === 'all' || item.fileType === radioValue" v-for="(item, index) of list" :key="index" :title="item.file_name" @click.native="showBtns(item)">
<i slot="icon" class="iconfont">&#xe890;</i>
<div slot="after-title" class="after-title-ctn">
<p v-if="mode === 'favorShare'" class="document-descript">某某某 2020-08-13 12:00</p>
<div v-show="item.showFunBtn" class="btns-ctn" @click.stop>
<div v-show="item.showFunBtn || false" class="btns-ctn" @click.stop>
<span class="btn-item" @click="handleOpen(item)">打开</span>
<span class="btn-item">下载</span>
<span class="btn-item" v-if="mode === 'myUpload'" @click="renameDialog = true">重命名</span>
<span class="btn-item" v-if="mode === 'myUpload'" @click="clickRenameBtn(item)">重命名</span>
<span class="btn-item" v-if="mode === 'myUpload'" @click="handleShare(item)">分享</span>
<span class="btn-item" style="color:#D9001B" v-if="mode === 'myUpload' || (mode === 'favorShare' && item.fileType === 'shareToMe')" @click="deleteDialog = true">删除</span>
<span class="btn-item" style="color:#D9001B" v-if="mode === 'myUpload' || (mode === 'favorShare' && item.fileType === 'shareToMe')" @click="selectDeleteItem(item)">删除</span>
<span class="btn-item" style="color:#D9001B" v-if="mode === 'favorShare' && item.fileType === 'myFavor'">取消收藏</span>
<span class="btn-item" style="color:#D9001B" v-if="mode === 'favorShare' && item.fileType === 'myShare'">取消分享</span>
</div>
......@@ -38,7 +38,7 @@
<x-input class="rename-input" v-model="renameValue" placeholder="请输入名称..."></x-input>
<div class="btn-ctn">
<x-button class="reset" mini plain @click.native="renameDialog = false">取消</x-button>
<x-button class="inquire" mini @click.native="renameDialog = false">确定</x-button>
<x-button class="inquire" mini @click.native="handleUpdate">确定</x-button>
</div>
</div>
</x-dialog>
......@@ -55,7 +55,7 @@
<p class="tips">删除后不可恢复,确认要删除此文档吗</p>
<div class="btn-ctn">
<x-button class="reset" mini plain @click.native="deleteDialog = false">取消</x-button>
<x-button class="inquire" mini @click.native="deleteDialog = false">确定</x-button>
<x-button class="inquire" mini @click.native="handleDelete">确定</x-button>
</div>
</div>
</x-dialog>
......@@ -81,6 +81,12 @@ export default {
return []
}
}
// fileParent: {
// type: Object,
// default: () => {
// return {}
// }
// }
},
components: {
Group,
......@@ -92,6 +98,8 @@ export default {
data () {
return {
radioValue: 'all', // 类型框的值 (all: 全部,myFavor:我收藏的,myShare:我分享的,shareToMe:分享给我的)
deleteItem: {}, // 储存选中删除的对象
renameItem: {}, // 储存选中重命名的对象
radioOption: [
{
label: '全部',
......@@ -115,6 +123,8 @@ export default {
deleteDialog: false
}
},
mounted () {
},
methods: {
showBtns (item) {
this.$emit('handleClickItem', item)
......@@ -126,9 +136,33 @@ export default {
handleShare (item) {
/* 分享文档 */
this.$emit('handleShare', item)
},
clickRenameBtn (item) {
/* 点击重命名按钮 */
this.renameValue = item.file_name
this.renameItem = item
this.renameDialog = true
},
handleUpdate () {
/* 修改文件名称 */
let data = {
b_id: this.renameItem.file_info_id,
file_name: this.renameValue
}
this.$emit('updateFileName', data)
},
mounted () {
selectDeleteItem (item) {
/* 选择删除对象并弹窗确认 */
this.deleteItem = item
this.deleteDialog = true
},
handleDelete () {
/* 删除文件 */
let data = {
b_id: this.deleteItem.file_info_id
}
this.$emit('handleDeleteFile', data)
}
}
}
</script>
......
<template>
<div>
<group :title="listTitle" class="cellgroup-ctn">
<cell v-for="(item, index) of list" :key="index" :title="item.title" @click.native="folderClick(item)">
<group :title="listTitle === ''?'':`${listTitle}(${list.length})`" class="cellgroup-ctn">
<cell v-for="(item, index) of list" :key="index" :title="item.folder_name" @click.native="folderClick(item)">
<i slot="icon" class="iconfont">&#xe166;</i>
<div slot="after-title" class="descript">
{{ item.descript }}
我上传了{{ item.file_count }}个文档
</div>
</cell>
</group>
......
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