Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
5007c1df
Commit
5007c1df
authored
May 21, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
资产预览树
parent
f583cde4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
33 deletions
+6
-33
PreviewTree.jsx
src/view/Manage/AssetManage/Component/PreviewTree.jsx
+6
-33
No files found.
src/view/Manage/AssetManage/Component/PreviewTree.jsx
View file @
5007c1df
...
@@ -5,37 +5,13 @@ let graph = null;
...
@@ -5,37 +5,13 @@ let graph = null;
const
globalFontSize
=
20
;
const
globalFontSize
=
20
;
const
maxTextWidth
=
160
;
const
maxTextWidth
=
160
;
const
COLLAPSE_ICON
=
function
COLLAPSE_ICON
(
x
,
y
,
r
)
{
return
[
[
'M'
,
x
-
r
,
y
-
r
],
[
'a'
,
r
,
r
,
0
,
1
,
0
,
r
*
2
,
0
],
[
'a'
,
r
,
r
,
0
,
1
,
0
,
-
r
*
2
,
0
],
[
'M'
,
x
+
2
-
r
,
y
-
r
],
[
'L'
,
x
+
r
-
2
,
y
-
r
],
];
};
const
EXPAND_ICON
=
function
EXPAND_ICON
(
x
,
y
,
r
)
{
return
[
[
'M'
,
x
-
r
,
y
-
r
],
[
'a'
,
r
,
r
,
0
,
1
,
0
,
r
*
2
,
0
],
[
'a'
,
r
,
r
,
0
,
1
,
0
,
-
r
*
2
,
0
],
[
'M'
,
x
+
2
-
r
,
y
-
r
],
[
'L'
,
x
+
r
-
2
,
y
-
r
],
[
'M'
,
x
,
y
-
2
*
r
+
2
],
[
'L'
,
x
,
y
-
2
],
];
};
class
PreviewTree
extends
React
.
Component
{
class
PreviewTree
extends
React
.
Component
{
componentDidMount
()
{
componentDidMount
()
{
const
{
type
,
loadMoreData
}
=
this
.
props
;
const
container
=
document
.
getElementById
(
'preview-tree'
);
const
container
=
document
.
getElementById
(
'container'
);
if
(
!
container
)
return
;
const
width
=
container
.
scrollWidth
;
const
width
=
container
.
scrollWidth
;
const
height
=
container
.
scrollHeight
||
5
00
;
const
height
=
container
.
scrollHeight
||
3
00
;
G6
.
registerNode
(
G6
.
registerNode
(
'tree-node'
,
'tree-node'
,
...
@@ -50,7 +26,7 @@ class PreviewTree extends React.Component {
...
@@ -50,7 +26,7 @@ class PreviewTree extends React.Component {
},
},
});
});
const
content
=
(
cfg
.
text
||
''
).
replace
(
/
(
.
{19})
/g
,
'$1
\
n'
);
const
content
=
(
cfg
.
label
||
''
).
replace
(
/
(
.
{19})
/g
,
'$1
\
n'
);
const
text
=
group
.
addShape
(
'text'
,
{
const
text
=
group
.
addShape
(
'text'
,
{
attrs
:
{
attrs
:
{
...
@@ -100,7 +76,7 @@ class PreviewTree extends React.Component {
...
@@ -100,7 +76,7 @@ class PreviewTree extends React.Component {
});
});
graph
=
new
G6
.
TreeGraph
({
graph
=
new
G6
.
TreeGraph
({
container
:
'
container
'
,
container
:
'
preview-tree
'
,
width
,
width
,
height
,
height
,
maxZoom
:
1
,
maxZoom
:
1
,
...
@@ -185,22 +161,19 @@ class PreviewTree extends React.Component {
...
@@ -185,22 +161,19 @@ class PreviewTree extends React.Component {
const
{
data
}
=
this
.
props
;
const
{
data
}
=
this
.
props
;
if
(
graph
&&
data
){
if
(
graph
&&
data
){
console
.
log
(
'data'
,
data
);
graph
.
data
(
data
);
graph
.
data
(
data
);
graph
.
render
();
graph
.
render
();
graph
.
fitView
();
graph
.
fitView
();
}
}
}
}
componentDidUpdate
(
prevProps
,
prevState
){
componentDidUpdate
(
prevProps
,
prevState
)
{
this
.
layoutGraph
();
this
.
layoutGraph
();
}
}
render
()
{
render
()
{
return
(
return
(
<
div
id=
'
container
'
style=
{
{
width
:
'100%'
,
height
:
'100%'
}
}
/>
<
div
id=
'
preview-tree
'
style=
{
{
width
:
'100%'
,
height
:
'100%'
}
}
/>
);
);
}
}
}
}
...
...
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