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
a2628d26
Commit
a2628d26
authored
Apr 10, 2021
by
zangsuyun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:资料优化
parent
66117db6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
6 deletions
+46
-6
src/modules/knowledge-base/components/KnowledgeBaseList.jsx
+44
-4
src/modules/knowledge-base/components/KnowledgeBaseOpt.jsx
+2
-2
No files found.
src/modules/knowledge-base/components/KnowledgeBaseList.jsx
View file @
a2628d26
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* @Author: zangsuyun
* @Author: zangsuyun
* @Date: 2021-03-12 14:49:40
* @Date: 2021-03-12 14:49:40
* @LastEditors: zangsuyun
* @LastEditors: zangsuyun
* @LastEditTime: 2021-04-
09 10:18:44
* @LastEditTime: 2021-04-
10 10:55:13
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -83,6 +83,48 @@ class KnowledgeBaseList extends React.Component {
...
@@ -83,6 +83,48 @@ class KnowledgeBaseList extends React.Component {
});
});
};
};
getBlob
=
(
url
)
=>
{
return
new
Promise
((
resolve
)
=>
{
const
xhr
=
new
XMLHttpRequest
()
xhr
.
open
(
'GET'
,
url
,
true
)
xhr
.
responseType
=
'blob'
xhr
.
onload
=
()
=>
{
if
(
xhr
.
status
===
200
)
{
resolve
(
xhr
.
response
)
}
}
xhr
.
send
()
})
}
saveAs
=
(
blob
,
filename
)
=>
{
if
(
window
.
navigator
.
msSaveOrOpenBlob
)
{
navigator
.
msSaveBlob
(
blob
,
filename
)
}
else
{
const
link
=
document
.
createElement
(
'a'
)
const
body
=
document
.
querySelector
(
'body'
)
// 创建对象url
link
.
href
=
window
.
URL
.
createObjectURL
(
blob
)
link
.
download
=
filename
body
.
appendChild
(
link
)
link
.
click
()
body
.
removeChild
(
link
)
// 通过调用 URL.createObjectURL() 创建的 URL 对象
window
.
URL
.
revokeObjectURL
(
link
.
href
)
}
}
// 下载文件
handleDownload
=
(
folder
)
=>
{
this
.
getBlob
(
folder
.
ossUrl
).
then
((
blob
)
=>
{
this
.
saveAs
(
blob
,
folder
.
folderName
)
})
}
// 预览文件
// 预览文件
handleScanFile
=
(
folder
)
=>
{
handleScanFile
=
(
folder
)
=>
{
console
.
log
(
folder
);
console
.
log
(
folder
);
...
@@ -113,9 +155,7 @@ class KnowledgeBaseList extends React.Component {
...
@@ -113,9 +155,7 @@ class KnowledgeBaseList extends React.Component {
// icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>,
// icon: <Icon type="question-circle" theme="filled" style={{ color: '#FF8534' }}></Icon>,
okText
:
"下载"
,
okText
:
"下载"
,
onOk
:
()
=>
{
onOk
:
()
=>
{
const
a
=
document
.
createElement
(
"a"
);
this
.
handleDownload
(
folder
)
a
.
href
=
ossUrl
;
a
.
click
();
},
},
});
});
break
;
break
;
...
...
src/modules/knowledge-base/components/KnowledgeBaseOpt.jsx
View file @
a2628d26
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
* @Author: zangsuyun
* @Author: zangsuyun
* @Date: 2021-03-12 14:25:52
* @Date: 2021-03-12 14:25:52
* @LastEditors: zangsuyun
* @LastEditors: zangsuyun
* @LastEditTime: 2021-04-
01 16:14:29
* @LastEditTime: 2021-04-
10 11:23:08
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
* @Copyright: © 2020 杭州杰竞科技有限公司 版权所有
*/
*/
...
@@ -76,7 +76,7 @@ export default function KnowledgeBaseOpt({
...
@@ -76,7 +76,7 @@ export default function KnowledgeBaseOpt({
isOpen=
{
true
}
isOpen=
{
true
}
accept=
".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.xlsx,.xls"
accept=
".ppt,.pptx,.doc,.docx,.pdf,.jpg,.jpeg,.png,.xlsx,.xls"
tooltip=
"支持文件类型:ppt、word、excel、pdf、jpg、jpeg、png"
tooltip=
"支持文件类型:ppt、word、excel、pdf、jpg、jpeg、png"
selectTypeList=
{
[
"JPG"
,
"JPEG"
,
"PNG"
,
'DOC'
,
'PDF'
,
'EXCEL'
]
}
// DOC 包含 .ppt,.pptx,.doc,.docx,.xls
selectTypeList=
{
[
"JPG"
,
"JPEG"
,
"PNG"
,
'DOC'
,
'PDF'
,
'EXCEL'
,
'application/msword'
,
'application/vnd.ms-powerpoint'
]
}
// DOC 包含 .pptx,.docx,.xls.XLSX,WORD:DOC
onClose=
{
()
=>
{
onClose=
{
()
=>
{
setModal
(
null
);
setModal
(
null
);
}
}
}
}
...
...
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