完善保存配置功能

This commit is contained in:
玄凤科技
2025-02-17 17:48:24 +08:00
parent aa2d323951
commit 985f108d3e
4 changed files with 59 additions and 36 deletions
+13 -1
View File
@@ -16,7 +16,7 @@
</div>
<div class="device-actions">
<button class="action-btn primary" @click="$emit('configure')">配置角色</button>
<button class="action-btn primary" @click="handleConfigure">配置角色</button>
<button class="action-btn" @click="$emit('voiceprint')">声纹识别</button>
<button class="action-btn" @click="$emit('history')">历史对话</button>
<div class="delete-container">
@@ -81,6 +81,18 @@ const handleDelete = () => {
emit('delete');
}
};
const handleConfigure = () => {
// 保存设备配置到 localStorage,确保 RoleSetting 可以访问
if (props.deviceId && props.deviceConfig) {
localStorage.setItem(`deviceConfig_${props.deviceId}`, JSON.stringify({
selected_module: props.selectedModules,
prompt: props.deviceConfig.prompt || '',
nickname: props.deviceConfig.nickname || '小智'
}));
}
emit('configure');
};
</script>
<style scoped>