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
562a0bc2
Commit
562a0bc2
authored
Jan 14, 2020
by
bianlongting
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimize
parent
f911b66d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
15 deletions
+60
-15
project.js
src/api/project.js
+9
-1
ProjectxOptions.vue
src/views/Editor/dialogs/ProjectxOptions.vue
+51
-14
No files found.
src/api/project.js
View file @
562a0bc2
...
@@ -124,7 +124,7 @@ export async function getProjectSkins(projectId, env) {
...
@@ -124,7 +124,7 @@ export async function getProjectSkins(projectId, env) {
cookie
:
{
cookie
:
{
dev
:
getCookie
(
'sso_ticket'
),
dev
:
getCookie
(
'sso_ticket'
),
test
:
localStorage
.
getItem
(
'ticket'
),
test
:
localStorage
.
getItem
(
'ticket'
),
prod
:
getCookie
(
'prod_ticket'
),
prod
:
localStorage
.
getItem
(
'prod_ticket'
),
}
}
}
}
})
})
...
@@ -133,3 +133,11 @@ export async function getProjectSkins(projectId, env) {
...
@@ -133,3 +133,11 @@ export async function getProjectSkins(projectId, env) {
export
async
function
getTestEnvTicket
()
{
export
async
function
getTestEnvTicket
()
{
return
await
fetchApi
(
`/polaris/getTestEnvTicket`
,
{
method
:
'get'
})
return
await
fetchApi
(
`/polaris/getTestEnvTicket`
,
{
method
:
'get'
})
}
}
export
async
function
getProdTicket
()
{
return
await
fetchApi
(
`/polaris/getProdTicket`
,
{
method
:
'get'
})
}
export
async
function
sendDingTalk
()
{
return
await
fetchApi
(
`/polaris/sendMessage`
,
{
method
:
'post'
})
}
\ No newline at end of file
src/views/Editor/dialogs/ProjectxOptions.vue
View file @
562a0bc2
...
@@ -65,7 +65,9 @@ import copy from "copy-to-clipboard";
...
@@ -65,7 +65,9 @@ import copy from "copy-to-clipboard";
import
{
import
{
getProjectSkins
,
getProjectSkins
,
saveSkins
,
saveSkins
,
getTestEnvTicket
getTestEnvTicket
,
getProdTicket
,
sendDingTalk
}
from
"../../../../src/api/project"
;
}
from
"../../../../src/api/project"
;
export
default
{
export
default
{
name
:
"ProjectxOptions"
,
name
:
"ProjectxOptions"
,
...
@@ -107,16 +109,45 @@ export default {
...
@@ -107,16 +109,45 @@ export default {
return
this
.
projectId
;
return
this
.
projectId
;
},
},
changeCurrentEnv
(
e
)
{
changeCurrentEnv
(
e
)
{
if
(
e
===
"test"
)
{
this
.
getTicket
(
getTestEnvTicket
);
}
else
if
(
e
===
"prod"
)
{
this
.
getTicket
(
getProdTicket
,
"prod_ticket"
);
}
const
projectId
=
this
.
getProjectId
(
e
);
const
projectId
=
this
.
getProjectId
(
e
);
this
.
skinId
=
""
;
this
.
skinId
=
""
;
this
.
getSkinsList
(
projectId
);
this
.
getSkinsList
(
projectId
);
},
},
async
getSkinsList
(
projectId
)
{
async
getSkinsList
(
projectId
)
{
const
{
currentEnv
}
=
this
;
const
{
currentEnv
}
=
this
;
if
(
!
projectId
)
{
this
.
$message
({
message
:
`请先配置
${
currentEnv
}
环境下的projectId`
,
type
:
"error"
});
return
;
}
try
{
try
{
const
data
=
await
getProjectSkins
(
projectId
,
currentEnv
);
const
data
=
await
getProjectSkins
(
projectId
,
currentEnv
);
if
(
data
.
success
!==
false
)
{
if
(
data
.
success
!==
false
)
{
this
.
skinList
=
data
;
this
.
skinList
=
data
;
}
else
{
// 如果是测试环境,ticket过期,则重新获取ticket
if
(
currentEnv
===
"test"
&&
data
.
notLogin
)
{
localStorage
.
setItem
(
"ticket"
,
""
);
await
this
.
getTicket
(
getTestEnvTicket
);
this
.
getSkinsList
(
this
.
projectId
);
}
else
if
(
currentEnv
===
"prod"
&&
data
.
notLogin
)
{
// 如果是线上环境,则发送钉钉消息
sendDingTalk
();
localStorage
.
setItem
(
"prod_ticket"
,
""
);
this
.
$message
({
message
:
"线上tickct失效,已给相关人员发送消息"
,
type
:
"info"
});
this
.
skinList
=
[];
return
;
// sendDingTalk();
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
data
.
message
,
message
:
data
.
message
,
...
@@ -125,6 +156,7 @@ export default {
...
@@ -125,6 +156,7 @@ export default {
this
.
skinList
=
[];
this
.
skinList
=
[];
return
;
return
;
}
}
}
}
catch
(
e
)
{
}
catch
(
e
)
{
this
.
skinList
=
[];
this
.
skinList
=
[];
throw
new
Error
(
e
.
message
);
throw
new
Error
(
e
.
message
);
...
@@ -180,8 +212,11 @@ export default {
...
@@ -180,8 +212,11 @@ export default {
if
(
currentTypes
!==
"2"
)
{
if
(
currentTypes
!==
"2"
)
{
// 2为修改,修改不需重新获取列表
// 2为修改,修改不需重新获取列表
this
.
getSkinsList
(
projectId
);
this
.
getSkinsList
(
projectId
);
}
else
if
(
currentTypes
!==
"3"
)
{
this
.
name
=
""
;
}
}
},
},
/** 获取访问链接 */
getUrl
()
{
getUrl
()
{
const
{
currentHtmlType
,
currentEnv
,
skinId
,
projectId
}
=
this
;
const
{
currentHtmlType
,
currentEnv
,
skinId
,
projectId
}
=
this
;
const
mapping
=
{
const
mapping
=
{
...
@@ -197,6 +232,14 @@ export default {
...
@@ -197,6 +232,14 @@ export default {
message
:
"链接复制成功"
,
message
:
"链接复制成功"
,
type
:
"success"
type
:
"success"
});
});
},
async
getTicket
(
fn
,
name
=
"ticket"
)
{
let
ticket
=
localStorage
.
getItem
(
name
);
if
(
!
ticket
)
{
ticket
=
await
fn
();
console
.
log
(
ticket
,
"ticketticket"
);
localStorage
.
setItem
(
name
,
ticket
);
}
}
}
},
},
async
mounted
()
{
async
mounted
()
{
...
@@ -205,13 +248,7 @@ export default {
...
@@ -205,13 +248,7 @@ export default {
this
.
projectId
=
projectId
;
this
.
projectId
=
projectId
;
this
.
getSkinsList
(
projectId
);
this
.
getSkinsList
(
projectId
);
},
},
async
created
()
{
async
created
()
{}
let
ticket
=
localStorage
.
getItem
(
"ticket"
);
if
(
!
ticket
)
{
ticket
=
await
getTestEnvTicket
();
localStorage
.
setItem
(
"ticket"
,
ticket
);
}
}
};
};
</
script
>
</
script
>
<
style
lang=
"scss"
>
<
style
lang=
"scss"
>
...
...
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