project.json5 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. // 项目json结构
  2. {
  3. // 版本号
  4. "version": "1.0.0",
  5. // 应用元数据
  6. "meta": {
  7. // 项目名称
  8. "name": "智能HOME项目",
  9. // 项目版本号
  10. "version": "1.0.0",
  11. // 项目描述
  12. "description": "智能HOME项目",
  13. // 源码路径
  14. "codePath": "C:\\Users\\Administrator\\Desktop\\project\\code",
  15. // 项目类型
  16. "type": "chip", // 'analog_display' | 'chip' | 'board' 1: 模拟显示 2: 芯片 3: 板卡
  17. // 屏幕类型
  18. "screenType": "single", // 'single' | 'dual' 1:单屏 2:双屏
  19. // 语言
  20. "language": "zh-cn",
  21. // 资源打包方式
  22. "resourcePackaging": "c_bin", // 'c' | 'c_bin' 1: C源码 2: C源码+BIN
  23. // BIN数量
  24. "binNum": "1", // 1~32
  25. // 芯片配置
  26. "chip": {
  27. // 芯片型号
  28. "model": "ESP32",
  29. // 闪存大小
  30. "flash_size": {
  31. "capacity": "16",
  32. "unit": "M"
  33. },
  34. // 内存大小
  35. "ram_size": {
  36. "capacity": "4",
  37. "unit": "M"
  38. }
  39. },
  40. // 板卡配置
  41. "board": {
  42. // 板卡型号
  43. "model": "ESP32",
  44. },
  45. // 屏幕配置
  46. "screens": [
  47. {
  48. // 屏幕类型
  49. "type": "1", // 1:主屏 2:副屏
  50. // 接口类型
  51. "interface": "RGB",
  52. // 屏幕宽
  53. "width": 1920,
  54. // 屏幕高
  55. "height": 1080,
  56. // 颜色深度
  57. "colorDepth": "16bit",
  58. // 颜色格式
  59. "colorFormat": "BGR",
  60. // 屏幕参数
  61. "params": {
  62. "PCLK": "",
  63. "VBP": "",
  64. "VFP": "",
  65. "HBP": "",
  66. "HFP": "",
  67. "HSYNC": "",
  68. "VSYNC": "",
  69. "HSYNC_WIDTH": "",
  70. "HSYNC_WIDTH": ""
  71. }
  72. }
  73. ],
  74. // 创建时间
  75. "createTime": "2025-09-01 12:00:00",
  76. // 修改时间
  77. "modifyTime": "2025-09-01 12:00:00",
  78. },
  79. // BIN列表
  80. "bins": [
  81. {
  82. "id": "bin_1",
  83. "fileName": "bin1.bin",
  84. "path": "./src/bin/bin1.bin"
  85. },
  86. {
  87. "id": "bin_2",
  88. "fileName": "bin2.bin",
  89. "path": "./src/bin/bin2.bin"
  90. }
  91. ],
  92. // 资源
  93. "resources": {
  94. // 图片资源
  95. "images": [
  96. {
  97. "id": "img_1",
  98. "fileName": "image1.png",
  99. "fielType": "png",
  100. "path": "./src/assets/images/image1.png",
  101. "compressFormat": "rle", // 无压缩、RLE压缩、QOI压缩、JPEG压缩、PNG压缩
  102. "alpha": 255, // 透明度0-255
  103. "bin": "bin_1", // 关联的BIN ID
  104. "colorFormat": "RGB565", // 颜色格式
  105. "colorDepth": "16bit", // 颜色深度
  106. }
  107. ],
  108. // 字体资源
  109. "fonts": [
  110. {
  111. "id": "font_1",
  112. "fileName": "font1.ttf",
  113. "fielType": "ttf",
  114. "path": "./src/assets/fonts/font1.ttf",
  115. "range": ["page", "custom", "range"], // 'all' | 'page' | 'custom' | 'range' 0: 全部 1:界面文本 2:自定义文本 3: 编码范围
  116. // 编码范围
  117. "codeRange": ["0x4E00-0x9FA5"],
  118. // 额外的文本内容
  119. "extText": "abcdefghijklmnopqrstuvwxyz",
  120. "bin": "bin_1" // 关联的BIN ID
  121. }
  122. ],
  123. "others": [
  124. // 动画资源
  125. {
  126. "id": "o_1",
  127. "fileName": "other.an",
  128. "fileType": "an",
  129. "path": "./src/assets/others/other.an"
  130. },
  131. // 样式资源
  132. {
  133. "id": "o_2",
  134. "fileName": "a.style",
  135. "fileType": "style",
  136. "path": "./src/assets/others/a.style"
  137. }
  138. ]
  139. },
  140. // 可复用控件
  141. "widgets": [
  142. {
  143. "id": "copy_obj_1",
  144. // 控件名称
  145. "name": "copy_obj_1",
  146. // 控件类型
  147. "widgetType": "lv_object",
  148. // 是否为可复用组件 widgets里面的为true
  149. "isCopy": true,
  150. // 复用来源组件id
  151. "copyFrom": "",
  152. // 元素类型
  153. "type": "widget",
  154. // 属性 根据每个控件生成
  155. "props": {
  156. // 坐标x
  157. "x": 0,
  158. // 坐标y
  159. "y": 0,
  160. // 宽度
  161. "width": 100,
  162. // 高度
  163. "height": 100,
  164. // 布局方式 flex grid
  165. "layout": "flex",
  166. // 启用
  167. "enable": true,
  168. // 可见
  169. "visible": true,
  170. // 值
  171. "value": {
  172. "valueType": "VARIABLE",
  173. "value": "page_1_a"
  174. },
  175. },
  176. // 样式 根据每个控件生成
  177. "style": {
  178. // 样式
  179. "style": "default",
  180. "state": {
  181. // 默认状态
  182. "normal": {
  183. // 直接使用颜色值
  184. "bg_color": "#000000",
  185. "border": "all", // all left right top bottom
  186. // 绑定变量或主题色
  187. "border_color": {
  188. // valueType的值: TEXT: 文本,VARIABLE: 变量,LANGUAGE: 多语言, COLOR: 主题颜色,不同的控件可以配置不同类型的属性
  189. "valueType": "TEXT",
  190. "value": "#ffffff"
  191. },
  192. "border_width": 1,
  193. "round_radius": 4
  194. },
  195. // 禁用状态
  196. "disabled": {
  197. "bg_color": "#000000",
  198. "border": "all",
  199. }
  200. }
  201. },
  202. // 事件
  203. "events": [
  204. {
  205. "id": "event_1",
  206. // 事件名称
  207. "name": "lv_obj_click_event",
  208. // 触发事件
  209. "trigger": "click",
  210. // 动作类型
  211. "type": "function", // 'play_animation' | 'function' -> play_animation: 播放动画 function: 执行函数
  212. // 动画ID
  213. animation: "",
  214. // 动画播放前函数ID
  215. animationPlayerBeforeEvent: "",
  216. // 动画播放后函数ID
  217. animationPlayerAfterEvent: "",
  218. // 函数ID
  219. function: "method_1"
  220. },
  221. // 加载完毕播放动画
  222. {
  223. "id": "event_1",
  224. // 事件名称
  225. "name": "lv_obj_click_event",
  226. // 触发事件
  227. "trigger": "click",
  228. // 动作类型
  229. "type": "play_animation", // 'play_animation' | 'function' -> play_animation: 播放动画 function: 执行函数
  230. // 动画ID
  231. animation: "animation_1",
  232. // 动画播放前函数ID
  233. animationPlayerBeforeEvent: "method_animation_1",
  234. // 动画播放后函数ID
  235. animationPlayerAfterEvent: "method_animation_2",
  236. // 函数ID
  237. function: ""
  238. }
  239. ],
  240. // 子对象
  241. "children": [
  242. {
  243. "id": "label_1",
  244. "name": "lv_label",
  245. "widgetType": "lv_label",
  246. "isCopy": false,
  247. "copyFrom": "",
  248. "type": "widget",
  249. "hidden": false,
  250. "locked": false,
  251. "props": {
  252. "id": "prop_1",
  253. "name": "text",
  254. "type": "string",
  255. "text": {
  256. "valueType": "LANGUAGE",
  257. "value": "hello"
  258. }
  259. },
  260. "style": {},
  261. "events": [],
  262. "children": []
  263. }
  264. ]
  265. },
  266. ],
  267. // 全局变量定义
  268. "variables": [
  269. {
  270. // 组ID
  271. "id": "group_1",
  272. // 组名称
  273. "name": "default_group",
  274. // 变量
  275. "variables": [
  276. {
  277. "id": "var_1",
  278. "name": "a",
  279. "value": "1",
  280. "type": "int"
  281. }
  282. ]
  283. }
  284. ],
  285. // 主题
  286. "themes": [
  287. {
  288. "id": "theme_0",
  289. // 主题名称
  290. "name": "默认主题",
  291. // 默认主题
  292. "default": true,
  293. // 颜色集
  294. "colors": [
  295. {
  296. "id": "color_1",
  297. // 颜色名称
  298. "name": "背景颜色",
  299. // 颜色值
  300. "value": "#000000",
  301. // 透明度
  302. "alpha": 255
  303. }
  304. ]
  305. },
  306. {
  307. "id": "theme_1",
  308. // 主题名称
  309. "name": "高亮主题",
  310. // 默认主题
  311. "default": false,
  312. // 颜色集 这里的颜色只能从默认主题获取,可以修改值
  313. "colors": [
  314. {
  315. "id": "color_1",
  316. // 颜色名称
  317. "name": "背景颜色",
  318. // 颜色值
  319. "value": "#ffffff",
  320. // 透明度
  321. "alpha": 255
  322. }
  323. ]
  324. }
  325. ],
  326. // 动画
  327. "animations": [
  328. {
  329. // 动画名称
  330. "name": "move_x_animation",
  331. // 时间轴
  332. "timeline": [
  333. {
  334. // 目标属性
  335. "target": "x",
  336. // 开始值
  337. "start": 0,
  338. // 结束值
  339. "end": 100,
  340. // 延迟时间
  341. "delay": 0,
  342. // 动画时间
  343. "duration": 500,
  344. // 动画效果
  345. "timingFunction": "ease",
  346. // 动画次数
  347. "iterationCount": "infinite" // 数值或infinite
  348. }
  349. ]
  350. }
  351. ],
  352. // 多语言
  353. "languages": [
  354. {
  355. "id": "language_1",
  356. // 语言表示
  357. "key": "hello",
  358. // 语言内容
  359. "values": [
  360. {
  361. "language": "zh-cn",
  362. "value": "你好",
  363. "font": "font_1"
  364. },
  365. {
  366. "language": "en",
  367. "value": "hello"
  368. },
  369. {
  370. "language": "ja",
  371. "value": "こんにちは"
  372. },
  373. {
  374. "language": "ko",
  375. "value": "안녕하세요"
  376. },
  377. {
  378. "language": "fr",
  379. "value": "bonjour"
  380. }
  381. ]
  382. }
  383. ],
  384. // 方法
  385. "methods": [
  386. {
  387. "id": "method_1",
  388. "name": "lv_obj_click",
  389. "action": "static lv_obj_click(void* ctx) { // TODO: 添加事件处理逻辑 }"
  390. }
  391. ],
  392. // 屏幕
  393. "screens": [
  394. {
  395. "id": "screen_1",
  396. // 名称
  397. "name": "主屏",
  398. // 元素类型
  399. "type": "screen",
  400. // 屏幕宽 未设置取通用配置
  401. "width": 1920,
  402. // 屏幕高 未设置取通用配置
  403. "height": 1080,
  404. // 颜色深度
  405. "colorDepth": "16bit",
  406. // 颜色格式
  407. "colorFormat": "BGR",
  408. // 页面
  409. "pages": [
  410. {
  411. "id": "page_1",
  412. // 页面名称
  413. "name": "启动页",
  414. // 元素类型
  415. "type": "page",
  416. // 隐藏
  417. "hidden": false,
  418. // 锁定
  419. "locked": false,
  420. // 参考线
  421. "referenceLine": [
  422. {
  423. "id": "r_1",
  424. // 垂直 水平
  425. "layout": "horizontal",
  426. // 位置
  427. "position": 0,
  428. // 显示
  429. "visible": true
  430. }
  431. ],
  432. // 属性
  433. "props": {},
  434. // 样式
  435. "style": {},
  436. // 事件
  437. "events": [],
  438. // 页面变量
  439. "variables": [
  440. {
  441. // 组ID
  442. "id": "page_group_1",
  443. // 组名称
  444. "name": "default_group",
  445. // 变量
  446. "variables": [
  447. {
  448. "id": "var_1",
  449. "name": "a",
  450. "value": "1",
  451. "type": "int"
  452. }
  453. ]
  454. }
  455. ],
  456. // 子组件
  457. "children": [
  458. {
  459. "id": "lv_obj_01",
  460. // 控件类型
  461. "widgetType": "lv_obj",
  462. // 控件名称
  463. "name": "容器",
  464. // 是否为可复用组件
  465. "isCopy": false,
  466. // 复用来源组件id
  467. "copyFrom": "copy_obj_1",
  468. // 类型
  469. "type": "widget",
  470. // 隐藏
  471. "hidden": false,
  472. // 锁定
  473. "locked": false,
  474. // 属性 根据每个控件生成
  475. "props": {
  476. // 坐标x
  477. "x": 100,
  478. // 坐标y
  479. "y": 100
  480. }
  481. },
  482. {
  483. "id": "label_1",
  484. "name": "lv_label",
  485. "widgetType": "lv_label",
  486. "isCopy": false,
  487. "copyFrom": "",
  488. "type": "widget",
  489. "hidden": false,
  490. "locked": false,
  491. "props": {
  492. "id": "prop_1",
  493. "name": "text",
  494. "type": "string",
  495. "text": {
  496. "valueType": "LANGUAGE",
  497. "value": "hello"
  498. }
  499. },
  500. "style": {},
  501. "events": [],
  502. "children": []
  503. }
  504. ]
  505. }
  506. ]
  507. }
  508. ]
  509. }