LoginPage.qml 2.4 KB

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