lgq
3 天以前 081f12a52906abe6c2d139fdc144135978681009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
import dxui from "../../../dxmodules/dxUi.js"
import viewUtils from "../viewUtils.js"
import topView from "../topView.js"
import screen from "../../screen.js"
import mainView from "../mainView.js"
import doorControlView from "./menu/doorControlView.js"
import cloudCertView from "./menu/cloudCertView.js"
import helpView from "./menu/helpView.js"
import networkSettingView from "./menu/networkSettingView.js"
import systemSettingView from "./menu/systemSettingView.js"
import deviceInfoView from "./menu/deviceInfoView.js"
import localUserView from "./menu/localUserView.js"
import recordQueryView from "./menu/recordQueryView.js"
import voiceBroadcastView from "./menu/voiceBroadcastView.js"
import developerView from "./menu/developerView.js"
import capcalView from "./menu/developer/capcalView.js"
import dxstd from "../../../dxmodules/dxStd.js"
import dxDriver from "../../../dxmodules/dxDriver.js"
 
const configView = {}
configView.init = function () {
    /**************************************************创建屏幕*****************************************************/
    const screenMain = dxui.View.build('configView', dxui.Utils.LAYER.MAIN)
    configView.screenMain = screenMain
    screenMain.scroll(false)
    screenMain.bgColor(0xffffff)
    screenMain.on(dxui.Utils.ENUM.LV_EVENT_SCREEN_LOADED, () => {
        topView.changeTheme(true)
        if (!configView.timer) {
            configView.timer = dxstd.setInterval(() => {
                let count = dxui.Utils.GG.NativeDisp.lvDispGetInactiveTime()
                if (count > 60 * 1000 && !capcalView.isRunning) {
                    dxstd.clearInterval(configView.timer)
                    configView.timer = null
                    dxui.loadMain(mainView.screenMain)
                }
            }, 1000)
        }
    })
 
    const titleBox = viewUtils.title(screenMain, undefined, 'configViewTitle', 'configView.title', () => {
        viewUtils.confirmOpen('configView.confirmExit', 'configView.confirmExitContent', () => {
            dxui.loadMain(mainView.screenMain)
        }, () => { })
    })
    titleBox.align(dxui.Utils.ALIGN.TOP_MID, 0, screen.screenSize.height * (50 / 1280))
 
 
    const menuBox = dxui.View.build('menuBox', screenMain)
    viewUtils._clearStyle(menuBox)
    menuBox.setSize(screen.screenSize.width * (600 / 600), screen.screenSize.height * (800 / 1280))
    menuBox.bgOpa(0)
    menuBox.align(dxui.Utils.ALIGN.TOP_MID, 0, screen.screenSize.height * (178 / 1280))
    menuBox.flexFlow(dxui.Utils.FLEX_FLOW.ROW_WRAP)
    menuBox.flexAlign(dxui.Utils.FLEX_ALIGN.START, dxui.Utils.FLEX_ALIGN.START, dxui.Utils.FLEX_ALIGN.START)
    menuBox.obj.lvObjSetStylePadGap(0, dxui.Utils.ENUM._LV_STYLE_STATE_CMP_SAME)
 
    configView.menuBtn('localUser', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/localUser.png', 'configView.localUser', () => {
        dxui.loadMain(localUserView.screenMain)
    })
 
    configView.menuBtn('networkSetting', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/networkSetting.png', 'configView.networkSetting', () => {
        dxui.loadMain(networkSettingView.screenMain)
    })
 
    configView.menuBtn('doorControl', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/doorControl.png', 'configView.doorControl', () => {
        dxui.loadMain(doorControlView.screenMain)
    })
 
    configView.menuBtn('systemSetting', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/systemSetting.png', 'configView.systemSetting', () => {
        dxui.loadMain(systemSettingView.screenMain)
    })
 
    configView.menuBtn('deviceInfo', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/deviceInfo.png', 'configView.deviceInfo', () => {
        dxui.loadMain(deviceInfoView.screenMain)
        deviceInfoView.refresh()
    })
 
    configView.menuBtn('recordQuery', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/recordQuery.png', 'configView.recordQuery', () => {
        dxui.loadMain(recordQueryView.screenMain)
    })
 
    configView.menuBtn('voiceBroadcast', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/voiceBroadcast.png', 'configView.voiceBroadcast', () => {
        dxui.loadMain(voiceBroadcastView.screenMain)
    })
 
    if (dxDriver.DRIVER.MODEL != 'vf202' && dxDriver.DRIVER.MODEL != 'vf203') {
        configView.menuBtn('cloudCert', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/cloudCert.png', 'configView.cloudCert', () => {
            dxui.loadMain(cloudCertView.screenMain)
        })
    }
 
    // configView.menuBtn('help', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/help.png', 'configView.help', () => {
    //     dxui.loadMain(helpView.screenMain)
    // })
 
    configView.menuBtn('developer', menuBox, screen.screenSize.width * (150 / 600), screen.screenSize.height * (180 / 1280), screen.resourcePath.imagePath + '/developer.png', 'configView.developer', () => {
        dxui.loadMain(developerView.screenMain)
    })
 
}
 
configView.menuBtn = function (id, parent, width, height, src, dataI18n, callback = () => { }) {
    const box = dxui.View.build(id, parent)
    viewUtils._clearStyle(box)
    box.setSize(width, height)
    box.bgOpa(0)
 
    const zoom = 1.02
 
    const bg = dxui.View.build(id + 'bg', box)
    viewUtils._clearStyle(bg)
    bg.setSize(screen.screenSize.width * (100 / 600), screen.screenSize.height * (120 / 1280))
    bg.bgColor(0xf6f6f6)
    bg.radius(screen.screenSize.width * (20 / 600))
    bg.align(dxui.Utils.ALIGN.TOP_MID, 0, screen.screenSize.height * (15 / 1280))
 
    const image = dxui.Image.build(id + 'image', bg)
    image.source(src)
    image.align(dxui.Utils.ALIGN.CENTER, 0, 0)
 
    bg.on(dxui.Utils.ENUM.LV_EVENT_PRESSED, () => {
        bg.setSize(screen.screenSize.width * (100 / 600) * zoom, screen.screenSize.height * (120 / 1280) * zoom)
        image.obj.lvImgSetZoom(256 * zoom)
    })
    bg.on(dxui.Utils.ENUM.LV_EVENT_RELEASED, () => {
        bg.setSize(screen.screenSize.width * (100 / 600), screen.screenSize.height * (120 / 1280))
        image.obj.lvImgSetZoom(256)
    })
 
    bg.on(dxui.Utils.EVENT.CLICK, () => {
        callback()
    })
 
    const textLbl = dxui.Label.build(id + 'text', box)
    textLbl.textFont(viewUtils.font(22))
    textLbl.textColor(0x767676)
    textLbl.dataI18n = dataI18n
    textLbl.align(dxui.Utils.ALIGN.BOTTOM_MID, 0, 0)
    textLbl.width(width)
    textLbl.textAlign(dxui.Utils.TEXT_ALIGN.CENTER)
    textLbl.longMode(dxui.Utils.LABEL_LONG_MODE.SCROLL_CIRCULAR)
 
 
}
 
 
export default configView