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
a03d5cff
Commit
a03d5cff
authored
Apr 22, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图集打包上传改为并行,加快速度
parent
cf25f3fb
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
29 deletions
+94
-29
common.js
src/api/common.js
+2
-2
polaris.js
src/api/polaris.js
+0
-4
project.js
src/api/project.js
+4
-2
zh-CN.json
src/locales/zh-CN.json
+1
-0
project.js
src/store/modules/project.js
+37
-4
properties.js
src/utils/properties.js
+1
-1
sheet-pack.js
src/utils/sheet-pack.js
+38
-7
PublishView.vue
src/views/Editor/dialogs/PublishView.vue
+5
-5
PxSkinEditorDialog.vue
src/views/Editor/dialogs/PxSkinEditorDialog.vue
+6
-4
No files found.
src/api/common.js
View file @
a03d5cff
...
...
@@ -24,13 +24,13 @@ class ApiError extends Error {
}
}
export
async
function
fetchApi
(
uri
,
{
host
=
''
,
params
,
method
=
'get'
,
auth
=
true
,
judgeSuccess
=
true
,
contentType
=
'json'
,
dataField
=
'data'
,
errMessage
}
=
{})
{
export
async
function
fetchApi
(
uri
,
{
host
=
''
,
params
,
method
=
'get'
,
auth
=
true
,
credentials
=
'include'
,
judgeSuccess
=
true
,
contentType
=
'json'
,
dataField
=
'data'
,
errMessage
}
=
{})
{
let
url
=
host
+
(
uri
.
startsWith
(
'http'
)
||
uri
.
startsWith
(
'//'
)
?
uri
:
API_HOST
+
uri
);
const
options
=
{
method
,
headers
:
{},
credentials
:
'include'
,
credentials
,
};
if
(
auth
)
{
//options.headers.authorization = 'Bearer ' + window['zeroing_token'];
...
...
src/api/polaris.js
View file @
a03d5cff
...
...
@@ -19,7 +19,3 @@ export async function getSkins(projectId, env) {
export
async
function
sendDingTalk
()
{
return
await
fetchApi
(
`/polaris/sendMessage`
,
{
method
:
'post'
})
}
export
async
function
getDevPersons
(){
return
await
fetchApi
(
'/api/editor/devPersons'
,
{
method
:
'get'
});
}
\ No newline at end of file
src/api/project.js
View file @
a03d5cff
...
...
@@ -64,11 +64,12 @@ export async function deleteOne(id) {
/**
* 获取一个项目
* @param id
* @param withData 是否携带data
* @return {Promise<*|any>}
*/
export
async
function
fetchOne
(
id
)
{
export
async
function
fetchOne
(
id
,
withData
=
true
)
{
return
await
fetchApi
(
'/api/project/query/data'
,
{
params
:
{
id
},
params
:
{
id
,
withData
},
method
:
'get'
,
errMessage
:
'Failed to fetch project'
,
})
...
...
@@ -83,6 +84,7 @@ export async function fetchOneFromDataUrl(dataUrl) {
return
await
fetchApi
(
dataUrl
,
{
auth
:
false
,
judgeSuccess
:
false
,
credentials
:
'same-origin'
,
errMessage
:
'Failed to fetch project'
,
})
}
...
...
src/locales/zh-CN.json
View file @
a03d5cff
...
...
@@ -243,6 +243,7 @@
"Accept Both"
:
"兼并"
,
"Previous Conflict"
:
"上一个冲突"
,
"Next Conflict"
:
"下一个冲突"
,
"To Verify"
:
"去验证"
,
"eventGroup"
:
{
"in"
:
"接收"
,
"out"
:
"派发"
...
...
src/store/modules/project.js
View file @
a03d5cff
...
...
@@ -101,7 +101,7 @@ export const projectStore = {
state
.
name
=
name
;
state
.
creator
=
creator
;
state
.
operator
=
operator
;
state
.
operators
=
operators
;
state
.
operators
=
operators
||
creator
;
//兼容未保存的本地存储
state
.
update_time
=
update_time
;
const
localData
=
state
.
data
;
...
...
@@ -479,7 +479,7 @@ export const projectStore = {
project
(
state
)
{
const
{
id
,
name
,
creator
,
data
,
update_time
,
operator
,
operators
,}
=
state
;
let
newData
=
clonePureObj
(
data
);
delete
newData
[
'dependencies'
];
//
delete newData['dependencies'];
deleteDesignConfig
(
newData
.
processes
);
deleteAssetsDepConfig
(
newData
);
return
{
...
...
@@ -640,6 +640,7 @@ export const projectStore = {
},
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
await
dispatch
(
'loadPackageInfos'
);
project
=
await
projectApi
.
fetchOne
(
project
.
id
,
false
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
if
(
projectData
)
{
project
.
data
=
projectData
;
...
...
@@ -918,7 +919,9 @@ async function packAssets(assets) {
let
newAssets
=
assets
.
concat
();
await
packImages
(
newAssets
,
{
getSheetUrlByUUID
});
for
(
let
asset
of
newAssets
)
{
await
Promise
.
all
(
newAssets
.
map
(
asset
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
try
{
if
(
asset
.
file
)
{
const
{
url
}
=
await
editorApi
.
uploadFile
(
asset
.
file
,
true
).
catch
(
e
=>
{
failedList
.
push
(
asset
);
...
...
@@ -940,7 +943,37 @@ async function packAssets(assets) {
delete
asset
.
frames
;
delete
asset
.
sheetUUID
;
}
resolve
();
}
catch
(
e
)
{
reject
(
e
);
}
})
}));
/*for (let asset of newAssets) {
if (asset.file) {
const {url} = await editorApi.uploadFile(asset.file, true).catch(e => {
failedList.push(asset);
});
let sheetConfig = {
file: url,
type: 'sheet',
frames: asset.frames,
};
let sheetConfigFile = new File([JSON.stringify(sheetConfig)], 'sheet.json', {type: 'plain/text'});
const {url: sheetConfigUrl} = await editorApi.uploadFile(sheetConfigFile, false, asset.sheetUUID).catch(e => {
failedList.push(asset)
});
asset.url = sheetConfigUrl;
asset.uuid = generateUUID();
delete asset.file;
delete asset.frames;
delete asset.sheetUUID;
}
}*/
return
newAssets
;
}
...
...
src/utils/properties.js
View file @
a03d5cff
...
...
@@ -158,7 +158,7 @@ export default {
lineSpacing
:
{
alias
:
'行间距'
,
type
:
'number'
,
default
:
14
default
:
0
},
textAlign
:
{
alias
:
'文本对齐'
,
...
...
src/utils/sheet-pack.js
View file @
a03d5cff
...
...
@@ -11,14 +11,14 @@ const packExts = ['.png']; //, '.jpg', '.jpeg', '.bmp'
let
canvas
=
document
.
createElement
(
'canvas'
);
export
async
function
packImages
(
ass
s
ts
,
options
=
{})
{
export
async
function
packImages
(
ass
e
ts
,
options
=
{})
{
const
padding
=
options
.
padding
||
1
;
const
maxSize
=
options
.
maxSize
||
2048
;
const
mode
=
options
.
mode
||
0
;
const
{
getSheetUrlByUUID
}
=
options
;
const
images
=
await
preProcessing
(
ass
s
ts
);
const
images
=
await
preProcessing
(
ass
e
ts
);
let
rects
=
[],
singles
=
[];
for
(
let
item
of
images
)
{
...
...
@@ -38,7 +38,7 @@ export async function packImages(asssts, options = {}) {
offY
:
0
,
})
}
else
{
ass
s
ts
.
push
({
ass
e
ts
.
push
({
name
:
assets
[
0
].
name
,
ext
:
assets
[
0
].
ext
,
url
:
assets
[
0
].
url
,
...
...
@@ -53,6 +53,7 @@ export async function packImages(asssts, options = {}) {
let
remainRects
=
rects
.
concat
();
let
index
=
0
;
let
sheetPacks
=
[];
while
(
remainRects
.
length
>
0
)
{
let
name
=
'sheet'
+
index
;
...
...
@@ -95,7 +96,7 @@ export async function packImages(asssts, options = {}) {
}
}
const
sheetUUID
=
sha256
(
urls
.
sort
().
join
()).
toString
();
/*
const sheetUUID = sha256(urls.sort().join()).toString();
let url;
if (getSheetUrlByUUID) {
...
...
@@ -103,22 +104,52 @@ export async function packImages(asssts, options = {}) {
}
if(url){
ass
s
ts
.
push
({
ass
e
ts.push({
ext: '.sht',
url,
uuid: generateUUID(),
});
}else{
ass
s
ts
.
push
({
ass
e
ts.push({
ext: '.sht',
file: new File([blob], name + '.png'),
frames,
sheetUUID,
});
}
}*/
sheetPacks
.
push
([
urls
,
name
,
blob
,
frames
]);
index
++
;
}
await
Promise
.
all
(
sheetPacks
.
map
(([
urls
,
name
,
blob
,
frames
])
=>
{
return
deal
(
assets
,
urls
,
getSheetUrlByUUID
,
name
,
blob
,
frames
);
}))
}
async
function
deal
(
assets
,
urls
,
getSheetUrlByUUID
,
name
,
blob
,
frames
)
{
const
sheetUUID
=
sha256
(
urls
.
sort
().
join
()).
toString
();
let
url
;
if
(
getSheetUrlByUUID
)
{
url
=
await
getSheetUrlByUUID
(
sheetUUID
);
}
if
(
url
)
{
assets
.
push
({
ext
:
'.sht'
,
url
,
uuid
:
generateUUID
(),
});
}
else
{
assets
.
push
({
ext
:
'.sht'
,
file
:
new
File
([
blob
],
name
+
'.png'
),
frames
,
sheetUUID
,
});
}
}
function
loadImage
(
url
,
assets
)
{
...
...
src/views/Editor/dialogs/PublishView.vue
View file @
a03d5cff
...
...
@@ -56,10 +56,9 @@
import
{
getSkins
,
saveSkin
,
sendDingTalk
,
getDevPersons
}
from
"../../../../src/api/polaris"
;
import
{
pxHostMapping
}
from
"../../../utils"
;
import
{
getDevPersons
}
from
"../../../api/editor"
;
export
default
{
name
:
"PublishView"
,
...
...
@@ -112,8 +111,6 @@
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
console
.
log
(
"getDevPersons"
,
getDevPersons
())
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
return
item
.
level
==
1
...
...
@@ -175,7 +172,10 @@
const
{
env
}
=
this
;
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
await
this
.
$alert
(
this
.
$t
(
'SSO is invalid'
));
await
this
.
$confirm
(
this
.
$t
(
'SSO is invalid'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'To Verify'
),
cancelButtonText
:
this
.
$t
(
'Close'
),
});
window
.
open
(
'/sso/login?env='
+
env
,
'_blank'
);
},
hasIndex
()
{
...
...
src/views/Editor/dialogs/PxSkinEditorDialog.vue
View file @
a03d5cff
...
...
@@ -89,10 +89,11 @@
import
EnabledSetter
from
"../components/EnabledSetter"
;
import
MonacoEditor
from
"vue-monaco"
;
import
PxConfigPopover
from
"../components/PxConfigPopover"
;
import
{
getSkins
,
saveSkin
,
getDevPersons
}
from
"../../../api/polaris"
;
import
{
getSkins
,
saveSkin
,}
from
"../../../api/polaris"
;
import
{
playWaiting
,
pxHostMapping
}
from
"../../../utils"
;
import
copy
from
"copy-to-clipboard"
;
import
PxSkinEditor
from
"./PxSkinEditor"
;
import
{
getDevPersons
}
from
"../../../api/editor"
;
export
default
{
name
:
"PxSkinEditorDialog"
,
...
...
@@ -178,8 +179,6 @@
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
console
.
log
(
"getDevPersons"
,
getDevPersons
())
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
return
item
.
level
==
1
...
...
@@ -207,7 +206,10 @@
const
{
env
}
=
this
;
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
await
this
.
$alert
(
this
.
$t
(
'SSO is invalid'
));
await
this
.
$confirm
(
this
.
$t
(
'SSO is invalid'
),
this
.
$t
(
'Alert'
),
{
confirmButtonText
:
this
.
$t
(
'To Verify'
),
cancelButtonText
:
this
.
$t
(
'Close'
),
});
window
.
open
(
'/sso/login?env='
+
env
,
'_blank'
);
},
async
saveSkin
(
skin
,
operate
)
{
...
...
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