Skip to content

Commit 5d21a4d

Browse files
author
SolonCode
committed
添加 API 密钥显示/隐藏切换功能;优化设置页面密码输入交互
1 parent d13fa0b commit 5d21a4d

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

soloncode-cli/src/main/resources/static/js/app-settings-providers.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,18 @@
599599
showList: showList
600600
};
601601

602+
// Provider API Key 显示切换
603+
$(document).on('click', '#providerApiKeyToggle', function () {
604+
var $input = $('#providerApiKey');
605+
if ($input.attr('type') === 'password') {
606+
$input.attr('type', 'text');
607+
$(this).html('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24"/><line x1="1" y1="1" x2="23" y2="23"/></svg>');
608+
} else {
609+
$input.attr('type', 'password');
610+
$(this).html('<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>');
611+
}
612+
});
613+
602614
// 自动初始化
603615
$(document).ready(function () {
604616
init();

soloncode-cli/src/main/resources/static/web.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,12 @@
13861386
</div>
13871387
<div class="form-group">
13881388
<label>API 密钥</label>
1389-
<input type="password" id="providerApiKey" placeholder="sk-xxx" autocomplete="new-password"/>
1389+
<div class="password-input-group">
1390+
<input type="password" id="providerApiKey" placeholder="sk-xxx" autocomplete="new-password"/>
1391+
<button class="password-toggle" id="providerApiKeyToggle" title="显示/隐藏">
1392+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z"/><circle cx="12" cy="12" r="3"/></svg>
1393+
</button>
1394+
</div>
13901395
</div>
13911396
<div class="form-group">
13921397
<div class="form-group-header">

0 commit comments

Comments
 (0)