@@ -6,18 +6,19 @@ import { BrushCleaning, Check, Delete, File } from "lucide-solid";
66
77import { ViewComponentProps } from "@/store/types" ;
88import { useViewModel } from "@/hooks" ;
9- import { Button , Input , ScrollView , Textarea } from "@/components/ui" ;
9+ import { Button , Checkbox , Input , ScrollView , Textarea } from "@/components/ui" ;
1010import { FieldObjV2 } from "@/components/fieldv2/obj" ;
1111import { FieldV2 } from "@/components/fieldv2/field" ;
1212
1313import { base , Handler } from "@/domains/base" ;
1414import { BizError } from "@/domains/error" ;
1515import { RequestCore } from "@/domains/request" ;
16- import { ButtonCore , InputCore , ScrollViewCore } from "@/domains/ui" ;
16+ import { ButtonCore , CheckboxCore , InputCore , ScrollViewCore } from "@/domains/ui" ;
1717import { ObjectFieldCore , SingleFieldCore } from "@/domains/ui/formv2" ;
1818import {
1919 fetchUserSettings ,
2020 registerShortcut ,
21+ toggleAutoStart ,
2122 unregisterShortcut ,
2223 updateUserSettings ,
2324 updateUserSettingsWithPath ,
@@ -33,6 +34,9 @@ function SettingsViewModel(props: ViewComponentProps) {
3334 register_shortcut : new RequestCore ( registerShortcut , { client : props . client } ) ,
3435 unregister_shortcut : new RequestCore ( unregisterShortcut , { client : props . client } ) ,
3536 } ,
37+ auto_start : {
38+ update : new RequestCore ( toggleAutoStart , { client : props . client } ) ,
39+ } ,
3640 } ;
3741 const methods = {
3842 refresh ( ) {
@@ -77,6 +81,20 @@ function SettingsViewModel(props: ViewComponentProps) {
7781 } ) ,
7882 $form_settings : new ObjectFieldCore ( {
7983 fields : {
84+ auto_start : new SingleFieldCore ( {
85+ label : "开机启动" ,
86+ input : new CheckboxCore ( {
87+ onChange ( ) {
88+ const v = ui . $form_settings . getValueWithPath ( [ "auto_start" ] ) ;
89+ methods . updateSettingsByPath ( "auto_start" , {
90+ value : v ,
91+ } ) ;
92+ request . auto_start . update . run ( {
93+ auto_start : v ,
94+ } ) ;
95+ } ,
96+ } ) ,
97+ } ) ,
8098 douyin : new ObjectFieldCore ( {
8199 label : "抖音" ,
82100 fields : {
@@ -163,6 +181,11 @@ export function SettingsView(props: ViewComponentProps) {
163181 < div class = "block" >
164182 < div class = "text-2xl text-w-fg-0" > 配置</ div >
165183 < div class = "mt-4 space-y-8" >
184+ < div >
185+ < FieldV2 store = { vm . ui . $form_settings . fields . auto_start } >
186+ < Checkbox store = { vm . ui . $form_settings . fields . auto_start . input } />
187+ </ FieldV2 >
188+ </ div >
166189 < div >
167190 < FieldObjV2 class = "space-y-2" store = { vm . ui . $form_settings . fields . douyin } >
168191 < FieldV2 store = { vm . ui . $form_settings . fields . douyin . fields . cookie } >
0 commit comments