Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xiaomai-cloud-class-web
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
xiaomai-cloud-class
xiaomai-cloud-class-web
Commits
39feca51
Commit
39feca51
authored
Jun 08, 2021
by
zhangleyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:联调永中
parent
435c83c7
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
227 additions
and
29 deletions
+227
-29
src/bu-components/ChooseMembersModal.jsx
+1
-1
src/bu-components/ManagingMembersModal.jsx
+8
-6
src/modules/resource-disk/components/FolderList.jsx
+137
-22
src/modules/resource-disk/modal/PreviewFileModal.jsx
+35
-0
src/modules/resource-disk/modal/PreviewFileModal.less
+46
-0
No files found.
src/bu-components/ChooseMembersModal.jsx
View file @
39feca51
...
...
@@ -155,7 +155,7 @@ class ChooseMembersModal extends React.Component {
let
rightsList
=
[];
// 保存新加进去的成员
selectUserList
.
map
((
item
)
=>
{
rightsList
.
push
({
rights
:
"LOOK
_DOWNLOAD
"
,
rights
:
"LOOK"
,
userId
:
item
.
userId
})
return
rightsList
...
...
src/bu-components/ManagingMembersModal.jsx
View file @
39feca51
...
...
@@ -19,7 +19,7 @@ class ManagingMembersModal extends React.Component {
addManagingMember
:
false
,
// 是否点击了添加成员
storeId
:
User
.
getStoreId
()
,
// 学院Id
iconRotateList
:
[],
userAuthority
:
[
'可编辑'
,
'可
查看/下载'
,
'仅
可查看'
,
''
,
'创建者'
,
'学院管理员'
]
,
// 空 代表删除
userAuthority
:
[
'可编辑'
,
'可
下载'
,
'
可查看'
,
''
,
'创建者'
,
'学院管理员'
]
,
// 空 代表删除
}
}
componentDidMount
()
{
...
...
@@ -64,7 +64,7 @@ class ManagingMembersModal extends React.Component {
// 修改成员权限
updateFileUserAuthority
=
(
params
,
newRights
=
1
)
=>
{
const
rightList
=
[
'EDIT'
,
'LOOK_DOWNLOAD'
,
''
];
const
rightList
=
[
'EDIT'
,
'LOOK_DOWNLOAD'
,
'
LOOK
'
];
let
{
iconRotateList
}
=
this
.
state
;
let
_params
=
params
;
_params
.
rights
=
rightList
[
newRights
];
...
...
@@ -173,10 +173,10 @@ class ManagingMembersModal extends React.Component {
<
span
className=
'menu-bottom'
>
下载、复制
</
span
>
</
div
>
</
Menu
.
Item
>
{
/*
<Menu.Item key="LOOK" >
<div onClick={() => this.updateFileUserAuthority(params, 2)}>
仅可查看
</div>
<span className='menu-bottom'>
{userAuthority[2]}
</span>
</Menu.Item>
*/
}
<
Menu
.
Item
key=
"LOOK"
>
<
div
onClick=
{
()
=>
this
.
updateFileUserAuthority
(
params
,
2
)
}
>
{
userAuthority
[
2
]
}
</
div
>
<
span
className=
'menu-bottom'
>
查看
</
span
>
</
Menu
.
Item
>
<
Menu
.
Divider
key=
'LINE'
/>
<
Menu
.
Item
key=
"REMOVE"
>
<
div
className=
'remove'
onClick=
{
()
=>
this
.
removeUser
(
params
,
userAuthority
[
3
])
}
>
移除
</
div
>
...
...
@@ -247,6 +247,8 @@ class ManagingMembersModal extends React.Component {
num
=
1
;
}
else
if
(
record
.
rights
===
"EDIT"
)
{
num
=
0
;
}
else
if
(
record
.
rights
==
"LOOK"
){
num
=
2
;
}
}
return
(
...
...
src/modules/resource-disk/components/FolderList.jsx
View file @
39feca51
...
...
@@ -21,13 +21,15 @@ import UploadProgressModal from '@/bu-components/UploadProgressModal';
import
SelectPrepareFileModal
from
'@/bu-components/SelectPrepareFileModal'
;
import
CopyFileModal
from
'@/bu-components/CopyFileModal'
;
import
ManagingMembersModal
from
'@/bu-components/ManagingMembersModal'
;
import
PreviewFileModal
from
'../modal/PreviewFileModal'
import
ScanFileModal
from
'../modal/ScanFileModal'
;
import
CreateFolderModal
from
'../modal/CreateFolderModal'
;
import
User
from
'@/common/js/user'
;
import
axios
from
'axios'
;
const
appId
=
"yozoqvpO2Hvz8346"
;
const
DEL_FOLDER_URL_MAP
=
{
'MYSELF'
:
'public/hadesStore/delFolder'
,
'COMMON'
:
'public/hadesStore/delFolder'
...
...
@@ -52,7 +54,9 @@ class FolderList extends React.Component {
showCopyFileModal
:
false
,
// 复制文件弹窗
showManagingModal
:
false
,
// 管理文件查看编辑权限
nonCompliantFileList
:
[],
// 不符合上限的文件列表
parentRights
:
''
// 继承父级文件夹权限
parentRights
:
''
,
// 继承父级文件夹权限
showPreviewModal
:
false
,
//是否显示loading
previewing
:
false
//是否正在预览
}
}
...
...
@@ -95,10 +99,104 @@ class FolderList extends React.Component {
break
;
}
}
getYoZoSign
=
(
data
,
type
)
=>
{
return
new
Promise
((
resolve
)
=>
{
let
uploadParams
;
if
(
type
===
"UPLOAD"
){
uploadParams
=
{
fileUrl
:
data
,
instId
:
window
.
currentUserInstInfo
.
instId
,
yoZoTypeEnum
:
'UPLOAD'
}
}
else
{
uploadParams
=
{
fileVersionId
:
data
,
instId
:
window
.
currentUserInstInfo
.
instId
,
yoZoTypeEnum
:
'VIEW'
}
}
Service
.
Apollo
(
'public/apollo/getYoZoSign'
,
uploadParams
).
then
(
res
=>
{
const
{
result
=
[]
}
=
res
;
resolve
(
result
)
});
})
}
saveYoZoFileVersionId
=
(
fileVersionId
,
folderId
)
=>
{
const
params
=
{
fileVersionId
,
folderId
,
instId
:
window
.
currentUserInstInfo
.
instId
,
}
Service
.
Apollo
(
'public/apollo/saveYoZoFileVersionId'
,
params
).
then
(
res
=>
{
});
}
// 预览文件
handleScanFile
=
(
folder
)
=>
{
const
{
folderFormat
,
folderSize
,
ossUrl
}
=
folder
;
handleScanFile
=
async
(
folder
)
=>
{
const
{
folderFormat
,
folderSize
,
ossUrl
,
rights
,
fileVersionId
,
id
}
=
folder
;
const
{
currentRootDisk
}
=
this
.
props
;
//如果是公共文件且只有查看的权限的用户的预览对接的三方是永中
const
that
=
this
;
if
(
currentRootDisk
.
disk
===
"COMMON"
){
switch
(
folderFormat
)
{
case
'PDF'
:
case
'WORD'
:
case
'DOCX'
:
case
'DOC'
:
case
'EXCEL'
:
case
'PPT'
:
case
'PPTX'
:
if
(
!
fileVersionId
){
// const rightDom = document.querySelector('.right-container');
// rightDom.style.zIndex = 112;
this
.
setState
({
previewing
:
true
,
showPreviewModal
:
true
},
async
()
=>
{
const
uploadSign
=
await
that
.
getYoZoSign
(
ossUrl
,
"UPLOAD"
);
axios
.
post
(
`https://dmc.yozocloud.cn/api/file/http?fileUrl=
${
ossUrl
}
&appId=
${
appId
}
&sign=
${
uploadSign
}
`
)
.
then
(
async
function
(
response
){
that
.
saveYoZoFileVersionId
(
response
.
data
.
data
.
fileVersionId
,
id
);
const
{
previewing
}
=
that
.
state
;
if
(
previewing
){
const
previewSign
=
await
that
.
getYoZoSign
(
response
.
data
.
data
.
fileVersionId
,
"VIEW"
);
that
.
closePreview
();
const
url
=
`https://eic.yozocloud.cn/api/view/file?fileVersionId=
${
response
.
data
.
data
.
fileVersionId
}
&appId=
${
appId
}
&sign=
${
previewSign
}
`
const
a
=
document
.
createElement
(
'a'
);
document
.
body
.
appendChild
(
a
);
a
.
setAttribute
(
'href'
,
url
);
a
.
setAttribute
(
'target'
,
'_blank'
);
a
.
click
();
document
.
body
.
removeChild
(
a
)
}
})
})
}
else
{
const
previewSign
=
await
that
.
getYoZoSign
(
fileVersionId
,
"VIEW"
);
const
url
=
`http://eic.yozocloud.cn/api/view/file?fileVersionId=
${
fileVersionId
}
&appId=
${
appId
}
&sign=
${
previewSign
}
`
const
a
=
document
.
createElement
(
'a'
);
document
.
body
.
appendChild
(
a
);
a
.
setAttribute
(
'href'
,
url
);
a
.
setAttribute
(
'target'
,
'_blank'
);
a
.
click
();
document
.
body
.
removeChild
(
a
)
}
break
;
default
:
const
scanFileModal
=
(
<
ScanFileModal
fileType=
{
folderFormat
}
item=
{
folder
}
close=
{
()
=>
{
this
.
setState
({
scanFileModal
:
null
});
}
}
/>
);
this
.
setState
({
scanFileModal
});
break
;
}
}
else
{
switch
(
folderFormat
)
{
case
'PDF'
:
window
.
open
(
ossUrl
,
"_blank"
);
...
...
@@ -126,20 +224,20 @@ class FolderList extends React.Component {
});
break
;
}
if
(
folderFormat
===
'EXCEL'
)
{
Modal
.
confirm
({
title
:
'抱歉,不能在线预览'
,
content
:
' 该文件类型不支持在线预览,请下载后再查看'
,
// icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>,
okText
:
"下载"
,
onOk
:
()
=>
{
const
a
=
document
.
createElement
(
'a'
);
a
.
href
=
ossUrl
;
a
.
click
();
}
});
break
;
}
//
if (folderFormat === 'EXCEL') {
//
Modal.confirm({
//
title: '抱歉,不能在线预览',
//
content: ' 该文件类型不支持在线预览,请下载后再查看',
//
// icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>,
//
okText: "下载",
//
onOk: () => {
//
const a = document.createElement('a');
//
a.href = ossUrl;
//
a.click();
//
}
//
});
//
break;
//
}
const
prefixUrl
=
"https://view.officeapps.live.com/op/view.aspx?src="
;
const
scanUrl
=
`
${
prefixUrl
}${
encodeURIComponent
(
ossUrl
)}
`
window
.
open
(
scanUrl
,
"_blank"
);
...
...
@@ -155,11 +253,25 @@ class FolderList extends React.Component {
this
.
setState
({
scanFileModal
});
break
;
}
}
// 预览文件埋点
this
.
handleDataDot
(
folderFormat
);
}
cancelPreview
=
()
=>
{
// const rightDom = document.querySelector('.right-container');
// rightDom.style.zIndex = 1;
this
.
setState
({
previewing
:
false
,
showPreviewModal
:
false
})
}
closePreview
=
()
=>
{
// const rightDom = document.querySelector('.right-container');
// rightDom.style.zIndex = 1;
this
.
setState
({
showPreviewModal
:
false
})
}
// 选择文件夹
handleSelectFolder
=
(
folder
)
=>
{
const
{
folderPathList
,
showResultPage
,
currentRootDisk
}
=
this
.
props
;
...
...
@@ -646,7 +758,8 @@ class FolderList extends React.Component {
const
{
currentFolder
,
currentFile
,
renameModalData
,
showSelectFileModal
,
showUploadModal
,
localFileList
,
showCopyFileModal
,
showManagingModal
showUploadModal
,
localFileList
,
showCopyFileModal
,
showManagingModal
,
showPreviewModal
}
=
this
.
state
;
const
{
selectedFileIds
,
folderList
,
showResultPage
,
...
...
@@ -787,7 +900,9 @@ class FolderList extends React.Component {
}
}
/>
}
{
showPreviewModal
&&
<
PreviewFileModal
onCancel=
{
()
=>
this
.
cancelPreview
()
}
onClose=
{
()
=>
this
.
cancelPreview
()
}
/>
}
{
this
.
state
.
scanFileModal
}
{
this
.
state
.
chargeModal
}
</
div
>
...
...
src/modules/resource-disk/modal/PreviewFileModal.jsx
0 → 100644
View file @
39feca51
import
React
from
'react'
;
import
{
Modal
}
from
'antd'
;
import
"./PreviewFileModal.less"
;
class
PreviewFileModal
extends
React
.
Component
{
constructor
(
props
)
{
super
(
props
);
this
.
state
=
{};
}
cancelPreView
=
()
=>
{
this
.
props
.
onCancel
();
}
closePreView
=
()
=>
{
this
.
props
.
onClose
();
}
render
()
{
return
(
<
div
className=
"preview-modal"
>
<
div
className=
"preview-modal-content"
>
<
div
className=
"load-img-box"
><
img
className=
"load-img"
src=
"https://image.xiaomaiketang.com/xm/3j32ashQst.png"
></
img
></
div
>
<
div
className=
"load-text-box"
>
<
div
className=
"load-text-box-title"
>
预览生成中
</
div
>
<
div
>
可暂时关闭窗口,预览生成后仍会打开文件
</
div
>
</
div
>
<
div
className=
"operate"
>
<
span
className=
"btn cancel-preview-btn"
onClick=
{
()
=>
this
.
cancelPreView
()
}
>
取消预览
</
span
>
<
span
className=
"btn close-preview-btn"
onClick=
{
()
=>
this
.
closePreView
()
}
>
暂时关闭
</
span
>
</
div
>
</
div
>
</
div
>
);
}
}
export
default
PreviewFileModal
;
src/modules/resource-disk/modal/PreviewFileModal.less
0 → 100644
View file @
39feca51
.preview-modal{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 102;
height: 100%;
background: rgba(0, 0, 0, 0.7);
.preview-modal-content{
position:absolute;
left:calc(50% - 160px);
top:calc(50% - 87px);
color:#FFF;
text-align:center;
width:320px;
height:174px;
.load-img-box{
.load-img{
width:44px;
height:44px;
}
}
.load-text-box{
margin-top:23px;
font-size:16px;
color:#FFF;
.load-text-box-title{
margin-bottom:8px;
}
}
.operate{
margin-top:24px;
.btn {
padding:5px 12px;
border:1px solid #E8E8E8;
border-radius:2px;
}
.cancel-preview-btn{
margin-right:8px;
}
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment