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 {
...
@@ -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
);
let
url
=
host
+
(
uri
.
startsWith
(
'http'
)
||
uri
.
startsWith
(
'//'
)
?
uri
:
API_HOST
+
uri
);
const
options
=
{
const
options
=
{
method
,
method
,
headers
:
{},
headers
:
{},
credentials
:
'include'
,
credentials
,
};
};
if
(
auth
)
{
if
(
auth
)
{
//options.headers.authorization = 'Bearer ' + window['zeroing_token'];
//options.headers.authorization = 'Bearer ' + window['zeroing_token'];
...
...
src/api/polaris.js
View file @
a03d5cff
...
@@ -19,7 +19,3 @@ export async function getSkins(projectId, env) {
...
@@ -19,7 +19,3 @@ export async function getSkins(projectId, env) {
export
async
function
sendDingTalk
()
{
export
async
function
sendDingTalk
()
{
return
await
fetchApi
(
`/polaris/sendMessage`
,
{
method
:
'post'
})
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) {
...
@@ -64,11 +64,12 @@ export async function deleteOne(id) {
/**
/**
* 获取一个项目
* 获取一个项目
* @param id
* @param id
* @param withData 是否携带data
* @return {Promise<*|any>}
* @return {Promise<*|any>}
*/
*/
export
async
function
fetchOne
(
id
)
{
export
async
function
fetchOne
(
id
,
withData
=
true
)
{
return
await
fetchApi
(
'/api/project/query/data'
,
{
return
await
fetchApi
(
'/api/project/query/data'
,
{
params
:
{
id
},
params
:
{
id
,
withData
},
method
:
'get'
,
method
:
'get'
,
errMessage
:
'Failed to fetch project'
,
errMessage
:
'Failed to fetch project'
,
})
})
...
@@ -83,6 +84,7 @@ export async function fetchOneFromDataUrl(dataUrl) {
...
@@ -83,6 +84,7 @@ export async function fetchOneFromDataUrl(dataUrl) {
return
await
fetchApi
(
dataUrl
,
{
return
await
fetchApi
(
dataUrl
,
{
auth
:
false
,
auth
:
false
,
judgeSuccess
:
false
,
judgeSuccess
:
false
,
credentials
:
'same-origin'
,
errMessage
:
'Failed to fetch project'
,
errMessage
:
'Failed to fetch project'
,
})
})
}
}
...
...
src/locales/zh-CN.json
View file @
a03d5cff
...
@@ -243,6 +243,7 @@
...
@@ -243,6 +243,7 @@
"Accept Both"
:
"兼并"
,
"Accept Both"
:
"兼并"
,
"Previous Conflict"
:
"上一个冲突"
,
"Previous Conflict"
:
"上一个冲突"
,
"Next Conflict"
:
"下一个冲突"
,
"Next Conflict"
:
"下一个冲突"
,
"To Verify"
:
"去验证"
,
"eventGroup"
:
{
"eventGroup"
:
{
"in"
:
"接收"
,
"in"
:
"接收"
,
"out"
:
"派发"
"out"
:
"派发"
...
...
src/store/modules/project.js
View file @
a03d5cff
...
@@ -101,7 +101,7 @@ export const projectStore = {
...
@@ -101,7 +101,7 @@ export const projectStore = {
state
.
name
=
name
;
state
.
name
=
name
;
state
.
creator
=
creator
;
state
.
creator
=
creator
;
state
.
operator
=
operator
;
state
.
operator
=
operator
;
state
.
operators
=
operators
;
state
.
operators
=
operators
||
creator
;
//兼容未保存的本地存储
state
.
update_time
=
update_time
;
state
.
update_time
=
update_time
;
const
localData
=
state
.
data
;
const
localData
=
state
.
data
;
...
@@ -479,7 +479,7 @@ export const projectStore = {
...
@@ -479,7 +479,7 @@ export const projectStore = {
project
(
state
)
{
project
(
state
)
{
const
{
id
,
name
,
creator
,
data
,
update_time
,
operator
,
operators
,}
=
state
;
const
{
id
,
name
,
creator
,
data
,
update_time
,
operator
,
operators
,}
=
state
;
let
newData
=
clonePureObj
(
data
);
let
newData
=
clonePureObj
(
data
);
delete
newData
[
'dependencies'
];
//
delete newData['dependencies'];
deleteDesignConfig
(
newData
.
processes
);
deleteDesignConfig
(
newData
.
processes
);
deleteAssetsDepConfig
(
newData
);
deleteAssetsDepConfig
(
newData
);
return
{
return
{
...
@@ -640,6 +640,7 @@ export const projectStore = {
...
@@ -640,6 +640,7 @@ export const projectStore = {
},
},
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
async
loadFromDataUrl
({
commit
,
dispatch
},
{
project
,
dataUrl
})
{
await
dispatch
(
'loadPackageInfos'
);
await
dispatch
(
'loadPackageInfos'
);
project
=
await
projectApi
.
fetchOne
(
project
.
id
,
false
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
const
projectData
=
await
projectApi
.
fetchOneFromDataUrl
(
dataUrl
);
if
(
projectData
)
{
if
(
projectData
)
{
project
.
data
=
projectData
;
project
.
data
=
projectData
;
...
@@ -918,7 +919,9 @@ async function packAssets(assets) {
...
@@ -918,7 +919,9 @@ async function packAssets(assets) {
let
newAssets
=
assets
.
concat
();
let
newAssets
=
assets
.
concat
();
await
packImages
(
newAssets
,
{
getSheetUrlByUUID
});
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
)
{
if
(
asset
.
file
)
{
const
{
url
}
=
await
editorApi
.
uploadFile
(
asset
.
file
,
true
).
catch
(
e
=>
{
const
{
url
}
=
await
editorApi
.
uploadFile
(
asset
.
file
,
true
).
catch
(
e
=>
{
failedList
.
push
(
asset
);
failedList
.
push
(
asset
);
...
@@ -940,7 +943,37 @@ async function packAssets(assets) {
...
@@ -940,7 +943,37 @@ async function packAssets(assets) {
delete
asset
.
frames
;
delete
asset
.
frames
;
delete
asset
.
sheetUUID
;
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
;
return
newAssets
;
}
}
...
...
src/utils/properties.js
View file @
a03d5cff
...
@@ -158,7 +158,7 @@ export default {
...
@@ -158,7 +158,7 @@ export default {
lineSpacing
:
{
lineSpacing
:
{
alias
:
'行间距'
,
alias
:
'行间距'
,
type
:
'number'
,
type
:
'number'
,
default
:
14
default
:
0
},
},
textAlign
:
{
textAlign
:
{
alias
:
'文本对齐'
,
alias
:
'文本对齐'
,
...
...
src/utils/sheet-pack.js
View file @
a03d5cff
...
@@ -11,14 +11,14 @@ const packExts = ['.png']; //, '.jpg', '.jpeg', '.bmp'
...
@@ -11,14 +11,14 @@ const packExts = ['.png']; //, '.jpg', '.jpeg', '.bmp'
let
canvas
=
document
.
createElement
(
'canvas'
);
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
padding
=
options
.
padding
||
1
;
const
maxSize
=
options
.
maxSize
||
2048
;
const
maxSize
=
options
.
maxSize
||
2048
;
const
mode
=
options
.
mode
||
0
;
const
mode
=
options
.
mode
||
0
;
const
{
getSheetUrlByUUID
}
=
options
;
const
{
getSheetUrlByUUID
}
=
options
;
const
images
=
await
preProcessing
(
ass
s
ts
);
const
images
=
await
preProcessing
(
ass
e
ts
);
let
rects
=
[],
singles
=
[];
let
rects
=
[],
singles
=
[];
for
(
let
item
of
images
)
{
for
(
let
item
of
images
)
{
...
@@ -38,7 +38,7 @@ export async function packImages(asssts, options = {}) {
...
@@ -38,7 +38,7 @@ export async function packImages(asssts, options = {}) {
offY
:
0
,
offY
:
0
,
})
})
}
else
{
}
else
{
ass
s
ts
.
push
({
ass
e
ts
.
push
({
name
:
assets
[
0
].
name
,
name
:
assets
[
0
].
name
,
ext
:
assets
[
0
].
ext
,
ext
:
assets
[
0
].
ext
,
url
:
assets
[
0
].
url
,
url
:
assets
[
0
].
url
,
...
@@ -53,6 +53,7 @@ export async function packImages(asssts, options = {}) {
...
@@ -53,6 +53,7 @@ export async function packImages(asssts, options = {}) {
let
remainRects
=
rects
.
concat
();
let
remainRects
=
rects
.
concat
();
let
index
=
0
;
let
index
=
0
;
let
sheetPacks
=
[];
while
(
remainRects
.
length
>
0
)
{
while
(
remainRects
.
length
>
0
)
{
let
name
=
'sheet'
+
index
;
let
name
=
'sheet'
+
index
;
...
@@ -95,7 +96,7 @@ export async function packImages(asssts, options = {}) {
...
@@ -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;
let url;
if (getSheetUrlByUUID) {
if (getSheetUrlByUUID) {
...
@@ -103,22 +104,52 @@ export async function packImages(asssts, options = {}) {
...
@@ -103,22 +104,52 @@ export async function packImages(asssts, options = {}) {
}
}
if(url){
if(url){
ass
s
ts
.
push
({
ass
e
ts.push({
ext: '.sht',
ext: '.sht',
url,
url,
uuid: generateUUID(),
uuid: generateUUID(),
});
});
}else{
}else{
ass
s
ts
.
push
({
ass
e
ts.push({
ext: '.sht',
ext: '.sht',
file: new File([blob], name + '.png'),
file: new File([blob], name + '.png'),
frames,
frames,
sheetUUID,
sheetUUID,
});
});
}
}*/
sheetPacks
.
push
([
urls
,
name
,
blob
,
frames
]);
index
++
;
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
)
{
function
loadImage
(
url
,
assets
)
{
...
...
src/views/Editor/dialogs/PublishView.vue
View file @
a03d5cff
...
@@ -56,10 +56,9 @@
...
@@ -56,10 +56,9 @@
import
{
import
{
getSkins
,
getSkins
,
saveSkin
,
saveSkin
,
sendDingTalk
,
getDevPersons
}
from
"../../../../src/api/polaris"
;
}
from
"../../../../src/api/polaris"
;
import
{
pxHostMapping
}
from
"../../../utils"
;
import
{
pxHostMapping
}
from
"../../../utils"
;
import
{
getDevPersons
}
from
"../../../api/editor"
;
export
default
{
export
default
{
name
:
"PublishView"
,
name
:
"PublishView"
,
...
@@ -112,8 +111,6 @@
...
@@ -112,8 +111,6 @@
const
{
pxEnv
}
=
this
.
options
;
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
console
.
log
(
"getDevPersons"
,
getDevPersons
())
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
return
item
.
level
==
1
return
item
.
level
==
1
...
@@ -175,7 +172,10 @@
...
@@ -175,7 +172,10 @@
const
{
env
}
=
this
;
const
{
env
}
=
this
;
this
.
pxProjectName
=
''
;
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
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'
);
window
.
open
(
'/sso/login?env='
+
env
,
'_blank'
);
},
},
hasIndex
()
{
hasIndex
()
{
...
...
src/views/Editor/dialogs/PxSkinEditorDialog.vue
View file @
a03d5cff
...
@@ -89,10 +89,11 @@
...
@@ -89,10 +89,11 @@
import
EnabledSetter
from
"../components/EnabledSetter"
;
import
EnabledSetter
from
"../components/EnabledSetter"
;
import
MonacoEditor
from
"vue-monaco"
;
import
MonacoEditor
from
"vue-monaco"
;
import
PxConfigPopover
from
"../components/PxConfigPopover"
;
import
PxConfigPopover
from
"../components/PxConfigPopover"
;
import
{
getSkins
,
saveSkin
,
getDevPersons
}
from
"../../../api/polaris"
;
import
{
getSkins
,
saveSkin
,}
from
"../../../api/polaris"
;
import
{
playWaiting
,
pxHostMapping
}
from
"../../../utils"
;
import
{
playWaiting
,
pxHostMapping
}
from
"../../../utils"
;
import
copy
from
"copy-to-clipboard"
;
import
copy
from
"copy-to-clipboard"
;
import
PxSkinEditor
from
"./PxSkinEditor"
;
import
PxSkinEditor
from
"./PxSkinEditor"
;
import
{
getDevPersons
}
from
"../../../api/editor"
;
export
default
{
export
default
{
name
:
"PxSkinEditorDialog"
,
name
:
"PxSkinEditorDialog"
,
...
@@ -178,8 +179,6 @@
...
@@ -178,8 +179,6 @@
const
{
pxEnv
}
=
this
.
options
;
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
console
.
log
(
"getDevPersons"
,
getDevPersons
())
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
await
getDevPersons
()
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
this
.
QAList
=
this
.
QAList
.
filter
((
item
)
=>
{
return
item
.
level
==
1
return
item
.
level
==
1
...
@@ -207,7 +206,10 @@
...
@@ -207,7 +206,10 @@
const
{
env
}
=
this
;
const
{
env
}
=
this
;
this
.
pxProjectName
=
''
;
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
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'
);
window
.
open
(
'/sso/login?env='
+
env
,
'_blank'
);
},
},
async
saveSkin
(
skin
,
operate
)
{
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