Commit a68746c 1 parent 3aa5e5b commit a68746c Copy full SHA for a68746c
File tree 1 file changed +16
-2
lines changed
packages/machine-setup/frontend/src/components
1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change 32
32
<n-tabs default-value =" video" justify-content =" space-evenly" type =" line" animated >
33
33
<n-tab-pane name =" video" tab =" 视频配置" >
34
34
<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 >
36
36
</n-tab-pane >
37
37
<n-tab-pane name =" desktop" tab =" 桌面配置" >
38
38
<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 >
40
40
</n-tab-pane >
41
41
</n-tabs >
42
42
</n-gi >
@@ -105,6 +105,20 @@ const statusService = async (service: string) => {
105
105
}
106
106
};
107
107
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
+
108
122
109
123
onMounted (async () => {
110
124
try {
You can’t perform that action at this time.
0 commit comments