tsb_ywy_2_page.lua 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. --[[
  2. @module tsb_ywy_2_page
  3. @summary 液位仪透传页面
  4. @version 1.0
  5. @date 2026.03.16
  6. @author 李一玮
  7. @usage
  8. 本文件是液位仪透传页面,展示液位仪的透传功能。
  9. ]]
  10. local tsb_ywy_2_page = {}
  11. local common_ui = require("tsb_common_page")
  12. -- 页面UI元素
  13. local main_container = nil
  14. -- 创建UI
  15. function tsb_ywy_2_page.create_ui()
  16. main_container = airui.container({
  17. x = 0,
  18. y = 0,
  19. w = 480,
  20. h = 320,
  21. color = 0xF5F5F5,
  22. })
  23. --------------------- 标题栏 ------------------------
  24. local title_bar = airui.container({
  25. parent = main_container,
  26. x = 0,
  27. y = 0,
  28. w = 480,
  29. h = 30,
  30. color = 0x4CAF50,
  31. })
  32. airui.label({
  33. parent = title_bar,
  34. text = "液位仪透传",
  35. x = 200,
  36. y = 8,
  37. w = 120,
  38. h = 20,
  39. font_size = 16,
  40. color = 0xFFFFFF,
  41. })
  42. -- 标题栏公共信息展示
  43. common_ui.add_battery_display(title_bar)
  44. common_ui.create_back_button(title_bar, tsb_ywy_2_page.cleanup)
  45. ---------------------------------------------------
  46. -- 滚动容器
  47. local scroll_container = airui.container({
  48. parent = main_container,
  49. x = 0,
  50. y = 30,
  51. w = 480,
  52. h = 290,
  53. color = 0xFFFFFF,--0xF5F5F5
  54. })
  55. ---------------------------------------------------
  56. --------------------- 分页内容区 ------------------------
  57. -- 液位仪透传页面
  58. local passthrough_page = airui.container({
  59. parent = scroll_container,
  60. x = 0,
  61. y = 0,
  62. w = 480,
  63. h = 290,
  64. color = 0xF0F7E8,--0xF1F8E9
  65. })
  66. --------------------- A口接收数据 ------------------------
  67. -- A口标签
  68. airui.label({
  69. parent = passthrough_page,
  70. text = "A口接收数据",
  71. x = 65,
  72. y = 10,
  73. w = 120,
  74. h = 20,
  75. font_size = 16,
  76. })
  77. -- A口数据容器
  78. local a_port_container = airui.container({
  79. parent = passthrough_page,
  80. x = 2,
  81. y = 30,
  82. w = 240,
  83. h = 250,
  84. color = 0xFFFFFF,
  85. })
  86. -- A口数据显示
  87. local a_port_data = airui.textarea({
  88. parent = a_port_container,
  89. x = 5,
  90. y = 5,
  91. w = 230,
  92. h = 245,
  93. text = "00 01 02 03 04 05 06 07\n" ..
  94. "08 09 0A 0B 0C 0D 0E 0F\n"
  95. })
  96. ---------------------------------------------------
  97. --------------------- B口接收数据 ------------------------
  98. -- B口标签
  99. airui.label({
  100. parent = passthrough_page,
  101. text = "B口接收数据",
  102. x = 310,
  103. y = 10,
  104. w = 120,
  105. h = 20,
  106. font_size = 16,
  107. })
  108. -- B口数据容器
  109. local b_port_container = airui.container({
  110. parent = passthrough_page,
  111. x = 238,
  112. y = 30,
  113. w = 240,
  114. h = 250,
  115. color = 0xFFFFFF,
  116. })
  117. -- B口数据显示
  118. local b_port_data = airui.textarea({
  119. parent = b_port_container,
  120. x = 5,
  121. y = 5,
  122. w = 230,
  123. h = 245,
  124. text = "40 41 42 43 44 45 46 47\n" ..
  125. "48 49 4A 4B 4C 4D 4E 4F\n"
  126. })
  127. ---------------------------------------------------
  128. -- 底部信息
  129. --common_ui.create_status_bar(main_container)
  130. end
  131. -- 初始化页面
  132. function tsb_ywy_2_page.init(params)
  133. tsb_ywy_2_page.create_ui()
  134. end
  135. -- 清理页面
  136. function tsb_ywy_2_page.cleanup()
  137. -- 停止定时器
  138. common_ui.cleanup()
  139. if main_container then
  140. main_container:destroy()
  141. main_container = nil
  142. end
  143. end
  144. return tsb_ywy_2_page