Skip to content

Commit a68746c

Browse files
committed
machine-setup: fix video info config save
1 parent 3aa5e5b commit a68746c

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

packages/machine-setup/frontend/src/components/VideoInfo.vue

+16-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@
3232
<n-tabs default-value="video" justify-content="space-evenly" type="line" animated>
3333
<n-tab-pane name="video" tab="视频配置">
3434
<n-input type="textarea" :rows="6" placeholder="配置文件" v-model:value="cameraInfo"></n-input>
35-
<n-button size="small" block type="primary">保存</n-button>
35+
<n-button size="small" block type="primary" @click="saveConfig('camera')">保存</n-button>
3636
</n-tab-pane>
3737
<n-tab-pane name="desktop" tab="桌面配置">
3838
<n-input type="textarea" :rows="6" placeholder="配置文件" v-model:value="screenInfo"></n-input>
39-
<n-button size="small" block type="primary">保存</n-button>
39+
<n-button size="small" block type="primary" @click="saveConfig('screen')">保存</n-button>
4040
</n-tab-pane>
4141
</n-tabs>
4242
</n-gi>
@@ -105,6 +105,20 @@ const statusService = async (service: string) => {
105105
}
106106
};
107107
108+
const saveConfig = async (service: string) => {
109+
try {
110+
if (service === 'camera') {
111+
await filesystem.writeFile('/etc/default/vlc-webcam', cameraInfo.value);
112+
} else if (service === 'screen') {
113+
await filesystem.writeFile('/etc/default/vlc-screen', screenInfo.value);
114+
}
115+
window.$notification.success({ title: '配置保存成功', content: '请重启服务以应用配置', duration: 3000 });
116+
} catch (error) {
117+
console.error(error);
118+
window.$notification.error({ title: '配置保存失败', content: (error as any).message, duration: 3000 });
119+
}
120+
};
121+
108122
109123
onMounted(async () => {
110124
try {

0 commit comments

Comments
 (0)