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
6b9e549e
Commit
6b9e549e
authored
Apr 14, 2020
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改发布流程
parent
00dd5872
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
63 additions
and
112 deletions
+63
-112
common.js
src/api/common.js
+18
-13
editor.js
src/api/editor.js
+15
-6
polaris.js
src/api/polaris.js
+4
-21
config.js
src/config.js
+2
-2
zh-CN.json
src/locales/zh-CN.json
+1
-1
PublishView.vue
src/views/Editor/dialogs/PublishView.vue
+4
-20
PxSkinEditorDialog.vue
src/views/Editor/dialogs/PxSkinEditorDialog.vue
+19
-49
No files found.
src/api/common.js
View file @
6b9e549e
...
@@ -33,10 +33,10 @@ export async function fetchApi(uri, {params, method = 'get', auth = true, judgeS
...
@@ -33,10 +33,10 @@ export async function fetchApi(uri, {params, method = 'get', auth = true, judgeS
const
options
=
{
const
options
=
{
method
,
method
,
headers
:
{},
headers
:
{},
//
credentials: 'include',
credentials
:
'include'
,
};
};
if
(
auth
)
{
if
(
auth
)
{
options
.
headers
.
authorization
=
'Bearer '
+
window
[
'zeroing_token'
];
//
options.headers.authorization = 'Bearer ' + window['zeroing_token'];
}
}
if
(
params
)
{
if
(
params
)
{
if
(
method
.
toLowerCase
()
===
'post'
)
{
if
(
method
.
toLowerCase
()
===
'post'
)
{
...
@@ -69,19 +69,24 @@ export async function fetchApi(uri, {params, method = 'get', auth = true, judgeS
...
@@ -69,19 +69,24 @@ export async function fetchApi(uri, {params, method = 'get', auth = true, judgeS
}
}
const
response
=
await
fetch
(
url
,
options
);
const
response
=
await
fetch
(
url
,
options
);
if
(
response
.
status
===
401
)
{
const
respText
=
await
response
.
text
();
location
.
href
=
'/admin/permission'
;
if
(
response
.
status
===
310
)
{
//客户端重定向,用于跨域重定向
location
.
href
=
respText
;
}
}
const
jsonObj
=
await
response
.
json
();
//console.log(jsonObj);
if
(
judgeSuccess
)
{
try
{
if
(
jsonObj
.
success
)
{
let
jsonObj
=
JSON
.
parse
(
respText
);
return
jsonObj
.
data
;
if
(
judgeSuccess
)
{
if
(
jsonObj
.
success
)
{
return
jsonObj
.
data
;
}
}
else
{
return
jsonObj
;
}
}
}
else
{
return
jsonObj
;
}
throw
new
ApiError
(
'call api failed'
,
jsonObj
.
code
,
errMessage
,
jsonObj
.
details
);
return
Promise
.
reject
(
new
ApiError
(
'call api failed'
,
jsonObj
.
code
,
errMessage
,
jsonObj
.
details
));
}
catch
(
e
)
{
return
Promise
.
reject
(
e
);
}
}
}
src/api/editor.js
View file @
6b9e549e
...
@@ -4,6 +4,15 @@
...
@@ -4,6 +4,15 @@
import
{
fetchApi
}
from
"./common"
;
import
{
fetchApi
}
from
"./common"
;
let
devPersons
;
export
async
function
getDevPersons
()
{
if
(
!
devPersons
)
{
devPersons
=
await
fetchApi
(
'/api/editor/devPersons'
);
}
return
devPersons
}
export
async
function
importView
(
file
)
{
export
async
function
importView
(
file
)
{
const
response
=
await
fetchApi
(
'/api/parsePSD'
,
{
const
response
=
await
fetchApi
(
'/api/parsePSD'
,
{
params
:
{
params
:
{
...
@@ -12,8 +21,8 @@ export async function importView(file) {
...
@@ -12,8 +21,8 @@ export async function importView(file) {
method
:
'post'
,
method
:
'post'
,
contentType
:
'form-data'
,
contentType
:
'form-data'
,
errMessage
:
'Failed to import view'
,
errMessage
:
'Failed to import view'
,
})
})
;
response
.
__originFile
=
file
response
.
__originFile
=
file
;
return
response
return
response
}
}
...
@@ -25,13 +34,13 @@ export async function uploadView(file) {
...
@@ -25,13 +34,13 @@ export async function uploadView(file) {
method
:
'post'
,
method
:
'post'
,
contentType
:
'form-data'
,
contentType
:
'form-data'
,
errMessage
:
'Failed to upload view'
,
errMessage
:
'Failed to upload view'
,
})
})
;
response
.
__originFile
=
file
;
response
.
__originFile
=
file
;
return
response
return
response
}
}
export
async
function
uploadFile
(
file
,
compress
=
false
,
uuid
)
{
export
async
function
uploadFile
(
file
,
compress
=
false
,
uuid
)
{
let
params
=
{
file
}
let
params
=
{
file
};
if
(
compress
)
{
if
(
compress
)
{
params
.
compress
=
true
params
.
compress
=
true
}
}
...
@@ -43,7 +52,7 @@ export async function uploadFile(file, compress = false, uuid) {
...
@@ -43,7 +52,7 @@ export async function uploadFile(file, compress = false, uuid) {
method
:
'post'
,
method
:
'post'
,
contentType
:
'form-data'
,
contentType
:
'form-data'
,
errMessage
:
'Failed to upload file'
,
errMessage
:
'Failed to upload file'
,
})
})
;
response
.
__originFile
=
file
response
.
__originFile
=
file
;
return
response
return
response
}
}
src/api/polaris.js
View file @
6b9e549e
...
@@ -5,32 +5,15 @@
...
@@ -5,32 +5,15 @@
import
{
fetchApi
}
from
"./common"
;
import
{
fetchApi
}
from
"./common"
;
import
{
getCookie
}
from
"./utils"
;
import
{
getCookie
}
from
"./utils"
;
export
async
function
saveSkin
s
(
params
)
{
export
async
function
saveSkin
(
params
)
{
return
await
fetchApi
(
`/polaris/
autoSaveSkins
`
,
{
return
await
fetchApi
(
`/polaris/
saveSkin
`
,
{
params
,
params
,
method
:
'post'
method
:
'post'
})
})
}
}
export
async
function
getProjectSkins
(
projectId
,
env
)
{
export
async
function
getSkins
(
projectId
,
env
)
{
return
await
fetchApi
(
`/polaris/getProjectSkins?projectId=
${
projectId
}
&env=
${
env
}
`
,
{
return
await
fetchApi
(
`/polaris/getSkins?projectId=
${
projectId
}
&env=
${
env
}
`
)
method
:
'post'
,
params
:
{
cookie
:
{
dev
:
getCookie
(
'sso_ticket'
),
test
:
localStorage
.
getItem
(
'ticket'
),
prod
:
localStorage
.
getItem
(
'prod_ticket'
),
}
}
})
}
export
async
function
getTestEnvTicket
()
{
return
await
fetchApi
(
`/polaris/getTestEnvTicket`
,
{
method
:
'get'
})
}
export
async
function
getProdTicket
()
{
return
await
fetchApi
(
`/polaris/getProdTicket`
,
{
method
:
'get'
})
}
}
export
async
function
sendDingTalk
()
{
export
async
function
sendDingTalk
()
{
...
...
src/config.js
View file @
6b9e549e
...
@@ -6,11 +6,11 @@ export let API_HOST;
...
@@ -6,11 +6,11 @@ export let API_HOST;
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
if
(
process
.
env
.
NODE_ENV
===
'development'
)
{
//API_HOST = '//10.10.95.74:7777';
//API_HOST = '//10.10.95.74:7777';
//API_HOST = '//192.168.1.16:7777';
//API_HOST = '//192.168.1.16:7777';
//API_HOST = '//10.10.93.88:7777
';
API_HOST
=
'//10.10.94.107:3000
'
;
//API_HOST = '//192.168.0.105:7777';
//API_HOST = '//192.168.0.105:7777';
//API_HOST = '//localhost:3002';
//API_HOST = '//localhost:3002';
//API_HOST = window.__data.apiHost;
//API_HOST = window.__data.apiHost;
API_HOST
=
'http://beacon.duiba.com.cn'
;
//
API_HOST = 'http://beacon.duiba.com.cn';
}
else
{
}
else
{
API_HOST
=
window
.
__data
.
apiHost
;
API_HOST
=
window
.
__data
.
apiHost
;
}
}
...
...
src/locales/zh-CN.json
View file @
6b9e549e
...
@@ -212,7 +212,7 @@
...
@@ -212,7 +212,7 @@
"Name required"
:
"名字必填"
,
"Name required"
:
"名字必填"
,
"Index page exists"
:
"已存在首页"
,
"Index page exists"
:
"已存在首页"
,
"Please config projectID"
:
"请先配置{env}环境下的projectId"
,
"Please config projectID"
:
"请先配置{env}环境下的projectId"
,
"
Online ticket is invalid"
:
"线上tickct失效,请联系管理员修改
"
,
"
SSO is invalid"
:
"SSO失效,请重新验证
"
,
"Are you sure to transform process?"
:
"你确定将此转化为{inlineType}过程吗?"
,
"Are you sure to transform process?"
:
"你确定将此转化为{inlineType}过程吗?"
,
"Input custom process name"
:
"请输入自定义过程名称"
,
"Input custom process name"
:
"请输入自定义过程名称"
,
"Invalid name"
:
"无效名称"
,
"Invalid name"
:
"无效名称"
,
...
...
src/views/Editor/dialogs/PublishView.vue
View file @
6b9e549e
...
@@ -43,10 +43,8 @@
...
@@ -43,10 +43,8 @@
import
{
mapGetters
}
from
"vuex"
;
import
{
mapGetters
}
from
"vuex"
;
import
copy
from
"copy-to-clipboard"
;
import
copy
from
"copy-to-clipboard"
;
import
{
import
{
getProjectSkins
,
getSkins
,
saveSkins
,
saveSkin
,
getTestEnvTicket
,
getProdTicket
,
sendDingTalk
sendDingTalk
}
from
"../../../../src/api/polaris"
;
}
from
"../../../../src/api/polaris"
;
import
{
pxHostMapping
}
from
"../../../utils"
;
import
{
pxHostMapping
}
from
"../../../utils"
;
...
@@ -91,12 +89,6 @@
...
@@ -91,12 +89,6 @@
async
getSkinsList
()
{
async
getSkinsList
()
{
const
{
env
}
=
this
;
const
{
env
}
=
this
;
if
(
env
===
"test"
)
{
await
this
.
getTicket
(
getTestEnvTicket
);
}
else
if
(
env
===
"prod"
)
{
await
this
.
getTicket
(
getProdTicket
,
"prod_ticket"
);
}
const
{
pxEnv
}
=
this
.
options
;
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
...
@@ -108,7 +100,7 @@
...
@@ -108,7 +100,7 @@
return
;
return
;
}
}
try
{
try
{
const
data
=
await
get
Project
Skins
(
pxPid
,
env
);
const
data
=
await
getSkins
(
pxPid
,
env
);
if
(
data
.
success
!==
false
)
{
if
(
data
.
success
!==
false
)
{
this
.
pxProjectName
=
data
.
name
;
this
.
pxProjectName
=
data
.
name
;
this
.
skins
=
data
.
skins
;
this
.
skins
=
data
.
skins
;
...
@@ -116,7 +108,6 @@
...
@@ -116,7 +108,6 @@
// 如果是测试环境,ticket过期,则重新获取ticket
// 如果是测试环境,ticket过期,则重新获取ticket
if
(
env
===
"test"
&&
data
.
notLogin
)
{
if
(
env
===
"test"
&&
data
.
notLogin
)
{
localStorage
.
setItem
(
"ticket"
,
""
);
localStorage
.
setItem
(
"ticket"
,
""
);
await
this
.
getTicket
(
getTestEnvTicket
);
this
.
getSkinsList
(
this
.
pxPid
);
this
.
getSkinsList
(
this
.
pxPid
);
}
else
if
(
env
===
"prod"
&&
data
.
notLogin
)
{
}
else
if
(
env
===
"prod"
&&
data
.
notLogin
)
{
localStorage
.
setItem
(
"prod_ticket"
,
""
);
localStorage
.
setItem
(
"prod_ticket"
,
""
);
...
@@ -176,7 +167,7 @@
...
@@ -176,7 +167,7 @@
name
,
name
,
env
:
env
env
:
env
};
};
const
{
ret
}
=
await
saveSkin
s
(
data
);
const
{
ret
}
=
await
saveSkin
(
data
);
if
(
ret
.
success
!==
false
)
{
if
(
ret
.
success
!==
false
)
{
this
.
$message
({
this
.
$message
({
message
:
`操作成功`
,
message
:
`操作成功`
,
...
@@ -212,13 +203,6 @@
...
@@ -212,13 +203,6 @@
type
:
"success"
type
:
"success"
});
});
},
},
async
getTicket
(
fn
,
name
=
"ticket"
)
{
let
ticket
=
localStorage
.
getItem
(
name
);
if
(
!
ticket
)
{
ticket
=
await
fn
();
localStorage
.
setItem
(
name
,
ticket
);
}
},
/*getTpl(id) {
/*getTpl(id) {
const {skins} = this;
const {skins} = this;
let tpl = "";
let tpl = "";
...
...
src/views/Editor/dialogs/PxSkinEditorDialog.vue
View file @
6b9e549e
...
@@ -83,7 +83,7 @@
...
@@ -83,7 +83,7 @@
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
{
get
ProdTicket
,
getProjectSkins
,
getTestEnvTicket
,
saveSkins
}
from
"../../../api/polaris"
;
import
{
get
Skins
,
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"
;
...
@@ -163,12 +163,6 @@
...
@@ -163,12 +163,6 @@
async
getSkinsList
()
{
async
getSkinsList
()
{
const
{
env
}
=
this
;
const
{
env
}
=
this
;
if
(
env
===
"test"
)
{
await
this
.
getTicket
(
getTestEnvTicket
);
}
else
if
(
env
===
"prod"
)
{
await
this
.
getTicket
(
getProdTicket
,
"prod_ticket"
);
}
const
{
pxEnv
}
=
this
.
options
;
const
{
pxEnv
}
=
this
.
options
;
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
const
pxPid
=
this
.
pxPid
=
pxEnv
[
env
];
...
@@ -180,45 +174,19 @@
...
@@ -180,45 +174,19 @@
return
;
return
;
}
}
try
{
try
{
const
data
=
await
getProjectSkins
(
pxPid
,
env
);
const
data
=
await
getSkins
(
pxPid
,
env
);
if
(
data
.
success
!==
false
)
{
this
.
pxProjectName
=
data
.
name
;
this
.
pxProjectName
=
data
.
name
;
this
.
skins
=
data
.
skins
;
this
.
skins
=
data
.
skins
;
}
else
{
// 如果是测试环境,ticket过期,则重新获取ticket
if
(
env
===
"test"
&&
data
.
notLogin
)
{
localStorage
.
setItem
(
"ticket"
,
""
);
await
this
.
getTicket
(
getTestEnvTicket
);
this
.
getSkinsList
(
this
.
projectId
);
}
else
if
(
env
===
"prod"
&&
data
.
notLogin
)
{
localStorage
.
setItem
(
"prod_ticket"
,
""
);
this
.
$message
({
message
:
this
.
$t
(
'Online ticket is invalid'
),
type
:
"info"
});
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
}
else
{
this
.
$message
({
message
:
data
.
message
,
type
:
"error"
});
this
.
pxProjectName
=
''
;
this
.
skins
=
[];
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
pxProjectName
=
''
;
this
.
invalidTicketNotice
();
this
.
skins
=
[];
throw
new
Error
(
e
.
message
);
}
}
},
},
async
getTicket
(
fn
,
name
=
"ticket"
)
{
async
invalidTicketNotice
()
{
let
ticket
=
localStorage
.
getItem
(
name
)
;
const
{
env
}
=
this
;
if
(
!
ticket
)
{
this
.
pxProjectName
=
''
;
ticket
=
await
fn
()
;
this
.
skins
=
[]
;
localStorage
.
setItem
(
name
,
ticket
);
await
this
.
$alert
(
this
.
$t
(
'SSO is invalid'
)
);
}
window
.
open
(
'/sso/login?env='
+
env
,
'_blank'
);
},
},
async
saveSkin
(
skin
,
operate
)
{
async
saveSkin
(
skin
,
operate
)
{
const
{
const
{
...
@@ -226,16 +194,18 @@
...
@@ -226,16 +194,18 @@
pxPid
,
pxPid
,
}
=
this
;
}
=
this
;
const
{
id
,
html
,
name
,
type
}
=
skin
;
const
{
id
,
html
,
name
,
type
}
=
skin
;
const
data
=
{
const
params
=
{
projectId
:
pxPid
,
projectId
:
pxPid
,
type
:
(
operate
+
1
).
toString
()
,
operate
:
operate
+
1
,
currentHtmlType
:
type
,
type
,
skinId
:
id
,
id
,
tpl
:
html
,
html
,
name
,
name
,
env
,
env
,
isProd
:
true
,
qas
:
[
921
],
};
};
const
{
ret
}
=
await
playWaiting
(
saveSkin
s
(
data
),
this
.
$t
(
'In processing'
));
const
{
ret
}
=
await
playWaiting
(
saveSkin
(
params
),
this
.
$t
(
'In processing'
));
if
(
ret
.
success
!==
false
)
{
if
(
ret
.
success
!==
false
)
{
this
.
$message
({
this
.
$message
({
...
...
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