@zeppos/zeus-cli 1.0.8 → 1.0.22
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/bin/cli.js +3 -0
- package/config/project.js +25 -1
- package/modules/build.js +117 -49
- package/modules/config.js +61 -17
- package/modules/create/index.js +61 -22
- package/modules/create/local-app.js +30 -6
- package/modules/help.js +10 -9
- package/modules/login.js +74 -24
- package/modules/run.js +40 -34
- package/modules/storage.js +2 -2
- package/package.json +3 -2
- package/public/template/empty/app.js +1 -1
- package/public/template/empty/app.json +1 -8
- package/public/template/empty/watchface/index.js +13 -0
- package/public/template/hello-world/app.js +1 -1
- package/public/template/hello-world/page/i18n/en-US.po +3 -0
- package/public/template/timer/app.js +10 -0
- package/public/template/timer/app.json +50 -0
- package/public/template/timer/assets/gtr-3-pro/images/bg/bg.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/0.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/1.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/2.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/3.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/4.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/5.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/6.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/7.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/8.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/9.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/bigNum/sp.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/btn/back.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/btn/lv.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/btn/red.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/bg.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/bottom.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/center.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/h.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/left.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/m.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/right.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/point/s.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/preview.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/second/second.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/0.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/1.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/2.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/3.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/4.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/5.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/6.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/7.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/8.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/9.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/d.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/smallNum/n.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/1.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/2.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/3.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/4.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/5.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/6.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_ch/7.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/1.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/2.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/3.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/4.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/5.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/6.png +0 -0
- package/public/template/timer/assets/gtr-3-pro/images/week_en/7.png +0 -0
- package/public/template/timer/shared/buffer.js +11 -0
- package/public/template/timer/shared/device-polyfill.js +3 -0
- package/public/template/timer/shared/global.js +17 -0
- package/public/template/timer/shared/js-module.js +27 -0
- package/public/template/timer/shared/logger.js +21 -0
- package/public/template/timer/shared/setTimeout.js +59 -0
- package/public/template/timer/watchface/gtr-3-pro/index.js +1 -0
- package/public/template/timer/watchface/round/index.js +438 -0
- package/public/template/hello-world/i18n/en-US.po +0 -2
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
export function getGlobal () {
|
|
3
|
+
if (typeof self !== 'undefined') {
|
|
4
|
+
return self
|
|
5
|
+
}
|
|
6
|
+
if (typeof window !== 'undefined') {
|
|
7
|
+
return window
|
|
8
|
+
}
|
|
9
|
+
if (typeof global !== 'undefined') {
|
|
10
|
+
return global
|
|
11
|
+
}
|
|
12
|
+
if (typeof globalThis !== 'undefined') {
|
|
13
|
+
return globalThis
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
throw new Error('unable to locate global object')
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function isHmUIDefined() {
|
|
2
|
+
return typeof hmUI !== 'undefined'
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function isHmBleDefined() {
|
|
6
|
+
return typeof hmBle !== 'undefined'
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function isHmTimerDefined() {
|
|
10
|
+
return typeof timer !== 'undefined'
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export function isHmFsDefined() {
|
|
14
|
+
return typeof hmFS !== 'undefined'
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isHmAppDefined() {
|
|
18
|
+
return typeof hmApp !== 'undefined'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function isHmSensorDefined() {
|
|
22
|
+
return typeof hmSensor !== 'undefined'
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isHmSettingDefined() {
|
|
26
|
+
return typeof hmSetting !== 'undefined'
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getGlobal } from './global'
|
|
2
|
+
|
|
3
|
+
let globalNS = getGlobal()
|
|
4
|
+
|
|
5
|
+
if (!globalNS.Logger) {
|
|
6
|
+
if (typeof DeviceRuntimeCore !== 'undefined') {
|
|
7
|
+
globalNS.Logger = DeviceRuntimeCore.HmLogger
|
|
8
|
+
} else {
|
|
9
|
+
if (typeof Logger !== 'undefined') {
|
|
10
|
+
|
|
11
|
+
}
|
|
12
|
+
// console.connect = () => {
|
|
13
|
+
// // pass
|
|
14
|
+
// }
|
|
15
|
+
// globalNS.Logger = {
|
|
16
|
+
// getLogger() {
|
|
17
|
+
// return console
|
|
18
|
+
// },
|
|
19
|
+
// }
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isHmTimerDefined } from './js-module'
|
|
2
|
+
import { getGlobal } from './global'
|
|
3
|
+
|
|
4
|
+
let globalNS = getGlobal()
|
|
5
|
+
|
|
6
|
+
if (typeof setTimeout === 'undefined' && isHmTimerDefined()) {
|
|
7
|
+
globalNS.clearTimeout = function clearTimeout(timerRef) {
|
|
8
|
+
timerRef && timer.stopTimer(timerRef)
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
globalNS.setTimeout = function setTimeout(func, ns) {
|
|
12
|
+
const timer1 = timer.createTimer(
|
|
13
|
+
ns || 1,
|
|
14
|
+
Number.MAX_SAFE_INTEGER,
|
|
15
|
+
function () {
|
|
16
|
+
globalNS.clearTimeout(timer1)
|
|
17
|
+
func && func()
|
|
18
|
+
},
|
|
19
|
+
{},
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
return timer1
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
globalNS.clearImmediate = function clearImmediate(timerRef) {
|
|
26
|
+
timerRef && timer.stopTimer(timerRef)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
globalNS.setImmediate = function setImmediate(func) {
|
|
30
|
+
const timer1 = timer.createTimer(
|
|
31
|
+
1,
|
|
32
|
+
Number.MAX_SAFE_INTEGER,
|
|
33
|
+
function () {
|
|
34
|
+
globalNS.clearImmediate(timer1)
|
|
35
|
+
func && func()
|
|
36
|
+
},
|
|
37
|
+
{},
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
return timer1
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
globalNS.clearInterval = function clearInterval(timerRef) {
|
|
44
|
+
timerRef && timer.stopTimer(timerRef)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
globalNS.setInterval = function setInterval(func, ms) {
|
|
48
|
+
const timer1 = timer.createTimer(
|
|
49
|
+
1,
|
|
50
|
+
ms,
|
|
51
|
+
function () {
|
|
52
|
+
func && func()
|
|
53
|
+
},
|
|
54
|
+
{},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
return timer1
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '../round/index'
|
|
@@ -0,0 +1,438 @@
|
|
|
1
|
+
let start_time = 0
|
|
2
|
+
let rootPath = null
|
|
3
|
+
let week_enArray = null
|
|
4
|
+
let week_chArray = null
|
|
5
|
+
let img_bg = null
|
|
6
|
+
let bigNumArr = null
|
|
7
|
+
let smallNumArr = null
|
|
8
|
+
let bigNumObject = new Array(8)
|
|
9
|
+
let smallNumObject = new Array(8)
|
|
10
|
+
let flag = true
|
|
11
|
+
let milli_value = 0
|
|
12
|
+
let second_value = 0
|
|
13
|
+
let min_value = 0
|
|
14
|
+
let constSecond = 0
|
|
15
|
+
let constMin = 0
|
|
16
|
+
let secondImg = null
|
|
17
|
+
let minPoint = null
|
|
18
|
+
let hourPoint = null
|
|
19
|
+
let createCount = 0;
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
const logger = Logger.getLogger('watchface6')
|
|
23
|
+
|
|
24
|
+
const img = (function(type){
|
|
25
|
+
return (path) => type + '/' + path
|
|
26
|
+
})('images')
|
|
27
|
+
|
|
28
|
+
function range(start, end, step = 1) {
|
|
29
|
+
if (arguments.length === 1) {
|
|
30
|
+
end = start
|
|
31
|
+
start = 0
|
|
32
|
+
step = 1
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const result = []
|
|
36
|
+
for (let i = start; i < end; i += step) {
|
|
37
|
+
result.push(i)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return result
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
WatchFace({
|
|
44
|
+
init_view() {
|
|
45
|
+
rootPath = "images/"
|
|
46
|
+
week_enArray = [
|
|
47
|
+
rootPath + "week_en/1.png",
|
|
48
|
+
rootPath + "week_en/2.png",
|
|
49
|
+
rootPath + "week_en/3.png",
|
|
50
|
+
rootPath + "week_en/4.png",
|
|
51
|
+
rootPath + "week_en/5.png",
|
|
52
|
+
rootPath + "week_en/6.png",
|
|
53
|
+
rootPath + "week_en/7.png",
|
|
54
|
+
]
|
|
55
|
+
week_chArray = [
|
|
56
|
+
rootPath + "week_ch/1.png",
|
|
57
|
+
rootPath + "week_ch/2.png",
|
|
58
|
+
rootPath + "week_ch/3.png",
|
|
59
|
+
rootPath + "week_ch/4.png",
|
|
60
|
+
rootPath + "week_ch/5.png",
|
|
61
|
+
rootPath + "week_ch/6.png",
|
|
62
|
+
rootPath + "week_ch/7.png",
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
bigNumArray = range(10).map((v) => {
|
|
66
|
+
return img(`bigNum/${v}.png`)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
smallNumArr = range(10).map((v) => {
|
|
70
|
+
return img(`smallNum/${v}.png`)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
dotImage = img('smallNum/d.png')
|
|
74
|
+
|
|
75
|
+
let pointObj = {
|
|
76
|
+
hour_centerX: px(239), //指针旋转中心 对应centerX
|
|
77
|
+
hour_centerY: px(239), //指针旋转中心 对应centerY
|
|
78
|
+
hour_posX: px(32), //指针自身旋转中心 对应positioin中的x
|
|
79
|
+
hour_posY: px(167), //指针自身旋转中心 对应positioin中的yi
|
|
80
|
+
hour_path: img('point/h.png'),
|
|
81
|
+
|
|
82
|
+
//分针 秒针同上 只需要把hour替换成minute/second 即可
|
|
83
|
+
minute_centerX: px(238), //指针旋转中心 对应centerX
|
|
84
|
+
minute_centerY: px(238), //指针旋转中心 对应centerY
|
|
85
|
+
minute_posX: px(23), //指针自身旋转中心 对应positioin中的x
|
|
86
|
+
minute_posY: px(230), //指针自身旋转中心 对应positioin中的y
|
|
87
|
+
minute_path: img('point/m.png'),
|
|
88
|
+
//指针路径
|
|
89
|
+
minute_cover_path: img('point/center.png'),
|
|
90
|
+
//指针圆心图片
|
|
91
|
+
minute_cover_y: px(214),
|
|
92
|
+
minute_cover_x: px(214),
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//息屏状态
|
|
96
|
+
var screenType = hmSetting.getScreenType();
|
|
97
|
+
if (screenType == hmSetting.screen_type.AOD) {
|
|
98
|
+
img_bg = hmUI.createWidget(hmUI.widget.FILL_RECT, {
|
|
99
|
+
x: px(0),
|
|
100
|
+
y: px(0),
|
|
101
|
+
w: px(480),
|
|
102
|
+
h: px(480),
|
|
103
|
+
color: 0x000000,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
} else {
|
|
107
|
+
img_bg = hmUI.createWidget(hmUI.widget.IMG, {
|
|
108
|
+
x: px(0),
|
|
109
|
+
y: px(0),
|
|
110
|
+
w: px(480),
|
|
111
|
+
h: px(480),
|
|
112
|
+
src: img('bg/bg.png'),
|
|
113
|
+
show_level: hmUI.show_level.ONAL_NORML,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
hourPoint = hmUI.createWidget(hmUI.widget.IMG, {
|
|
118
|
+
x: px(0),
|
|
119
|
+
y: px(0),
|
|
120
|
+
w: px(480),
|
|
121
|
+
h: px(480),
|
|
122
|
+
// pos_x: 148-22,
|
|
123
|
+
// pos_y: 240-71,
|
|
124
|
+
pos_x: px(126),
|
|
125
|
+
pos_y: px(169),
|
|
126
|
+
center_x: px(148),
|
|
127
|
+
center_y: px(238),
|
|
128
|
+
src: img('point/left.png'),
|
|
129
|
+
angle: 0,
|
|
130
|
+
show_level: hmUI.show_level.ONLY_NORMAL,
|
|
131
|
+
});
|
|
132
|
+
minPoint = hmUI.createWidget(hmUI.widget.IMG, {
|
|
133
|
+
x: px(0),
|
|
134
|
+
y: px(0),
|
|
135
|
+
w: px(480),
|
|
136
|
+
h: px(480),
|
|
137
|
+
// pos_x: 333-23,
|
|
138
|
+
// pos_y: 240-71,
|
|
139
|
+
pos_x: px(310),
|
|
140
|
+
pos_y: px(169),
|
|
141
|
+
center_x: px(333),
|
|
142
|
+
center_y: px(238),
|
|
143
|
+
src: img('point/right.png'),
|
|
144
|
+
angle: 0,
|
|
145
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
for (let i = 0; i < bigNumObject.length; i++) {
|
|
149
|
+
console.log(i + 'uuuuu')
|
|
150
|
+
if (i == 2 || i == 5) {
|
|
151
|
+
bigNumObject[i] = hmUI.createWidget(hmUI.widget.IMG, {
|
|
152
|
+
x: 155 + i * 22,
|
|
153
|
+
y: px(108),
|
|
154
|
+
src: img('bigNum/sp.png'),
|
|
155
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
156
|
+
});
|
|
157
|
+
} else {
|
|
158
|
+
bigNumObject[i] = hmUI.createWidget(hmUI.widget.IMG, {
|
|
159
|
+
x: 150 + i * 22,
|
|
160
|
+
y: px(108),
|
|
161
|
+
src: img('bigNum/0.png'),
|
|
162
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
bigNumObject[i].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
for (let j = 0; j < smallNumObject.length; j++) {
|
|
169
|
+
if (j == 2 || j == 5) {
|
|
170
|
+
smallNumObject[j] = hmUI.createWidget(hmUI.widget.IMG, {
|
|
171
|
+
x: 182 + j * 15,
|
|
172
|
+
y: px(158),
|
|
173
|
+
src: img('smallNum/n.png'),
|
|
174
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
smallNumObject[j] = hmUI.createWidget(hmUI.widget.IMG, {
|
|
178
|
+
x: 179 + j * 15,
|
|
179
|
+
y: px(158),
|
|
180
|
+
src: img('smallNum/0.png'),
|
|
181
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
smallNumObject[j].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
let backBtn = hmUI.createWidget(hmUI.widget.IMG, {
|
|
188
|
+
x: px(150),
|
|
189
|
+
y: px(306),
|
|
190
|
+
src: img('btn/back.png'),
|
|
191
|
+
show_level: hmUI.show_level.ONAL_NORML,
|
|
192
|
+
});
|
|
193
|
+
backBtn.setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
194
|
+
let green_red_btn = hmUI.createWidget(hmUI.widget.IMG, {
|
|
195
|
+
x: px(250),
|
|
196
|
+
y: px(306),
|
|
197
|
+
src: img('btn/lv.png'),
|
|
198
|
+
show_level: hmUI.show_level.ONLY_NORMAL,
|
|
199
|
+
});
|
|
200
|
+
green_red_btn.setProperty(hmUI.prop.VISIBLE, false);
|
|
201
|
+
|
|
202
|
+
let week = hmUI.createWidget(hmUI.widget.IMG_WEEK, {
|
|
203
|
+
x: px(155),
|
|
204
|
+
y: px(97),
|
|
205
|
+
week_en: week_enArray,
|
|
206
|
+
week_tc: week_chArray,
|
|
207
|
+
week_sc: week_chArray,
|
|
208
|
+
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD,
|
|
209
|
+
});
|
|
210
|
+
let monthDay = hmUI.createWidget(hmUI.widget.IMG_DATE, {
|
|
211
|
+
month_startX: px(205),
|
|
212
|
+
month_startY: px(149),
|
|
213
|
+
month_unit_sc: img('smallNum/d.png'),
|
|
214
|
+
month_unit_tc: img('smallNum/d.png'),
|
|
215
|
+
month_unit_en: img('smallNum/d.png'),
|
|
216
|
+
month_align: hmUI.align.LEFT,
|
|
217
|
+
month_space: 0,
|
|
218
|
+
month_zero: 1,
|
|
219
|
+
month_follow: 0,
|
|
220
|
+
month_en_array: smallNumArr,
|
|
221
|
+
month_sc_array: smallNumArr,
|
|
222
|
+
month_tc_array: smallNumArr,
|
|
223
|
+
|
|
224
|
+
day_align: hmUI.align.LEFT,
|
|
225
|
+
day_space: 0,
|
|
226
|
+
day_zero: 1,
|
|
227
|
+
day_follow: 1,
|
|
228
|
+
day_en_array: smallNumArr,
|
|
229
|
+
day_sc_array: smallNumArr,
|
|
230
|
+
day_tc_array: smallNumArr,
|
|
231
|
+
show_level: hmUI.show_level.ONLY_NORMAL | hmUI.show_level.ONAL_AOD,
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
secondImg = hmUI.createWidget(hmUI.widget.IMG, {
|
|
235
|
+
x: px(180),
|
|
236
|
+
y: px(272),
|
|
237
|
+
w: px(122),
|
|
238
|
+
h: px(122),
|
|
239
|
+
src: img('second/second.png'),
|
|
240
|
+
show_level: hmUI.show_level.ONLY_NORMAL
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
let secondPointer = hmUI.createWidget(hmUI.widget.TIME_POINTER, {
|
|
244
|
+
second_centerX: px(240), //指针旋转中心 对应centerX
|
|
245
|
+
second_centerY: px(332), //指针旋转中心 对应centerY
|
|
246
|
+
second_posX: px(22), //指针自身旋转中心 对应positioin中的x
|
|
247
|
+
second_posY: px(71), //指针自身旋转中心 对应positioin中的y
|
|
248
|
+
second_path: img('point/bottom.png'),
|
|
249
|
+
show_level: hmUI.show_level.ONLY_NORMAL,
|
|
250
|
+
});
|
|
251
|
+
let timePointer = hmUI.createWidget(hmUI.widget.TIME_POINTER, pointObj);
|
|
252
|
+
let centerSecondPointer = hmUI.createWidget(hmUI.widget.TIME_POINTER, {
|
|
253
|
+
second_centerX: px(240), //指针旋转中心 对应centerX
|
|
254
|
+
second_centerY: px(240), //指针旋转中心 对应centerY
|
|
255
|
+
second_posX: px(19), //指针自身旋转中心 对应positioin中的x
|
|
256
|
+
second_posY: px(263), //指针自身旋转中心 对应positioin中的y
|
|
257
|
+
second_path: img('point/s.png'),
|
|
258
|
+
second_cover_path: img('point/center.png'),
|
|
259
|
+
second_cover_y: px(214),
|
|
260
|
+
second_cover_x: px(214),
|
|
261
|
+
});
|
|
262
|
+
centerSecondPointer.setProperty(hmUI.prop.VISIBLE, false);
|
|
263
|
+
|
|
264
|
+
secondImg.addEventListener(hmUI.event.CLICK_UP, (function (info) {
|
|
265
|
+
week.setProperty(hmUI.prop.VISIBLE, false);
|
|
266
|
+
monthDay.setProperty(hmUI.prop.VISIBLE, false);
|
|
267
|
+
secondImg.setProperty(hmUI.prop.VISIBLE, false);
|
|
268
|
+
secondPointer.setProperty(hmUI.prop.VISIBLE, false);
|
|
269
|
+
centerSecondPointer.setProperty(hmUI.prop.VISIBLE, true);
|
|
270
|
+
for (let n = 0; n < 8; n++) {
|
|
271
|
+
bigNumObject[n].setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
|
|
272
|
+
smallNumObject[n].setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
|
|
273
|
+
if (n == 0 || n == 1 || n == 3 || n == 4 || n == 6 || n == 7) {
|
|
274
|
+
bigNumObject[n].setProperty(hmUI.prop.SRC, img('bigNum/0.png'))
|
|
275
|
+
smallNumObject[n].setProperty(hmUI.prop.SRC, img('smallNum/0.png'))
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
milli_value = 0
|
|
279
|
+
second_value = 0
|
|
280
|
+
min_value = 0
|
|
281
|
+
|
|
282
|
+
constSecond = 0
|
|
283
|
+
constMin = 0
|
|
284
|
+
backBtn.setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
|
|
285
|
+
green_red_btn.setProperty(hmUI.prop.VISIBLE, true); //false隐藏 true显示
|
|
286
|
+
flag = true
|
|
287
|
+
}));
|
|
288
|
+
|
|
289
|
+
backBtn.addEventListener(hmUI.event.CLICK_UP, (function (info) {
|
|
290
|
+
timer.stopTimer(hsTimer)
|
|
291
|
+
timer.stopTimer(sTimer)
|
|
292
|
+
green_red_btn.setProperty(hmUI.prop.SRC, img('btn/lv.png')); //false隐藏 true显示
|
|
293
|
+
for (let n = 0; n < 8; n++) {
|
|
294
|
+
bigNumObject[n].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
295
|
+
smallNumObject[n].setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
296
|
+
}
|
|
297
|
+
backBtn.setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
298
|
+
green_red_btn.setProperty(hmUI.prop.VISIBLE, false); //false隐藏 true显示
|
|
299
|
+
|
|
300
|
+
week.setProperty(hmUI.prop.VISIBLE, true);
|
|
301
|
+
monthDay.setProperty(hmUI.prop.VISIBLE, true);
|
|
302
|
+
secondImg.setProperty(hmUI.prop.VISIBLE, true);
|
|
303
|
+
secondPointer.setProperty(hmUI.prop.VISIBLE, true);
|
|
304
|
+
centerSecondPointer.setProperty(hmUI.prop.VISIBLE, false);
|
|
305
|
+
minPoint.setProperty(hmUI.prop.ANGLE, 0)
|
|
306
|
+
hourPoint.setProperty(hmUI.prop.ANGLE, 0)
|
|
307
|
+
}));
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
green_red_btn.addEventListener(hmUI.event.CLICK_UP, (function (info) {
|
|
311
|
+
flag = !flag
|
|
312
|
+
minPoint.setProperty(hmUI.prop.ANGLE, 0)
|
|
313
|
+
hourPoint.setProperty(hmUI.prop.ANGLE, 0)
|
|
314
|
+
if (flag) {
|
|
315
|
+
green_red_btn.setProperty(hmUI.prop.SRC, img("btn/lv.png")); //false隐藏 true显示
|
|
316
|
+
timer.stopTimer(hsTimer)
|
|
317
|
+
timer.stopTimer(sTimer)
|
|
318
|
+
bigNumObject[0].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
319
|
+
bigNumObject[1].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
320
|
+
bigNumObject[3].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
321
|
+
bigNumObject[4].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
322
|
+
bigNumObject[6].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
323
|
+
bigNumObject[7].setProperty(hmUI.prop.SRC, img("bigNum/0.png"))
|
|
324
|
+
|
|
325
|
+
smallNumObject[0].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
326
|
+
.SysProGetInt("t0") + ".png")
|
|
327
|
+
smallNumObject[1].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
328
|
+
.SysProGetInt("t1") + ".png")
|
|
329
|
+
smallNumObject[3].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
330
|
+
.SysProGetInt("t3") + ".png")
|
|
331
|
+
smallNumObject[4].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
332
|
+
.SysProGetInt("t4") + ".png")
|
|
333
|
+
smallNumObject[6].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
334
|
+
.SysProGetInt("t6") + ".png")
|
|
335
|
+
smallNumObject[7].setProperty(hmUI.prop.SRC, rootPath + "smallNum/" + hmFS
|
|
336
|
+
.SysProGetInt("t7") + ".png")
|
|
337
|
+
} else {
|
|
338
|
+
green_red_btn.setProperty(hmUI.prop.SRC, img("btn/red.png")); //false隐藏 true显示
|
|
339
|
+
hmFS.SysProSetInt("t0", 0);
|
|
340
|
+
hmFS.SysProSetInt("t1", 0);
|
|
341
|
+
hmFS.SysProSetInt("t3", 0);
|
|
342
|
+
hmFS.SysProSetInt("t4", 0);
|
|
343
|
+
hmFS.SysProSetInt("t6", 0);
|
|
344
|
+
hmFS.SysProSetInt("t7", 0);
|
|
345
|
+
milli_value = 0
|
|
346
|
+
second_value = 0
|
|
347
|
+
min_value = 0
|
|
348
|
+
|
|
349
|
+
constSecond = 0
|
|
350
|
+
constMin = 0
|
|
351
|
+
timerSample()
|
|
352
|
+
|
|
353
|
+
}
|
|
354
|
+
}));
|
|
355
|
+
|
|
356
|
+
let hsTimer = null
|
|
357
|
+
let sTimer = null
|
|
358
|
+
|
|
359
|
+
function setHaomiao(t) {
|
|
360
|
+
if (milli_value >= 99) {
|
|
361
|
+
milli_value = -1
|
|
362
|
+
}
|
|
363
|
+
milli_value++
|
|
364
|
+
bigNumObject[6].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(milli_value /
|
|
365
|
+
10) + ".png")
|
|
366
|
+
bigNumObject[7].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(milli_value %
|
|
367
|
+
10) + ".png")
|
|
368
|
+
|
|
369
|
+
hmFS.SysProSetInt("t6", parseInt(milli_value / 10));
|
|
370
|
+
hmFS.SysProSetInt("t7", parseInt(milli_value % 10));
|
|
371
|
+
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
function setmiao(t) {
|
|
375
|
+
if (second_value >= 59) {
|
|
376
|
+
second_value = -1
|
|
377
|
+
}
|
|
378
|
+
second_value++
|
|
379
|
+
constSecond++
|
|
380
|
+
setAngle(constSecond)
|
|
381
|
+
if (second_value == 0) {
|
|
382
|
+
min_value++
|
|
383
|
+
setfen()
|
|
384
|
+
}
|
|
385
|
+
bigNumObject[3].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(second_value /
|
|
386
|
+
10) + ".png")
|
|
387
|
+
bigNumObject[4].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(second_value %
|
|
388
|
+
10) + ".png")
|
|
389
|
+
|
|
390
|
+
hmFS.SysProSetInt("t3", parseInt(second_value / 10));
|
|
391
|
+
hmFS.SysProSetInt("t4", parseInt(second_value % 10));
|
|
392
|
+
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
function setfen(t) {
|
|
396
|
+
if (min_value > 59) {
|
|
397
|
+
min_value = 59
|
|
398
|
+
}
|
|
399
|
+
console.log(parseInt(min_value / 10) + 'hhhhh')
|
|
400
|
+
console.log(parseInt(min_value % 10) + '%%%%%')
|
|
401
|
+
bigNumObject[0].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(min_value /
|
|
402
|
+
10) + ".png")
|
|
403
|
+
bigNumObject[1].setProperty(hmUI.prop.SRC, rootPath + "bigNum/" + parseInt(min_value %
|
|
404
|
+
10) + ".png")
|
|
405
|
+
|
|
406
|
+
hmFS.SysProSetInt("t0", parseInt(min_value / 10));
|
|
407
|
+
hmFS.SysProSetInt("t1", parseInt(min_value % 10));
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
function timerSample() {
|
|
411
|
+
console.log('999999')
|
|
412
|
+
hsTimer = timer.createTimer(
|
|
413
|
+
10, 10, setHaomiao, {})
|
|
414
|
+
sTimer = timer.createTimer(
|
|
415
|
+
1000, 1000, setmiao, {})
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function setAngle(seconds) {
|
|
419
|
+
minPoint.setProperty(hmUI.prop.ANGLE, parseInt(seconds * 0.008))
|
|
420
|
+
hourPoint.setProperty(hmUI.prop.ANGLE, parseInt(seconds * 0.2))
|
|
421
|
+
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
},
|
|
425
|
+
|
|
426
|
+
onInit() {
|
|
427
|
+
logger.log('index page.js on init invoke')
|
|
428
|
+
},
|
|
429
|
+
|
|
430
|
+
build() {
|
|
431
|
+
logger.log('index page.js on build invoke')
|
|
432
|
+
this.init_view()
|
|
433
|
+
},
|
|
434
|
+
|
|
435
|
+
onDestory() {
|
|
436
|
+
logger.log('index page.js on destory invoke')
|
|
437
|
+
},
|
|
438
|
+
})
|