Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zeroing-editor
Project
Project
Details
Activity
Releases
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
劳工
zeroing-editor
Commits
13404bc7
Commit
13404bc7
authored
Oct 12, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
素材面板拆分成左右,并加入属性子面板
parent
058d0999
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
40 deletions
+97
-40
index.js
mock/api/project/query/data/index.js
+2
-2
assets.scss
src/themes/light/assets.scss
+35
-2
base.scss
src/themes/light/base.scss
+1
-1
Assets.vue
src/views/Editor/Assets.vue
+52
-26
AssetsShow.vue
src/views/Editor/Assets/AssetsShow.vue
+4
-7
FileItem.vue
src/views/Editor/Assets/FileItem.vue
+3
-2
No files found.
mock/api/project/query/data/index.js
View file @
13404bc7
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2019-09-23.
* Created by rockyl on 2019-09-23.
*/
*/
const
data
1
=
{
const
data
=
{
"views"
:
[
"views"
:
[
{
{
"name"
:
"view1"
,
"name"
:
"view1"
,
...
@@ -71,7 +71,7 @@ const data1 = {
...
@@ -71,7 +71,7 @@ const data1 = {
}
}
]
]
};
};
const
data
=
{
const
data
1
=
{
"views"
:
[
"views"
:
[
],
],
"assets"
:
[
"assets"
:
[
...
...
src/themes/light/assets.scss
View file @
13404bc7
@import
"var"
;
@import
"var"
;
.assets
{
.assets
{
.
contain
er
{
.
wrapp
er
{
display
:
flex
;
display
:
flex
;
flex
:
1
;
flex
:
1
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -19,6 +19,39 @@
...
@@ -19,6 +19,39 @@
}
}
}
}
.container
{
display
:
flex
;
flex
:
1
;
}
.properties
{
width
:
30%
;
padding
:
3px
;
font-size
:
12px
;
line-height
:
14px
;
color
:
$--color-text-primary
;
border-right
:
1px
solid
$--border-color-base
;
.item
{
border-bottom
:
1px
solid
$--border-color-base
;
}
p
{
word-break
:
break-all
;
margin
:
0
;
}
.name
{
font-size
:
16px
;
line-height
:
22px
;
width
:
100%
;
}
.ext
{
color
:
$--color-text-regular
;
}
}
.file-list
{
.file-list
{
display
:
flex
;
display
:
flex
;
flex
:
1
;
flex
:
1
;
...
@@ -104,7 +137,7 @@
...
@@ -104,7 +137,7 @@
.file-uploader
{
.file-uploader
{
width
:
60px
;
width
:
60px
;
height
:
60px
;
height
:
60px
;
margin
:
5px
5px
5
px
;
margin
:
4
px
;
border
:
1px
dashed
$--color-text-secondary
;
border
:
1px
dashed
$--color-text-secondary
;
border-radius
:
6px
;
border-radius
:
6px
;
cursor
:
pointer
;
cursor
:
pointer
;
...
...
src/themes/light/base.scss
View file @
13404bc7
...
@@ -20,5 +20,5 @@ html, body, #app {
...
@@ -20,5 +20,5 @@ html, body, #app {
right
:
0
;
right
:
0
;
bottom
:
0
;
bottom
:
0
;
background-color
:
rgba
(
0
,
0
,
0
,
0
.7
);
background-color
:
rgba
(
0
,
0
,
0
,
0
.7
);
z-index
:
2
;
z-index
:
2
000
;
}
}
src/views/Editor/Assets.vue
View file @
13404bc7
<
template
>
<
template
>
<pane
class=
"assets"
icon=
"el-icon-s-shop"
:title=
"$t('panes.Assets')"
>
<pane
class=
"assets"
icon=
"el-icon-s-shop"
:title=
"$t('panes.Assets')"
>
<div
class=
"
contain
er"
>
<div
class=
"
wrapp
er"
>
<!--
<div
class=
"header-bar"
>
<!--
<div
class=
"header-bar"
>
<el-link>
{{
$t
(
'Upload'
)
}}
</el-link>
<el-link>
{{
$t
(
'Upload'
)
}}
</el-link>
</div>
-->
</div>
-->
<el-scrollbar
class=
"assets-scrollbar"
wrap-class=
"wrap-x-hidden"
view-class=
"scrollbar-view"
>
<div
class=
"container"
>
<div
class=
"file-list"
>
<div
class=
"properties"
>
<el-upload
<template
v-if=
"currentItem"
>
class=
"file-uploader"
<div
class=
"item"
>
:action=
"uploadFileUrl"
<p
class=
"name"
>
{{
currentItem
.
name
}}
</p>
name=
"file"
<p
class=
"ext"
>
{{
currentItem
.
ext
}}
</p>
multiple
</div>
:show-file-list=
"false"
:on-success=
"uploadFileSuccess"
<div
class=
"item"
>
:on-error=
"uploadFileError"
<p
v-for=
"(field, index) in showFields"
:key=
"index"
>
>
<span>
{{
field
}}
</span>
:
<i
class=
"el-icon-plus file-uploader-icon"
></i>
<span>
{{
currentItem
[
field
]
}}
</span>
</el-upload>
</p>
<file-item
v-for=
"(file, index) in assets"
:data=
"file"
:key=
"index"
@
show-file-details=
"showFileDetails"
/>
</div>
</
template
>
</div>
</div>
</el-scrollbar>
<el-scrollbar
class=
"assets-scrollbar"
wrap-class=
"wrap-x-hidden"
view-class=
"scrollbar-view"
>
<div
class=
"file-list"
>
<el-upload
class=
"file-uploader"
:action=
"uploadFileUrl"
name=
"file"
multiple
:show-file-list=
"false"
:on-success=
"uploadFileSuccess"
:on-error=
"uploadFileError"
>
<i
class=
"el-icon-plus file-uploader-icon"
></i>
</el-upload>
<file-item
v-for=
"(asset, index) in assets"
:data=
"asset"
:key=
"index"
@
show-file-details=
"showFileDetails"
@
click=
"onItemClick(asset)"
/>
</div>
</el-scrollbar>
</div>
</div>
</div>
<assets-show
ref=
"assetsShow"
/>
<assets-show
ref=
"assetsShow"
/>
</pane>
</pane>
...
@@ -31,40 +50,47 @@
...
@@ -31,40 +50,47 @@
import
FileItem
from
"./Assets/FileItem"
;
import
FileItem
from
"./Assets/FileItem"
;
import
AssetsShow
from
"./Assets/AssetsShow"
;
import
AssetsShow
from
"./Assets/AssetsShow"
;
import
{
UPLOAD_FILE_URL
}
from
"../../config"
;
import
{
UPLOAD_FILE_URL
}
from
"../../config"
;
import
SplitPanes
from
'splitpanes'
export
default
{
export
default
{
name
:
"Assets"
,
name
:
"Assets"
,
components
:
{
AssetsShow
,
FileItem
,
Pane
},
components
:
{
AssetsShow
,
FileItem
,
Pane
,
SplitPanes
},
data
()
{
data
()
{
return
{}
return
{
showFields
:
[
'url'
,
'uuid'
],
currentItem
:
null
,
}
},
},
computed
:
{
computed
:
{
uploadFileUrl
(){
uploadFileUrl
()
{
return
UPLOAD_FILE_URL
;
return
UPLOAD_FILE_URL
;
},
},
...
mapState
({
...
mapState
({
assets
:
state
=>
state
.
project
.
data
.
assets
assets
:
state
=>
state
.
project
.
data
.
assets
}),
}),
},
},
mounted
(){
mounted
()
{
this
.
currentItem
=
null
;
},
},
methods
:
{
methods
:
{
showFileDetails
(
file
){
showFileDetails
(
file
)
{
this
.
$refs
.
assetsShow
.
show
(
file
);
this
.
$refs
.
assetsShow
.
show
(
file
);
},
},
uploadFileSuccess
(
response
,
file
){
onItemClick
(
asset
)
{
if
(
response
.
success
){
this
.
currentItem
=
asset
;
},
uploadFileSuccess
(
response
,
file
)
{
if
(
response
.
success
)
{
//console.log('upload success', response, file);
//console.log('upload success', response, file);
this
.
addAsset
({
this
.
addAsset
({
url
:
response
.
url
,
url
:
response
.
url
,
file
,
file
,
})
})
}
else
{
}
else
{
this
.
uploadFileError
();
this
.
uploadFileError
();
}
}
},
},
uploadFileError
(){
uploadFileError
()
{
console
.
log
(
'upload error'
)
console
.
log
(
'upload error'
)
},
},
...
mapMutations
([
...
mapMutations
([
...
...
src/views/Editor/Assets/AssetsShow.vue
View file @
13404bc7
...
@@ -12,13 +12,9 @@
...
@@ -12,13 +12,9 @@
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
<el-button
class=
"close-button"
size=
"mini"
circle
icon=
"el-icon-close"
@
click=
"hide"
></el-button>
<el-button
class=
"close-button"
size=
"mini"
circle
icon=
"el-icon-close"
@
click=
"hide"
></el-button>
<div
class=
"name-bar"
>
<div
class=
"name-bar"
>
<el-input
size=
"mini"
class=
"item"
v-model=
"file.name"
readonly
>
<el-input
v-for=
"(field, index) in showFields"
:key=
"index"
size=
"mini"
class=
"item"
v-model=
"file[field]"
readonly
>
<template
slot=
"prepend"
><span
class=
"field"
>
name
</span></
template
>
<template
slot=
"prepend"
><span
class=
"field"
>
{{
field
}}
</span></
template
>
<el-button
slot=
"append"
icon=
"el-icon-document-copy"
@
click=
"copyValue('name')"
></el-button>
<el-button
slot=
"append"
icon=
"el-icon-document-copy"
@
click=
"copyValue(field)"
></el-button>
</el-input>
<el-input
size=
"mini"
class=
"item"
v-model=
"file.url"
readonly
>
<
template
slot=
"prepend"
><span
class=
"field"
>
url
</span></
template
>
<el-button
slot=
"append"
icon=
"el-icon-document-copy"
@
click=
"copyValue('url')"
></el-button>
</el-input>
</el-input>
</div>
</div>
<el-image
class=
"big-image"
:src=
"imageUrl"
fit=
"contain"
@
load=
"onImageLoaded"
/>
<el-image
class=
"big-image"
:src=
"imageUrl"
fit=
"contain"
@
load=
"onImageLoaded"
/>
...
@@ -45,6 +41,7 @@
...
@@ -45,6 +41,7 @@
visible
:
false
,
visible
:
false
,
file
:
null
,
file
:
null
,
size
:
''
,
size
:
''
,
showFields
:
[
'name'
,
'url'
,
'uuid'
],
}
}
},
},
watch
:
{
watch
:
{
...
...
src/views/Editor/Assets/FileItem.vue
View file @
13404bc7
<
template
>
<
template
>
<div
class=
"file-item"
>
<div
class=
"file-item"
@
click=
"$emit('click', $event)"
>
<div
class=
"icon"
>
<div
class=
"icon"
>
<i
v-if=
"!showThumbnail"
draggable=
"true"
class=
"file-icon"
:class=
"fileIcon"
></i>
<i
v-if=
"!showThumbnail"
draggable=
"true"
class=
"file-icon"
:class=
"fileIcon"
></i>
<img
@
dragstart=
"assetDragStart(data)"
v-if=
"showThumbnail"
draggable=
"true"
class=
"thumbnail"
:src=
"thumbnailUrl"
alt=
"thumb"
@
dblclick=
"onDbclick()"
>
<img
@
dragstart=
"assetDragStart(data)"
v-if=
"showThumbnail"
draggable=
"true"
class=
"thumbnail"
:src=
"thumbnailUrl"
alt=
"thumb"
@
dblclick=
"onDbclick()"
>
...
@@ -34,7 +34,8 @@
...
@@ -34,7 +34,8 @@
},
},
computed
:
{
computed
:
{
fileIcon
()
{
fileIcon
()
{
return
'icon-'
+
fileTypeIcon
[
this
.
data
.
ext
];
let
icon
=
fileTypeIcon
[
this
.
data
.
ext
];
return
'icon-'
+
(
icon
?
fileTypeIcon
[
this
.
data
.
ext
]
:
fileTypeIcon
[
''
]);
},
},
showThumbnail
()
{
showThumbnail
()
{
return
fileTypeIcon
[
this
.
data
.
ext
]
===
't'
;
return
fileTypeIcon
[
this
.
data
.
ext
]
===
't'
;
...
...
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