LoginPage.qml 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. import Felgo
  2. import QtQuick
  3. import QtQuick.Layouts
  4. import "../model"
  5. //import ExampleCustomMaterial 1.0
  6. AppPage {
  7. id: loginPage
  8. title: "植物病菌孢子捕捉分析系统"
  9. property int logintimeout: 300
  10. backgroundColor: app.theme_backgroundColor
  11. useSafeArea: false
  12. Component.onCompleted: {
  13. console.log("LoginPage Component.onCompleted...")
  14. }
  15. // 添加一个函数来处理亮度设置和重置计时
  16. function resetScreenTimeout() {
  17. serial.setLightness(128)
  18. logintimeout = 300
  19. }
  20. onVisibleChanged: {
  21. if(loginPage.visible===true){
  22. numberpad.txtPassword.clear()
  23. }
  24. }
  25. // login form background
  26. Rectangle {
  27. id: loginForm
  28. anchors.fill: parent
  29. color: app.theme_backgroundColor
  30. width: parent.width //content.width + dp(48)
  31. height: parent.height //content.height + dp(16)
  32. radius: dp(4)
  33. MouseArea {
  34. anchors.fill: parent
  35. onClicked: {
  36. console.log("AppPage clicked!")
  37. // 在这里添加处理点击事件的逻辑
  38. resetScreenTimeout()
  39. }
  40. }
  41. Column{
  42. anchors.fill: loginForm
  43. topPadding: 5
  44. bottomPadding: 5
  45. AppText {
  46. id: apptext_title
  47. anchors.horizontalCenter: parent.horizontalCenter //垂直居中显示
  48. text: "植物病菌孢子捕捉分析系统1.3"
  49. color: app.fontColor
  50. fontSize: 30
  51. }
  52. AppText{
  53. id: text_logintime
  54. text: "休眠计时:" + logintimeout
  55. color: "red"
  56. fontSize: 20
  57. }
  58. AppText {
  59. anchors.right: parent.right
  60. text: "软件版本:" + app.appversionText
  61. color: "gray"
  62. fontSize: 10
  63. }
  64. }
  65. NumberPad {
  66. id: numberpad
  67. anchors.centerIn: parent
  68. mlogin.onClicked: {
  69. loginPage.forceActiveFocus() // move focus away from text fields
  70. logic.login(txtPassword.text)
  71. resetScreenTimeout()
  72. }
  73. onButtonClicked: {
  74. resetScreenTimeout()
  75. }
  76. }
  77. }
  78. }