Skip to content

Commit 347f9ad

Browse files
committed
fix: fix some bugs
- 优化设置界面 UI - 修复麦克风单双声道设置 UI 显示
1 parent 0bf29a7 commit 347f9ad

7 files changed

Lines changed: 65 additions & 122 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ All notable changes to this project will be documented in this file 🌱.
55
## [Unreleased]
66
### Added
77
- 新增开机自启动管理功能
8+
- 新增 microphone 双声道合并
89

910
### Fixed
1011
- 修复了停止推流时本地视频显示异常问题
12+
- 修复无登陆状态时的登出异常
1113

1214
### Change
1315
- 协议更新
16+
- UI 优化
1417

1518
---
1619

src/electron/main.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,8 @@ function createSettingsWindow() {
129129
show: false,
130130
titleBarStyle: process.platform === 'darwin' ? 'hiddenInset' : 'hidden',
131131
...(process.platform === 'win32' && { frame: false }),
132+
vibrancy: 'sidebar', // 或 'sidebar'
133+
visualEffectState: 'active',
132134
});
133135

134136
// 窗口关闭时清空引用
@@ -193,8 +195,10 @@ function setupIpcHandlers() {
193195

194196
ipcMainHandle('logout', async () => {
195197
try {
196-
await webSocketService.cancelReady();
197-
configManager.clearUserConfig();
198+
if (configManager && webSocketService) {
199+
await webSocketService.cancelReady();
200+
configManager.clearUserConfig();
201+
}
198202
app.quit();
199203
log.info('登出成功');
200204
return { success: true };

src/ui/components/config-dialog.vue

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,11 @@ export default class ConfigDialog extends Vue {
3434
@Inject()
3535
closeConfigDialog: Function;
3636
37-
// 强制更新的 key
38-
private componentKey = 0;
39-
4037
// 监听对话框打开
4138
@Watch('configDialogVisible')
4239
onDialogChange(newVal: boolean) {
4340
if (newVal) {
4441
this.deviceManager.updateSimulcastBitrates();
45-
this.forceUpdate();
4642
}
4743
}
4844
@@ -68,7 +64,6 @@ export default class ConfigDialog extends Vue {
6864
*/
6965
set selectedChannelRid(rid: string) {
7066
this.deviceManager.selectSimulcastChannel(rid);
71-
this.forceUpdate();
7267
}
7368
7469
/**
@@ -89,27 +84,18 @@ export default class ConfigDialog extends Vue {
8984
get isSampleRateFixed(): boolean {
9085
// 立体声模式使用 AudioContext,采样率固定
9186
// 单声道模式使用原始流,采样率可调整
92-
const channelMode = this.deviceManager.currentConfigDevice?.settings?.channelMode;
93-
return channelMode === 'stereo';
87+
const configForm = this.deviceManager.configForm;
88+
return configForm?.channelMode === 'stereo';
9489
}
9590
96-
/**
97-
* 获取采样率的最小值
98-
*/
9991
get sampleRateMin(): number {
10092
return this.deviceManager.currentConfigDevice?.capabilities?.sampleRate?.min || 8000;
10193
}
10294
103-
/**
104-
* 获取采样率的最大值
105-
*/
10695
get sampleRateMax(): number {
10796
return this.deviceManager.currentConfigDevice?.capabilities?.sampleRate?.max || 48000;
10897
}
10998
110-
/**
111-
* 转换 rid 名称
112-
*/
11399
private convertRidName(rid: string): string {
114100
const nameMap: Record<string, string> = {
115101
original: '原画',
@@ -120,39 +106,24 @@ export default class ConfigDialog extends Vue {
120106
return nameMap[rid] || rid;
121107
}
122108
123-
/**
124-
* 格式化 simulcast 配置显示
125-
*/
126109
private formatSimulcastConfig(config: any): string {
127110
const name = this.convertRidName(config.rid);
128111
const bitrate = Math.round(config.maxBitRate);
129112
const scale = config.scaleResolutionDownBy;
130113
return `${name} (${scale}x) @ ${bitrate} Kbps`;
131114
}
132115
133-
/**
134-
* 处理码率选择变化
135-
*/
136116
private onSimulcastChange(rid: string) {
137117
this.deviceManager.selectSimulcastChannel(rid);
138-
this.forceUpdate();
139118
}
140119
141-
/**
142-
* 处理预设分辨率变化
143-
*/
144120
private onPresetChange(presetStr: string) {
145121
this.deviceManager.applyPreset(presetStr);
146122
this.deviceManager.updateSimulcastBitrates();
147-
this.forceUpdate();
148123
}
149124
150-
/**
151-
* 处理帧率变化
152-
*/
153125
private onFrameRateChange() {
154126
this.deviceManager.updateSimulcastBitrates();
155-
this.forceUpdate();
156127
}
157128
158129
/**
@@ -161,14 +132,9 @@ export default class ConfigDialog extends Vue {
161132
private onChannelModeChange(mode: 'mono' | 'stereo') {
162133
// 根据通道模式自动设置声道数
163134
this.deviceManager.configForm.channelCount = mode === 'stereo' ? 2 : 1;
164-
this.forceUpdate();
165-
}
166-
167-
/**
168-
* 强制组件更新
169-
*/
170-
private forceUpdate() {
171-
this.componentKey++;
135+
if (mode === 'stereo') {
136+
this.deviceManager.configForm.sampleRate = this.sampleRateMax;
137+
}
172138
}
173139
}
174140
</script>
@@ -220,12 +186,8 @@ export default class ConfigDialog extends Vue {
220186
<div class="capabilities-info">
221187
<p v-if="deviceManager.currentConfigDevice?.capabilities?.sampleRate">
222188
采样率:
223-
{{ Math.round(sampleRateMin) }}
224-
<span v-if="!isSampleRateFixed"> - {{ Math.round(sampleRateMax) }} </span>
225-
Hz
226-
<span v-if="isSampleRateFixed" style="color: var(--font-secondary-color)">
227-
(固定)
228-
</span>
189+
<span v-if="isSampleRateFixed">{{ Math.round(sampleRateMax) }} Hz</span>
190+
<span v-else>{{ Math.round(sampleRateMin) }} - {{ Math.round(sampleRateMax) }} Hz</span>
229191
</p>
230192
<p v-else>待获取设备参数信息</p>
231193
</div>
@@ -263,12 +225,7 @@ export default class ConfigDialog extends Vue {
263225
</el-form-item>
264226

265227
<el-form-item label="码率">
266-
<el-select
267-
:key="componentKey"
268-
v-model="selectedChannelRid"
269-
placeholder="选择码率"
270-
@change="onSimulcastChange"
271-
>
228+
<el-select v-model="selectedChannelRid" placeholder="选择码率" @change="onSimulcastChange">
272229
<el-option
273230
v-for="config in simulcastConfigs"
274231
:key="config.rid"

src/ui/components/device-card.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,21 +110,22 @@ export default class DeviceCard extends Vue {
110110

111111
<div class="device-handler-buttons">
112112
<el-button
113-
size="small"
114113
:disabled="isReady"
115114
circle
116115
@click="openConfigDialog(device)"
117-
class="ghost-button"
116+
type="info"
117+
plain
118+
size="small"
118119
>
119120
<SettingsIcon style="width: 16px" />
120-
<!-- <span>修改设备参数</span> -->
121121
</el-button>
122122
<el-button
123-
size="small"
124123
:disabled="isReady"
125124
circle
126125
@click="removeDevice(device)"
127-
class="ghost-button danger-ghost-button"
126+
type="danger"
127+
plain
128+
size="small"
128129
>
129130
<Trash style="color: var(--bg-pure-color); width: 14px" />
130131
</el-button>
@@ -269,9 +270,9 @@ export default class DeviceCard extends Vue {
269270
height: 60%;
270271
display: flex;
271272
// background-color: red;
272-
gap: 10px;
273+
gap: .2rem;
273274
flex: 1;
274-
justify-content: space-between;
275+
justify-content: end;
275276
align-items: center;
276277
}
277278
}
@@ -281,7 +282,6 @@ export default class DeviceCard extends Vue {
281282
background-color: transparent;
282283
background: transparent;
283284
color: var(--font-secondary-color);
284-
border: 1px solid var(--font-secondary-color);
285285
transition: all 0.3s ease;
286286
display: flex;
287287
justify-content: center;
@@ -304,8 +304,8 @@ export default class DeviceCard extends Vue {
304304
&:hover {
305305
background-color: transparent !important;
306306
background: transparent !important;
307-
color: var(--font-secondary-color) !important;
308-
border-color: var(--font-secondary-color) !important;
307+
// color: var(--font-secondary-color) !important;
308+
// border-color: var(--font-secondary-color) !important;
309309
}
310310
}
311311
}

src/ui/components/settings-nav.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default class SettingsNav extends Vue {}
2828
flex-direction: column;
2929
justify-content: flex-start;
3030
align-items: center;
31-
background-color: var(--bg-secondary-color);
31+
background-color: transparent;
3232
& .settings-button {
3333
width: 85%;
3434
height: 40px;
@@ -42,7 +42,7 @@ export default class SettingsNav extends Vue {}
4242
cursor: pointer;
4343
transition: all 0.3s ease;
4444
&:hover {
45-
background-color: var(--bg-primary-color);
45+
background-color: rgba(194, 194, 194, 0.5);
4646
}
4747
color: var(--font-primary-color);
4848
}

src/ui/modules/home/home.view.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ export default class HomeView extends Vue {
237237
@Provide()
238238
async updateVideoElement(device: Device) {
239239
try {
240-
if (!device.stream) return;
240+
if (!device.stream || device.type === 'microphone') return;
241241
242242
const idx = this.findDeviceCardIndex(device);
243243
if (idx === -1) {

0 commit comments

Comments
 (0)