@zeppos/zeus-cli 1.3.3 → 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 +2 -2
- package/private-modules/zeppos-app-utils/dist/config/device.js +2 -443
- 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/package.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/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
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createWidget, widget, prop } from '@zos/ui'
|
|
2
2
|
import { getDeviceInfo, SCREEN_SHAPE_SQUARE } from '@zos/device'
|
|
3
3
|
import { log as Logger } from '@zos/utils'
|
|
4
|
+
import { localStorage } from '@zos/storage'
|
|
4
5
|
|
|
5
6
|
import { TITLE_TEXT_STYLE, TIPS_TEXT_STYLE, SCROLL_LIST, ADD_BUTTON } from './index.style'
|
|
6
|
-
import { readFileSync, writeFileSync } from './../../utils/fs'
|
|
7
7
|
import { getScrollListDataConfig } from './../../utils/index'
|
|
8
8
|
|
|
9
9
|
const logger = Logger.getLogger('todo-list-page')
|
|
@@ -15,7 +15,7 @@ Page({
|
|
|
15
15
|
tipText: null,
|
|
16
16
|
refreshText: null,
|
|
17
17
|
addButton: null,
|
|
18
|
-
dataList:
|
|
18
|
+
dataList: localStorage.getItem('dataList', [])
|
|
19
19
|
},
|
|
20
20
|
onInit() {
|
|
21
21
|
logger.debug('page onInit invoked')
|
|
@@ -26,12 +26,12 @@ Page({
|
|
|
26
26
|
logger.debug('page build invoked')
|
|
27
27
|
|
|
28
28
|
if (getDeviceInfo().screenShape !== SCREEN_SHAPE_SQUARE) {
|
|
29
|
-
this.state.title =
|
|
29
|
+
this.state.title = createWidget(widget.TEXT, {
|
|
30
30
|
...TITLE_TEXT_STYLE
|
|
31
31
|
})
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
this.state.addButton =
|
|
34
|
+
this.state.addButton = createWidget(widget.BUTTON, {
|
|
35
35
|
...ADD_BUTTON,
|
|
36
36
|
click_func: () => {
|
|
37
37
|
this.addRandomTodoItem()
|
|
@@ -42,7 +42,7 @@ Page({
|
|
|
42
42
|
},
|
|
43
43
|
onDestroy() {
|
|
44
44
|
logger.debug('page onDestroy invoked')
|
|
45
|
-
|
|
45
|
+
localStorage.setItem('dataList', this.state.dataList)
|
|
46
46
|
},
|
|
47
47
|
onMessage() {
|
|
48
48
|
messageBuilder.on('call', ({ payload: buf }) => {
|
|
@@ -94,26 +94,26 @@ Page({
|
|
|
94
94
|
if (showEmpty) {
|
|
95
95
|
if (dataList.length === 0) {
|
|
96
96
|
!this.state.tipText &&
|
|
97
|
-
(this.state.tipText =
|
|
97
|
+
(this.state.tipText = createWidget(widget.TEXT, {
|
|
98
98
|
...TIPS_TEXT_STYLE
|
|
99
99
|
}))
|
|
100
100
|
}
|
|
101
101
|
const isTip = dataList.length === 0
|
|
102
102
|
|
|
103
|
-
this.state.refreshText && this.state.refreshText.setProperty(
|
|
104
|
-
this.state.tipText && this.state.tipText.setProperty(
|
|
105
|
-
this.state.scrollList && this.state.scrollList.setProperty(
|
|
103
|
+
this.state.refreshText && this.state.refreshText.setProperty(prop.VISIBLE, false)
|
|
104
|
+
this.state.tipText && this.state.tipText.setProperty(prop.VISIBLE, isTip)
|
|
105
|
+
this.state.scrollList && this.state.scrollList.setProperty(prop.VISIBLE, !isTip)
|
|
106
106
|
} else {
|
|
107
107
|
// 占位刷新
|
|
108
108
|
!this.state.refreshText &&
|
|
109
|
-
(this.state.refreshText =
|
|
109
|
+
(this.state.refreshText = createWidget(widget.TEXT, {
|
|
110
110
|
...TIPS_TEXT_STYLE,
|
|
111
111
|
text: ' '
|
|
112
112
|
}))
|
|
113
113
|
|
|
114
|
-
this.state.tipText && this.state.tipText.setProperty(
|
|
115
|
-
this.state.refreshText.setProperty(
|
|
116
|
-
this.state.scrollList && this.state.scrollList.setProperty(
|
|
114
|
+
this.state.tipText && this.state.tipText.setProperty(prop.VISIBLE, false)
|
|
115
|
+
this.state.refreshText.setProperty(prop.VISIBLE, true)
|
|
116
|
+
this.state.scrollList && this.state.scrollList.setProperty(prop.VISIBLE, false)
|
|
117
117
|
}
|
|
118
118
|
},
|
|
119
119
|
createAndUpdateList(showEmpty = true) {
|
|
@@ -124,7 +124,7 @@ Page({
|
|
|
124
124
|
this.changeUI(showEmpty)
|
|
125
125
|
const dataTypeConfig = getScrollListDataConfig(dataList.length === 0 ? -1 : 0, dataList.length)
|
|
126
126
|
if (scrollList) {
|
|
127
|
-
scrollList.setProperty(
|
|
127
|
+
scrollList.setProperty(prop.UPDATE_DATA, {
|
|
128
128
|
data_array: dataList,
|
|
129
129
|
data_count: dataList.length,
|
|
130
130
|
data_type_config: [{ start: 0, end: dataList.length, type_id: 2 }],
|
|
@@ -132,7 +132,7 @@ Page({
|
|
|
132
132
|
on_page: 1
|
|
133
133
|
})
|
|
134
134
|
} else {
|
|
135
|
-
this.state.scrollList =
|
|
135
|
+
this.state.scrollList = createWidget(widget.SCROLL_LIST, {
|
|
136
136
|
...(SCROLL_LIST || {}),
|
|
137
137
|
data_array: dataList,
|
|
138
138
|
data_count: dataList.length,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { align, text_style } from '@zos/ui'
|
|
2
2
|
import { getText } from '@zos/i18n'
|
|
3
3
|
import { getDeviceInfo } from '@zos/device'
|
|
4
4
|
import { px } from '@zos/utils'
|
|
@@ -13,15 +13,15 @@ export const TITLE_TEXT_STYLE = {
|
|
|
13
13
|
h: px(50),
|
|
14
14
|
color: 0xffffff,
|
|
15
15
|
text_size: 36,
|
|
16
|
-
align_h:
|
|
17
|
-
text_style:
|
|
16
|
+
align_h: align.CENTER_H,
|
|
17
|
+
text_style: text_style.WRAP,
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export const ADD_BUTTON = {
|
|
21
21
|
text: getText('add'),
|
|
22
22
|
x: px(30),
|
|
23
23
|
y: px(65),
|
|
24
|
-
w: px(
|
|
24
|
+
w: px(80),
|
|
25
25
|
h: px(50),
|
|
26
26
|
normal_color: 0xfc6950,
|
|
27
27
|
press_color: 0xfeb4a8,
|
|
@@ -36,9 +36,9 @@ export const TIPS_TEXT_STYLE = {
|
|
|
36
36
|
h: DEVICE_HEIGHT - px(120),
|
|
37
37
|
color: 0xffffff,
|
|
38
38
|
text_size: 32,
|
|
39
|
-
align_h:
|
|
40
|
-
align_v:
|
|
41
|
-
text_style:
|
|
39
|
+
align_h: align.CENTER_H,
|
|
40
|
+
align_v: align.CENTER_V,
|
|
41
|
+
text_style: text_style.WRAP,
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
export const SCROLL_LIST = {
|
|
@@ -58,8 +58,8 @@ export const SCROLL_LIST = {
|
|
|
58
58
|
key: 'name',
|
|
59
59
|
color: 0xffff00,
|
|
60
60
|
text_size: px(36),
|
|
61
|
-
align_h:
|
|
62
|
-
}
|
|
61
|
+
align_h: align.LEFT,
|
|
62
|
+
},
|
|
63
63
|
],
|
|
64
64
|
text_view_count: 1,
|
|
65
65
|
item_height: px(80)
|
|
@@ -77,8 +77,8 @@ export const SCROLL_LIST = {
|
|
|
77
77
|
key: 'name',
|
|
78
78
|
color: 0xff0000,
|
|
79
79
|
text_size: px(36),
|
|
80
|
-
align_h:
|
|
81
|
-
}
|
|
80
|
+
align_h: align.LEFT,
|
|
81
|
+
},
|
|
82
82
|
],
|
|
83
83
|
text_view_count: 1,
|
|
84
84
|
item_height: px(80)
|