From e491cdb48129752324c4e3764f99bd9203c56dec Mon Sep 17 00:00:00 2001
From: lgq <1015864684@qq.com>
Date: 星期二, 31 三月 2026 09:48:44 +0800
Subject: [PATCH] 1.新增VF205门禁机代码
---
vf205_access/src/view/config/menu/voiceBroadcastView.js | 137 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 137 insertions(+), 0 deletions(-)
diff --git a/vf205_access/src/view/config/menu/voiceBroadcastView.js b/vf205_access/src/view/config/menu/voiceBroadcastView.js
new file mode 100644
index 0000000..3d31fce
--- /dev/null
+++ b/vf205_access/src/view/config/menu/voiceBroadcastView.js
@@ -0,0 +1,137 @@
+import dxui from '../../../../dxmodules/dxUi.js'
+import std from '../../../../dxmodules/dxStd.js'
+import viewUtils from "../../viewUtils.js"
+import topView from "../../topView.js"
+import configView from '../configView.js'
+import i18n from "../../i18n.js"
+import screen from '../../../screen.js'
+const voiceBroadcastView = {}
+
+const strangerData = ["鏃犺闊�", "璇峰厛娉ㄥ唽", "闄岀敓浜轰綘濂�"]
+const strangerData0 = ["No voice", "Play first register", "Play stranger hello"]
+const voiceModeData = ["鏃犺闊�", "鍚嶅瓧", "闂�欒"]
+const voiceModeData0 = ["No voice", "Play name", "Play greeting"]
+
+voiceBroadcastView.init = function () {
+ /**************************************************鍒涘缓灞忓箷*****************************************************/
+ const screenMain = dxui.View.build('voiceBroadcastView', dxui.Utils.LAYER.MAIN)
+ voiceBroadcastView.screenMain = screenMain
+ screenMain.scroll(false)
+ screenMain.bgColor(0xffffff)
+ screenMain.on(dxui.Utils.ENUM.LV_EVENT_SCREEN_LOADED, () => {
+ topView.changeTheme(true)
+
+ const configAll = screen.getConfig()
+ strangerVoiceDropdown.setOptions(configAll['base.language'] == 'CN' ? strangerData : strangerData0)
+ voiceModeDropdown.setOptions(configAll['base.language'] == 'CN' ? voiceModeData : voiceModeData0)
+
+ strangerVoiceDropdown.setSelected(configAll['face.stranger'])
+ voiceModeDropdown.setSelected(configAll['face.voiceMode'])
+ volumeSlider.value(configAll['base.volume'])
+ volumeSlider.send(dxui.Utils.EVENT.VALUE_CHANGED)
+ })
+
+ const titleBox = viewUtils.title(screenMain, configView.screenMain, 'voiceBroadcastViewTitle', 'voiceBroadcastView.title')
+ titleBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 70)
+
+ const strangerVoiceBox = dxui.View.build('strangerVoiceBox', screenMain)
+ viewUtils._clearStyle(strangerVoiceBox)
+ strangerVoiceBox.bgOpa(0)
+ strangerVoiceBox.setSize(screen.screenSize.width - 28 * 2, 80)
+ strangerVoiceBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 140)
+ strangerVoiceBox.borderWidth(1)
+ strangerVoiceBox.setBorderColor(0xDEDEDE)
+ strangerVoiceBox.obj.setStyleBorderSide(dxui.Utils.ENUM.LV_BORDER_SIDE_BOTTOM, 0)
+
+ const strangerVoiceLbl = dxui.Label.build('strangerVoiceLbl', strangerVoiceBox)
+ strangerVoiceLbl.textFont(viewUtils.font(26))
+ strangerVoiceLbl.dataI18n = 'voiceBroadcastView.strangerVoice'
+ strangerVoiceLbl.align(dxui.Utils.ALIGN.LEFT_MID, 0, 0)
+
+ const strangerVoiceDropdown = dxui.Dropdown.build('strangerVoiceDropdown', strangerVoiceBox)
+ strangerVoiceDropdown.textFont(viewUtils.font(26))
+ strangerVoiceDropdown.getList().textFont(viewUtils.font(26))
+ strangerVoiceDropdown.align(dxui.Utils.ALIGN.RIGHT_MID, 0, 0)
+ strangerVoiceDropdown.setSymbol('/app/code/resource/image/down.png')
+ strangerVoiceDropdown.width(300)
+ strangerVoiceDropdown.setOptions(['璇峰厛娉ㄥ唽', '璇峰厛娉ㄥ唽璇峰厛娉ㄥ唽璇峰厛娉ㄥ唽', '璇峰厛娉ㄥ唽'])
+
+
+ const voiceModeBox = dxui.View.build('voiceModeBox', screenMain)
+ viewUtils._clearStyle(voiceModeBox)
+ voiceModeBox.bgOpa(0)
+ voiceModeBox.setSize(screen.screenSize.width - 28 * 2, 80)
+ voiceModeBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 220)
+ voiceModeBox.borderWidth(1)
+ voiceModeBox.setBorderColor(0xDEDEDE)
+ voiceModeBox.obj.setStyleBorderSide(dxui.Utils.ENUM.LV_BORDER_SIDE_BOTTOM, 0)
+
+ const voiceModeLbl = dxui.Label.build('voiceModeLbl', voiceModeBox)
+ voiceModeLbl.textFont(viewUtils.font(26))
+ voiceModeLbl.dataI18n = 'voiceBroadcastView.voiceMode'
+ voiceModeLbl.align(dxui.Utils.ALIGN.LEFT_MID, 0, 0)
+
+ const voiceModeDropdown = dxui.Dropdown.build('voiceModeDropdown', voiceModeBox)
+ voiceModeDropdown.textFont(viewUtils.font(26))
+ voiceModeDropdown.getList().textFont(viewUtils.font(26))
+ voiceModeDropdown.align(dxui.Utils.ALIGN.RIGHT_MID, 0, 0)
+ voiceModeDropdown.setSymbol('/app/code/resource/image/down.png')
+ voiceModeDropdown.width(300)
+ voiceModeDropdown.setOptions(['璇峰厛娉ㄥ唽', '璇峰厛娉ㄥ唽璇峰厛娉ㄥ唽璇峰厛娉ㄥ唽', '璇峰厛娉ㄥ唽'])
+
+
+ const volumeBox = dxui.View.build('volumeBox', screenMain)
+ viewUtils._clearStyle(volumeBox)
+ volumeBox.bgOpa(0)
+ volumeBox.setSize(screen.screenSize.width - 28 * 2, 80)
+ volumeBox.align(dxui.Utils.ALIGN.TOP_MID, 0, 300)
+ volumeBox.borderWidth(1)
+ volumeBox.setBorderColor(0xDEDEDE)
+ volumeBox.obj.setStyleBorderSide(dxui.Utils.ENUM.LV_BORDER_SIDE_BOTTOM, 0)
+
+ const volumeLbl = dxui.Label.build('volumeLbl', volumeBox)
+ volumeLbl.textFont(viewUtils.font(26))
+ volumeLbl.dataI18n = 'voiceBroadcastView.volume'
+ volumeLbl.align(dxui.Utils.ALIGN.LEFT_MID, 0, 0)
+
+ const volumeValueLbl = dxui.Label.build('volumeValueLbl', volumeBox)
+ volumeValueLbl.textFont(viewUtils.font(26))
+ volumeValueLbl.align(dxui.Utils.ALIGN.RIGHT_MID, 0, 0)
+ volumeValueLbl.width(50)
+ volumeValueLbl.text('0')
+ volumeValueLbl.textAlign(dxui.Utils.TEXT_ALIGN.RIGHT)
+
+ const volumeSlider = dxui.Slider.build('volumeSlider', volumeBox)
+ volumeSlider.width(300)
+ volumeSlider.range(0, 100)
+ volumeSlider.on(dxui.Utils.EVENT.VALUE_CHANGED, () => {
+ volumeValueLbl.text(volumeSlider.value() + '')
+ })
+ volumeSlider.alignTo(volumeValueLbl, dxui.Utils.ALIGN.OUT_LEFT_MID, -10, 0)
+
+ const saveBtn = viewUtils.bottomBtn(screenMain, screenMain.id + 'saveBtn', 'voiceBroadcastView.save', () => {
+ const saveConfigData = {
+ face: {
+ stranger: strangerVoiceDropdown.getSelected(),
+ voiceMode: voiceModeDropdown.getSelected(),
+ },
+ base: {
+ volume: volumeSlider.value(),
+ }
+ }
+ const res = screen.saveConfig(saveConfigData)
+ if (res === true) {
+ voiceBroadcastView.statusPanel.success()
+ std.setTimeout(() => {
+ // 鎴愬姛杩斿洖涓婁竴灞傜晫闈�
+ dxui.loadMain(configView.screenMain)
+ }, 500)
+ } else {
+ voiceBroadcastView.statusPanel.fail()
+ }
+ })
+ saveBtn.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, -83)
+ voiceBroadcastView.statusPanel = viewUtils.statusPanel(screenMain, 'voiceBroadcastView.success', 'voiceBroadcastView.fail')
+}
+
+export default voiceBroadcastView
--
Gitblit v1.9.3