头像设置

This commit is contained in:
2026-04-10 17:14:31 +08:00
parent 4ce99ae140
commit ef239a0ea5
3 changed files with 198 additions and 1 deletions

View File

@@ -49,9 +49,36 @@ class CallStateManager {
async init() {
// 初始化配置
await this.setupConfig();
// 加载用户设置
this.loadUserSettings();
// 获取本地摄像头视频流
await this.getLocalStream();
}
// 加载用户设置
loadUserSettings() {
const userSettings = localStorage.getItem('userSettings');
if (userSettings) {
try {
const settings = JSON.parse(userSettings);
// 更新本地用户信息
if (settings.name || settings.avatar) {
this.state.session.localUser = {
...this.state.session.localUser,
id: settings.userId || this.state.session.localUser.id,
name: settings.name || this.state.session.localUser.name,
avatar: settings.avatar || this.state.session.localUser.avatar
};
// 通知UI更新
this.notify({ type: 'USER_SETTINGS_UPDATED', user: this.state.session.localUser });
}
} catch (error) {
console.error('Error loading user settings:', error);
}
}
}
async setupConfig() {
const res = await getServerConfig();
this.useWebSocket = res.useWebSocket;