@ray-js/api 1.4.29 → 1.4.31
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/lib/cloud/alarm.js +2 -2
- package/lib/cloud/core.js +1 -1
- package/lib/cloud/device.js +5 -5
- package/lib/cloud/linkage.js +8 -8
- package/lib/cloud/statistic.js +9 -9
- package/lib/cloud/timer.js +14 -14
- package/lib/getElementById/index.thing.js +1 -1
- package/lib/getElementById/index.wechat.js +1 -1
- package/lib/panel/i18n/index.js +12 -13
- package/lib/panel/i18n/index.wechat.js +12 -13
- package/lib/panel/publishDps.js +1 -1
- package/lib/redirectTo/index.js +0 -1
- package/lib/utils.js +5 -5
- package/lib/utils.wechat.js +5 -5
- package/package.json +5 -5
package/lib/cloud/alarm.js
CHANGED
@@ -8,7 +8,7 @@ import { THING } from '../constants';
|
|
8
8
|
*/
|
9
9
|
const getDevAlarmList = devId => {
|
10
10
|
return requestCloud({
|
11
|
-
api:
|
11
|
+
api: `${THING}.m.linkage.rule.product.query`,
|
12
12
|
version: '1.0',
|
13
13
|
data: {
|
14
14
|
devId
|
@@ -24,7 +24,7 @@ const getDevAlarmList = devId => {
|
|
24
24
|
*/
|
25
25
|
const setAlarmSwitch = params => {
|
26
26
|
return requestCloud({
|
27
|
-
api:
|
27
|
+
api: `${THING}.m.linkage.dev.warn.set`,
|
28
28
|
version: '1.0',
|
29
29
|
data: _objectSpread({}, params)
|
30
30
|
});
|
package/lib/cloud/core.js
CHANGED
package/lib/cloud/device.js
CHANGED
@@ -52,7 +52,7 @@ const getGroupDpsInfos = groupId => {
|
|
52
52
|
*/
|
53
53
|
const updateGroupDpName = params => {
|
54
54
|
return requestCloud({
|
55
|
-
api:
|
55
|
+
api: `${THING}.m.group.dpname.update`,
|
56
56
|
version: '1.0',
|
57
57
|
data: _objectSpread({}, params)
|
58
58
|
});
|
@@ -65,7 +65,7 @@ const updateGroupDpName = params => {
|
|
65
65
|
*/
|
66
66
|
const getWeatherQuality = params => {
|
67
67
|
return requestCloud({
|
68
|
-
api:
|
68
|
+
api: `${THING}.m.public.weather.get`,
|
69
69
|
version: '2.0',
|
70
70
|
data: _objectSpread({}, params)
|
71
71
|
});
|
@@ -78,7 +78,7 @@ const getWeatherQuality = params => {
|
|
78
78
|
*/
|
79
79
|
const getWeathers = params => {
|
80
80
|
return requestCloud({
|
81
|
-
api:
|
81
|
+
api: `${THING}.m.public.weathers.get`,
|
82
82
|
version: '2.0',
|
83
83
|
data: _objectSpread({}, params)
|
84
84
|
});
|
@@ -93,7 +93,7 @@ const getWeathers = params => {
|
|
93
93
|
*/
|
94
94
|
const saveCustomizePosition = params => {
|
95
95
|
return requestCloud({
|
96
|
-
api:
|
96
|
+
api: `${THING}.m.device.customize.position.save`,
|
97
97
|
version: '1.0',
|
98
98
|
data: _objectSpread({}, params)
|
99
99
|
});
|
@@ -105,7 +105,7 @@ const saveCustomizePosition = params => {
|
|
105
105
|
*/
|
106
106
|
const getCustomizePosition = params => {
|
107
107
|
return requestCloud({
|
108
|
-
api:
|
108
|
+
api: `${THING}.m.device.customize.position.get`,
|
109
109
|
version: '1.0',
|
110
110
|
data: _objectSpread({}, params)
|
111
111
|
});
|
package/lib/cloud/linkage.js
CHANGED
@@ -8,7 +8,7 @@ import { THING } from '../constants';
|
|
8
8
|
*/
|
9
9
|
const getLinkageDeviceList = params => {
|
10
10
|
return requestCloud({
|
11
|
-
api:
|
11
|
+
api: `${THING}.m.linkage.dev.list`,
|
12
12
|
version: '3.0',
|
13
13
|
data: _objectSpread({}, params)
|
14
14
|
});
|
@@ -23,7 +23,7 @@ const getSceneList = _ref => {
|
|
23
23
|
devId
|
24
24
|
} = _ref;
|
25
25
|
return requestCloud({
|
26
|
-
api:
|
26
|
+
api: `${THING}.m.linkage.rule.brief.query`,
|
27
27
|
version: '1.0',
|
28
28
|
data: {
|
29
29
|
devId
|
@@ -40,7 +40,7 @@ const getSceneList = _ref => {
|
|
40
40
|
|
41
41
|
const getBindRuleList = params => {
|
42
42
|
return requestCloud({
|
43
|
-
api:
|
43
|
+
api: `${THING}.m.linkage.associative.entity.id.category.query`,
|
44
44
|
version: '1.0',
|
45
45
|
data: _objectSpread({}, params)
|
46
46
|
});
|
@@ -65,7 +65,7 @@ const bindRule = _ref2 => {
|
|
65
65
|
bizDomain
|
66
66
|
} = _ref2;
|
67
67
|
return requestCloud({
|
68
|
-
api:
|
68
|
+
api: `${THING}.m.linkage.associative.entity.bind`,
|
69
69
|
version: '1.0',
|
70
70
|
data: {
|
71
71
|
relationExpr: {
|
@@ -102,7 +102,7 @@ const bindRule = _ref2 => {
|
|
102
102
|
*/
|
103
103
|
const removeRule = params => {
|
104
104
|
return requestCloud({
|
105
|
-
api:
|
105
|
+
api: `${THING}.m.linkage.associative.entity.remove`,
|
106
106
|
version: '1.0',
|
107
107
|
data: _objectSpread({}, params)
|
108
108
|
});
|
@@ -117,7 +117,7 @@ const triggerRule = _ref3 => {
|
|
117
117
|
ruleId
|
118
118
|
} = _ref3;
|
119
119
|
return requestCloud({
|
120
|
-
api:
|
120
|
+
api: `${THING}.m.linkage.rule.trigger`,
|
121
121
|
version: '1.0',
|
122
122
|
data: {
|
123
123
|
ruleId
|
@@ -134,7 +134,7 @@ const enableRule = _ref4 => {
|
|
134
134
|
ruleId
|
135
135
|
} = _ref4;
|
136
136
|
return requestCloud({
|
137
|
-
api:
|
137
|
+
api: `${THING}.m.linkage.rule.enable`,
|
138
138
|
version: '1.0',
|
139
139
|
data: {
|
140
140
|
ruleId
|
@@ -151,7 +151,7 @@ const disableRule = _ref5 => {
|
|
151
151
|
ruleId
|
152
152
|
} = _ref5;
|
153
153
|
return requestCloud({
|
154
|
-
api:
|
154
|
+
api: `${THING}.m.linkage.rule.disable`,
|
155
155
|
version: '1.0',
|
156
156
|
data: {
|
157
157
|
ruleId
|
package/lib/cloud/statistic.js
CHANGED
@@ -14,7 +14,7 @@ import { THING } from '../constants';
|
|
14
14
|
*/
|
15
15
|
const getLogInSpecifiedTime = params => {
|
16
16
|
return requestCloud({
|
17
|
-
api:
|
17
|
+
api: `${THING}.m.smart.operate.all.log`,
|
18
18
|
version: '1.0',
|
19
19
|
data: _objectSpread({}, params)
|
20
20
|
});
|
@@ -62,7 +62,7 @@ const getLogUserAction = params => {
|
|
62
62
|
*/
|
63
63
|
const getDpLogDays = params => {
|
64
64
|
return requestCloud({
|
65
|
-
api:
|
65
|
+
api: `${THING}.m.dp.stat.days.list`,
|
66
66
|
version: '1.0',
|
67
67
|
data: _objectSpread({}, params)
|
68
68
|
});
|
@@ -76,7 +76,7 @@ const getDpLogDays = params => {
|
|
76
76
|
*/
|
77
77
|
const getDpResultByMonth = params => {
|
78
78
|
return requestCloud({
|
79
|
-
api:
|
79
|
+
api: `${THING}.m.dp.stat.month.list`,
|
80
80
|
version: '1.0',
|
81
81
|
data: _objectSpread({}, params)
|
82
82
|
});
|
@@ -93,7 +93,7 @@ const getDpResultByMonth = params => {
|
|
93
93
|
*/
|
94
94
|
const getDpResultByHour = params => {
|
95
95
|
return requestCloud({
|
96
|
-
api:
|
96
|
+
api: `${THING}.m.dp.rang.stat.hour.list`,
|
97
97
|
version: '1.0',
|
98
98
|
data: _objectSpread({}, params)
|
99
99
|
});
|
@@ -111,7 +111,7 @@ const getDpResultByHour = params => {
|
|
111
111
|
*/
|
112
112
|
const getDataWithSpecified = params => {
|
113
113
|
return requestCloud({
|
114
|
-
api:
|
114
|
+
api: `${THING}.m.dp.rang.stat.day.list`,
|
115
115
|
version: '2.0',
|
116
116
|
data: _objectSpread({}, params)
|
117
117
|
});
|
@@ -127,7 +127,7 @@ const getDataWithSpecified = params => {
|
|
127
127
|
*/
|
128
128
|
const getWeekWithSpecified = params => {
|
129
129
|
return requestCloud({
|
130
|
-
api:
|
130
|
+
api: `${THING}.m.dp.rang.stat.week.list`,
|
131
131
|
version: '1.0',
|
132
132
|
data: _objectSpread({}, params)
|
133
133
|
});
|
@@ -145,7 +145,7 @@ const getWeekWithSpecified = params => {
|
|
145
145
|
*/
|
146
146
|
const getMonthWithSpecified = params => {
|
147
147
|
return requestCloud({
|
148
|
-
api:
|
148
|
+
api: `${THING}.m.dp.rang.stat.month.list`,
|
149
149
|
version: '2.0',
|
150
150
|
data: _objectSpread({}, params)
|
151
151
|
});
|
@@ -159,7 +159,7 @@ const getMonthWithSpecified = params => {
|
|
159
159
|
*/
|
160
160
|
const getDpAllStatistResult = params => {
|
161
161
|
return requestCloud({
|
162
|
-
api:
|
162
|
+
api: `${THING}.m.dp.stat.total`,
|
163
163
|
version: '1.0',
|
164
164
|
data: _objectSpread({}, params)
|
165
165
|
});
|
@@ -179,7 +179,7 @@ const getDpAllStatistResult = params => {
|
|
179
179
|
*/
|
180
180
|
const getMultiDpsAllResult = params => {
|
181
181
|
return requestCloud({
|
182
|
-
api:
|
182
|
+
api: `${THING}.m.device.query.device.log`,
|
183
183
|
version: '1.0',
|
184
184
|
data: _objectSpread({}, params)
|
185
185
|
});
|
package/lib/cloud/timer.js
CHANGED
@@ -15,7 +15,7 @@ import { THING } from '../constants';
|
|
15
15
|
*/
|
16
16
|
const addSingleTimer = params => {
|
17
17
|
return requestCloud({
|
18
|
-
api:
|
18
|
+
api: `${THING}.m.clock.dps.add`,
|
19
19
|
version: '1.0',
|
20
20
|
data: _objectSpread({}, params)
|
21
21
|
});
|
@@ -29,7 +29,7 @@ const addSingleTimer = params => {
|
|
29
29
|
*/
|
30
30
|
const queryTimerTasks = params => {
|
31
31
|
return requestCloud({
|
32
|
-
api:
|
32
|
+
api: `${THING}.m.clock.dps.list`,
|
33
33
|
version: '1.0',
|
34
34
|
data: _objectSpread({}, params)
|
35
35
|
});
|
@@ -48,7 +48,7 @@ const queryTimerTasks = params => {
|
|
48
48
|
*/
|
49
49
|
const modifySingleTimer = params => {
|
50
50
|
return requestCloud({
|
51
|
-
api:
|
51
|
+
api: `${THING}.m.clock.dps.update`,
|
52
52
|
version: '1.0',
|
53
53
|
data: _objectSpread({}, params)
|
54
54
|
});
|
@@ -67,7 +67,7 @@ const modifySingleTimer = params => {
|
|
67
67
|
*/
|
68
68
|
const addGroupTimer = params => {
|
69
69
|
return requestCloud({
|
70
|
-
api:
|
70
|
+
api: `${THING}.m.clock.dps.group.add`,
|
71
71
|
version: '1.0',
|
72
72
|
data: _objectSpread({}, params)
|
73
73
|
});
|
@@ -81,7 +81,7 @@ const addGroupTimer = params => {
|
|
81
81
|
*/
|
82
82
|
const queryGroupTimerTasks = params => {
|
83
83
|
return requestCloud({
|
84
|
-
api:
|
84
|
+
api: `${THING}.m.clock.dps.group.list`,
|
85
85
|
version: '1.0',
|
86
86
|
data: _objectSpread({}, params)
|
87
87
|
});
|
@@ -99,7 +99,7 @@ const queryGroupTimerTasks = params => {
|
|
99
99
|
*/
|
100
100
|
const modifyGroupTimer = params => {
|
101
101
|
return requestCloud({
|
102
|
-
api:
|
102
|
+
api: `${THING}.m.clock.dps.group.update`,
|
103
103
|
version: '1.0',
|
104
104
|
data: _objectSpread({}, params)
|
105
105
|
});
|
@@ -114,7 +114,7 @@ const modifyGroupTimer = params => {
|
|
114
114
|
*/
|
115
115
|
const modDeleteTaskByIds = params => {
|
116
116
|
return requestCloud({
|
117
|
-
api:
|
117
|
+
api: `${THING}.m.clock.batch.status.update`,
|
118
118
|
version: '1.0',
|
119
119
|
data: _objectSpread({}, params)
|
120
120
|
});
|
@@ -129,7 +129,7 @@ const modDeleteTaskByIds = params => {
|
|
129
129
|
*/
|
130
130
|
const modDeleteTaskByCategory = params => {
|
131
131
|
return requestCloud({
|
132
|
-
api:
|
132
|
+
api: `${THING}.m.clock.category.status.update`,
|
133
133
|
version: '1.0',
|
134
134
|
data: _objectSpread({}, params)
|
135
135
|
});
|
@@ -170,7 +170,7 @@ const getDpsLastTimer = params => {
|
|
170
170
|
*/
|
171
171
|
const getLastTimerPeriod = params => {
|
172
172
|
return requestCloud({
|
173
|
-
api:
|
173
|
+
api: `${THING}.m.timer.nearest.get`,
|
174
174
|
version: '1.0',
|
175
175
|
data: _objectSpread({}, params)
|
176
176
|
});
|
@@ -181,7 +181,7 @@ const getLastTimerPeriod = params => {
|
|
181
181
|
*/
|
182
182
|
const getAstronomicalList = params => {
|
183
183
|
return requestCloud({
|
184
|
-
api:
|
184
|
+
api: `${THING}.m.timer.astronomical.list`,
|
185
185
|
version: '1.0',
|
186
186
|
data: _objectSpread({}, params)
|
187
187
|
});
|
@@ -203,7 +203,7 @@ const getAstronomicalList = params => {
|
|
203
203
|
*/
|
204
204
|
const addAstronomical = params => {
|
205
205
|
return requestCloud({
|
206
|
-
api:
|
206
|
+
api: `${THING}.m.timer.astronomical.add`,
|
207
207
|
version: '1.0',
|
208
208
|
data: _objectSpread({}, params)
|
209
209
|
});
|
@@ -225,7 +225,7 @@ const addAstronomical = params => {
|
|
225
225
|
*/
|
226
226
|
const updateAstronomical = params => {
|
227
227
|
return requestCloud({
|
228
|
-
api:
|
228
|
+
api: `${THING}.m.timer.astronomical.update`,
|
229
229
|
version: '1.0',
|
230
230
|
data: _objectSpread({}, params)
|
231
231
|
});
|
@@ -238,7 +238,7 @@ const updateAstronomical = params => {
|
|
238
238
|
*/
|
239
239
|
const updateAstronomicalStatus = params => {
|
240
240
|
return requestCloud({
|
241
|
-
api:
|
241
|
+
api: `${THING}.m.timer.astronomical.status.update`,
|
242
242
|
version: '1.0',
|
243
243
|
data: _objectSpread({}, params)
|
244
244
|
});
|
@@ -250,7 +250,7 @@ const updateAstronomicalStatus = params => {
|
|
250
250
|
*/
|
251
251
|
const removeAstronomical = params => {
|
252
252
|
return requestCloud({
|
253
|
-
api:
|
253
|
+
api: `${THING}.m.timer.astronomical.remove`,
|
254
254
|
version: '1.0',
|
255
255
|
data: _objectSpread({}, params)
|
256
256
|
});
|
package/lib/panel/i18n/index.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import "core-js/modules/es.string.replace.js";
|
2
1
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
3
2
|
import { getBitValue } from '../utils';
|
4
3
|
export default class I18N {
|
@@ -11,7 +10,7 @@ export default class I18N {
|
|
11
10
|
}
|
12
11
|
forceUpdateNetworkLang(productId) {
|
13
12
|
requestCloud({
|
14
|
-
api:
|
13
|
+
api: `${THING}.m.i18n.get`,
|
15
14
|
version: '1.0',
|
16
15
|
data: {
|
17
16
|
productId,
|
@@ -102,14 +101,14 @@ export default class I18N {
|
|
102
101
|
formatString(str) {
|
103
102
|
let res = str;
|
104
103
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
105
|
-
res = this._replaceAll(
|
104
|
+
res = this._replaceAll(`{${i}}`, i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
106
105
|
}
|
107
106
|
return res;
|
108
107
|
}
|
109
108
|
formatValue(key) {
|
110
109
|
let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
111
110
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
112
|
-
res = this._replaceAll(
|
111
|
+
res = this._replaceAll(`{${i}}`, i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
113
112
|
}
|
114
113
|
return res;
|
115
114
|
}
|
@@ -122,17 +121,17 @@ export default class I18N {
|
|
122
121
|
getDpLang(code, value) {
|
123
122
|
let key;
|
124
123
|
if (typeof value === 'undefined') {
|
125
|
-
key =
|
124
|
+
key = `dp_${code}`.toLowerCase();
|
126
125
|
} else if (typeof value === 'boolean') {
|
127
126
|
const valStr = value ? 'on' : 'off';
|
128
|
-
key =
|
127
|
+
key = `dp_${code}_${valStr}`.toLowerCase();
|
129
128
|
} else {
|
130
|
-
key =
|
129
|
+
key = `dp_${code}_${value}`.toLowerCase();
|
131
130
|
}
|
132
131
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
133
132
|
}
|
134
133
|
getDpName(code, defaultName) {
|
135
|
-
const key =
|
134
|
+
const key = `dp_${code}`.toLowerCase();
|
136
135
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
137
136
|
}
|
138
137
|
getDpsLang(key) {
|
@@ -164,7 +163,7 @@ export default class I18N {
|
|
164
163
|
if (typeof schema === 'undefined') return result;
|
165
164
|
const lists = schema.range;
|
166
165
|
lists.map(v => {
|
167
|
-
const key =
|
166
|
+
const key = `dp_${dpCode}_${v}`.toLowerCase();
|
168
167
|
result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
169
168
|
return null;
|
170
169
|
});
|
@@ -178,12 +177,12 @@ export default class I18N {
|
|
178
177
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
179
178
|
*/
|
180
179
|
parseCountdown(t, power) {
|
181
|
-
const h = parseFloat(
|
182
|
-
const m = parseFloat(
|
180
|
+
const h = parseFloat(`${t / 3600}`);
|
181
|
+
const m = parseFloat(`${t / 60 - h * 60}`);
|
183
182
|
const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
184
183
|
const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
185
|
-
const time = h >= 1.0 ?
|
186
|
-
const key =
|
184
|
+
const time = h >= 1.0 ? `${Math.round(h)}${tHour}` : `${Math.round(m)}${tMinute}`;
|
185
|
+
const key = `countdown_${power ? 'on' : 'off'}`;
|
187
186
|
const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
188
187
|
return this.formatString(str, time);
|
189
188
|
}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import "core-js/modules/es.string.replace.js";
|
2
1
|
import { requestCloud, getSystemInfoSync, THING } from '../..';
|
3
2
|
import { getBitValue } from '../utils';
|
4
3
|
|
@@ -16,7 +15,7 @@ export default class I18N {
|
|
16
15
|
}
|
17
16
|
forceUpdateNetworkLang(productId) {
|
18
17
|
requestCloud({
|
19
|
-
api:
|
18
|
+
api: `${THING}.m.i18n.get`,
|
20
19
|
version: '1.0',
|
21
20
|
data: {
|
22
21
|
productId,
|
@@ -107,14 +106,14 @@ export default class I18N {
|
|
107
106
|
formatString(str) {
|
108
107
|
let res = str;
|
109
108
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
110
|
-
res = this._replaceAll(
|
109
|
+
res = this._replaceAll(`{${i}}`, i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
111
110
|
}
|
112
111
|
return res;
|
113
112
|
}
|
114
113
|
formatValue(key) {
|
115
114
|
let res = typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
116
115
|
for (let i = 0; i < (arguments.length <= 1 ? 0 : arguments.length - 1); i++) {
|
117
|
-
res = this._replaceAll(
|
116
|
+
res = this._replaceAll(`{${i}}`, i + 1 < 1 || arguments.length <= i + 1 ? undefined : arguments[i + 1], res);
|
118
117
|
}
|
119
118
|
return res;
|
120
119
|
}
|
@@ -127,17 +126,17 @@ export default class I18N {
|
|
127
126
|
getDpLang(code, value) {
|
128
127
|
let key;
|
129
128
|
if (typeof value === 'undefined') {
|
130
|
-
key =
|
129
|
+
key = `dp_${code}`.toLowerCase();
|
131
130
|
} else if (typeof value === 'boolean') {
|
132
131
|
const valStr = value ? 'on' : 'off';
|
133
|
-
key =
|
132
|
+
key = `dp_${code}_${valStr}`.toLowerCase();
|
134
133
|
} else {
|
135
|
-
key =
|
134
|
+
key = `dp_${code}_${value}`.toLowerCase();
|
136
135
|
}
|
137
136
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
138
137
|
}
|
139
138
|
getDpName(code, defaultName) {
|
140
|
-
const key =
|
139
|
+
const key = `dp_${code}`.toLowerCase();
|
141
140
|
return I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : defaultName;
|
142
141
|
}
|
143
142
|
getDpsLang(key) {
|
@@ -169,7 +168,7 @@ export default class I18N {
|
|
169
168
|
if (typeof schema === 'undefined') return result;
|
170
169
|
const lists = schema.range;
|
171
170
|
lists.map(v => {
|
172
|
-
const key =
|
171
|
+
const key = `dp_${dpCode}_${v}`.toLowerCase();
|
173
172
|
result[v] = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
174
173
|
return null;
|
175
174
|
});
|
@@ -183,12 +182,12 @@ export default class I18N {
|
|
183
182
|
* @param {*} power 设备当前的开关状态 (如果当前设备为开启状态, 则倒计时显示为关闭)
|
184
183
|
*/
|
185
184
|
parseCountdown(t, power) {
|
186
|
-
const h = parseFloat(
|
187
|
-
const m = parseFloat(
|
185
|
+
const h = parseFloat(`${t / 3600}`);
|
186
|
+
const m = parseFloat(`${t / 60 - h * 60}`);
|
188
187
|
const tHour = I18n.t('t_hour') !== 't_hour' ? I18n.t('t_hour') : typeof this.t_hour !== 'undefined' ? this.t_hour : I18n.t('t_hour');
|
189
188
|
const tMinute = I18n.t('t_minute') !== 't_minute' ? I18n.t('t_minute') : typeof this.t_minute !== 'undefined' ? this.t_minute : I18n.t('t_minute');
|
190
|
-
const time = h >= 1.0 ?
|
191
|
-
const key =
|
189
|
+
const time = h >= 1.0 ? `${Math.round(h)}${tHour}` : `${Math.round(m)}${tMinute}`;
|
190
|
+
const key = `countdown_${power ? 'on' : 'off'}`;
|
192
191
|
const str = I18n.t(key) !== key ? I18n.t(key) : typeof this[key] !== 'undefined' ? this[key] : I18n.t(key);
|
193
192
|
return this.formatString(str, time);
|
194
193
|
}
|
package/lib/panel/publishDps.js
CHANGED
@@ -25,7 +25,7 @@ export function sendDps(data) {
|
|
25
25
|
const codeIds = (devInfo === null || devInfo === void 0 ? void 0 : devInfo.codeIds) || {};
|
26
26
|
Object.keys(data).forEach(code => {
|
27
27
|
if (codeIds[code] !== undefined) {
|
28
|
-
dps[
|
28
|
+
dps[`${codeIds[code]}`] = data[code];
|
29
29
|
} else {
|
30
30
|
dps[code] = data[code];
|
31
31
|
}
|
package/lib/redirectTo/index.js
CHANGED
package/lib/utils.js
CHANGED
@@ -3,12 +3,12 @@ export function factory(name) {
|
|
3
3
|
return function () {
|
4
4
|
var _inst$opts$namespace;
|
5
5
|
if (opts.deprecated) {
|
6
|
-
console.warn(
|
6
|
+
console.warn(`该方法 ${name} 已弃用`);
|
7
7
|
}
|
8
8
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
9
9
|
const method = opts.namespace ? ((_inst$opts$namespace = inst[opts.namespace]) !== null && _inst$opts$namespace !== void 0 ? _inst$opts$namespace : {})[name] : inst[name];
|
10
10
|
if (!method) {
|
11
|
-
console.warn(
|
11
|
+
console.warn(`// TODO 暂未实现方法 ${opts.namespace ? opts.namespace + '.' : ''}${name}`);
|
12
12
|
return;
|
13
13
|
}
|
14
14
|
return method.apply(this, arguments);
|
@@ -17,11 +17,11 @@ export function factory(name) {
|
|
17
17
|
export function factoryContants(name) {
|
18
18
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
19
19
|
if (opts.deprecated) {
|
20
|
-
console.warn(
|
20
|
+
console.warn(`该变量 ${name} 已弃用`);
|
21
21
|
}
|
22
22
|
const inst = typeof ty === 'undefined' ? {} : ty;
|
23
23
|
if (!inst[name]) {
|
24
|
-
console.warn(
|
24
|
+
console.warn(`// TODO 暂未实现变量 ${name}`);
|
25
25
|
return;
|
26
26
|
}
|
27
27
|
return inst[name];
|
@@ -34,7 +34,7 @@ export function objectToUrlParams(obj) {
|
|
34
34
|
const value = obj[key];
|
35
35
|
const encodedKey = encodeURIComponent(key);
|
36
36
|
const encodedValue = encodeURIComponent(value);
|
37
|
-
params.push(
|
37
|
+
params.push(`${encodedKey}=${encodedValue}`);
|
38
38
|
}
|
39
39
|
}
|
40
40
|
return params.join('&');
|
package/lib/utils.wechat.js
CHANGED
@@ -5,7 +5,7 @@ export function factory(name) {
|
|
5
5
|
if (/(set|get|remove|clear)+Storage(Sync)?$/.test(name)) {
|
6
6
|
return function (option) {
|
7
7
|
if (opts.deprecated) {
|
8
|
-
console.warn(
|
8
|
+
console.warn(`该方法 ${name} 已弃用`);
|
9
9
|
}
|
10
10
|
// eslint-disable-next-line prefer-rest-params
|
11
11
|
return wx[name].call(this, option.key, option.data);
|
@@ -13,10 +13,10 @@ export function factory(name) {
|
|
13
13
|
}
|
14
14
|
return function () {
|
15
15
|
if (opts.deprecated) {
|
16
|
-
console.warn(
|
16
|
+
console.warn(`该方法 ${name} 已弃用`);
|
17
17
|
}
|
18
18
|
if (!tyWx[name] && !wx[name]) {
|
19
|
-
console.warn(
|
19
|
+
console.warn(`// TODO 暂未实现方法 wx.${name}`);
|
20
20
|
return;
|
21
21
|
}
|
22
22
|
// 优先取得 TTT 能力的方法
|
@@ -30,11 +30,11 @@ export function factory(name) {
|
|
30
30
|
export function factoryContants(name) {
|
31
31
|
let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
32
32
|
if (opts.deprecated) {
|
33
|
-
console.warn(
|
33
|
+
console.warn(`该变量 ${name} 已弃用`);
|
34
34
|
}
|
35
35
|
const inst = typeof wx === 'undefined' ? {} : wx;
|
36
36
|
if (!inst[name]) {
|
37
|
-
console.warn(
|
37
|
+
console.warn(`// TODO 暂未实现变量 ${name}`);
|
38
38
|
return;
|
39
39
|
}
|
40
40
|
return inst[name];
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.4.
|
3
|
+
"version": "1.4.31",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -29,13 +29,13 @@
|
|
29
29
|
"watch": "ray start --type=component"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@ray-js/framework": "
|
33
|
-
"@ray-js/router": "
|
32
|
+
"@ray-js/framework": "1.4.31",
|
33
|
+
"@ray-js/router": "1.4.31",
|
34
34
|
"@ray-js/wechat": "^0.0.33",
|
35
35
|
"base64-browser": "^1.0.1"
|
36
36
|
},
|
37
37
|
"devDependencies": {
|
38
|
-
"@ray-js/cli": "
|
38
|
+
"@ray-js/cli": "1.4.31",
|
39
39
|
"art-template": "^4.13.2",
|
40
40
|
"fs-extra": "^10.1.0",
|
41
41
|
"miniprogram-api-typings": "^3.12.2",
|
@@ -45,5 +45,5 @@
|
|
45
45
|
"access": "public",
|
46
46
|
"registry": "https://registry.npmjs.org"
|
47
47
|
},
|
48
|
-
"gitHead": "
|
48
|
+
"gitHead": "337923ae8d5c5b321da92271bba78c651d391c9b"
|
49
49
|
}
|