@tmsfe/tms-core 0.0.34 → 0.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tmsfe/tms-core",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "tms运行时框架",
5
5
  "repository": {
6
6
  "type": "git",
@@ -53,7 +53,7 @@ function getBaseData(deviceData: IDeviceData): { arr: DataItem[], nextIndex: num
53
53
  arr[23] = page.route;
54
54
  // 24: f24,当前页面的query
55
55
  arr[24] = JSON.stringify(page.options);
56
- // 25 ~ 30: 预留字典给后续扩展使用
56
+ // 25 ~ 30: 预留字段给后续扩展使用
57
57
  // 31 ~ 40: 提供给开发自定义
58
58
  // --------------------------字段列表--------------------------
59
59
  return { arr, nextIndex: 31 };
@@ -117,6 +117,11 @@ function getAppScene(): string {
117
117
  return scene.toString();
118
118
  }
119
119
 
120
+ // 给非空字段都encodeURIComponent一下
121
+ function encodeItems(arr: DataItem[]): DataItem[] {
122
+ return arr.map(t => t ? encodeURIComponent(t) : t);
123
+ }
124
+
120
125
  // 是否爬虫
121
126
  let isCrawler: boolean | null = null;
122
127
 
@@ -202,6 +207,7 @@ function getDeviceData(): Promise<IDeviceData> {
202
207
  export default {
203
208
  init,
204
209
  getTms,
210
+ encodeItems,
205
211
  getInitOptions,
206
212
  getSystemInfo,
207
213
  getSystemInfoString,
@@ -73,7 +73,7 @@ function requestFail(batch: DataItem[][]): void {
73
73
  */
74
74
  function send(arr: DataItem[]): void {
75
75
  stopTimer();
76
- cacheArr.unshift(arr); // 如果队列中很多,排前面比较稳妥
76
+ cacheArr.unshift(helper.encodeItems(arr)); // 如果队列中很多,排前面比较稳妥
77
77
  batchSendData();
78
78
  }
79
79
 
@@ -82,7 +82,7 @@ function send(arr: DataItem[]): void {
82
82
  * @param arr
83
83
  */
84
84
  function queue(arr: DataItem[]): void {
85
- cacheArr.push(arr);
85
+ cacheArr.push(helper.encodeItems(arr));
86
86
  checkQueue(false);
87
87
  }
88
88