gxd-uni-library-editx 1.0.9 → 1.0.10-beta2
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 +1 -1
- package/src/components/XdBaiduMap/XdBaiduMap.vue +3 -3
- package/src/components/XdCityLocation/XdCityLocation.vue +17 -1
- package/src/components/XdCityShowApi/XdCityShowApi.vue +3 -2
- package/src/components/XdConfirm/XdConfirm.vue +2 -0
- package/src/components/XdLayout/XdLayout.vue +12 -2
- package/src/utils/xd.event.js +2 -1
- package/src/utils/xdh5log.js +57 -11
package/package.json
CHANGED
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
},
|
|
152
152
|
|
|
153
153
|
reLoad(){
|
|
154
|
-
if(this.count >
|
|
154
|
+
if(this.count > 5) {
|
|
155
155
|
let date = new Date();
|
|
156
156
|
this.$xdLog.setARMSCustomError('baidu_Location_fail', {
|
|
157
157
|
time: date.getTime(),
|
|
@@ -185,8 +185,8 @@
|
|
|
185
185
|
this.uiCenter = point;
|
|
186
186
|
this.location = location;
|
|
187
187
|
storage.set(this.threeLocationContentSave, location, 1/60)
|
|
188
|
-
this.LocationContent = `我的坐标:{lat:${location.latitude}, lng:${location.longitude}}
|
|
189
|
-
this.$emit('onLocationSuccess',location);
|
|
188
|
+
this.LocationContent = `我的坐标:{lat:${location.latitude}, lng:${location.longitude}}`;
|
|
189
|
+
this.$emit('onLocationSuccess', location);
|
|
190
190
|
},
|
|
191
191
|
(error) => {
|
|
192
192
|
this.reLoad();
|
|
@@ -82,6 +82,9 @@
|
|
|
82
82
|
backed: false,
|
|
83
83
|
initBaidu: false,
|
|
84
84
|
uiBaiduAk: '',
|
|
85
|
+
|
|
86
|
+
failStatus: false,
|
|
87
|
+
timeStatus: null,
|
|
85
88
|
}
|
|
86
89
|
},
|
|
87
90
|
created() {
|
|
@@ -110,6 +113,7 @@
|
|
|
110
113
|
init(){
|
|
111
114
|
|
|
112
115
|
if(this.stateLocation){
|
|
116
|
+
this.$xdLog.setProject('Location.cache', this.stateLocation);
|
|
113
117
|
this.$emit('done', this.stateLocation);
|
|
114
118
|
if(!this.showSwitchCity) return;
|
|
115
119
|
}
|
|
@@ -117,6 +121,12 @@
|
|
|
117
121
|
//#ifdef H5
|
|
118
122
|
if(this.baidu) {
|
|
119
123
|
this.initBaidu = true;
|
|
124
|
+
// 超时3秒
|
|
125
|
+
this.timeStatus = setTimeout(() => {
|
|
126
|
+
this.$emit('done', null);
|
|
127
|
+
this.failStatus = true;
|
|
128
|
+
this.$xdLog.setProject('Location.timeout', 'Location.timeout.3s');
|
|
129
|
+
}, 3000)
|
|
120
130
|
}
|
|
121
131
|
// #endif
|
|
122
132
|
},
|
|
@@ -139,7 +149,13 @@
|
|
|
139
149
|
if(this.backed) return;
|
|
140
150
|
this.backed = true;
|
|
141
151
|
this.setLocationInfo(this.location);
|
|
142
|
-
|
|
152
|
+
|
|
153
|
+
//超过3秒就不走这里的逻辑
|
|
154
|
+
if(this.failStatus === false) {
|
|
155
|
+
this.$xdLog.setProject('Location.done', this.location);
|
|
156
|
+
this.$emit('done', this.location);
|
|
157
|
+
clearTimeout(this.timeStatus);
|
|
158
|
+
}
|
|
143
159
|
},
|
|
144
160
|
|
|
145
161
|
handleBaiduInit(location){
|
|
@@ -93,9 +93,11 @@
|
|
|
93
93
|
async init(){
|
|
94
94
|
//缓存中获取用户定位信息
|
|
95
95
|
if (this.stateCity) {
|
|
96
|
+
this.$xdLog.setProject('Get.city.cache', {city: this.stateCity, location: this.stateLocation});
|
|
96
97
|
this.$emit("done", {city: this.stateCity, location: this.stateLocation});
|
|
97
98
|
} else {
|
|
98
99
|
await this.getCity();
|
|
100
|
+
this.$xdLog.setProject('Get.city.done', {city: this.stateCity, location: this.stateLocation});
|
|
99
101
|
this.$emit("done", {city: this.stateCity, location: this.stateLocation});
|
|
100
102
|
}
|
|
101
103
|
},
|
|
@@ -122,9 +124,9 @@
|
|
|
122
124
|
errMsg: 'request:fail timeout',
|
|
123
125
|
stateLocation: this.stateLocation
|
|
124
126
|
});
|
|
125
|
-
|
|
126
127
|
let cityInfo = this.$xdUniHelper.cloneDeep(this.$settings.defaultCity);
|
|
127
128
|
this.setCityInfo(cityInfo);
|
|
129
|
+
this.$xdLog.setProject('Get.city.timeout', {city: cityInfo, location: this.stateLocation});
|
|
128
130
|
status = true;
|
|
129
131
|
resolve()
|
|
130
132
|
}, time);
|
|
@@ -175,7 +177,6 @@
|
|
|
175
177
|
},
|
|
176
178
|
|
|
177
179
|
handleDone(location) {
|
|
178
|
-
console.log('location', location);
|
|
179
180
|
this.setLocationInfo(location);
|
|
180
181
|
this.init();
|
|
181
182
|
},
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
<view class="xd-input-confirm__body-btn">
|
|
33
33
|
<view>
|
|
34
34
|
<xd-button
|
|
35
|
+
:font-size="32"
|
|
35
36
|
v-if="confirm.cancel"
|
|
36
37
|
@click="handleConfirm('cancel')"
|
|
37
38
|
:type="confirm.cancelColorType"
|
|
@@ -43,6 +44,7 @@
|
|
|
43
44
|
</view>
|
|
44
45
|
<view>
|
|
45
46
|
<xd-button
|
|
47
|
+
:font-size="32"
|
|
46
48
|
@click="handleConfirm('confirm')"
|
|
47
49
|
v-if="confirm.confirm"
|
|
48
50
|
:type="confirm.confirmColorType"
|
|
@@ -438,12 +438,22 @@
|
|
|
438
438
|
},
|
|
439
439
|
|
|
440
440
|
//框架加载完成
|
|
441
|
-
layoutLoading(){
|
|
441
|
+
layoutLoading(value){
|
|
442
|
+
if(value === true) {
|
|
443
|
+
this.$xdLog.setProject('Layout.loading.done', {
|
|
444
|
+
time: new Date().getTime(),
|
|
445
|
+
timeString: new Date().toLocaleString(),
|
|
446
|
+
});
|
|
447
|
+
}
|
|
442
448
|
this.doneLayoutAndLocation()
|
|
443
449
|
},
|
|
444
450
|
|
|
445
451
|
//定位完成
|
|
446
452
|
locationStatus(){
|
|
453
|
+
this.$xdLog.setProject('Layout.location.done', {
|
|
454
|
+
time: new Date().getTime(),
|
|
455
|
+
timeString: new Date().toLocaleString(),
|
|
456
|
+
});
|
|
447
457
|
this.doneLayoutAndLocation()
|
|
448
458
|
}
|
|
449
459
|
},
|
|
@@ -532,7 +542,7 @@
|
|
|
532
542
|
if (this.locationStatus && this.layoutLoading) {
|
|
533
543
|
this.$emit('onDone', this.getLayoutInfo);
|
|
534
544
|
this.$emit('done', this.getLayoutInfo);
|
|
535
|
-
this.$xdLog.setProject('Layout.
|
|
545
|
+
this.$xdLog.setProject('Layout.done', {...this.getLayoutInfo, time: new Date().getTime() - this.startTime})
|
|
536
546
|
}
|
|
537
547
|
},
|
|
538
548
|
|
package/src/utils/xd.event.js
CHANGED
|
@@ -120,13 +120,14 @@ export class JfbEvent {
|
|
|
120
120
|
setTimeout(() => {
|
|
121
121
|
let refsObj = this.getRefs(ref);
|
|
122
122
|
if (refsObj && typeof refsObj['onCheck'] === 'function') {
|
|
123
|
+
this.vm.$xdLog.setProject('App.Event', this.eventName);
|
|
123
124
|
if (typeof refsObj[this.eventName] === 'function') {
|
|
124
125
|
refsObj[this.eventName](this.data);
|
|
125
126
|
}
|
|
126
127
|
} else {
|
|
127
128
|
handle()
|
|
128
129
|
}
|
|
129
|
-
},
|
|
130
|
+
}, 50)
|
|
130
131
|
};
|
|
131
132
|
handle();
|
|
132
133
|
}
|
package/src/utils/xdh5log.js
CHANGED
|
@@ -6,6 +6,24 @@ let logInstance = null;
|
|
|
6
6
|
import cookie from "@/common/cookie";
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
const random= (min, max)=>{
|
|
10
|
+
let Range = max - min;
|
|
11
|
+
let Rand = Math.random();
|
|
12
|
+
return (min + Math.round(Rand * Range));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const randomChar= (len)=>{
|
|
16
|
+
let arrstring = '_qwertyuiopasdfghjklzxcvbnm123456789QWERTYUIOPASDFGHJKLZXCVBNM'.split('');
|
|
17
|
+
let str = '';
|
|
18
|
+
for (let i = 0; i < len; i++) {
|
|
19
|
+
let index = random(0, arrstring.length - 1);
|
|
20
|
+
str += arrstring[index];
|
|
21
|
+
}
|
|
22
|
+
return str;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
9
27
|
/**
|
|
10
28
|
* @description 过滤上报url
|
|
11
29
|
* @returns {Function[]}
|
|
@@ -68,13 +86,14 @@ const __bl = BrowserLogger['singleton']({
|
|
|
68
86
|
sample:settings.aliSample,
|
|
69
87
|
pvSample: settings.aliPvSample,
|
|
70
88
|
disableHook: settings['aliDisableHook'] !== undefined ? settings['aliDisableHook'] : true, //禁用AJAX请求监听
|
|
71
|
-
behavior:
|
|
89
|
+
behavior: true, //是否为了便于排查错误而记录报错的用户行为。
|
|
72
90
|
enableSPA: settings['aliEnableSPA'] !== undefined ? settings['aliEnableSPA'] : false, //是否启动单页面上报pv日志
|
|
73
91
|
enableConsole: settings['aliEnableConsole'] !== undefined ? settings['aliEnableConsole'] : false, //是否劫持Console
|
|
74
92
|
sendResource: settings['aliSendResource'] !== undefined ? settings['aliSendResource'] : true,//静态资源错误上报
|
|
75
93
|
autoSendPerf: settings['aliAutoSendPerf'] !== undefined ? settings['aliAutoSendPerf'] : true, //性能和api分析日志
|
|
76
94
|
appType: "web",
|
|
77
95
|
imgUrl: "https://arms-retcode.aliyuncs.com/r.png?",
|
|
96
|
+
c1: randomChar(32),
|
|
78
97
|
ignore: {
|
|
79
98
|
ignoreUrls: ignoreUrls(),
|
|
80
99
|
ignoreApis: ignoreApis(),
|
|
@@ -86,7 +105,8 @@ const __bl = BrowserLogger['singleton']({
|
|
|
86
105
|
|
|
87
106
|
class Logs {
|
|
88
107
|
constructor(){
|
|
89
|
-
this.initH5GlobalEvent()
|
|
108
|
+
this.initH5GlobalEvent();
|
|
109
|
+
this.timeReportBehavior = null;
|
|
90
110
|
}
|
|
91
111
|
|
|
92
112
|
/**
|
|
@@ -126,7 +146,7 @@ class Logs {
|
|
|
126
146
|
* @param params {*} 上传数据对象
|
|
127
147
|
* @param eventName {string} 事件名字
|
|
128
148
|
*/
|
|
129
|
-
setARMSInfo(params, eventName='default') {
|
|
149
|
+
setARMSInfo(params, eventName='default', c2) {
|
|
130
150
|
if (Object.prototype.toString.call(params) === '[object Object]'
|
|
131
151
|
|| Object.prototype.toString.call(params) === '[object Array]'
|
|
132
152
|
) {
|
|
@@ -137,15 +157,41 @@ class Logs {
|
|
|
137
157
|
__bl.custom({data: params, c1: eventName})
|
|
138
158
|
}
|
|
139
159
|
|
|
160
|
+
getParams(data){
|
|
161
|
+
if (Object.prototype.toString.call(data) === '[object Array]') {
|
|
162
|
+
return data.join('--');
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if(Object.prototype.toString.call(data) === '[object Object]') {
|
|
166
|
+
return data = Object.keys(data).map(k=>{
|
|
167
|
+
let d = data[k];
|
|
168
|
+
if(Object.prototype.toString.call(d) === '[object Array]' || Object.prototype.toString.call(d) === '[object Object]') {
|
|
169
|
+
d = JSON.stringify(data[k]);
|
|
170
|
+
}
|
|
171
|
+
return `${k}.${d}`;
|
|
172
|
+
}).join('---')
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return data
|
|
176
|
+
}
|
|
177
|
+
|
|
140
178
|
setProject(pos, params){
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
179
|
+
params = this.getParams(params);
|
|
180
|
+
__bl.addBehavior({
|
|
181
|
+
data: {
|
|
182
|
+
name: pos,
|
|
183
|
+
message: params,
|
|
184
|
+
},
|
|
185
|
+
page: window.location.path
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
if(this.timeReportBehavior) {
|
|
189
|
+
clearTimeout(this.timeReportBehavior);
|
|
190
|
+
this.timeReportBehavior = null
|
|
191
|
+
}
|
|
192
|
+
this.timeReportBehavior = setTimeout(()=>{
|
|
193
|
+
__bl.reportBehavior();
|
|
194
|
+
}, 10000)
|
|
149
195
|
}
|
|
150
196
|
|
|
151
197
|
getARMS(){
|