@zeppos/zeus-cli 1.6.5 → 1.6.6
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/modules/create.js +3 -0
- package/package.json +2 -2
- package/private-modules/zeppos-app-utils/dist/modules/create/index.js +3 -2
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.js +27 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.json +52 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/consume.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/beer.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cake.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/chocolate.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/coffee.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cookies.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ham.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/hamburger.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ice cream.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/pizza.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/sausage.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/multiply.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/consume.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/beer.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cake.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/chocolate.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/coffee.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cookies.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ham.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/hamburger.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ice cream.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/pizza.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/sausage.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/multiply.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.js +107 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.r.layout.js +48 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.s.layout.js +33 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.js +127 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.r.layout.js +110 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.s.layout.js +98 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/en-US.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/zh-CN.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/constants.js +62 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/storage.js +40 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/_package.json +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/index.js +13 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.json +60 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.b/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.b.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.r.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.s.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/index.js +56 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.js +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.json +51 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.js +45 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.r.layout.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.s.layout.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/constants.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/device.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.json +51 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.js +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.r.layout.js +19 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.s.layout.js +19 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/zh-CN.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/utils/index.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.js +16 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.json +71 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.b/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/images/icons/ic_moon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.js +205 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.r.layout.js +106 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.js +88 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.r.layout.js +74 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.js +98 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.r.layout.js +80 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.js +53 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.r.layout.js +75 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/.prettierrc.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app-side/index.js +47 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.js +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.json +55 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/add.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/delete.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/add.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/delete.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.js +177 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.r.layout.js +112 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.s.layout.js +112 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/i18n/en-US.po +21 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/i18n/en-US.po +5 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/index.js +143 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/constants.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/fs.js +34 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/index.js +38 -0
- package/private-modules/zeppos-app-utils/package.json +1 -1
package/modules/create.js
CHANGED
|
@@ -104,6 +104,9 @@ var inquirerFunc = function (args, _a) {
|
|
|
104
104
|
{
|
|
105
105
|
name: 'OS 3.0 API (Build products can run on devices with OS 3.0 and above)',
|
|
106
106
|
value: 'v3'
|
|
107
|
+
}, {
|
|
108
|
+
name: 'OS 4.0 API (Build products can run on devices with OS 4.0 and above)',
|
|
109
|
+
value: 'v4'
|
|
107
110
|
}];
|
|
108
111
|
if (isWatchFace) {
|
|
109
112
|
options = options.slice(0, 2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeppos/zeus-cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "zeus mini-program tools",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"author": "zepp",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"qrcode-terminal": "^0.12.0",
|
|
22
22
|
"vorpal": "^1.12.0",
|
|
23
23
|
"yargs": "^17.7.2",
|
|
24
|
-
"@zeppos/zpm": "^3.1.
|
|
24
|
+
"@zeppos/zpm": "^3.1.4",
|
|
25
25
|
"axios": "^1.7.7",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
27
|
"chokidar": "^3.6.0",
|
|
@@ -117,7 +117,8 @@ var createX = function (cwdPath, args, func, beforeFiles) {
|
|
|
117
117
|
v1: (0, path_1.resolve)(templateDir, './os1.0'),
|
|
118
118
|
v2: (0, path_1.resolve)(templateDir, './os2.0'),
|
|
119
119
|
v3: (0, path_1.resolve)(templateDir, './os3.0'),
|
|
120
|
-
'v3.5': (0, path_1.resolve)(templateDir, './os3.5')
|
|
120
|
+
'v3.5': (0, path_1.resolve)(templateDir, './os3.5'),
|
|
121
|
+
v4: (0, path_1.resolve)(templateDir, './os4.0')
|
|
121
122
|
};
|
|
122
123
|
localTemplates = Object.keys(localTemplatesDirMap).reduce(function (temps, osVersion) {
|
|
123
124
|
var dir = localTemplatesDirMap[osVersion];
|
|
@@ -131,7 +132,7 @@ var createX = function (cwdPath, args, func, beforeFiles) {
|
|
|
131
132
|
};
|
|
132
133
|
return temps;
|
|
133
134
|
}, {});
|
|
134
|
-
allOS = ['v1', 'v2', 'v3', 'v3.5'];
|
|
135
|
+
allOS = ['v1', 'v2', 'v3', 'v3.5', 'v4'];
|
|
135
136
|
appTypes = ['watchface', 'app', 'workout-extension'];
|
|
136
137
|
genChoices = function () { return allOS.reduce(function (pre, osVersion) {
|
|
137
138
|
pre[osVersion] = [];
|
package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "calories",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@zeppos/device-types": "^3.0.0"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zeppos/zml": "^0.0.38"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { log as Logger } from "@zos/utils";
|
|
2
|
+
import LocalStorage from "./utils/storage";
|
|
3
|
+
|
|
4
|
+
const logger = Logger.getLogger("calories-app");
|
|
5
|
+
const fileName = "calorie_data.txt";
|
|
6
|
+
|
|
7
|
+
App({
|
|
8
|
+
globalData: {
|
|
9
|
+
foodType: "chocolate",
|
|
10
|
+
localStorage: null,
|
|
11
|
+
},
|
|
12
|
+
onCreate() {
|
|
13
|
+
try {
|
|
14
|
+
this.globalData.localStorage = new LocalStorage(fileName);
|
|
15
|
+
const { foodType = "chocolate" } = this.globalData.localStorage.get();
|
|
16
|
+
this.globalData.foodType = foodType;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
logger.log("--->e:", e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
onDestroy() {
|
|
23
|
+
this.globalData.localStorage.set({
|
|
24
|
+
foodType: getApp()._options.globalData.foodType,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configVersion": "v3",
|
|
3
|
+
"app": {
|
|
4
|
+
"appId": 20001,
|
|
5
|
+
"appName": "Calories",
|
|
6
|
+
"appType": "app",
|
|
7
|
+
"version": {
|
|
8
|
+
"code": 1,
|
|
9
|
+
"name": "1.0.0"
|
|
10
|
+
},
|
|
11
|
+
"icon": "icon.png",
|
|
12
|
+
"vender": "zepp",
|
|
13
|
+
"description": "calories application"
|
|
14
|
+
},
|
|
15
|
+
"permissions": [
|
|
16
|
+
"data:os.device.info",
|
|
17
|
+
"device:os.local_storage",
|
|
18
|
+
"data:user.hd.calorie"
|
|
19
|
+
],
|
|
20
|
+
"runtime": {
|
|
21
|
+
"apiVersion": {
|
|
22
|
+
"compatible": "4.0",
|
|
23
|
+
"target": "4.0",
|
|
24
|
+
"minVersion": "4.0"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"targets": {
|
|
28
|
+
"gt": {
|
|
29
|
+
"module": {
|
|
30
|
+
"page": {
|
|
31
|
+
"pages": ["page/gt/index", "page/gt/food-list"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"platforms": [
|
|
35
|
+
{
|
|
36
|
+
"st": "r",
|
|
37
|
+
"dw": 480
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"st": "s",
|
|
41
|
+
"dw": 390
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"i18n": {
|
|
47
|
+
"en-US": {
|
|
48
|
+
"appName": "Calories"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"defaultLanguage": "en-US"
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { back } from "@zos/router";
|
|
3
|
+
import { log as Logger, px } from "@zos/utils";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
COMMON_TITLE_TEXT,
|
|
7
|
+
FOOD_LIST_Y,
|
|
8
|
+
FOOD_LIST_ITEM_MARGIN,
|
|
9
|
+
FOOD_LIST_ITEM_HEIGHT,
|
|
10
|
+
FOOD_LIST_RADIOGROUP,
|
|
11
|
+
FOOD_LIST_RADIO_ITEM,
|
|
12
|
+
FOOD_LIST_RADIO_ITEM_TEXT,
|
|
13
|
+
} from "zosLoader:./food-list.[pf].layout.js";
|
|
14
|
+
import { FOOD_CALORIES, isSquare } from "../../utils/constants";
|
|
15
|
+
const logger = Logger.getLogger("calories");
|
|
16
|
+
const globalData = getApp()._options.globalData;
|
|
17
|
+
|
|
18
|
+
Page({
|
|
19
|
+
state: {
|
|
20
|
+
activeIndex: -1,
|
|
21
|
+
isFinishInit: false,
|
|
22
|
+
radioGroup: null,
|
|
23
|
+
radioButtonsArray: [],
|
|
24
|
+
},
|
|
25
|
+
onInit() {
|
|
26
|
+
logger.log("onInit");
|
|
27
|
+
},
|
|
28
|
+
setPrograms(index) {
|
|
29
|
+
this.state.activeIndex = index;
|
|
30
|
+
globalData.foodType = FOOD_CALORIES[index].type;
|
|
31
|
+
back();
|
|
32
|
+
},
|
|
33
|
+
buildTitle() {
|
|
34
|
+
!isSquare && hmUI.createWidget(hmUI.widget.TEXT, COMMON_TITLE_TEXT);
|
|
35
|
+
},
|
|
36
|
+
buildFoodList() {
|
|
37
|
+
let activeIndex = 0;
|
|
38
|
+
const radioGroup = hmUI.createWidget(hmUI.widget.RADIO_GROUP, {
|
|
39
|
+
...FOOD_LIST_RADIOGROUP,
|
|
40
|
+
check_func: (group, index, checked) => {
|
|
41
|
+
if (checked) {
|
|
42
|
+
this.state.isFinishInit && this.setPrograms(index);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.state.radioGroup = radioGroup;
|
|
48
|
+
|
|
49
|
+
for (let index = 0; index < FOOD_CALORIES.length; index++) {
|
|
50
|
+
this.buildRadioButton(index);
|
|
51
|
+
this.buildRadioText(index);
|
|
52
|
+
activeIndex =
|
|
53
|
+
FOOD_CALORIES[index].type === globalData.foodType ? index : activeIndex;
|
|
54
|
+
}
|
|
55
|
+
this.state.activeIndex = activeIndex;
|
|
56
|
+
this.initRadioGroup();
|
|
57
|
+
},
|
|
58
|
+
buildElement() {
|
|
59
|
+
this.buildTitle();
|
|
60
|
+
this.buildFoodList();
|
|
61
|
+
},
|
|
62
|
+
buildRadioButton(index) {
|
|
63
|
+
const radio = this.state.radioGroup.createWidget(hmUI.widget.STATE_BUTTON, {
|
|
64
|
+
...FOOD_LIST_RADIO_ITEM.styles,
|
|
65
|
+
y: px(index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)),
|
|
66
|
+
});
|
|
67
|
+
this.state.radioButtonsArray.push(radio);
|
|
68
|
+
},
|
|
69
|
+
buildRadioText(index) {
|
|
70
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
71
|
+
...FOOD_LIST_RADIO_ITEM_TEXT,
|
|
72
|
+
y: px(
|
|
73
|
+
FOOD_LIST_Y + index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)
|
|
74
|
+
),
|
|
75
|
+
text: `${FOOD_CALORIES[index].name[0].toUpperCase()}${FOOD_CALORIES[
|
|
76
|
+
index
|
|
77
|
+
].name.slice(1)}`,
|
|
78
|
+
});
|
|
79
|
+
text.addEventListener(hmUI.event.SELECT, () => {
|
|
80
|
+
this.state.radioGroup.setProperty(
|
|
81
|
+
hmUI.prop.CHECKED,
|
|
82
|
+
this.state.radioButtonsArray[index]
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
initRadioGroup() {
|
|
87
|
+
this.state.radioGroup.setProperty(
|
|
88
|
+
hmUI.prop.INIT,
|
|
89
|
+
this.state.radioButtonsArray[0]
|
|
90
|
+
);
|
|
91
|
+
this.state.radioGroup.setProperty(
|
|
92
|
+
hmUI.prop.CHECKED,
|
|
93
|
+
this.state.radioButtonsArray[this.state.activeIndex]
|
|
94
|
+
);
|
|
95
|
+
this.state.isFinishInit = true;
|
|
96
|
+
},
|
|
97
|
+
build() {
|
|
98
|
+
this.buildElement();
|
|
99
|
+
},
|
|
100
|
+
onReady() {},
|
|
101
|
+
|
|
102
|
+
onShow() {},
|
|
103
|
+
|
|
104
|
+
onHide() {},
|
|
105
|
+
|
|
106
|
+
onDestroy() {},
|
|
107
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { getText } from "@zos/i18n";
|
|
3
|
+
import { px } from "@zos/utils";
|
|
4
|
+
|
|
5
|
+
import { DEVICE_WIDTH } from "../../utils/constants";
|
|
6
|
+
|
|
7
|
+
export const COMMON_TITLE_TEXT = {
|
|
8
|
+
text: getText("calories"),
|
|
9
|
+
x: px(96),
|
|
10
|
+
y: px(40),
|
|
11
|
+
w: DEVICE_WIDTH - 2 * px(96),
|
|
12
|
+
h: px(46),
|
|
13
|
+
color: 0xffffff,
|
|
14
|
+
text_size: px(36),
|
|
15
|
+
align_h: hmUI.align.CENTER_H,
|
|
16
|
+
align_v: hmUI.align.CENTER_V,
|
|
17
|
+
text_style: hmUI.text_style.WRAP,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const FOOD_LIST_Y = px(178);
|
|
21
|
+
export const FOOD_LIST_ITEM_MARGIN = px(64);
|
|
22
|
+
export const FOOD_LIST_ITEM_HEIGHT = px(64);
|
|
23
|
+
export const FOOD_LIST_RADIOGROUP = {
|
|
24
|
+
select_src: "selected.png",
|
|
25
|
+
unselect_src: "unselected.png",
|
|
26
|
+
x: px(44),
|
|
27
|
+
y: px(FOOD_LIST_Y),
|
|
28
|
+
w: -1,
|
|
29
|
+
h: -1,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const FOOD_LIST_RADIO_ITEM = {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0,
|
|
35
|
+
w: px(FOOD_LIST_ITEM_HEIGHT),
|
|
36
|
+
h: px(FOOD_LIST_ITEM_HEIGHT),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
40
|
+
x: px(120),
|
|
41
|
+
y: 0,
|
|
42
|
+
w: px(360),
|
|
43
|
+
h: px(64),
|
|
44
|
+
color: 0xffffff,
|
|
45
|
+
text_size: px(32),
|
|
46
|
+
align_h: hmUI.align.LEFT,
|
|
47
|
+
align_v: hmUI.align.CENTER_V,
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { px } from "@zos/utils";
|
|
3
|
+
|
|
4
|
+
export const COMMON_TITLE_TEXT = null;
|
|
5
|
+
export const FOOD_LIST_Y = px(96);
|
|
6
|
+
export const FOOD_LIST_ITEM_MARGIN = px(60);
|
|
7
|
+
export const FOOD_LIST_ITEM_HEIGHT = px(52);
|
|
8
|
+
export const FOOD_LIST_RADIOGROUP = {
|
|
9
|
+
select_src: "selected.png",
|
|
10
|
+
unselect_src: "unselected.png",
|
|
11
|
+
x: px(30),
|
|
12
|
+
y: FOOD_LIST_Y,
|
|
13
|
+
w: -1,
|
|
14
|
+
h: -1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const FOOD_LIST_RADIO_ITEM = {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: FOOD_LIST_Y,
|
|
20
|
+
w: FOOD_LIST_ITEM_HEIGHT,
|
|
21
|
+
h: FOOD_LIST_ITEM_HEIGHT,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
25
|
+
x: px(106),
|
|
26
|
+
y: px(97),
|
|
27
|
+
w: px(254),
|
|
28
|
+
h: FOOD_LIST_ITEM_HEIGHT,
|
|
29
|
+
color: 0xffffff,
|
|
30
|
+
text_size: px(32),
|
|
31
|
+
align_h: hmUI.align.LEFT,
|
|
32
|
+
align_v: hmUI.align.CENTER_V,
|
|
33
|
+
};
|
package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as hmUI 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
|
+
COMMON_TITLE_TEXT,
|
|
11
|
+
UNIT_TEXT,
|
|
12
|
+
UNIT_TEXT_SIZE,
|
|
13
|
+
TOTAL_CONSUME_TEXT,
|
|
14
|
+
CONSUME_ICON,
|
|
15
|
+
CONSUME_ICON_WIDTH,
|
|
16
|
+
ALIGN_DESC_GROUP,
|
|
17
|
+
IMGAE_CALORIES_MARIN,
|
|
18
|
+
CALORIES_UNIT_MARIN,
|
|
19
|
+
EQUIVALENT_TO_BUTTON,
|
|
20
|
+
EQUIVALENT_TO_FOOD_ICON,
|
|
21
|
+
EQUIVALENT_MORE_X,
|
|
22
|
+
EQUIVALENT_MARGIN,
|
|
23
|
+
EQUIVALENT_TO_FOOD_ICON_WIDTH,
|
|
24
|
+
EQUIVALENT_MORE_FOOD_ICON,
|
|
25
|
+
EQUIVALENT_MORE_FOOD_NUM,
|
|
26
|
+
} from "zosLoader:./index.[pf].layout.js";
|
|
27
|
+
import { FOOD_CALORIES, DEVICE_WIDTH, isSquare } from "../../utils/constants";
|
|
28
|
+
const logger = Logger.getLogger("calories");
|
|
29
|
+
const globalData = getApp()._options.globalData;
|
|
30
|
+
|
|
31
|
+
Page({
|
|
32
|
+
buildTopContent(calories) {
|
|
33
|
+
const { width: w1 } = hmUI.getTextLayout("" + calories, {
|
|
34
|
+
text_size: CALORIE_TEXT_SIZE,
|
|
35
|
+
text_width: 0,
|
|
36
|
+
wrapped: 0,
|
|
37
|
+
});
|
|
38
|
+
const { width: w2 } = hmUI.getTextLayout(getText("unit"), {
|
|
39
|
+
text_size: UNIT_TEXT_SIZE,
|
|
40
|
+
text_width: 0,
|
|
41
|
+
wrapped: 0,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const w =
|
|
45
|
+
w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN;
|
|
46
|
+
const x = Math.round((DEVICE_WIDTH - w) / 2);
|
|
47
|
+
|
|
48
|
+
const group = hmUI.createWidget(hmUI.widget.GROUP, {
|
|
49
|
+
...ALIGN_DESC_GROUP,
|
|
50
|
+
x,
|
|
51
|
+
w,
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
group.createWidget(hmUI.widget.TEXT, {
|
|
55
|
+
...CALORIE_TEXT,
|
|
56
|
+
text: `${calories}`,
|
|
57
|
+
x: CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
|
|
58
|
+
w: w1,
|
|
59
|
+
});
|
|
60
|
+
group.createWidget(hmUI.widget.TEXT, {
|
|
61
|
+
...UNIT_TEXT,
|
|
62
|
+
x: w - w2,
|
|
63
|
+
w: w2,
|
|
64
|
+
});
|
|
65
|
+
group.createWidget(hmUI.widget.IMG, CONSUME_ICON);
|
|
66
|
+
},
|
|
67
|
+
build() {
|
|
68
|
+
let calories = new Calorie().getCurrent(); // Math.floor(Math.random() * 1000)
|
|
69
|
+
let currentFood = globalData.foodType;
|
|
70
|
+
|
|
71
|
+
!isSquare && hmUI.createWidget(hmUI.widget.TEXT, COMMON_TITLE_TEXT);
|
|
72
|
+
hmUI.createWidget(hmUI.widget.TEXT, TOTAL_CONSUME_TEXT);
|
|
73
|
+
|
|
74
|
+
this.buildTopContent(calories);
|
|
75
|
+
|
|
76
|
+
let activeIndex = FOOD_CALORIES.findIndex(
|
|
77
|
+
(item) => item.type === currentFood
|
|
78
|
+
);
|
|
79
|
+
this.calculate(calories, FOOD_CALORIES[activeIndex]);
|
|
80
|
+
hmUI.createWidget(hmUI.widget.BUTTON, {
|
|
81
|
+
...EQUIVALENT_TO_BUTTON,
|
|
82
|
+
click_func: () => {
|
|
83
|
+
push({
|
|
84
|
+
url: "page/gt/food-list",
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
calculate(currentCalories, foodData) {
|
|
90
|
+
let { value, type } = foodData;
|
|
91
|
+
let count = Math.floor(currentCalories / value);
|
|
92
|
+
if (count === 1 || count === 2 || count === 3) {
|
|
93
|
+
let x =
|
|
94
|
+
(DEVICE_WIDTH -
|
|
95
|
+
EQUIVALENT_TO_FOOD_ICON_WIDTH * count -
|
|
96
|
+
EQUIVALENT_MARGIN * (count - 1)) /
|
|
97
|
+
2;
|
|
98
|
+
for (let index = 0; index < count; index++) {
|
|
99
|
+
this.drawFood(
|
|
100
|
+
x + (EQUIVALENT_MARGIN + EQUIVALENT_TO_FOOD_ICON_WIDTH) * index,
|
|
101
|
+
type
|
|
102
|
+
); // icon
|
|
103
|
+
}
|
|
104
|
+
} else {
|
|
105
|
+
this.drawFood(EQUIVALENT_MORE_X, type); // icon
|
|
106
|
+
hmUI.createWidget(hmUI.widget.IMG, EQUIVALENT_MORE_FOOD_ICON);
|
|
107
|
+
hmUI.createWidget(hmUI.widget.TEXT, {
|
|
108
|
+
...EQUIVALENT_MORE_FOOD_NUM,
|
|
109
|
+
text: `${count}`,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
drawFood(x, type) {
|
|
114
|
+
hmUI.createWidget(hmUI.widget.IMG, {
|
|
115
|
+
...EQUIVALENT_TO_FOOD_ICON,
|
|
116
|
+
x: px(x),
|
|
117
|
+
src: `food/${type}.png`,
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
onReady() {},
|
|
121
|
+
|
|
122
|
+
onShow() {},
|
|
123
|
+
|
|
124
|
+
onHide() {},
|
|
125
|
+
|
|
126
|
+
onDestroy() {},
|
|
127
|
+
});
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { getText } from "@zos/i18n";
|
|
3
|
+
import { px } from "@zos/utils";
|
|
4
|
+
import { DEVICE_WIDTH } from "../../utils/constants";
|
|
5
|
+
|
|
6
|
+
export const COMMON_TITLE_TEXT = {
|
|
7
|
+
text: getText("calories"),
|
|
8
|
+
x: px(96),
|
|
9
|
+
y: px(40),
|
|
10
|
+
w: DEVICE_WIDTH - 2 * px(96),
|
|
11
|
+
h: px(46),
|
|
12
|
+
color: 0xffffff,
|
|
13
|
+
text_size: px(36),
|
|
14
|
+
align_h: hmUI.align.CENTER_H,
|
|
15
|
+
align_v: hmUI.align.CENTER_V,
|
|
16
|
+
text_style: hmUI.text_style.WRAP,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const ALIGN_DESC_GROUP = {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: px(118),
|
|
22
|
+
w: 0,
|
|
23
|
+
h: px(100),
|
|
24
|
+
};
|
|
25
|
+
export const IMGAE_CALORIES_MARIN = 0;
|
|
26
|
+
export const CALORIES_UNIT_MARIN = px(8);
|
|
27
|
+
export const CALORIE_TEXT_SIZE = px(100);
|
|
28
|
+
export const CALORIE_TEXT = {
|
|
29
|
+
text: "",
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0,
|
|
32
|
+
w: 0,
|
|
33
|
+
h: px(100),
|
|
34
|
+
color: 0xffffff,
|
|
35
|
+
text_size: CALORIE_TEXT_SIZE,
|
|
36
|
+
align_h: hmUI.align.LEFT,
|
|
37
|
+
align_v: hmUI.align.CENTER_V,
|
|
38
|
+
};
|
|
39
|
+
export const UNIT_TEXT_SIZE = px(28);
|
|
40
|
+
export const UNIT_TEXT = {
|
|
41
|
+
text: getText("unit"),
|
|
42
|
+
x: 0,
|
|
43
|
+
y: px(63),
|
|
44
|
+
w: 0,
|
|
45
|
+
h: px(34),
|
|
46
|
+
color: 0x999999,
|
|
47
|
+
text_size: UNIT_TEXT_SIZE,
|
|
48
|
+
align_h: hmUI.align.LEFT,
|
|
49
|
+
align_v: hmUI.align.CENTER_V,
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const TOTAL_CONSUME_TEXT = {
|
|
53
|
+
text: getText("consumption"),
|
|
54
|
+
x: px(40),
|
|
55
|
+
y: px(218),
|
|
56
|
+
w: DEVICE_WIDTH - 2 * px(40),
|
|
57
|
+
h: px(38),
|
|
58
|
+
color: 0x999999,
|
|
59
|
+
text_size: px(28),
|
|
60
|
+
align_h: hmUI.align.CENTER_H,
|
|
61
|
+
align_v: hmUI.align.CENTER_V,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const EQUIVALENT_TO_BUTTON = {
|
|
65
|
+
text: getText("equivalent"),
|
|
66
|
+
press_color: 0x333333,
|
|
67
|
+
normal_color: 0x1a1a1a,
|
|
68
|
+
x: px(108),
|
|
69
|
+
y: px(376),
|
|
70
|
+
w: DEVICE_WIDTH - 2 * px(108),
|
|
71
|
+
h: px(56),
|
|
72
|
+
color: 0xffffff,
|
|
73
|
+
text_size: px(32),
|
|
74
|
+
radius: px(28),
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
export const CONSUME_ICON_WIDTH = px(48);
|
|
78
|
+
export const CONSUME_ICON = {
|
|
79
|
+
src: "consume.png",
|
|
80
|
+
x: 0,
|
|
81
|
+
y: px(53),
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export const EQUIVALENT_MARGIN = px(8);
|
|
85
|
+
export const EQUIVALENT_MORE_X = px(155);
|
|
86
|
+
export const EQUIVALENT_TO_FOOD_ICON_WIDTH = px(80);
|
|
87
|
+
|
|
88
|
+
export const EQUIVALENT_TO_FOOD_ICON = {
|
|
89
|
+
src: "food/hamburger.png",
|
|
90
|
+
x: 0,
|
|
91
|
+
y: px(288),
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const EQUIVALENT_MORE_FOOD_ICON = {
|
|
95
|
+
src: "multiply.png",
|
|
96
|
+
x: px(243),
|
|
97
|
+
y: px(304),
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const EQUIVALENT_MORE_FOOD_NUM = {
|
|
101
|
+
text: "",
|
|
102
|
+
x: px(299),
|
|
103
|
+
y: px(294),
|
|
104
|
+
w: px(100),
|
|
105
|
+
h: px(60),
|
|
106
|
+
color: 0xee801e,
|
|
107
|
+
text_size: px(55),
|
|
108
|
+
align_h: hmUI.align.LEFT,
|
|
109
|
+
align_v: hmUI.align.CENTER_V,
|
|
110
|
+
};
|