123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- import QtQuick
- import QtQuick.Controls 2.5
- import QtQuick.Layouts 1.3
- import "backend.js" as Backend
- Item {
- width: 1920
- height: 1080
- FontLoader {
- id: alibaba
- source: "qrc:/components/font/Alibaba-PuHuiTi-Bold.ttf"
- }
- FontLoader {
- id: fontawesome
- source: "qrc:/components/font/fontawesome-webfont.ttf"
- }
- FontLoader {
- id: digtalFont
- source: "qrc:/components/font/fontawesome-webfont.ttf"
- }
- signal loginSuccess(var userName, var password)
- // signal carSeleted(var id)
- function loginUser(uname, pword) {
- var ret = Backend.validateUserCredentials(uname, pword)
- var message = ""
- if (ret) {
- message = "用户名或密码输入错误"
- subPopup.popMessage = message
- subPopup.open()
- return
- }
- // loginSuccess(uname, pword)
- appModel.userLogin(uname, pword)
- page_car.visible = true
- page_car.stack = stack
- stack.push(page_car)
- }
- function carSelect(id) {
- appModel.connectCar(id)
- }
- Popup {
- id: subPopup
- property alias popMessage: message.text
- background: Rectangle {
- id: subPopupBg
- implicitWidth: 1920
- implicitHeight: 60
- color: popupBgColorErr
- }
- y: (parent.height - 60)
- modal: true
- focus: true
- closePolicy: Popup.CloseOnPressOutside
- Text {
- id: message
- anchors.centerIn: parent
- font.pointSize: 12
- color: popupTextColor
- font.family: alibaba.name
- }
- onOpened: subPopupClose.start()
- }
- Timer {
- id: subPopupClose
- interval: 3000
- onTriggered: subPopup.close()
- }
- Rectangle {
- anchors.fill: parent
- Image {
- fillMode: Image.PreserveAspectFit
- source: 'qrc:/images/bg.png'
- }
- color: 'transparent'
- }
- Rectangle {
- width: parent.width
- height: 80
- color: 'transparent'
- z: 99
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- fillMode: Image.PreserveAspectFit
- source: 'qrc:/images/banner.png'
- }
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- text: '中冶非视距远程操控系统'
- font.family: alibaba.name
- font.pointSize: 24
- color: mainTextColor
- }
- }
- StackView {
- id: stack
- initialItem: page_login
- anchors.fill: parent
- }
- LoginPage {
- id: page_login
- visible: false
- }
- CarPage {
- id: page_car
- visible: false
- }
- DetailPage {
- id: page_detail
- visible: false
- }
- }
|