tsb_devinfo_page.lua 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. --[[
  2. @module tsb_devinfo_page
  3. @summary 设备信息页面
  4. @version 1.0
  5. @date 2026.03.04
  6. @author 李一玮
  7. @usage
  8. 本文件是设备信息页面,展示设备的各种信息。
  9. ]]
  10. local tsb_devinfo_page = {}
  11. -- 页面UI元素
  12. local main_container = nil
  13. local common_ui = require("tsb_common_page")
  14. -- 创建UI
  15. function tsb_devinfo_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 = 0xB3E5FC,
  31. })
  32. airui.label({
  33. parent = title_bar,
  34. text = "本机信息",
  35. x = 200,
  36. y = 8,
  37. w = 80,
  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_devinfo_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 = 270,
  53. color = 0xFFFFFF,
  54. })
  55. --------------------- 设备信息展示 ------------------------
  56. -- 程序版本
  57. airui.label({
  58. parent = scroll_container,
  59. text = "程序版本:",
  60. x = 20,
  61. y = 20,
  62. w = 100,
  63. h = 30,
  64. font_size = 16,
  65. })
  66. local version_label = airui.label({
  67. parent = scroll_container,
  68. text = "V1.0.0",
  69. x = 120,
  70. y = 20,
  71. w = 200,
  72. h = 30,
  73. font_size = 16,
  74. color = 0x666666,
  75. })
  76. -- 运行时间
  77. airui.label({
  78. parent = scroll_container,
  79. text = "运行时间:",
  80. x = 20,
  81. y = 60,
  82. w = 100,
  83. h = 30,
  84. font_size = 16,
  85. })
  86. local runtime_label = airui.label({
  87. parent = scroll_container,
  88. text = "00:00:00",
  89. x = 120,
  90. y = 60,
  91. w = 200,
  92. h = 30,
  93. font_size = 16,
  94. color = 0x666666,
  95. })
  96. -- 设备复位次数
  97. airui.label({
  98. parent = scroll_container,
  99. text = "设备复位次数:",
  100. x = 20,
  101. y = 100,
  102. w = 120,
  103. h = 30,
  104. font_size = 16,
  105. })
  106. local reset_count_label = airui.label({
  107. parent = scroll_container,
  108. text = "0",
  109. x = 140,
  110. y = 100,
  111. w = 200,
  112. h = 30,
  113. font_size = 16,
  114. color = 0x666666,
  115. })
  116. -- 设备SN
  117. airui.label({
  118. parent = scroll_container,
  119. text = "设备SN:",
  120. x = 20,
  121. y = 140,
  122. w = 100,
  123. h = 30,
  124. font_size = 16,
  125. })
  126. local device_sn_label = airui.label({
  127. parent = scroll_container,
  128. text = "SN001",
  129. x = 120,
  130. y = 140,
  131. w = 200,
  132. h = 30,
  133. font_size = 16,
  134. color = 0x666666,
  135. })
  136. -- IMEI
  137. airui.label({
  138. parent = scroll_container,
  139. text = "IMEI:",
  140. x = 20,
  141. y = 180,
  142. w = 100,
  143. h = 30,
  144. font_size = 16,
  145. })
  146. local imei_label = airui.label({
  147. parent = scroll_container,
  148. text = "123456789012345",
  149. x = 120,
  150. y = 180,
  151. w = 300,
  152. h = 30,
  153. font_size = 16,
  154. color = 0x666666,
  155. })
  156. -- ICCID
  157. airui.label({
  158. parent = scroll_container,
  159. text = "ICCID:",
  160. x = 20,
  161. y = 220,
  162. w = 100,
  163. h = 30,
  164. font_size = 16,
  165. })
  166. local iccid_label = airui.label({
  167. parent = scroll_container,
  168. text = "8986012345678901234",
  169. x = 120,
  170. y = 220,
  171. w = 300,
  172. h = 30,
  173. font_size = 16,
  174. color = 0x666666,
  175. })
  176. ---------------------------------------------------
  177. -- 底部信息
  178. common_ui.create_status_bar(main_container)
  179. end
  180. -- 初始化页面
  181. function tsb_devinfo_page.init(params)
  182. tsb_devinfo_page.create_ui()
  183. end
  184. -- 清理页面
  185. function tsb_devinfo_page.cleanup()
  186. if main_container then
  187. main_container:destroy()
  188. main_container = nil
  189. end
  190. end
  191. return tsb_devinfo_page