tsb_update_page.lua 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. --[[
  2. @module tsb_update_page
  3. @summary 更新页面
  4. @version 1.0
  5. @date 2026.03.04
  6. @author 李一玮
  7. @usage
  8. 本文件是更新页面,展示更新的各种用法。
  9. ]]
  10. local tsb_update_page = {}
  11. -- 页面UI元素
  12. local main_container = nil
  13. local common_ui = require("tsb_common_page")
  14. -- 创建UI
  15. function tsb_update_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 = 0xA5D6A7,
  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_update_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. local update_btn = airui.button({
  57. parent = scroll_container,
  58. x = 15,
  59. y = 15,
  60. w = 120,
  61. h = 40,
  62. text = "检查设备更新",
  63. on_click = function()
  64. log.info("检查设备更新")
  65. end
  66. })
  67. -- 底部信息
  68. common_ui.create_status_bar(main_container)
  69. end
  70. -- 初始化页面
  71. function tsb_update_page.init(params)
  72. tsb_update_page.create_ui()
  73. end
  74. -- 清理页面
  75. function tsb_update_page.cleanup()
  76. if main_container then
  77. main_container:destroy()
  78. main_container = nil
  79. end
  80. end
  81. return tsb_update_page