Commit 7b2a9c12 authored by 赵炳峰's avatar 赵炳峰
parents a74dc3aa 61b5d3e2
...@@ -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,49 @@ export default { ...@@ -28,5 +28,49 @@ 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 })
},
// 删除文件
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 = { ...@@ -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` // 校本资源
} }
......
<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>
......
...@@ -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)
......
...@@ -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,24 +22,26 @@ ...@@ -22,24 +22,26 @@
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>
<el-table-column <el-table-column
v-if="manageMode" v-if="manageMode"
prop="private"
label="公开/不公开" label="公开/不公开"
width="180"> width="180">
<template slot-scope="scope">
{{ scope.row.is_public == 1 ? '不公开': (scope.row.is_public == 2 ? '对所有教师公开': '对部分教师公开')}}
</template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column
v-if="manageMode" v-if="manageMode"
prop="documentCount" prop="file_count"
label="文档数量" label="文档数量"
width="150"> width="150">
</el-table-column> </el-table-column>
...@@ -54,8 +56,14 @@ ...@@ -54,8 +56,14 @@
min-width="220"> min-width="220">
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination" v-if="!(fileList[0] && fileList[0].isFolder)"> <div class="pagination" v-if="currentIsFiLe">
<pagination :amount="50"></pagination> <pagination
:amount="paginationQuery.amount"
:page-size="paginationQuery.pageSize"
:page-index="paginationQuery.pageIndex"
@getCurrentPage="handleCurrentChange"
@getSizeChange="handleSizeChange"
/>
</div> </div>
</div> </div>
</template> </template>
...@@ -84,12 +92,19 @@ export default { ...@@ -84,12 +92,19 @@ export default {
manageMode: { // 是否为我管理的页面使用 manageMode: { // 是否为我管理的页面使用
type: Boolean, type: Boolean,
default: false default: false
},
paginationQuery: {
type: Object,
default: () => {
return { amount: 0, pageSize: 50, pageIndex: 1 }
}
} }
}, },
computed: { computed: {
folderTypeOptions () { folderTypeOptions () {
/* 根据foderType来判断显示哪种options */ /* 根据foderType来判断显示哪种options */
const uploadType = { 1: '学校文件夹', 2: '个人文件夹' } const uploadType = { 1: '学校文件夹', 2: '个人文件夹' }
const school = { 1: '常规文件夹', 2: '任务文件夹' }
const favorType = { 1: '我收藏的', 2: '我分享的', 3: '分享给我的' } const favorType = { 1: '我收藏的', 2: '我分享的', 3: '分享给我的' }
let folderTypeOptions = {} let folderTypeOptions = {}
switch (this.mode) { switch (this.mode) {
...@@ -99,6 +114,9 @@ export default { ...@@ -99,6 +114,9 @@ export default {
case 'favor': case 'favor':
folderTypeOptions = favorType folderTypeOptions = favorType
break break
case 'school':
folderTypeOptions = school
break
} }
return folderTypeOptions return folderTypeOptions
} }
...@@ -117,10 +135,10 @@ export default { ...@@ -117,10 +135,10 @@ export default {
this.$emit('tableIntoFile', row) this.$emit('tableIntoFile', row)
}, },
handleSizeChange (val) { handleSizeChange (val) {
console.log(`每页 ${val} 条`) this.$emit('getSizeChange', val)
}, },
handleCurrentChange (val) { handleCurrentChange (val) {
console.log(`当前页: ${val}`) this.$emit('getCurrentPage', val)
} }
} }
} }
......
<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">
<!-- 第二层 -->
<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> <i class="el-icon-folder folder-icon"></i>
<span class="folderName" @click="upload">语文文案</span> <span class="folderName">{{ secondLevel.folder_name }}</span>
</div> </div>
</div> <div v-if="secondLevel.children && secondLevel.children.length > 0">
<div class="folder-select"> <!-- 第三层 -->
<div class="folder-line select-first"> <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> <i class="el-icon-folder folder-icon"></i>
<span class="folderName">二年级文案</span> <span class="folderName">{{ thirdLevel.folder_name }}</span>
</div>
</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>
</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;
} }
} }
......
...@@ -16,7 +16,7 @@ export default { ...@@ -16,7 +16,7 @@ export default {
}, },
data () { data () {
return { return {
isShowPrevPage: true, isShowPrevPage: false,
menus: [ menus: [
{ {
name: '校内资源', name: '校内资源',
...@@ -28,24 +28,8 @@ export default { ...@@ -28,24 +28,8 @@ export default {
} }
}, },
methods: { methods: {
initDataFromRoute (route) {
/* 根据路由参数来显示对应数据 */
if (route.query.folderName) { // 有参数说明不是首页,显示返回上一页
this.isShowPrevPage = true
} else {
this.isShowPrevPage = false
}
}
}, },
mounted () { mounted () {
},
created () {
this.initDataFromRoute(this.$route)
},
watch: {
$route (to, from) {
this.initDataFromRoute(to)
}
} }
} }
......
...@@ -4,6 +4,7 @@ import loginApi from './loginApi' // 登录 ...@@ -4,6 +4,7 @@ import loginApi from './loginApi' // 登录
import aliOssApi from './aliOssApi' // ali-oss import aliOssApi from './aliOssApi' // ali-oss
import homeApi from './homeApi' import homeApi from './homeApi'
import commonApi from './commonApi' import commonApi from './commonApi'
import schoolBasedResourcesApi from './schoolBasedResourcesApi'
import education from './education' // 教务管理 import education from './education' // 教务管理
...@@ -15,5 +16,6 @@ export default { ...@@ -15,5 +16,6 @@ export default {
wxCommonApi, wxCommonApi,
aliOssApi, aliOssApi,
homeApi, homeApi,
schoolBasedResourcesApi,
...education ...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接口 ...@@ -29,6 +29,9 @@ import fundebugVue from 'fundebug-vue' // 导入api接口
// import VConsole from 'vconsole' // import VConsole from 'vconsole'
// new VConsole() // new VConsole()
const bus = new Vue() // eventBus 事件总线
Vue.prototype.$EventBus = bus // 将事件总线挂载到vue的原型上
Vue.prototype.$api = api Vue.prototype.$api = api
Vue.prototype.$common = common // 将common挂载到vue的原型上 Vue.prototype.$common = common // 将common挂载到vue的原型上
Vue.prototype.$handleResponse = handleResponse Vue.prototype.$handleResponse = handleResponse
......
<template> <template>
<div class="container"> <div class="container" style="position: relative;">
<v-header :title="title" :isShowPrevPage="isShowPrevPage"> <v-header :title="title" :isShowPrevPage="isShowPrevPage">
<span slot="action" class="header-slot pull-right"></span> <span slot="action" class="header-slot pull-right"></span>
</v-header> </v-header>
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<router-view></router-view> <router-view></router-view>
</div> </div>
</div> </div>
<action-menu v-show="!currentIsFirstLevel"/>
<tab-bar :menus="tabBarMenus"></tab-bar> <tab-bar :menus="tabBarMenus"></tab-bar>
</div> </div>
</template> </template>
...@@ -20,13 +21,15 @@ export default { ...@@ -20,13 +21,15 @@ export default {
components: { components: {
VHeader: () => import('@/common/header/VHeader'), VHeader: () => import('@/common/header/VHeader'),
Tabs: () => import('@/common/tab/Tabs'), Tabs: () => import('@/common/tab/Tabs'),
TabBar: () => import('@/common/tabBar/TabBar') TabBar: () => import('@/common/tabBar/TabBar'),
ActionMenu: () => import('./components/ActionMenu')
}, },
data () { data () {
return { return {
title: '标题', title: '校本资源',
isShowPrevPage: true, isShowPrevPage: false,
showTabs: false, // 是否显示Tabs组件 currentIsFirstLevel: true, // 当前列表是不是第一层文件夹
showTabs: true, // 是否显示Tabs组件
tabsMenus: [ tabsMenus: [
{ {
label: '我上传的', label: '我上传的',
...@@ -56,42 +59,49 @@ export default { ...@@ -56,42 +59,49 @@ export default {
scroll: '' 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 () { mounted () {
this.$nextTick(() => { this.$nextTick(() => {
this.scroll = new BScroll(this.$refs.contentWrapper, { this.scroll = new BScroll(this.$refs.contentWrapper, {
click: true click: true
}) })
}) })
this.$EventBus.$on('intoLayer', this.folderIntoLayer)
}, },
created () { created () {
this.initDataFromRoute(this.$route) // this.initDataFromRoute(this.$route)
}, },
watch: { watch: {
$route (to, from) { // $route (to, from) {
this.initDataFromRoute(to) // 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> </script>
......
...@@ -8,21 +8,27 @@ ...@@ -8,21 +8,27 @@
<x-button class="add-btn" plain @click.native="teacherSelectorShow = true"><i class="iconfont">&#xe862;</i> 添加分享教师</x-button> <x-button class="add-btn" plain @click.native="teacherSelectorShow = true"><i class="iconfont">&#xe862;</i> 添加分享教师</x-button>
<div class="share-header"> <div class="share-header">
<span class="dashed"></span> <span class="dashed"></span>
<span class="person-count">已分享名单(100人)</span> <span class="person-count">已分享名单({{ shareList.length }}人)</span>
<span class="dashed"></span> <span class="dashed"></span>
</div> </div>
<div class="search-ctn"> <div class="search-ctn">
<searchs></searchs> <searchs></searchs>
</div> </div>
<div class="share-list"> <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"> <div class="name-ctn">
<span class="name">张飞</span> <span class="name">{{ person.realname }}</span>
<i class="iconfont">&#xe827;</i> <!-- <i class="iconfont">&#xe827;</i> -->
</div> </div>
</x-button> </x-button>
</div> </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> </div>
</div> </div>
...@@ -43,19 +49,90 @@ export default { ...@@ -43,19 +49,90 @@ export default {
return { return {
title: '分享文档', title: '分享文档',
scroll: '', scroll: '',
teacherSelectorShow: false shareList: [],
teacherSelectorShow: false,
fileId: '' // 文件id
} }
}, },
methods: {
},
created () { created () {
}, },
mounted () { mounted () {
this.fileId = this.$route.query.file_id
this.getShareList()
this.$nextTick(() => { this.$nextTick(() => {
this.scroll = new BScroll(this.$refs.contentWrapper, { this.scroll = new BScroll(this.$refs.contentWrapper, {
click: true 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> </script>
...@@ -116,7 +193,11 @@ export default { ...@@ -116,7 +193,11 @@ export default {
align-items: center; align-items: center;
.name { .name {
padding-top: 2px; padding-top: 2px;
font-size: 15px; font-size: 14px;
width: 100%;
overflow: hidden;
// text-overflow:ellipsis;
// white-space: nowrap;
} }
.iconfont { .iconfont {
font-size: 17px; 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 @@ ...@@ -10,16 +10,16 @@
<span class="radio-item">分享给我的</span> --> <span class="radio-item">分享给我的</span> -->
</div> </div>
<group class="cellgroup-ctn"> <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> <i slot="icon" class="iconfont">&#xe890;</i>
<div slot="after-title" class="after-title-ctn"> <div slot="after-title" class="after-title-ctn">
<p v-if="mode === 'favorShare'" class="document-descript">某某某 2020-08-13 12:00</p> <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" @click="handleOpen(item)">打开</span>
<span class="btn-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" 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 === 'myFavor'">取消收藏</span>
<span class="btn-item" style="color:#D9001B" v-if="mode === 'favorShare' && item.fileType === 'myShare'">取消分享</span> <span class="btn-item" style="color:#D9001B" v-if="mode === 'favorShare' && item.fileType === 'myShare'">取消分享</span>
</div> </div>
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<x-input class="rename-input" v-model="renameValue" placeholder="请输入名称..."></x-input> <x-input class="rename-input" v-model="renameValue" placeholder="请输入名称..."></x-input>
<div class="btn-ctn"> <div class="btn-ctn">
<x-button class="reset" mini plain @click.native="renameDialog = false">取消</x-button> <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>
</div> </div>
</x-dialog> </x-dialog>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<p class="tips">删除后不可恢复,确认要删除此文档吗</p> <p class="tips">删除后不可恢复,确认要删除此文档吗</p>
<div class="btn-ctn"> <div class="btn-ctn">
<x-button class="reset" mini plain @click.native="deleteDialog = false">取消</x-button> <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>
</div> </div>
</x-dialog> </x-dialog>
...@@ -81,6 +81,12 @@ export default { ...@@ -81,6 +81,12 @@ export default {
return [] return []
} }
} }
// fileParent: {
// type: Object,
// default: () => {
// return {}
// }
// }
}, },
components: { components: {
Group, Group,
...@@ -92,6 +98,8 @@ export default { ...@@ -92,6 +98,8 @@ export default {
data () { data () {
return { return {
radioValue: 'all', // 类型框的值 (all: 全部,myFavor:我收藏的,myShare:我分享的,shareToMe:分享给我的) radioValue: 'all', // 类型框的值 (all: 全部,myFavor:我收藏的,myShare:我分享的,shareToMe:分享给我的)
deleteItem: {}, // 储存选中删除的对象
renameItem: {}, // 储存选中重命名的对象
radioOption: [ radioOption: [
{ {
label: '全部', label: '全部',
...@@ -115,6 +123,8 @@ export default { ...@@ -115,6 +123,8 @@ export default {
deleteDialog: false deleteDialog: false
} }
}, },
mounted () {
},
methods: { methods: {
showBtns (item) { showBtns (item) {
this.$emit('handleClickItem', item) this.$emit('handleClickItem', item)
...@@ -126,9 +136,33 @@ export default { ...@@ -126,9 +136,33 @@ export default {
handleShare (item) { handleShare (item) {
/* 分享文档 */ /* 分享文档 */
this.$emit('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> </script>
......
<template> <template>
<div> <div>
<group :title="listTitle" class="cellgroup-ctn"> <group :title="listTitle === ''?'':`${listTitle}(${list.length})`" class="cellgroup-ctn">
<cell v-for="(item, index) of list" :key="index" :title="item.title" @click.native="folderClick(item)"> <cell v-for="(item, index) of list" :key="index" :title="item.folder_name" @click.native="folderClick(item)">
<i slot="icon" class="iconfont">&#xe166;</i> <i slot="icon" class="iconfont">&#xe166;</i>
<div slot="after-title" class="descript"> <div slot="after-title" class="descript">
{{ item.descript }} 我上传了{{ item.file_count }}个文档
</div> </div>
</cell> </cell>
</group> </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