-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsettings.html
More file actions
215 lines (204 loc) · 5.77 KB
/
settings.html
File metadata and controls
215 lines (204 loc) · 5.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>设置</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: system-ui, -apple-system, "Microsoft YaHei", sans-serif;
background: #1a1a2e;
color: #fff;
user-select: none;
-webkit-user-select: none;
overflow: hidden;
}
.titlebar {
height: 36px;
background: #16213e;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 12px;
-webkit-app-region: drag;
}
.titlebar-title {
font-size: 13px;
font-weight: 500;
opacity: 0.9;
}
.btn-close {
background: transparent;
border: none;
color: rgba(255,255,255,0.7);
width: 28px;
height: 28px;
border-radius: 4px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
-webkit-app-region: no-drag;
transition: all 0.2s;
}
.btn-close:hover {
background: #e81123;
color: #fff;
}
.content {
padding: 20px;
}
.setting-item {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px 0;
border-bottom: 1px solid rgba(255,255,255,0.1);
}
.setting-item:last-child {
border-bottom: none;
}
.setting-label {
flex: 1;
}
.setting-title {
font-size: 14px;
font-weight: 500;
margin-bottom: 4px;
}
.setting-desc {
font-size: 12px;
opacity: 0.6;
}
/* Toggle Switch */
.toggle {
position: relative;
width: 44px;
height: 24px;
flex-shrink: 0;
margin-left: 16px;
}
.toggle input {
opacity: 0;
width: 0;
height: 0;
}
.toggle-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(255,255,255,0.2);
transition: 0.3s;
border-radius: 24px;
}
.toggle-slider:before {
position: absolute;
content: "";
height: 18px;
width: 18px;
left: 3px;
bottom: 3px;
background-color: #fff;
transition: 0.3s;
border-radius: 50%;
}
.toggle input:checked + .toggle-slider {
background-color: #667eea;
}
.toggle input:checked + .toggle-slider:before {
transform: translateX(20px);
}
/* 禁用状态 */
.toggle input:disabled + .toggle-slider {
opacity: 0.4;
cursor: not-allowed;
}
.setting-item.disabled .setting-label {
opacity: 0.5;
}
.setting-hint {
font-size: 11px;
color: #667eea;
margin-top: 4px;
}
</style>
</head>
<body>
<div class="titlebar">
<span class="titlebar-title">设置</span>
<button class="btn-close" id="btn-close" title="关闭">
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="18" y1="6" x2="6" y2="18"></line>
<line x1="6" y1="6" x2="18" y2="18"></line>
</svg>
</button>
</div>
<div class="content">
<div class="setting-item" style="display:none">
<div class="setting-label">
<div class="setting-title">精灵模式</div>
<div class="setting-desc">在标题栏显示"收起"按钮,可收起为悬浮球</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-sprite-mode">
<span class="toggle-slider"></span>
</label>
</div>
<div class="setting-item">
<div class="setting-label">
<div class="setting-title">关闭时最小化到托盘</div>
<div class="setting-desc">点击关闭按钮时隐藏到系统托盘而非退出</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-minimize-to-tray">
<span class="toggle-slider"></span>
</label>
</div>
<div class="setting-item" style="display:none">
<div class="setting-label">
<div class="setting-title">UAT 模式</div>
<div class="setting-desc">启用后在标题栏显示环境切换开关</div>
</div>
<label class="toggle">
<input type="checkbox" id="toggle-uat-mode">
<span class="toggle-slider"></span>
</label>
</div>
</div>
<script>
const { ipcRenderer } = require('electron');
const toggleSpriteMode = document.getElementById('toggle-sprite-mode');
const toggleMinimizeToTray = document.getElementById('toggle-minimize-to-tray');
const toggleUatMode = document.getElementById('toggle-uat-mode');
// 加载当前设置
ipcRenderer.invoke('get-settings').then(settings => {
toggleSpriteMode.checked = settings.spriteMode === true;
toggleMinimizeToTray.checked = settings.minimizeToTray !== false;
toggleUatMode.checked = settings.uatMode === true;
});
// 保存设置
function saveSettings() {
const settings = {
spriteMode: toggleSpriteMode.checked,
minimizeToTray: toggleMinimizeToTray.checked,
uatMode: toggleUatMode.checked
};
ipcRenderer.send('save-settings', settings);
}
toggleSpriteMode.addEventListener('change', saveSettings);
toggleMinimizeToTray.addEventListener('change', saveSettings);
toggleUatMode.addEventListener('change', saveSettings);
// 关闭窗口
document.getElementById('btn-close').addEventListener('click', () => {
ipcRenderer.send('close-settings');
});
</script>
</body>
</html>