From 98cab4e769cef331ed9b08933eb79b7ade9c1580 Mon Sep 17 00:00:00 2001 From: yibaiba <946100224@qq.com> Date: Fri, 16 Oct 2026 10:28:21 +0800 Subject: [PATCH] feat: refine auto-answer settings controls --- internal/api/settings_phone.go | 2 +- internal/api/settings_phone_test.go | 18 + web/src/App.vue | 36 +- web/src/components.d.ts | 1 + web/src/components/PhoneContactsDrawer.vue | 37 ++- .../commands/CommandAudioPlayer.vue | 109 ++----- .../proxy/ProxyUpstreamInventory.vue | 6 +- .../settings/AutoAnswerSettings.vue | 307 +++++++++++++----- web/tests/autoAnswerSettingsSource.test.ts | 51 +++ web/tests/brandSource.test.ts | 3 + web/tests/commandLayoutSource.test.ts | 3 +- web/tests/phonePresentation.test.ts | 8 + web/tests/proxyLayoutSource.test.ts | 2 + 13 files changed, 388 insertions(+), 195 deletions(-) create mode 100644 web/tests/autoAnswerSettingsSource.test.ts diff --git a/internal/api/settings_phone.go b/internal/api/settings_phone.go index 75bcefad..4217f493 100644 --- a/internal/api/settings_phone.go +++ b/internal/api/settings_phone.go @@ -20,7 +20,7 @@ import ( const ( maxAutoAnswerAudioBytes = 16 << 20 - defaultAutoAnswerDelaySeconds = 30 + defaultAutoAnswerDelaySeconds = 8 ) type phoneSettingsResponse struct { diff --git a/internal/api/settings_phone_test.go b/internal/api/settings_phone_test.go index 5d79e034..b48c0176 100644 --- a/internal/api/settings_phone_test.go +++ b/internal/api/settings_phone_test.go @@ -25,6 +25,24 @@ func (settingsPromptDecoder) DecodePCM(_ context.Context, path string) ([]int16, return make([]int16, 160), 8000, nil } +func TestPhoneSettingsPayloadUsesEightSecondDefault(t *testing.T) { + service, err := phone.NewService(phone.ServiceOptions{ + Gateway: &phoneRouteGatewayStub{}, WebRTCUDPAddress: "127.0.0.1:0", + AutoAnswer: phone.AutoAnswerConfig{Devices: map[string]phone.AutoAnswerDeviceConfig{ + "dev-1": {Enabled: false}, + }}, + }) + if err != nil { + t.Fatal(err) + } + t.Cleanup(func() { _ = service.Close(context.Background()) }) + + payload := (&Server{phone: service}).phoneSettingsPayload() + if len(payload.AutoAnswer.Devices) != 1 || payload.AutoAnswer.Devices[0].DelaySeconds != 8 { + t.Fatalf("auto answer payload = %+v, want 8 second default", payload.AutoAnswer.Devices) + } +} + func TestPhoneSettingsEnableAutoAnswerAndPersist(t *testing.T) { gin.SetMode(gin.TestMode) directory := t.TempDir() diff --git a/web/src/App.vue b/web/src/App.vue index 6b3f21ca..1f897b67 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -208,9 +208,8 @@ function retryStartup() {

-
- - +
@@ -300,19 +300,29 @@ function retryStartup() { } .license-input { - border: 1px solid var(--ui-border); - border-radius: 16px; - background: var(--ui-surface-subtle); - color: var(--ui-text); + padding: 0; } -.license-input:focus { - border-color: var(--ui-primary); +.license-input .el-input__wrapper { + min-height: 44px; + border-radius: var(--ui-radius-md); + background: var(--ui-surface-subtle); + box-shadow: 0 0 0 1px var(--ui-border) inset; +} + +.license-input .el-input__wrapper.is-focus { box-shadow: var(--ui-focus); } +.license-input .el-input__inner { + color: var(--ui-text); + text-align: center; +} + .license-reject, .license-accept { + min-height: 44px; + margin-left: 0; border: 1px solid var(--ui-border); border-radius: var(--ui-radius-pill); } diff --git a/web/src/components.d.ts b/web/src/components.d.ts index cbc1d1f5..408b4955 100644 --- a/web/src/components.d.ts +++ b/web/src/components.d.ts @@ -70,6 +70,7 @@ declare module 'vue' { ElSegmented: typeof import('element-plus/es')['ElSegmented'] ElSelect: typeof import('element-plus/es')['ElSelect'] ElSkeleton: typeof import('element-plus/es')['ElSkeleton'] + ElSlider: typeof import('element-plus/es')['ElSlider'] ElSwitch: typeof import('element-plus/es')['ElSwitch'] ElTable: typeof import('element-plus/es')['ElTable'] ElTableColumn: typeof import('element-plus/es')['ElTableColumn'] diff --git a/web/src/components/PhoneContactsDrawer.vue b/web/src/components/PhoneContactsDrawer.vue index a98f4412..680516aa 100644 --- a/web/src/components/PhoneContactsDrawer.vue +++ b/web/src/components/PhoneContactsDrawer.vue @@ -53,7 +53,7 @@ const selecting = ref(false) const expanded = ref('') const selected = ref([]) const searchInput = ref<{ focus?: () => void } | null>(null) -const nameInput = ref(null) +const nameInput = ref<{ focus?: () => void } | null>(null) const fileInput = ref(null) const draftName = ref('') const draftNumber = ref('') @@ -259,7 +259,7 @@ function toggleAdd() { return } adding.value = true - void nextTick(() => nameInput.value?.focus()) + void nextTick(() => nameInput.value?.focus?.()) } function resetDraft() { @@ -492,11 +492,11 @@ async function reload() {