@zeppos/zeus-cli 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/private-modules/zeppos-app-utils/dist/modules/create/local-app.js +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app-widget/index.js +99 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app.js +9 -15
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app.json +24 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/page/gts/food-list.js +4 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/page/gts/index.js +24 -24
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/secondary-widget/index.js +139 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/styles-gts-3.js +23 -24
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/styles.js +24 -24
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/empty/jsconfig.json +2 -7
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/pages/index.js +12 -12
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app.json +8 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.page.js +16 -16
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.style.js +11 -11
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/i18n/en-US.po +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/todo-list/secondary-widget/index.js +160 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/todo-list/utils/constants.js +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/app.json +2 -18
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gtr/home/index.page.js +5 -5
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gtr/home/index.style.js +7 -7
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gts/home/index.page.js +5 -5
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gts/home/index.style.js +6 -6
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/app.json +23 -9
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_0.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_1.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_10.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_11.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_12.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_13.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_14.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_15.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_16.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_17.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_18.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_19.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_2.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_20.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_21.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_22.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_23.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_24.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_25.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_26.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_27.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_28.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_29.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_3.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_30.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_31.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_32.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_33.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_34.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_35.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_36.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_4.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_5.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_6.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_7.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_8.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_9.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/button_normal.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/button_press.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/false copy.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/icon copy.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/0.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/1.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/2.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/3.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/4.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/5.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/6.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/7.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/8.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/9.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/radio_select.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/select.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/switch_off.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/switch_on.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/unselect.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/zeppos.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/raw/custom.ttf +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/config/tree.js +76 -2
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/index.js +7 -5
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_digital_crown.js +26 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_key.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_wrist_motion.js +27 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/router/set_launch_app_timeout.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/sensor/pai.js +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/arc.js +28 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/button.js +44 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/checkbox_group.js +45 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/circle.js +28 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/cycle_image_text_list.js +43 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/cycle_list.js +26 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/dialog.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/fill_rect.js +29 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/histogram.js +76 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/img.js +23 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/img_anim.js +37 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/page_indicator.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/pick_date.js +43 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/polyline.js +36 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/qrcode.js +22 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/radio_group.js +44 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/scroll_list.js +106 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/slide_switch.js +28 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/stroke_rect.js +28 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/text.js +51 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/view_container.js +81 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/UI/TextByLine.js +19 -12
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/UI/Title.js +2 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/styles.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/test.js +3 -2
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/empty/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/empty/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/assets/common.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/assets/common.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/global.d.ts +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/jsconfig.json +1 -1
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/_package.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/jsconfig.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/storage.js +0 -40
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/_package.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/jsconfig.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/_package.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/app-side/index.js +0 -11
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/jsconfig.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/setting/i18n/en-US.po +0 -2
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/setting/index.js +0 -5
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/_package.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/jsconfig.json +0 -14
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/utils/constants.js +0 -3
- package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/utils/fs.js +0 -34
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/.prettierrc.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app-side/index.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/assets/gts/icon.png +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.page.json +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/setting/i18n/en-US.po +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/setting/index.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/data.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/defer.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/device-polyfill.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/es6-promise.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/event.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/message-side.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/message.js +0 -0
- /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/utils/index.js +0 -0
package/package.json
CHANGED
|
@@ -67,7 +67,7 @@ var createLocalApp = function (args) { return __awaiter(void 0, void 0, void 0,
|
|
|
67
67
|
fs_1["default"].renameSync((0, path_1.resolve)(workDir, "./_package.json"), (0, path_1.resolve)(workDir, "./package.json"));
|
|
68
68
|
}
|
|
69
69
|
if (fs_extra_1["default"].existsSync((0, path_1.resolve)(templateInfo.path, "./package.json")) && !fs_extra_1["default"].existsSync((0, path_1.resolve)(templateInfo.path, "./global.d.ts"))) {
|
|
70
|
-
fs_1["default"].writeFileSync("".concat(workDir, "/global.d.ts"), '/// <reference path="node_modules/@zeppos/device-types/index.d.ts" />');
|
|
70
|
+
fs_1["default"].writeFileSync("".concat(workDir, "/global.d.ts"), args.OSVersion === 'v1' ? '/// <reference path="node_modules/@zeppos/device-types/index.d.ts" />' : '/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />');
|
|
71
71
|
}
|
|
72
72
|
appJsonPath = (0, path_1.resolve)(workDir, './app.json');
|
|
73
73
|
appJson = fs_extra_1["default"].readJsonSync(appJsonPath);
|
package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app-widget/index.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { getTextLayout, createWidget, widget, deleteWidget, setAppWidgetSize, getAppWidgetSize } from "@zos/ui";
|
|
2
|
+
import { log as Logger, px } from "@zos/utils";
|
|
3
|
+
import { Calorie } from "@zos/sensor";
|
|
4
|
+
import { getText } from "@zos/i18n";
|
|
5
|
+
|
|
6
|
+
const logger = Logger.getLogger("calories");
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
CALORIE_TEXT,
|
|
10
|
+
CALORIE_TEXT_SIZE,
|
|
11
|
+
UNIT_TEXT,
|
|
12
|
+
UNIT_TEXT_SIZE,
|
|
13
|
+
CONSUME_ICON,
|
|
14
|
+
CONSUME_ICON_WIDTH,
|
|
15
|
+
IMGAE_CALORIES_MARIN,
|
|
16
|
+
CALORIES_UNIT_MARIN,
|
|
17
|
+
DEVICE_WIDTH,
|
|
18
|
+
TOTAL_CONSUME_TEXT,
|
|
19
|
+
} from "../utils/styles-gts-3";
|
|
20
|
+
|
|
21
|
+
AppWidget({
|
|
22
|
+
state: {
|
|
23
|
+
refreshWidgetList: [],
|
|
24
|
+
},
|
|
25
|
+
|
|
26
|
+
onInit() {
|
|
27
|
+
logger.log("===onInit===");
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
onDataRestore() {},
|
|
31
|
+
|
|
32
|
+
build() {
|
|
33
|
+
logger.log(getAppWidgetSize())
|
|
34
|
+
|
|
35
|
+
setAppWidgetSize({
|
|
36
|
+
h: px(120)
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
createWidget(widget.TEXT, TOTAL_CONSUME_TEXT);
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
onResume() {
|
|
43
|
+
try {
|
|
44
|
+
if (this.state.refreshWidgetList.length) {
|
|
45
|
+
this.state.refreshWidgetList.forEach((i) => {
|
|
46
|
+
deleteWidget(i);
|
|
47
|
+
});
|
|
48
|
+
this.state.refreshWidgetList = [];
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
this.getData();
|
|
52
|
+
logger.log("===onResume===");
|
|
53
|
+
} catch(e) {
|
|
54
|
+
console.log('LifeCycle Error', e)
|
|
55
|
+
e && e.stack && e.stack.split(/\n/).forEach((i) => console.log('error stack', i))
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
getData() {
|
|
60
|
+
const calories = new Calorie().getCurrent(); // Math.floor(Math.random() * 1000)
|
|
61
|
+
|
|
62
|
+
this.buildTopContent(calories);
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
buildTopContent(calories) {
|
|
66
|
+
const { width: w1 } = getTextLayout("" + calories, {
|
|
67
|
+
text_size: CALORIE_TEXT_SIZE,
|
|
68
|
+
text_width: 0,
|
|
69
|
+
wrapped: 0,
|
|
70
|
+
});
|
|
71
|
+
const { width: w2 } = getTextLayout(getText("unit"), {
|
|
72
|
+
text_size: UNIT_TEXT_SIZE,
|
|
73
|
+
text_width: 0,
|
|
74
|
+
wrapped: 0,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const w =
|
|
78
|
+
w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN;
|
|
79
|
+
const x = Math.round((DEVICE_WIDTH - w) / 2);
|
|
80
|
+
const baseY = px(48);
|
|
81
|
+
|
|
82
|
+
const textId = createWidget(widget.TEXT, {
|
|
83
|
+
...CALORIE_TEXT,
|
|
84
|
+
text: `${calories}`,
|
|
85
|
+
x: x + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
|
|
86
|
+
w: w1,
|
|
87
|
+
y: CALORIE_TEXT.y + baseY,
|
|
88
|
+
});
|
|
89
|
+
const unitId = createWidget(widget.TEXT, {
|
|
90
|
+
...UNIT_TEXT,
|
|
91
|
+
x: x + w - w2,
|
|
92
|
+
w: w2,
|
|
93
|
+
y: UNIT_TEXT.y + baseY,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
this.state.refreshWidgetList.push(textId, unitId);
|
|
97
|
+
createWidget(widget.IMG, { ...CONSUME_ICON, x, y: CONSUME_ICON.y + baseY });
|
|
98
|
+
},
|
|
99
|
+
});
|
|
@@ -1,27 +1,21 @@
|
|
|
1
|
-
import { log as Logger } from
|
|
2
|
-
import
|
|
1
|
+
import { log as Logger } from '@zos/utils'
|
|
2
|
+
import { localStorage } from '@zos/storage'
|
|
3
3
|
|
|
4
|
-
const logger = Logger.getLogger(
|
|
5
|
-
const fileName = "calorie_data.txt";
|
|
4
|
+
const logger = Logger.getLogger('calories-app')
|
|
6
5
|
|
|
7
6
|
App({
|
|
8
7
|
globalData: {
|
|
9
|
-
foodType:
|
|
10
|
-
localStorage: null,
|
|
8
|
+
foodType: '',
|
|
11
9
|
},
|
|
12
10
|
onCreate() {
|
|
13
11
|
try {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
const { foodType = 'chocolate' } = localStorage.getItem('calorie', {})
|
|
13
|
+
this.globalData.foodType = foodType
|
|
14
|
+
|
|
17
15
|
} catch (e) {
|
|
18
16
|
logger.log("--->e:", e);
|
|
19
17
|
}
|
|
20
18
|
},
|
|
21
19
|
|
|
22
|
-
onDestroy() {
|
|
23
|
-
|
|
24
|
-
foodType: getApp()._options.globalData.foodType,
|
|
25
|
-
});
|
|
26
|
-
},
|
|
27
|
-
});
|
|
20
|
+
onDestroy() {},
|
|
21
|
+
})
|
|
@@ -29,6 +29,30 @@
|
|
|
29
29
|
"module": {
|
|
30
30
|
"page": {
|
|
31
31
|
"pages": ["page/gts/index", "page/gts/food-list"]
|
|
32
|
+
},
|
|
33
|
+
"secondary-widget": {
|
|
34
|
+
"widgets": [
|
|
35
|
+
{
|
|
36
|
+
"path": "secondary-widget/index",
|
|
37
|
+
"icon": "icon.png",
|
|
38
|
+
"name": "calories",
|
|
39
|
+
"runtime": {
|
|
40
|
+
"type": "js"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
"app-widget": {
|
|
46
|
+
"widgets": [
|
|
47
|
+
{
|
|
48
|
+
"path": "app-widget/index",
|
|
49
|
+
"icon": "icon.png",
|
|
50
|
+
"name": "calories",
|
|
51
|
+
"runtime": {
|
|
52
|
+
"type": "js"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
]
|
|
32
56
|
}
|
|
33
57
|
},
|
|
34
58
|
"platforms": [
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as hmUI from "@zos/ui";
|
|
2
2
|
import { back } from "@zos/router";
|
|
3
3
|
import { log as Logger, px } from "@zos/utils";
|
|
4
|
+
import { localStorage } from "@zos/storage";
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
FOOD_LIST_Y,
|
|
@@ -28,6 +29,9 @@ Page({
|
|
|
28
29
|
setPrograms(index) {
|
|
29
30
|
this.state.activeIndex = index;
|
|
30
31
|
globalData.foodType = FOOD_CALORIES[index].type;
|
|
32
|
+
localStorage.setItem("calorie", {
|
|
33
|
+
foodType: globalData.foodType
|
|
34
|
+
});
|
|
31
35
|
back();
|
|
32
36
|
},
|
|
33
37
|
buildFoodList() {
|
package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/page/gts/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { push } from
|
|
3
|
-
import { getText } from
|
|
4
|
-
import { Calorie } from
|
|
5
|
-
import { log as Logger, px } from
|
|
1
|
+
import { getTextLayout, createWidget, widget } from '@zos/ui'
|
|
2
|
+
import { push } from '@zos/router'
|
|
3
|
+
import { getText } from '@zos/i18n'
|
|
4
|
+
import { Calorie } from '@zos/sensor'
|
|
5
|
+
import { log as Logger, px } from '@zos/utils'
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
CALORIE_TEXT,
|
|
@@ -30,12 +30,12 @@ const globalData = getApp()._options.globalData;
|
|
|
30
30
|
|
|
31
31
|
Page({
|
|
32
32
|
buildTopContent(calories) {
|
|
33
|
-
const { width: w1 } =
|
|
33
|
+
const { width: w1 } = getTextLayout('' + calories, {
|
|
34
34
|
text_size: CALORIE_TEXT_SIZE,
|
|
35
35
|
text_width: 0,
|
|
36
|
-
wrapped: 0
|
|
37
|
-
})
|
|
38
|
-
const { width: w2 } =
|
|
36
|
+
wrapped: 0
|
|
37
|
+
})
|
|
38
|
+
const { width: w2 } = getTextLayout(getText('unit'), {
|
|
39
39
|
text_size: UNIT_TEXT_SIZE,
|
|
40
40
|
text_width: 0,
|
|
41
41
|
wrapped: 0,
|
|
@@ -45,38 +45,38 @@ Page({
|
|
|
45
45
|
w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN;
|
|
46
46
|
const x = Math.round((DEVICE_WIDTH - w) / 2);
|
|
47
47
|
|
|
48
|
-
const group =
|
|
48
|
+
const group = createWidget(widget.GROUP, {
|
|
49
49
|
...ALIGN_DESC_GROUP,
|
|
50
50
|
x,
|
|
51
51
|
w,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
group.createWidget(
|
|
54
|
+
group.createWidget(widget.TEXT, {
|
|
55
55
|
...CALORIE_TEXT,
|
|
56
56
|
text: `${calories}`,
|
|
57
57
|
x: CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
|
|
58
58
|
w: w1,
|
|
59
|
-
})
|
|
60
|
-
group.createWidget(
|
|
59
|
+
})
|
|
60
|
+
group.createWidget(widget.TEXT, {
|
|
61
61
|
...UNIT_TEXT,
|
|
62
62
|
x: w - w2,
|
|
63
63
|
w: w2,
|
|
64
|
-
})
|
|
65
|
-
group.createWidget(
|
|
64
|
+
})
|
|
65
|
+
group.createWidget(widget.IMG, CONSUME_ICON)
|
|
66
66
|
},
|
|
67
67
|
build() {
|
|
68
68
|
let calories = new Calorie().getCurrent(); // Math.floor(Math.random() * 1000)
|
|
69
69
|
let currentFood = globalData.foodType;
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
createWidget(widget.TEXT, TOTAL_CONSUME_TEXT)
|
|
72
72
|
|
|
73
73
|
this.buildTopContent(calories);
|
|
74
74
|
|
|
75
75
|
let activeIndex = FOOD_CALORIES.findIndex(
|
|
76
|
-
(item) => item.type === currentFood
|
|
77
|
-
)
|
|
78
|
-
this.calculate(calories, FOOD_CALORIES[activeIndex])
|
|
79
|
-
|
|
76
|
+
(item) => item.type === currentFood,
|
|
77
|
+
)
|
|
78
|
+
this.calculate(calories, FOOD_CALORIES[activeIndex])
|
|
79
|
+
createWidget(widget.BUTTON, {
|
|
80
80
|
...EQUIVALENT_TO_BUTTON,
|
|
81
81
|
click_func: () => {
|
|
82
82
|
push({
|
|
@@ -101,16 +101,16 @@ Page({
|
|
|
101
101
|
); // icon
|
|
102
102
|
}
|
|
103
103
|
} else {
|
|
104
|
-
this.drawFood(EQUIVALENT_MORE_X, type)
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
this.drawFood(EQUIVALENT_MORE_X, type) // icon
|
|
105
|
+
createWidget(widget.IMG, EQUIVALENT_MORE_FOOD_ICON)
|
|
106
|
+
createWidget(widget.TEXT, {
|
|
107
107
|
...EQUIVALENT_MORE_FOOD_NUM,
|
|
108
108
|
text: `${count}`,
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
drawFood(x, type) {
|
|
113
|
-
|
|
113
|
+
createWidget(widget.IMG, {
|
|
114
114
|
...EQUIVALENT_TO_FOOD_ICON,
|
|
115
115
|
x: px(x),
|
|
116
116
|
src: `food/${type}.png`,
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { getTextLayout, createWidget, widget, deleteWidget } from "@zos/ui";
|
|
2
|
+
import { push } from "@zos/router";
|
|
3
|
+
import { getText } from "@zos/i18n";
|
|
4
|
+
import { Calorie } from "@zos/sensor";
|
|
5
|
+
import { log as Logger, px } from "@zos/utils";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
CALORIE_TEXT,
|
|
9
|
+
CALORIE_TEXT_SIZE,
|
|
10
|
+
UNIT_TEXT,
|
|
11
|
+
UNIT_TEXT_SIZE,
|
|
12
|
+
TOTAL_CONSUME_TEXT,
|
|
13
|
+
CONSUME_ICON,
|
|
14
|
+
CONSUME_ICON_WIDTH,
|
|
15
|
+
IMGAE_CALORIES_MARIN,
|
|
16
|
+
CALORIES_UNIT_MARIN,
|
|
17
|
+
EQUIVALENT_TO_BUTTON,
|
|
18
|
+
EQUIVALENT_TO_FOOD_ICON,
|
|
19
|
+
DEVICE_WIDTH,
|
|
20
|
+
EQUIVALENT_MORE_X,
|
|
21
|
+
EQUIVALENT_MARGIN,
|
|
22
|
+
EQUIVALENT_TO_FOOD_ICON_WIDTH,
|
|
23
|
+
EQUIVALENT_MORE_FOOD_ICON,
|
|
24
|
+
EQUIVALENT_MORE_FOOD_NUM,
|
|
25
|
+
} from "../utils/styles-gts-3";
|
|
26
|
+
import { FOOD_CALORIES } from "../utils/constants";
|
|
27
|
+
const logger = Logger.getLogger("calories");
|
|
28
|
+
const globalData = getApp()._options.globalData;
|
|
29
|
+
|
|
30
|
+
SecondaryWidget({
|
|
31
|
+
state: {
|
|
32
|
+
refreshWidgetList: [],
|
|
33
|
+
},
|
|
34
|
+
buildTopContent(calories) {
|
|
35
|
+
const { width: w1 } = getTextLayout("" + calories, {
|
|
36
|
+
text_size: CALORIE_TEXT_SIZE,
|
|
37
|
+
text_width: 0,
|
|
38
|
+
wrapped: 0,
|
|
39
|
+
});
|
|
40
|
+
const { width: w2 } = getTextLayout(getText("unit"), {
|
|
41
|
+
text_size: UNIT_TEXT_SIZE,
|
|
42
|
+
text_width: 0,
|
|
43
|
+
wrapped: 0,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const w =
|
|
47
|
+
w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN;
|
|
48
|
+
const x = Math.round((DEVICE_WIDTH - w) / 2);
|
|
49
|
+
const baseY = px(64);
|
|
50
|
+
|
|
51
|
+
const textId = createWidget(widget.TEXT, {
|
|
52
|
+
...CALORIE_TEXT,
|
|
53
|
+
text: `${calories}`,
|
|
54
|
+
x: x + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
|
|
55
|
+
w: w1,
|
|
56
|
+
y: CALORIE_TEXT.y + baseY,
|
|
57
|
+
});
|
|
58
|
+
const unitId = createWidget(widget.TEXT, {
|
|
59
|
+
...UNIT_TEXT,
|
|
60
|
+
x: x + w - w2,
|
|
61
|
+
w: w2,
|
|
62
|
+
y: UNIT_TEXT.y + baseY,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.state.refreshWidgetList.push(textId, unitId);
|
|
66
|
+
createWidget(widget.IMG, { ...CONSUME_ICON, x, y: CONSUME_ICON.y + baseY });
|
|
67
|
+
},
|
|
68
|
+
build() {
|
|
69
|
+
logger.log("===build===");
|
|
70
|
+
createWidget(widget.TEXT, TOTAL_CONSUME_TEXT);
|
|
71
|
+
|
|
72
|
+
createWidget(widget.BUTTON, {
|
|
73
|
+
...EQUIVALENT_TO_BUTTON,
|
|
74
|
+
click_func: () => {
|
|
75
|
+
push({
|
|
76
|
+
url: "page/gts/food-list",
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
calculate(currentCalories, foodData) {
|
|
82
|
+
let { value, type } = foodData;
|
|
83
|
+
let count = Math.floor(currentCalories / value);
|
|
84
|
+
if (count === 1 || count === 2 || count === 3) {
|
|
85
|
+
let x =
|
|
86
|
+
(DEVICE_WIDTH -
|
|
87
|
+
EQUIVALENT_TO_FOOD_ICON_WIDTH * count -
|
|
88
|
+
EQUIVALENT_MARGIN * (count - 1)) /
|
|
89
|
+
2;
|
|
90
|
+
for (let index = 0; index < count; index++) {
|
|
91
|
+
this.drawFood(
|
|
92
|
+
x + (EQUIVALENT_MARGIN + EQUIVALENT_TO_FOOD_ICON_WIDTH) * index,
|
|
93
|
+
type
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
} else {
|
|
97
|
+
this.drawFood(EQUIVALENT_MORE_X, type); // icon
|
|
98
|
+
const imgId = createWidget(widget.IMG, EQUIVALENT_MORE_FOOD_ICON);
|
|
99
|
+
const textId = createWidget(widget.TEXT, {
|
|
100
|
+
...EQUIVALENT_MORE_FOOD_NUM,
|
|
101
|
+
text: `${count}`,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
this.state.refreshWidgetList.push(imgId, textId);
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
drawFood(x, type) {
|
|
108
|
+
const imgWidget = createWidget(widget.IMG, {
|
|
109
|
+
...EQUIVALENT_TO_FOOD_ICON,
|
|
110
|
+
x: px(x),
|
|
111
|
+
src: `food/${type}.png`,
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
this.state.refreshWidgetList.push(imgWidget);
|
|
115
|
+
},
|
|
116
|
+
onResume() {
|
|
117
|
+
if (this.state.refreshWidgetList.length) {
|
|
118
|
+
this.state.refreshWidgetList.forEach((i) => {
|
|
119
|
+
deleteWidget(i);
|
|
120
|
+
});
|
|
121
|
+
this.state.refreshWidgetList = [];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
this.getData();
|
|
125
|
+
logger.log("===onResume===");
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
getData() {
|
|
129
|
+
const calories = new Calorie().getCurrent(); // Math.floor(Math.random() * 1000)
|
|
130
|
+
const currentFood = globalData.foodType;
|
|
131
|
+
|
|
132
|
+
this.buildTopContent(calories);
|
|
133
|
+
|
|
134
|
+
const activeIndex = FOOD_CALORIES.findIndex(
|
|
135
|
+
(item) => item.type === currentFood
|
|
136
|
+
);
|
|
137
|
+
this.calculate(calories, FOOD_CALORIES[activeIndex]);
|
|
138
|
+
},
|
|
139
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getText } from
|
|
3
|
-
import { getDeviceInfo } from
|
|
4
|
-
import { px } from
|
|
1
|
+
import { align, text_style } from '@zos/ui'
|
|
2
|
+
import { getText } from '@zos/i18n'
|
|
3
|
+
import { getDeviceInfo } from '@zos/device'
|
|
4
|
+
import { px } from '@zos/utils'
|
|
5
5
|
|
|
6
6
|
export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo();
|
|
7
7
|
|
|
@@ -13,10 +13,9 @@ export const COMMON_TITLE_TEXT = {
|
|
|
13
13
|
h: 42,
|
|
14
14
|
color: 0xffffff,
|
|
15
15
|
text_size: 32,
|
|
16
|
-
align_v:
|
|
17
|
-
text_style:
|
|
18
|
-
}
|
|
19
|
-
|
|
16
|
+
align_v: align.LEFT,
|
|
17
|
+
text_style: text_style.WRAP,
|
|
18
|
+
}
|
|
20
19
|
export const ALIGN_DESC_GROUP = {
|
|
21
20
|
x: 0,
|
|
22
21
|
y: px(80),
|
|
@@ -34,10 +33,10 @@ export const CALORIE_TEXT = {
|
|
|
34
33
|
h: px(82),
|
|
35
34
|
color: 0xffffff,
|
|
36
35
|
text_size: CALORIE_TEXT_SIZE,
|
|
37
|
-
align_h:
|
|
38
|
-
align_v:
|
|
39
|
-
}
|
|
40
|
-
export const UNIT_TEXT_SIZE = px(24)
|
|
36
|
+
align_h: align.LEFT,
|
|
37
|
+
align_v: align.CENTER_V,
|
|
38
|
+
}
|
|
39
|
+
export const UNIT_TEXT_SIZE = px(24)
|
|
41
40
|
export const UNIT_TEXT = {
|
|
42
41
|
text: getText("unit"),
|
|
43
42
|
x: 0,
|
|
@@ -46,9 +45,9 @@ export const UNIT_TEXT = {
|
|
|
46
45
|
h: px(34),
|
|
47
46
|
color: 0x999999,
|
|
48
47
|
text_size: UNIT_TEXT_SIZE,
|
|
49
|
-
align_h:
|
|
50
|
-
align_v:
|
|
51
|
-
}
|
|
48
|
+
align_h: align.LEFT,
|
|
49
|
+
align_v: align.CENTER_V,
|
|
50
|
+
}
|
|
52
51
|
|
|
53
52
|
export const TOTAL_CONSUME_TEXT = {
|
|
54
53
|
text: getText("consumption"),
|
|
@@ -58,9 +57,9 @@ export const TOTAL_CONSUME_TEXT = {
|
|
|
58
57
|
h: 38,
|
|
59
58
|
color: 0x999999,
|
|
60
59
|
text_size: 28,
|
|
61
|
-
align_h:
|
|
62
|
-
align_v:
|
|
63
|
-
}
|
|
60
|
+
align_h: align.CENTER_H,
|
|
61
|
+
align_v: align.CENTER_V,
|
|
62
|
+
}
|
|
64
63
|
|
|
65
64
|
export const EQUIVALENT_TO_BUTTON = {
|
|
66
65
|
text: getText("equivalent"),
|
|
@@ -106,9 +105,9 @@ export const EQUIVALENT_MORE_FOOD_NUM = {
|
|
|
106
105
|
h: 60,
|
|
107
106
|
color: 0xee801e,
|
|
108
107
|
text_size: 50,
|
|
109
|
-
align_h:
|
|
110
|
-
align_v:
|
|
111
|
-
}
|
|
108
|
+
align_h: align.LEFT,
|
|
109
|
+
align_v: align.CENTER_V,
|
|
110
|
+
}
|
|
112
111
|
|
|
113
112
|
export const FOOD_LIST_Y = 96;
|
|
114
113
|
export const FOOD_LIST_ITEM_MARGIN = 60;
|
|
@@ -136,6 +135,6 @@ export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
|
136
135
|
h: FOOD_LIST_ITEM_HEIGHT,
|
|
137
136
|
color: 0xffffff,
|
|
138
137
|
text_size: 32,
|
|
139
|
-
align_h:
|
|
140
|
-
align_v:
|
|
141
|
-
}
|
|
138
|
+
align_h: align.LEFT,
|
|
139
|
+
align_v: align.CENTER_V,
|
|
140
|
+
}
|
package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/styles.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { getText } from
|
|
3
|
-
import { getDeviceInfo } from
|
|
4
|
-
import { px } from
|
|
1
|
+
import { align, text_style } from '@zos/ui'
|
|
2
|
+
import { getText } from '@zos/i18n'
|
|
3
|
+
import { getDeviceInfo } from '@zos/device'
|
|
4
|
+
import { px } from '@zos/utils'
|
|
5
5
|
|
|
6
6
|
export const { width: DEVICE_WIDTH, height: DEVICE_HEIGHT } = getDeviceInfo();
|
|
7
7
|
|
|
@@ -13,10 +13,10 @@ export const COMMON_TITLE_TEXT = {
|
|
|
13
13
|
h: px(46),
|
|
14
14
|
color: 0xffffff,
|
|
15
15
|
text_size: px(36),
|
|
16
|
-
align_h:
|
|
17
|
-
align_v:
|
|
18
|
-
text_style:
|
|
19
|
-
}
|
|
16
|
+
align_h: align.CENTER_H,
|
|
17
|
+
align_v: align.CENTER_V,
|
|
18
|
+
text_style: text_style.WRAP,
|
|
19
|
+
}
|
|
20
20
|
|
|
21
21
|
export const ALIGN_DESC_GROUP = {
|
|
22
22
|
x: 0,
|
|
@@ -35,10 +35,10 @@ export const CALORIE_TEXT = {
|
|
|
35
35
|
h: px(100),
|
|
36
36
|
color: 0xffffff,
|
|
37
37
|
text_size: CALORIE_TEXT_SIZE,
|
|
38
|
-
align_h:
|
|
39
|
-
align_v:
|
|
40
|
-
}
|
|
41
|
-
export const UNIT_TEXT_SIZE = px(28)
|
|
38
|
+
align_h: align.LEFT,
|
|
39
|
+
align_v: align.CENTER_V,
|
|
40
|
+
}
|
|
41
|
+
export const UNIT_TEXT_SIZE = px(28)
|
|
42
42
|
export const UNIT_TEXT = {
|
|
43
43
|
text: getText("unit"),
|
|
44
44
|
x: px(0),
|
|
@@ -47,9 +47,9 @@ export const UNIT_TEXT = {
|
|
|
47
47
|
h: px(34),
|
|
48
48
|
color: 0x999999,
|
|
49
49
|
text_size: UNIT_TEXT_SIZE,
|
|
50
|
-
align_h:
|
|
51
|
-
align_v:
|
|
52
|
-
}
|
|
50
|
+
align_h: align.LEFT,
|
|
51
|
+
align_v: align.CENTER_V,
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
export const TOTAL_CONSUME_TEXT = {
|
|
55
55
|
text: getText("consumption"),
|
|
@@ -59,9 +59,9 @@ export const TOTAL_CONSUME_TEXT = {
|
|
|
59
59
|
h: px(38),
|
|
60
60
|
color: 0x999999,
|
|
61
61
|
text_size: px(28),
|
|
62
|
-
align_h:
|
|
63
|
-
align_v:
|
|
64
|
-
}
|
|
62
|
+
align_h: align.CENTER_H,
|
|
63
|
+
align_v: align.CENTER_V,
|
|
64
|
+
}
|
|
65
65
|
|
|
66
66
|
export const EQUIVALENT_TO_BUTTON = {
|
|
67
67
|
text: getText("equivalent"),
|
|
@@ -107,9 +107,9 @@ export const EQUIVALENT_MORE_FOOD_NUM = {
|
|
|
107
107
|
h: px(60),
|
|
108
108
|
color: 0xee801e,
|
|
109
109
|
text_size: px(55),
|
|
110
|
-
align_h:
|
|
111
|
-
align_v:
|
|
112
|
-
}
|
|
110
|
+
align_h: align.LEFT,
|
|
111
|
+
align_v: align.CENTER_V,
|
|
112
|
+
}
|
|
113
113
|
|
|
114
114
|
export const FOOD_LIST_Y = 178;
|
|
115
115
|
export const FOOD_LIST_ITEM_MARGIN = 64;
|
|
@@ -137,6 +137,6 @@ export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
|
137
137
|
h: px(64),
|
|
138
138
|
color: 0xffffff,
|
|
139
139
|
text_size: px(32),
|
|
140
|
-
align_h:
|
|
141
|
-
align_v:
|
|
142
|
-
}
|
|
140
|
+
align_h: align.LEFT,
|
|
141
|
+
align_v: align.CENTER_V,
|
|
142
|
+
}
|
|
@@ -4,11 +4,6 @@
|
|
|
4
4
|
"target": "es6",
|
|
5
5
|
"checkJs": true
|
|
6
6
|
},
|
|
7
|
-
"exclude": [
|
|
8
|
-
|
|
9
|
-
"**/node_modules/*"
|
|
10
|
-
],
|
|
11
|
-
"files": [
|
|
12
|
-
"node_modules/@zeppos/device-types/index.d.ts"
|
|
13
|
-
]
|
|
7
|
+
"exclude": ["node_modules", "**/node_modules/*"],
|
|
8
|
+
"files": ["node_modules/@zeppos/device-types/dist/index.d.ts"]
|
|
14
9
|
}
|
package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/pages/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { log as Logger, px } from
|
|
1
|
+
import { createWidget, widget, align, text_style } from '@zos/ui'
|
|
2
|
+
import { log as Logger, px } from '@zos/utils'
|
|
3
3
|
import {
|
|
4
4
|
DEFAULT_COLOR,
|
|
5
5
|
DEFAULT_COLOR_TRANSPARENT,
|
|
@@ -12,7 +12,7 @@ const { messageBuilder } = getApp()._options.globalData;
|
|
|
12
12
|
Page({
|
|
13
13
|
state: {},
|
|
14
14
|
build() {
|
|
15
|
-
|
|
15
|
+
createWidget(widget.BUTTON, {
|
|
16
16
|
x: (DEVICE_WIDTH - px(400)) / 2,
|
|
17
17
|
y: px(260),
|
|
18
18
|
w: px(400),
|
|
@@ -38,19 +38,19 @@ Page({
|
|
|
38
38
|
const { result = {} } = data;
|
|
39
39
|
const { text } = result;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
createWidget(widget.TEXT, {
|
|
42
42
|
x: px(50),
|
|
43
43
|
y: px(100),
|
|
44
44
|
w: DEVICE_WIDTH - 2 * px(50),
|
|
45
45
|
h: px(46),
|
|
46
46
|
color: 0xffffff,
|
|
47
47
|
text_size: px(36),
|
|
48
|
-
align_h:
|
|
49
|
-
align_v:
|
|
50
|
-
text_style:
|
|
51
|
-
text
|
|
52
|
-
})
|
|
48
|
+
align_h: align.CENTER_H,
|
|
49
|
+
align_v: align.CENTER_V,
|
|
50
|
+
text_style: text_style.NONE,
|
|
51
|
+
text
|
|
52
|
+
})
|
|
53
|
+
.catch((res) => { });
|
|
53
54
|
})
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
55
|
+
}
|
|
56
|
+
})
|