Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
61c9d5e8
authored
Sep 29, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加服务地址复制按钮
parent
14b17e16
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
6 deletions
+23
-6
src/views/console/components/token.vue
+23
-6
No files found.
src/views/console/components/token.vue
View file @
61c9d5e8
...
...
@@ -25,6 +25,14 @@
<el-tooltip
effect=
"dark"
content=
"http://phslgld.hnluchuan.com:3000/"
placement=
"top"
>
<span
class=
"secret-text"
>
http://phslgld.hnluchuan.com:3000/
</span>
</el-tooltip>
<el-button
type=
"primary"
link
class=
"ml10"
@
click=
"copyBaseUrl"
>
<el-icon><DocumentCopy
/></el-icon>
</el-button>
</el-form-item>
</el-form>
<el-form
:model=
"rechargeForm"
label-width=
"100px"
label-position=
"left"
>
...
...
@@ -256,24 +264,33 @@ function maskKey(key) {
return
key
.
substring
(
0
,
6
)
+
"****"
+
key
.
substring
(
key
.
length
-
6
);
}
const
BASE_URL
=
"http://phslgld.hnluchuan.com:3000/"
;
function
copyApiKey
()
{
if
(
!
apiKey
.
value
)
{
proxy
.
$modal
.
msgError
(
"暂无可复制的 API Key"
);
return
;
}
const
text
=
apiKey
.
value
;
copyText
(
apiKey
.
value
,
"API Key"
);
}
function
copyBaseUrl
()
{
copyText
(
BASE_URL
,
"服务地址"
);
}
function
copyText
(
text
,
label
)
{
if
(
navigator
.
clipboard
&&
window
.
isSecureContext
)
{
navigator
.
clipboard
.
writeText
(
text
).
then
(()
=>
{
proxy
.
$modal
.
msgSuccess
(
"已复制 API Key"
);
proxy
.
$modal
.
msgSuccess
(
`已复制
${
label
}
`
);
}).
catch
(()
=>
{
fallbackCopy
(
text
);
fallbackCopy
(
text
,
label
);
});
}
else
{
fallbackCopy
(
text
);
fallbackCopy
(
text
,
label
);
}
}
function
fallbackCopy
(
text
)
{
function
fallbackCopy
(
text
,
label
)
{
const
textarea
=
document
.
createElement
(
"textarea"
);
textarea
.
value
=
text
;
textarea
.
style
.
position
=
"fixed"
;
...
...
@@ -284,7 +301,7 @@ function fallbackCopy(text) {
try
{
const
successful
=
document
.
execCommand
(
"copy"
);
if
(
successful
)
{
proxy
.
$modal
.
msgSuccess
(
"已复制 API Key"
);
proxy
.
$modal
.
msgSuccess
(
`已复制
${
label
}
`
);
}
else
{
proxy
.
$modal
.
msgError
(
"复制失败,请手动复制"
);
}
...
...
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