Commit 61b5d3e2 authored by fangshupeng's avatar fangshupeng

跟新进度

parent 7d4012e4
......@@ -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