@ray-js/api 1.4.0-alpha.3 → 1.4.0-alpha.5
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/BaseKit-3.3.10.js +85 -83
- package/lib/BizKit-3.2.7.js +48 -47
- package/lib/DeviceKit-3.3.1.js +194 -193
- package/lib/HomeKit-3.1.4.js +2 -1
- package/lib/MapKit-3.0.7.js +4 -2
- package/lib/MiniKit-3.1.0.js +65 -64
- package/lib/PlayNetKit-1.1.3.js +2 -1
- package/lib/cloud/alarm.js +4 -7
- package/lib/cloud/core.js +2 -3
- package/lib/cloud/device.js +20 -31
- package/lib/cloud/interface.d.ts +7 -7
- package/lib/cloud/linkage.js +43 -41
- package/lib/cloud/statistic.js +21 -33
- package/lib/cloud/timer.js +31 -48
- package/lib/constants.js +1 -1
- package/lib/core/promisify/index.js +5 -9
- package/lib/getBoundingClientRect/index.js +16 -17
- package/lib/getBoundingClientRect/index.thing.js +16 -17
- package/lib/getBoundingClientRect/index.wechat.js +16 -17
- package/lib/getCdnUrl/index.thing.js +4 -7
- package/lib/getElementById/index.js +1 -3
- package/lib/getElementById/index.thing.js +2 -4
- package/lib/getElementById/index.wechat.js +2 -4
- package/lib/hideTabBar/index.d.ts +7 -1
- package/lib/index.js +3 -2
- package/lib/lifecycles/offAppEvent/index.js +2 -2
- package/lib/lifecycles/offAppHide/index.js +2 -2
- package/lib/lifecycles/offAppShow/index.js +2 -2
- package/lib/lifecycles/offError/index.js +2 -2
- package/lib/lifecycles/offThemeChange/index.js +2 -2
- package/lib/lifecycles/offWindowResize/index.js +2 -2
- package/lib/lifecycles/onAppEvent/index.js +2 -2
- package/lib/lifecycles/onAppHide/index.js +2 -2
- package/lib/lifecycles/onAppShow/index.js +2 -2
- package/lib/lifecycles/onError/index.js +2 -2
- package/lib/lifecycles/onPageNotFound/index.js +2 -2
- package/lib/lifecycles/onThemeChange/index.js +2 -2
- package/lib/lifecycles/onWindowResize/index.js +2 -2
- package/lib/navigateBack/index.js +3 -6
- package/lib/navigateTo/index.js +2 -5
- package/lib/onNavigationBarBack/index.js +1 -2
- package/lib/onNavigationBarBack/index.wechat.js +1 -2
- package/lib/panel/devInfo/index.js +84 -121
- package/lib/panel/i18n/index.d.ts +1 -1
- package/lib/panel/i18n/index.js +180 -262
- package/lib/panel/i18n/index.wechat.d.ts +1 -1
- package/lib/panel/i18n/index.wechat.js +184 -267
- package/lib/panel/normalizeNetwork.d.ts +2 -2
- package/lib/panel/normalizeNetwork.js +2 -7
- package/lib/panel/publishDps.d.ts +1 -1
- package/lib/panel/publishDps.js +13 -18
- package/lib/panel/types/devInfo.d.ts +3 -3
- package/lib/panel/types/utilities.d.ts +8 -8
- package/lib/panel/utils.js +1 -3
- package/lib/reLaunch/index.js +2 -5
- package/lib/redirectTo/index.js +2 -6
- package/lib/requestCloud/index.js +2 -2
- package/lib/requestCloud/index.wechat.js +0 -1
- package/lib/setNavigationBarBack/index.js +1 -2
- package/lib/setNavigationBarBack/index.wechat.js +1 -2
- package/lib/setNavigationBarColor/index.js +3 -6
- package/lib/setNavigationBarTitle/index.js +5 -6
- package/lib/showTabBar/index.d.ts +7 -1
- package/lib/switchTab/index.js +2 -5
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +5 -14
- package/lib/utils.wechat.d.ts +1 -1
- package/lib/utils.wechat.js +9 -21
- package/lib/viewAPI.js +13 -12
- package/package.json +7 -7
- package/LICENSE.md +0 -9
package/lib/cloud/statistic.js
CHANGED
@@ -2,7 +2,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
// 数据统计接口
|
3
3
|
import { requestCloud } from '../';
|
4
4
|
import { THING } from '../constants';
|
5
|
-
|
6
5
|
/**
|
7
6
|
* 获取 DP 点指定时间段上报日志
|
8
7
|
* @param {string} devId 设备Id
|
@@ -13,13 +12,14 @@ import { THING } from '../constants';
|
|
13
12
|
* @param {string} endTime 设备上报的时间,查询结束时间,单位为毫秒
|
14
13
|
* @param {string} sortType DESC 倒序 或 ASC 顺序, 默认为 DESC
|
15
14
|
*/
|
16
|
-
|
15
|
+
const getLogInSpecifiedTime = params => {
|
17
16
|
return requestCloud({
|
18
17
|
api: "".concat(THING, ".m.smart.operate.all.log"),
|
19
18
|
version: '1.0',
|
20
19
|
data: _objectSpread({}, params)
|
21
20
|
});
|
22
21
|
};
|
22
|
+
|
23
23
|
/**
|
24
24
|
* 获取 DP 点上报日志
|
25
25
|
* @param {string} devId 设备Id
|
@@ -28,15 +28,14 @@ var getLogInSpecifiedTime = function (params) {
|
|
28
28
|
* @param {number} limit 最大值, 最大值上限为 1000,
|
29
29
|
* @param {string} sortType 'DESC' 倒序 或 'ASC' 顺序, 默认为 'DESC'
|
30
30
|
*/
|
31
|
-
|
32
|
-
|
33
|
-
var getDpReportLog = function (params) {
|
31
|
+
const getDpReportLog = params => {
|
34
32
|
return requestCloud({
|
35
33
|
api: 'm.smart.operate.log',
|
36
34
|
version: '2.0',
|
37
35
|
data: _objectSpread({}, params)
|
38
36
|
});
|
39
37
|
};
|
38
|
+
|
40
39
|
/**
|
41
40
|
* 获取用户操作的下发日志
|
42
41
|
* @param {string} devId 设备Id
|
@@ -45,15 +44,14 @@ var getDpReportLog = function (params) {
|
|
45
44
|
* @param {number} limit 最大值, 最大值上限为 1000,
|
46
45
|
* @param {string} sortType 'DESC' 倒序 或 'ASC' 顺序, 默认为 'DESC'
|
47
46
|
*/
|
48
|
-
|
49
|
-
|
50
|
-
var getLogUserAction = function (params) {
|
47
|
+
const getLogUserAction = params => {
|
51
48
|
return requestCloud({
|
52
49
|
api: 'm.smart.operate.publish.log',
|
53
50
|
version: '1.0',
|
54
51
|
data: _objectSpread({}, params)
|
55
52
|
});
|
56
53
|
};
|
54
|
+
|
57
55
|
/**
|
58
56
|
* 获取设备月的每日上报的数据统计
|
59
57
|
* @param {string} devId 设备Id
|
@@ -62,30 +60,28 @@ var getLogUserAction = function (params) {
|
|
62
60
|
* @param {string} endDay 结束日期,例如20180531
|
63
61
|
* @param {string} type 统计的类型,sum、minux 或 max
|
64
62
|
*/
|
65
|
-
|
66
|
-
|
67
|
-
var getDpLogDays = function (params) {
|
63
|
+
const getDpLogDays = params => {
|
68
64
|
return requestCloud({
|
69
65
|
api: "".concat(THING, ".m.dp.stat.days.list"),
|
70
66
|
version: '1.0',
|
71
67
|
data: _objectSpread({}, params)
|
72
68
|
});
|
73
69
|
};
|
70
|
+
|
74
71
|
/**
|
75
72
|
* 按月(一年)获取 DP 点的统计结果
|
76
73
|
* @param {string} devId 设备Id
|
77
74
|
* @param {string} dpId dpId
|
78
75
|
* @param {string} type 统计的类型,sum、minux 或 max
|
79
76
|
*/
|
80
|
-
|
81
|
-
|
82
|
-
var getDpResultByMonth = function (params) {
|
77
|
+
const getDpResultByMonth = params => {
|
83
78
|
return requestCloud({
|
84
79
|
api: "".concat(THING, ".m.dp.stat.month.list"),
|
85
80
|
version: '1.0',
|
86
81
|
data: _objectSpread({}, params)
|
87
82
|
});
|
88
83
|
};
|
84
|
+
|
89
85
|
/**
|
90
86
|
* 按小时获取 DP 点的统计数据
|
91
87
|
* @param {string} devId 设备Id
|
@@ -95,15 +91,14 @@ var getDpResultByMonth = function (params) {
|
|
95
91
|
* @param {string} uid 用户id
|
96
92
|
* @param {number} auto auto=1 :中间数据缺失时,使用上一时段的数据补充。auto=2 :中间数据缺失时,使用#补充
|
97
93
|
*/
|
98
|
-
|
99
|
-
|
100
|
-
var getDpResultByHour = function (params) {
|
94
|
+
const getDpResultByHour = params => {
|
101
95
|
return requestCloud({
|
102
96
|
api: "".concat(THING, ".m.dp.rang.stat.hour.list"),
|
103
97
|
version: '1.0',
|
104
98
|
data: _objectSpread({}, params)
|
105
99
|
});
|
106
100
|
};
|
101
|
+
|
107
102
|
/**
|
108
103
|
* 获取指定天数范围内的数据
|
109
104
|
* @param {string} devId 设备Id
|
@@ -114,15 +109,14 @@ var getDpResultByHour = function (params) {
|
|
114
109
|
* @param {string} uid 用户id
|
115
110
|
* @param {number} auto auto=1 :中间数据缺失时,使用上一时段的数据补充。auto=2 :中间数据缺失时,使用#补充
|
116
111
|
*/
|
117
|
-
|
118
|
-
|
119
|
-
var getDataWithSpecified = function (params) {
|
112
|
+
const getDataWithSpecified = params => {
|
120
113
|
return requestCloud({
|
121
114
|
api: "".concat(THING, ".m.dp.rang.stat.day.list"),
|
122
115
|
version: '2.0',
|
123
116
|
data: _objectSpread({}, params)
|
124
117
|
});
|
125
118
|
};
|
119
|
+
|
126
120
|
/**
|
127
121
|
* 获取指定周范围内的数据
|
128
122
|
* @param {string} devId 设备Id
|
@@ -131,15 +125,14 @@ var getDataWithSpecified = function (params) {
|
|
131
125
|
* @param {string} endWeek 结束周
|
132
126
|
* @param {string} type 统计的类型,sum、minux 或 avg
|
133
127
|
*/
|
134
|
-
|
135
|
-
|
136
|
-
var getWeekWithSpecified = function (params) {
|
128
|
+
const getWeekWithSpecified = params => {
|
137
129
|
return requestCloud({
|
138
130
|
api: "".concat(THING, ".m.dp.rang.stat.week.list"),
|
139
131
|
version: '1.0',
|
140
132
|
data: _objectSpread({}, params)
|
141
133
|
});
|
142
134
|
};
|
135
|
+
|
143
136
|
/**
|
144
137
|
* 获取指定月范围内的数据
|
145
138
|
* @param {string} devId 设备Id
|
@@ -150,30 +143,28 @@ var getWeekWithSpecified = function (params) {
|
|
150
143
|
* @param {string} uid 用户id
|
151
144
|
* @param {number} auto auto=1 :中间数据缺失时,使用上一时段的数据补充。auto=2 :中间数据缺失时,使用#补充
|
152
145
|
*/
|
153
|
-
|
154
|
-
|
155
|
-
var getMonthWithSpecified = function (params) {
|
146
|
+
const getMonthWithSpecified = params => {
|
156
147
|
return requestCloud({
|
157
148
|
api: "".concat(THING, ".m.dp.rang.stat.month.list"),
|
158
149
|
version: '2.0',
|
159
150
|
data: _objectSpread({}, params)
|
160
151
|
});
|
161
152
|
};
|
153
|
+
|
162
154
|
/**
|
163
155
|
* 获取单个 DP 点所有统计结果的聚合
|
164
156
|
* @param {string} devId 设备Id
|
165
157
|
* @param {string} dpId dpId
|
166
158
|
* @param {string} type 统计的类型,sum、minux 或 avg
|
167
159
|
*/
|
168
|
-
|
169
|
-
|
170
|
-
var getDpAllStatistResult = function (params) {
|
160
|
+
const getDpAllStatistResult = params => {
|
171
161
|
return requestCloud({
|
172
162
|
api: "".concat(THING, ".m.dp.stat.total"),
|
173
163
|
version: '1.0',
|
174
164
|
data: _objectSpread({}, params)
|
175
165
|
});
|
176
166
|
};
|
167
|
+
|
177
168
|
/**
|
178
169
|
* 获取多个 DP 点的统计结果的聚合(不限时长)
|
179
170
|
* @param {string} devId 设备Id
|
@@ -186,14 +177,11 @@ var getDpAllStatistResult = function (params) {
|
|
186
177
|
* @param {string} startRowKey 开始页索引
|
187
178
|
* @param {string} endRowKey: 结束页索引
|
188
179
|
*/
|
189
|
-
|
190
|
-
|
191
|
-
var getMultiDpsAllResult = function (params) {
|
180
|
+
const getMultiDpsAllResult = params => {
|
192
181
|
return requestCloud({
|
193
182
|
api: "".concat(THING, ".m.device.query.device.log"),
|
194
183
|
version: '1.0',
|
195
184
|
data: _objectSpread({}, params)
|
196
185
|
});
|
197
186
|
};
|
198
|
-
|
199
187
|
export { getLogInSpecifiedTime, getDpReportLog, getLogUserAction, getDpLogDays, getDpResultByMonth, getDpResultByHour, getDataWithSpecified, getWeekWithSpecified, getMonthWithSpecified, getDpAllStatistResult, getMultiDpsAllResult };
|
package/lib/cloud/timer.js
CHANGED
@@ -2,7 +2,6 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
// 云端定时接口
|
3
3
|
import { requestCloud } from '../';
|
4
4
|
import { THING } from '../constants';
|
5
|
-
|
6
5
|
/**
|
7
6
|
* 添加单次定时
|
8
7
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -14,28 +13,28 @@ import { THING } from '../constants';
|
|
14
13
|
* @param {boolean} isAppPush 是否发送执行通知
|
15
14
|
* @param {string} aliasName 定时备注
|
16
15
|
*/
|
17
|
-
|
16
|
+
const addSingleTimer = params => {
|
18
17
|
return requestCloud({
|
19
18
|
api: "".concat(THING, ".m.clock.dps.add"),
|
20
19
|
version: '1.0',
|
21
20
|
data: _objectSpread({}, params)
|
22
21
|
});
|
23
22
|
};
|
23
|
+
|
24
24
|
/**
|
25
25
|
* 查询定时任务
|
26
26
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
27
27
|
* @param {number} bizType 资源类型。0:单设备;1:群组设备。
|
28
28
|
* @param {string} category 定时分类
|
29
29
|
*/
|
30
|
-
|
31
|
-
|
32
|
-
var queryTimerTasks = function (params) {
|
30
|
+
const queryTimerTasks = params => {
|
33
31
|
return requestCloud({
|
34
32
|
api: "".concat(THING, ".m.clock.dps.list"),
|
35
33
|
version: '1.0',
|
36
34
|
data: _objectSpread({}, params)
|
37
35
|
});
|
38
36
|
};
|
37
|
+
|
39
38
|
/**
|
40
39
|
* 修改单次定时
|
41
40
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -47,15 +46,14 @@ var queryTimerTasks = function (params) {
|
|
47
46
|
* @param {boolean} isAppPush 是否发送执行通知
|
48
47
|
* @param {string} aliasName 定时备注
|
49
48
|
*/
|
50
|
-
|
51
|
-
|
52
|
-
var modifySingleTimer = function (params) {
|
49
|
+
const modifySingleTimer = params => {
|
53
50
|
return requestCloud({
|
54
51
|
api: "".concat(THING, ".m.clock.dps.update"),
|
55
52
|
version: '1.0',
|
56
53
|
data: _objectSpread({}, params)
|
57
54
|
});
|
58
55
|
};
|
56
|
+
|
59
57
|
/**
|
60
58
|
* 添加分组定时
|
61
59
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -67,30 +65,28 @@ var modifySingleTimer = function (params) {
|
|
67
65
|
* @param {boolean} isAppPush 是否发送执行通知
|
68
66
|
* @param {string} aliasName 定时备注
|
69
67
|
*/
|
70
|
-
|
71
|
-
|
72
|
-
var addGroupTimer = function (params) {
|
68
|
+
const addGroupTimer = params => {
|
73
69
|
return requestCloud({
|
74
70
|
api: "".concat(THING, ".m.clock.dps.group.add"),
|
75
71
|
version: '1.0',
|
76
72
|
data: _objectSpread({}, params)
|
77
73
|
});
|
78
74
|
};
|
75
|
+
|
79
76
|
/**
|
80
77
|
* 分组定时查询
|
81
78
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
82
79
|
* @param {number} bizType 资源类型。0:单设备;1:群组设备。
|
83
80
|
* @param {string} category 定时分类
|
84
81
|
*/
|
85
|
-
|
86
|
-
|
87
|
-
var queryGroupTimerTasks = function (params) {
|
82
|
+
const queryGroupTimerTasks = params => {
|
88
83
|
return requestCloud({
|
89
84
|
api: "".concat(THING, ".m.clock.dps.group.list"),
|
90
85
|
version: '1.0',
|
91
86
|
data: _objectSpread({}, params)
|
92
87
|
});
|
93
88
|
};
|
89
|
+
|
94
90
|
/**
|
95
91
|
* 修改分组定时
|
96
92
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -101,15 +97,14 @@ var queryGroupTimerTasks = function (params) {
|
|
101
97
|
* @param {boolean} isAppPush 是否发送执行通知
|
102
98
|
* @param {string} aliasName 定时备注
|
103
99
|
*/
|
104
|
-
|
105
|
-
|
106
|
-
var modifyGroupTimer = function (params) {
|
100
|
+
const modifyGroupTimer = params => {
|
107
101
|
return requestCloud({
|
108
102
|
api: "".concat(THING, ".m.clock.dps.group.update"),
|
109
103
|
version: '1.0',
|
110
104
|
data: _objectSpread({}, params)
|
111
105
|
});
|
112
106
|
};
|
107
|
+
|
113
108
|
/**
|
114
109
|
* 根据 ids 修改( 删除 )任务状态
|
115
110
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -117,15 +112,14 @@ var modifyGroupTimer = function (params) {
|
|
117
112
|
* @param {string} ids 定时任务的 ID。提交多任务时使用逗号(,)分隔。例如"1,2,3,4"。单次提交任务数量不得超过 168。
|
118
113
|
* @param {number} status 初始化状态,0:关闭;1:开启;2:删除。
|
119
114
|
*/
|
120
|
-
|
121
|
-
|
122
|
-
var modDeleteTaskByIds = function (params) {
|
115
|
+
const modDeleteTaskByIds = params => {
|
123
116
|
return requestCloud({
|
124
117
|
api: "".concat(THING, ".m.clock.batch.status.update"),
|
125
118
|
version: '1.0',
|
126
119
|
data: _objectSpread({}, params)
|
127
120
|
});
|
128
121
|
};
|
122
|
+
|
129
123
|
/**
|
130
124
|
* 根据 category 修改( 删除 )定时任务状态
|
131
125
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)
|
@@ -133,71 +127,66 @@ var modDeleteTaskByIds = function (params) {
|
|
133
127
|
* @param {string} category 定时分类
|
134
128
|
* @param {number} status 初始化状态,0:关闭;1:开启;2:删除。
|
135
129
|
*/
|
136
|
-
|
137
|
-
|
138
|
-
var modDeleteTaskByCategory = function (params) {
|
130
|
+
const modDeleteTaskByCategory = params => {
|
139
131
|
return requestCloud({
|
140
132
|
api: "".concat(THING, ".m.clock.category.status.update"),
|
141
133
|
version: '1.0',
|
142
134
|
data: _objectSpread({}, params)
|
143
135
|
});
|
144
136
|
};
|
137
|
+
|
145
138
|
/**
|
146
139
|
* 获取某个DP点最近的定时
|
147
140
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)。
|
148
141
|
* @param {string} type device_group 或者 device。
|
149
142
|
* @param {string} instruct 格式为'{devId:"xxx",dpId:"1"}'。
|
150
143
|
*/
|
151
|
-
|
152
|
-
|
153
|
-
var getDpLastTimer = function (params) {
|
144
|
+
const getDpLastTimer = params => {
|
154
145
|
return requestCloud({
|
155
146
|
api: 's.m.linkage.timer.nearest.get',
|
156
147
|
version: '1.0',
|
157
148
|
data: _objectSpread({}, params)
|
158
149
|
});
|
159
150
|
};
|
151
|
+
|
160
152
|
/**
|
161
153
|
* 获取多个 DP 点最近的定时
|
162
154
|
* @param {string} bizId 单设备 ID(devId) 或者群组设备 ID(groupId)。
|
163
155
|
* @param {string} type device_group 或者 device。
|
164
156
|
* @param {string} instruct 格式为'{devId:"xxx",dpId:"1"}'。
|
165
157
|
*/
|
166
|
-
|
167
|
-
|
168
|
-
var getDpsLastTimer = function (params) {
|
158
|
+
const getDpsLastTimer = params => {
|
169
159
|
return requestCloud({
|
170
160
|
api: 's.m.linkage.timer.nearest.bat.get',
|
171
161
|
version: '1.0',
|
172
162
|
data: _objectSpread({}, params)
|
173
163
|
});
|
174
164
|
};
|
165
|
+
|
175
166
|
/**
|
176
167
|
* 获取最近的一条定时(包含时间段判断)
|
177
168
|
* @param {string} devId 设备 ID。
|
178
169
|
* @param {string} instruct 格式为'{devId:"xxx",dpId:"1"}'。
|
179
170
|
*/
|
180
|
-
|
181
|
-
|
182
|
-
var getLastTimerPeriod = function (params) {
|
171
|
+
const getLastTimerPeriod = params => {
|
183
172
|
return requestCloud({
|
184
173
|
api: "".concat(THING, ".m.timer.nearest.get"),
|
185
174
|
version: '1.0',
|
186
175
|
data: _objectSpread({}, params)
|
187
176
|
});
|
188
177
|
};
|
178
|
+
|
189
179
|
/**
|
190
180
|
* 获取天文定时列表
|
191
181
|
*/
|
192
|
-
|
193
|
-
|
194
|
-
var getAstronomicalList = function (params) {
|
182
|
+
const getAstronomicalList = params => {
|
195
183
|
return requestCloud({
|
196
184
|
api: "".concat(THING, ".m.timer.astronomical.list"),
|
197
185
|
version: '1.0',
|
198
186
|
data: _objectSpread({}, params)
|
199
187
|
});
|
200
188
|
};
|
189
|
+
|
201
190
|
/**
|
202
191
|
* 添加天文定时
|
203
192
|
* @param {string} bizId 设备 ID 或群组 ID
|
@@ -212,15 +201,14 @@ var getAstronomicalList = function (params) {
|
|
212
201
|
* @param {number} lat 纬度
|
213
202
|
* @param {number} lon 经度
|
214
203
|
*/
|
215
|
-
|
216
|
-
|
217
|
-
var addAstronomical = function (params) {
|
204
|
+
const addAstronomical = params => {
|
218
205
|
return requestCloud({
|
219
206
|
api: "".concat(THING, ".m.timer.astronomical.add"),
|
220
207
|
version: '1.0',
|
221
208
|
data: _objectSpread({}, params)
|
222
209
|
});
|
223
210
|
};
|
211
|
+
|
224
212
|
/**
|
225
213
|
* 修改天文定时
|
226
214
|
* @param {string} bizId 设备 ID 或群组 ID
|
@@ -235,41 +223,36 @@ var addAstronomical = function (params) {
|
|
235
223
|
* @param {number} lat 纬度
|
236
224
|
* @param {number} lon 经度
|
237
225
|
*/
|
238
|
-
|
239
|
-
|
240
|
-
var updateAstronomical = function (params) {
|
226
|
+
const updateAstronomical = params => {
|
241
227
|
return requestCloud({
|
242
228
|
api: "".concat(THING, ".m.timer.astronomical.update"),
|
243
229
|
version: '1.0',
|
244
230
|
data: _objectSpread({}, params)
|
245
231
|
});
|
246
232
|
};
|
233
|
+
|
247
234
|
/**
|
248
235
|
* 修改天文定时使能
|
249
236
|
* @param {string} id 定时任务id
|
250
237
|
* @param {number} status 0:关闭;1开启
|
251
238
|
*/
|
252
|
-
|
253
|
-
|
254
|
-
var updateAstronomicalStatus = function (params) {
|
239
|
+
const updateAstronomicalStatus = params => {
|
255
240
|
return requestCloud({
|
256
241
|
api: "".concat(THING, ".m.timer.astronomical.status.update"),
|
257
242
|
version: '1.0',
|
258
243
|
data: _objectSpread({}, params)
|
259
244
|
});
|
260
245
|
};
|
246
|
+
|
261
247
|
/**
|
262
248
|
* 删除天文定时
|
263
249
|
* @param {string} id 定时任务 id
|
264
250
|
*/
|
265
|
-
|
266
|
-
|
267
|
-
var removeAstronomical = function (params) {
|
251
|
+
const removeAstronomical = params => {
|
268
252
|
return requestCloud({
|
269
253
|
api: "".concat(THING, ".m.timer.astronomical.remove"),
|
270
254
|
version: '1.0',
|
271
255
|
data: _objectSpread({}, params)
|
272
256
|
});
|
273
257
|
};
|
274
|
-
|
275
258
|
export { addSingleTimer, queryTimerTasks, modifySingleTimer, addGroupTimer, queryGroupTimerTasks, modifyGroupTimer, modDeleteTaskByIds, modDeleteTaskByCategory, getDpLastTimer, getDpsLastTimer, getLastTimerPeriod, getAstronomicalList, addAstronomical, updateAstronomical, updateAstronomicalStatus, removeAstronomical };
|
package/lib/constants.js
CHANGED
@@ -1,24 +1,20 @@
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
3
|
-
import "core-js/modules/es.promise.js";
|
4
2
|
export function promisify(api) {
|
5
3
|
return function () {
|
6
|
-
|
7
|
-
return new Promise(
|
8
|
-
|
4
|
+
let arg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
5
|
+
return new Promise((resolve, reject) => {
|
6
|
+
const promisifyArg = arg;
|
9
7
|
api(_objectSpread(_objectSpread({}, promisifyArg), {}, {
|
10
|
-
success:
|
8
|
+
success: res => {
|
11
9
|
if (promisifyArg && typeof promisifyArg.success === 'function') {
|
12
10
|
promisifyArg.success(res);
|
13
11
|
}
|
14
|
-
|
15
12
|
resolve(res);
|
16
13
|
},
|
17
|
-
fail:
|
14
|
+
fail: res => {
|
18
15
|
if (promisifyArg && typeof promisifyArg.fail === 'function') {
|
19
16
|
promisifyArg.fail(res);
|
20
17
|
}
|
21
|
-
|
22
18
|
reject(res);
|
23
19
|
}
|
24
20
|
}));
|
@@ -1,26 +1,25 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
|
-
|
4
1
|
/**
|
5
2
|
* 获取元素的大小及其相对于视口的位置
|
6
3
|
* @param element HTEMLElement | Nodes
|
7
4
|
*/
|
8
5
|
export default function getBoundingClientRect(element) {
|
9
|
-
return new Promise(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
6
|
+
return new Promise(resolve => {
|
7
|
+
const rect = element.getBoundingClientRect();
|
8
|
+
const {
|
9
|
+
right,
|
10
|
+
left,
|
11
|
+
top,
|
12
|
+
bottom,
|
13
|
+
width,
|
14
|
+
height
|
15
|
+
} = rect;
|
17
16
|
resolve({
|
18
|
-
right
|
19
|
-
left
|
20
|
-
top
|
21
|
-
bottom
|
22
|
-
width
|
23
|
-
height
|
17
|
+
right,
|
18
|
+
left,
|
19
|
+
top,
|
20
|
+
bottom,
|
21
|
+
width,
|
22
|
+
height
|
24
23
|
});
|
25
24
|
});
|
26
25
|
}
|
@@ -1,22 +1,21 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
|
-
import "core-js/modules/es.regexp.exec.js";
|
4
1
|
export default function getBoundingClientRect(ref) {
|
5
|
-
return new Promise(
|
6
|
-
ref.boundingClientRect(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
return new Promise(resolve => {
|
3
|
+
ref.boundingClientRect(rect => {
|
4
|
+
const {
|
5
|
+
right,
|
6
|
+
left,
|
7
|
+
top,
|
8
|
+
bottom,
|
9
|
+
width,
|
10
|
+
height
|
11
|
+
} = rect;
|
13
12
|
resolve({
|
14
|
-
right
|
15
|
-
left
|
16
|
-
top
|
17
|
-
bottom
|
18
|
-
width
|
19
|
-
height
|
13
|
+
right,
|
14
|
+
left,
|
15
|
+
top,
|
16
|
+
bottom,
|
17
|
+
width,
|
18
|
+
height
|
20
19
|
});
|
21
20
|
}).exec();
|
22
21
|
});
|
@@ -1,22 +1,21 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
|
-
import "core-js/modules/es.regexp.exec.js";
|
4
1
|
export default function getBoundingClientRect(ref) {
|
5
|
-
return new Promise(
|
6
|
-
ref.boundingClientRect(
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
2
|
+
return new Promise(resolve => {
|
3
|
+
ref.boundingClientRect(rect => {
|
4
|
+
const {
|
5
|
+
right,
|
6
|
+
left,
|
7
|
+
top,
|
8
|
+
bottom,
|
9
|
+
width,
|
10
|
+
height
|
11
|
+
} = rect;
|
13
12
|
resolve({
|
14
|
-
right
|
15
|
-
left
|
16
|
-
top
|
17
|
-
bottom
|
18
|
-
width
|
19
|
-
height
|
13
|
+
right,
|
14
|
+
left,
|
15
|
+
top,
|
16
|
+
bottom,
|
17
|
+
width,
|
18
|
+
height
|
20
19
|
});
|
21
20
|
}).exec();
|
22
21
|
});
|
@@ -3,12 +3,11 @@ export default function getCdnUrl(path, cdnMap) {
|
|
3
3
|
console.warn('请传入cdnMap');
|
4
4
|
return path;
|
5
5
|
}
|
6
|
-
|
7
|
-
|
8
|
-
ty.getAppInfo().then(function (res) {
|
6
|
+
let regionCode = 'EU';
|
7
|
+
ty.getAppInfo().then(res => {
|
9
8
|
regionCode = res.regionCode;
|
10
9
|
});
|
11
|
-
|
10
|
+
const region = {
|
12
11
|
AY: 'images.tuyacn.com',
|
13
12
|
AZ: 'usimagesd1448c85ulz2o4.cdn5th.com',
|
14
13
|
EU: 'euimagesd2h2yqnfpu4gl5.cdn5th.com',
|
@@ -17,12 +16,10 @@ export default function getCdnUrl(path, cdnMap) {
|
|
17
16
|
WE: 'd2h2yqnfpu4gl5.cdn5th.com',
|
18
17
|
UE: 'usimagesd1448c85ulz2o4.cdn5th.com'
|
19
18
|
}[regionCode];
|
20
|
-
|
21
|
-
|
19
|
+
const cdnShortPath = cdnMap[path];
|
22
20
|
if (!cdnShortPath) {
|
23
21
|
console.warn('[App] cdn "' + path + '" is not exist.');
|
24
22
|
return path;
|
25
23
|
}
|
26
|
-
|
27
24
|
return 'https://' + region + '/' + cdnShortPath;
|
28
25
|
}
|
@@ -1,8 +1,6 @@
|
|
1
|
-
import "core-js/modules/es.object.to-string.js";
|
2
|
-
import "core-js/modules/es.promise.js";
|
3
1
|
export default function getElementById(id) {
|
4
|
-
return new Promise(
|
5
|
-
|
2
|
+
return new Promise(resolve => {
|
3
|
+
const nodeRef = ty.createSelectorQuery().select("#".concat(id));
|
6
4
|
resolve(nodeRef);
|
7
5
|
});
|
8
6
|
}
|