@smart100/spu-web-plugin 0.0.31 → 0.0.32
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/dist/spu-web-plugin.mjs +137 -56
- package/package.json +2 -2
- package/src/apaasSpuTrack.ts +5 -4
- package/src/package/ali-oss/aliyun-oss-sdk.js +25121 -25121
- package/src/package/ali-oss/aliyun-oss-sdk.min.js +14 -14
- package/src/package/ali-oss/package.json +162 -162
package/dist/spu-web-plugin.mjs
CHANGED
|
@@ -708,7 +708,7 @@ function _toPropertyKey$1(arg) {
|
|
|
708
708
|
return typeof key === "symbol" ? key : String(key);
|
|
709
709
|
}
|
|
710
710
|
|
|
711
|
-
var version = "0.0.
|
|
711
|
+
var version = "0.0.32";
|
|
712
712
|
|
|
713
713
|
/** Detect free variable `global` from Node.js. */
|
|
714
714
|
var freeGlobal$2 = typeof global == 'object' && global && global.Object === Object && global;
|
|
@@ -12106,6 +12106,7 @@ var WxworksuiteBaseOpendata = /*#__PURE__*/function (_LitElement) {
|
|
|
12106
12106
|
_this.type = ''; // userName | departmentName
|
|
12107
12107
|
_this.mode = 'close'; // open | close
|
|
12108
12108
|
_this._isCanUseWxworkSuite = true;
|
|
12109
|
+
_this._isRealOpenid = true;
|
|
12109
12110
|
_this._topWWOpenData = null;
|
|
12110
12111
|
return _this;
|
|
12111
12112
|
}
|
|
@@ -12119,37 +12120,12 @@ var WxworksuiteBaseOpendata = /*#__PURE__*/function (_LitElement) {
|
|
|
12119
12120
|
key: "connectedCallback",
|
|
12120
12121
|
value: function () {
|
|
12121
12122
|
var _connectedCallback = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12122
|
-
var _this2 = this;
|
|
12123
12123
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12124
12124
|
while (1) switch (_context.prev = _context.next) {
|
|
12125
12125
|
case 0:
|
|
12126
12126
|
_get(_getPrototypeOf(WxworksuiteBaseOpendata.prototype), "connectedCallback", this).call(this);
|
|
12127
12127
|
// console.log('connectedCallback')
|
|
12128
|
-
|
|
12129
|
-
var topWWOpenData = _ref.topWWOpenData;
|
|
12130
|
-
_this2._isCanUseWxworkSuite = true;
|
|
12131
|
-
if (_this2.wwopendataRef) {
|
|
12132
|
-
if (topWWOpenData) {
|
|
12133
|
-
_this2._topWWOpenData = topWWOpenData;
|
|
12134
|
-
topWWOpenData.bind(_this2.wwopendataRef);
|
|
12135
|
-
// topWWOpenData.on('update', (event: any) => {
|
|
12136
|
-
// const openid = event.detail.element.getAttribute('openid')
|
|
12137
|
-
// console.log('渲染数据发生变更', event, openid)
|
|
12138
|
-
// if (this.type === 'departmentName') {
|
|
12139
|
-
// console.log('渲染数据发生变更', event)
|
|
12140
|
-
// console.log('渲染数据发生变更', openid)
|
|
12141
|
-
// }
|
|
12142
|
-
// })
|
|
12143
|
-
topWWOpenData.on('error', function (event) {
|
|
12144
|
-
// console.error('获取数据失败', event)
|
|
12145
|
-
_this2._isCanUseWxworkSuite = false;
|
|
12146
|
-
});
|
|
12147
|
-
}
|
|
12148
|
-
}
|
|
12149
|
-
})["catch"](function (err) {
|
|
12150
|
-
// console.error('jssdk.init() fail', err)
|
|
12151
|
-
_this2._isCanUseWxworkSuite = false;
|
|
12152
|
-
});
|
|
12128
|
+
this._deal();
|
|
12153
12129
|
case 2:
|
|
12154
12130
|
case "end":
|
|
12155
12131
|
return _context.stop();
|
|
@@ -12166,10 +12142,8 @@ var WxworksuiteBaseOpendata = /*#__PURE__*/function (_LitElement) {
|
|
|
12166
12142
|
value: function updated(changedProperties) {
|
|
12167
12143
|
// 页面在浏览器,在 iOS,Mac,Android 上面的企业微信都表现正常,但是在 windows 企业微信下,会偶发不能渲染通讯录控件内容
|
|
12168
12144
|
// 解答:由于 企业微信的 windows 客户端浏览器内核不支持 customElements,每次更新了 open-data 元素后,需要用 bind 或者 bindAll 接口对目标元素进行一次更新,这样才能保证 open-data 元素实时渲染正确的数据。遇到上面的情况,请检查一下页面代码,看看有没有可能出现时序问题:先执行了 bind,然后才渲染出对应的 open-data 元素
|
|
12169
|
-
if (changedProperties.has('openid')) {
|
|
12170
|
-
|
|
12171
|
-
this._topWWOpenData.bind(this.wwopendataRef);
|
|
12172
|
-
}
|
|
12145
|
+
if (changedProperties.has('openid') || changedProperties.has('type')) {
|
|
12146
|
+
this._deal();
|
|
12173
12147
|
}
|
|
12174
12148
|
}
|
|
12175
12149
|
// private test (e: Event) {
|
|
@@ -12182,6 +12156,45 @@ var WxworksuiteBaseOpendata = /*#__PURE__*/function (_LitElement) {
|
|
|
12182
12156
|
// console.log(value)
|
|
12183
12157
|
// this._isCanUseWxworkSuite = !this._isCanUseWxworkSuite
|
|
12184
12158
|
// }
|
|
12159
|
+
}, {
|
|
12160
|
+
key: "_deal",
|
|
12161
|
+
value: function _deal() {
|
|
12162
|
+
var _this2 = this;
|
|
12163
|
+
if (this.type === 'userName') {
|
|
12164
|
+
this._isRealOpenid = this.openid.length >= 32 && !/[\u4e00-\u9fa5]/g.test(this.openid);
|
|
12165
|
+
} else if (this.type === 'departmentName') {
|
|
12166
|
+
this._isRealOpenid = Number.isInteger(Number(this.openid));
|
|
12167
|
+
}
|
|
12168
|
+
jssdk.init().then(function (_ref) {
|
|
12169
|
+
var topWWOpenData = _ref.topWWOpenData;
|
|
12170
|
+
_this2._isCanUseWxworkSuite = true;
|
|
12171
|
+
setTimeout(function () {
|
|
12172
|
+
if (_this2.wwopendataRef) {
|
|
12173
|
+
if (topWWOpenData) {
|
|
12174
|
+
_this2._topWWOpenData = topWWOpenData;
|
|
12175
|
+
topWWOpenData.bind(_this2.wwopendataRef);
|
|
12176
|
+
// topWWOpenData.on('update', (event: any) => {
|
|
12177
|
+
// const openid = event.detail.element.getAttribute('openid')
|
|
12178
|
+
// console.log('渲染数据发生变更', event, openid)
|
|
12179
|
+
// if (this.type === 'departmentName') {
|
|
12180
|
+
// console.log('渲染数据发生变更', event)
|
|
12181
|
+
// console.log('渲染数据发生变更', openid)
|
|
12182
|
+
// }
|
|
12183
|
+
// })
|
|
12184
|
+
topWWOpenData.on('error', function (event) {
|
|
12185
|
+
// console.error('获取数据失败', event)
|
|
12186
|
+
_this2._isCanUseWxworkSuite = false;
|
|
12187
|
+
_this2._topWWOpenData = null;
|
|
12188
|
+
});
|
|
12189
|
+
}
|
|
12190
|
+
}
|
|
12191
|
+
}, 0);
|
|
12192
|
+
})["catch"](function (err) {
|
|
12193
|
+
// console.error('jssdk.init() fail', err)
|
|
12194
|
+
_this2._isCanUseWxworkSuite = false;
|
|
12195
|
+
_this2._topWWOpenData = null;
|
|
12196
|
+
});
|
|
12197
|
+
}
|
|
12185
12198
|
}, {
|
|
12186
12199
|
key: "getValue",
|
|
12187
12200
|
value: function getValue() {
|
|
@@ -12217,7 +12230,7 @@ var WxworksuiteBaseOpendata = /*#__PURE__*/function (_LitElement) {
|
|
|
12217
12230
|
// <button @click="${this.test}">test</button>
|
|
12218
12231
|
// ${this._isCanUseWxworkSuite ? html`<ww-open-data type="${this.type}" openid="${this.openid}" mode="${this.mode}" />` : this.openid}
|
|
12219
12232
|
// ${ this._isCanUseWxworkSuite ? html`true` : 'false' }
|
|
12220
|
-
return x(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n ", "\n "])), this._isCanUseWxworkSuite ? x(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["<ww-open-data type=\"", "\" openid=\"", "\" mode=\"", "\" />"])), this.type, this.openid, this.mode) : this.openid);
|
|
12233
|
+
return x(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n ", "\n "])), this._isCanUseWxworkSuite && this._isRealOpenid ? x(_templateObject2$5 || (_templateObject2$5 = _taggedTemplateLiteral(["<ww-open-data type=\"", "\" openid=\"", "\" mode=\"", "\" />"])), this.type, this.openid, this.mode) : this.openid);
|
|
12221
12234
|
}
|
|
12222
12235
|
}], [{
|
|
12223
12236
|
key: "register",
|
|
@@ -12242,6 +12255,7 @@ __decorate([n$1({
|
|
|
12242
12255
|
type: String
|
|
12243
12256
|
})], WxworksuiteBaseOpendata.prototype, "mode", void 0);
|
|
12244
12257
|
__decorate([r$1()], WxworksuiteBaseOpendata.prototype, "_isCanUseWxworkSuite", void 0);
|
|
12258
|
+
__decorate([r$1()], WxworksuiteBaseOpendata.prototype, "_isRealOpenid", void 0);
|
|
12245
12259
|
__decorate([r$1()], WxworksuiteBaseOpendata.prototype, "_topWWOpenData", void 0);
|
|
12246
12260
|
|
|
12247
12261
|
/**
|
|
@@ -12574,9 +12588,25 @@ var WxworksuiteTree = /*#__PURE__*/function (_LitElement) {
|
|
|
12574
12588
|
} else {
|
|
12575
12589
|
_this._searchlist = _this._list.filter(function (item) {
|
|
12576
12590
|
if (_this.wwopendatatype !== 'expression') {
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12591
|
+
if (_this.wwopendatatype === 'userName') {
|
|
12592
|
+
var isRealOpenid = item.name.length >= 32 && !/[\u4e00-\u9fa5]/g.test(item.name);
|
|
12593
|
+
if (isRealOpenid) {
|
|
12594
|
+
return searchOptions.some(function (item2) {
|
|
12595
|
+
return item2.id.toString() === item.name.toString();
|
|
12596
|
+
});
|
|
12597
|
+
} else {
|
|
12598
|
+
return item.name.indexOf(_this._searchvalue) !== -1;
|
|
12599
|
+
}
|
|
12600
|
+
} else if (_this.wwopendatatype === 'departmentName') {
|
|
12601
|
+
var _isRealOpenid = Number.isInteger(Number(item.name));
|
|
12602
|
+
if (_isRealOpenid) {
|
|
12603
|
+
return searchOptions.some(function (item2) {
|
|
12604
|
+
return item2.id.toString() === item.name.toString();
|
|
12605
|
+
});
|
|
12606
|
+
} else {
|
|
12607
|
+
return item.name.indexOf(_this._searchvalue) !== -1;
|
|
12608
|
+
}
|
|
12609
|
+
}
|
|
12580
12610
|
} else {
|
|
12581
12611
|
// return searchOptions.some((item2: any) => item.name.toString().indexOf(item2.id.toString()) !== -1)
|
|
12582
12612
|
var arr = getExpressionArr(item.name);
|
|
@@ -13272,6 +13302,7 @@ var WxworksuiteOrganizationpickMobile = /*#__PURE__*/function (_LitElement) {
|
|
|
13272
13302
|
_this.displaytype = 'mobile';
|
|
13273
13303
|
_this.ismulselect = false;
|
|
13274
13304
|
_this.issearch = true;
|
|
13305
|
+
_this.userule = true;
|
|
13275
13306
|
_this.searchplaceholder = '请输入关键字搜索';
|
|
13276
13307
|
// normal 父子有关联 共同取值 半选不取
|
|
13277
13308
|
// individual 父子无关联 各自独立取值
|
|
@@ -13285,14 +13316,32 @@ var WxworksuiteOrganizationpickMobile = /*#__PURE__*/function (_LitElement) {
|
|
|
13285
13316
|
_this.singleselectmode = 'normal';
|
|
13286
13317
|
_this._expandicon = 'organization';
|
|
13287
13318
|
_this._list = [];
|
|
13288
|
-
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13319
|
+
// axios.post('/api/teapi/dy-biz/100000000000000000/110000000000000000', {
|
|
13320
|
+
// pl_orgstruct: {
|
|
13321
|
+
// status: '1'
|
|
13322
|
+
// }
|
|
13323
|
+
// }).then((res: any) => {
|
|
13324
|
+
// // console.log(res)
|
|
13325
|
+
// const list = res?.data?.pl_orgstruct || []
|
|
13326
|
+
// list.forEach((item: any) => {
|
|
13327
|
+
// item.name = item.orgname
|
|
13328
|
+
// // item.name = '1'
|
|
13329
|
+
// item.id = item.orgstructid
|
|
13330
|
+
// item.pid = item.parentorgstructid
|
|
13331
|
+
// })
|
|
13332
|
+
// this._list = list
|
|
13333
|
+
// })
|
|
13334
|
+
normalAxios$1.post('/api/system/v1.0/org/page', {
|
|
13335
|
+
showchild: true,
|
|
13336
|
+
orgstructtypeid: 1,
|
|
13337
|
+
useRule: _this.userule,
|
|
13338
|
+
pageindex: 1,
|
|
13339
|
+
pagesize: 99999,
|
|
13340
|
+
getAllStatus: false // 是否获取全部数据(即包含禁用)
|
|
13292
13341
|
}).then(function (res) {
|
|
13293
13342
|
var _res$data;
|
|
13294
13343
|
// console.log(res)
|
|
13295
|
-
var list = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.
|
|
13344
|
+
var list = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
|
|
13296
13345
|
list.forEach(function (item) {
|
|
13297
13346
|
item.name = item.orgname;
|
|
13298
13347
|
// item.name = '1'
|
|
@@ -13395,6 +13444,9 @@ __decorate([n$1({
|
|
|
13395
13444
|
__decorate([n$1({
|
|
13396
13445
|
type: Boolean
|
|
13397
13446
|
})], WxworksuiteOrganizationpickMobile.prototype, "issearch", void 0);
|
|
13447
|
+
__decorate([n$1({
|
|
13448
|
+
type: Boolean
|
|
13449
|
+
})], WxworksuiteOrganizationpickMobile.prototype, "userule", void 0);
|
|
13398
13450
|
__decorate([n$1({
|
|
13399
13451
|
type: String
|
|
13400
13452
|
})], WxworksuiteOrganizationpickMobile.prototype, "searchplaceholder", void 0);
|
|
@@ -13447,6 +13499,7 @@ var WxworksuiteMemberpickMobile = /*#__PURE__*/function (_LitElement) {
|
|
|
13447
13499
|
_this.displaytype = 'mobile';
|
|
13448
13500
|
_this.ismulselect = false;
|
|
13449
13501
|
_this.issearch = true;
|
|
13502
|
+
_this.userule = true;
|
|
13450
13503
|
_this.searchplaceholder = '请输入关键字搜索';
|
|
13451
13504
|
// normal 父子有关联 共同取值 半选不取
|
|
13452
13505
|
// individual 父子无关联 各自独立取值
|
|
@@ -13459,22 +13512,47 @@ var WxworksuiteMemberpickMobile = /*#__PURE__*/function (_LitElement) {
|
|
|
13459
13512
|
// disable 不能选非末级节点 只能选末级节点 暂不实现
|
|
13460
13513
|
_this.singleselectmode = 'normal';
|
|
13461
13514
|
_this._list = [];
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
|
|
13465
|
-
|
|
13466
|
-
|
|
13467
|
-
|
|
13468
|
-
|
|
13469
|
-
|
|
13515
|
+
// axios.post('/api/teapi/dy-biz/1032470355689738336/1273067686762516579', {
|
|
13516
|
+
// member: {
|
|
13517
|
+
// searchkey: '',
|
|
13518
|
+
// orglimit: '',
|
|
13519
|
+
// orgstructid: '',
|
|
13520
|
+
// email: '',
|
|
13521
|
+
// includechild: '1'
|
|
13522
|
+
// }
|
|
13523
|
+
// }).then((res: any) => {
|
|
13524
|
+
// // console.log(res)
|
|
13525
|
+
// const list = res?.data?.member || []
|
|
13526
|
+
// list.forEach((item: any, index: number) => {
|
|
13527
|
+
// item.name = `__$$wwopendata(${item.userinfoname}, userName)(${item.positionname})`
|
|
13528
|
+
// // item.name = `__$$wwopendata(${item.userinfoname}, userName)(${item.positionname})__$$wwopendata(哈哈+${index}, departmentName)`
|
|
13529
|
+
// item.id = item.memberid
|
|
13530
|
+
// item.pid = ''
|
|
13531
|
+
// item.iswwopendata = true
|
|
13532
|
+
// item.wwopendatatype = 'expression'
|
|
13533
|
+
// })
|
|
13534
|
+
// this._list = list
|
|
13535
|
+
// })
|
|
13536
|
+
normalAxios$1.post('/api/system/v1.0/member/getMemberList', {
|
|
13537
|
+
name: '',
|
|
13538
|
+
phoneNumber: '',
|
|
13539
|
+
saleAreaCodePath: '',
|
|
13540
|
+
positionName: '',
|
|
13541
|
+
pageindex: 1,
|
|
13542
|
+
pagesize: 99999,
|
|
13543
|
+
// useRule: false, // 使用数据权限
|
|
13544
|
+
// useRule: this.userule, // 使用数据权限
|
|
13545
|
+
appcode: 'sales',
|
|
13546
|
+
belongDistributorId: ''
|
|
13470
13547
|
}).then(function (res) {
|
|
13471
13548
|
var _res$data;
|
|
13472
13549
|
// console.log(res)
|
|
13473
|
-
|
|
13550
|
+
// debugger
|
|
13551
|
+
var list = (res === null || res === void 0 || (_res$data = res.data) === null || _res$data === void 0 || (_res$data = _res$data.data) === null || _res$data === void 0 ? void 0 : _res$data.list) || [];
|
|
13474
13552
|
list.forEach(function (item, index) {
|
|
13475
|
-
item.name = "__$$wwopendata(".concat(item.
|
|
13476
|
-
// item.name = `__$$wwopendata(${item.
|
|
13477
|
-
item.id = item.
|
|
13553
|
+
item.name = "__$$wwopendata(".concat(item.userName, ", userName)(").concat(item.positionName, ")");
|
|
13554
|
+
// item.name = `__$$wwopendata(${item.userName}, userName)(${item.positionName})__$$wwopendata(哈哈+${index}, departmentName)`
|
|
13555
|
+
item.id = item.memberId;
|
|
13478
13556
|
item.pid = '';
|
|
13479
13557
|
item.iswwopendata = true;
|
|
13480
13558
|
item.wwopendatatype = 'expression';
|
|
@@ -13575,6 +13653,9 @@ __decorate([n$1({
|
|
|
13575
13653
|
__decorate([n$1({
|
|
13576
13654
|
type: Boolean
|
|
13577
13655
|
})], WxworksuiteMemberpickMobile.prototype, "issearch", void 0);
|
|
13656
|
+
__decorate([n$1({
|
|
13657
|
+
type: Boolean
|
|
13658
|
+
})], WxworksuiteMemberpickMobile.prototype, "userule", void 0);
|
|
13578
13659
|
__decorate([n$1({
|
|
13579
13660
|
type: String
|
|
13580
13661
|
})], WxworksuiteMemberpickMobile.prototype, "searchplaceholder", void 0);
|
|
@@ -59353,7 +59434,7 @@ var getIndextagSync = function getIndextagSync(params) {
|
|
|
59353
59434
|
var initApaasSpuTrack = function initApaasSpuTrack() {
|
|
59354
59435
|
setTimeout(function () {
|
|
59355
59436
|
var _window, _window2;
|
|
59356
|
-
if (ApaasSpuTrack && !window.apaasSpuTrack && !((_window = window) !== null && _window !== void 0 && (_window = _window.aPaaS) !== null && _window !== void 0 && _window.getWebInitParams) && !((_window2 = window) !== null && _window2 !== void 0 && (_window2 = _window2.Module) !== null && _window2 !== void 0 && _window2.getIndextagSync)) {
|
|
59437
|
+
if (ApaasSpuTrack && !window.apaasSpuTrack && !((_window = window) !== null && _window !== void 0 && (_window = _window.aPaaS) !== null && _window !== void 0 && _window.getWebInitParams) && !((_window2 = window) !== null && _window2 !== void 0 && (_window2 = _window2.Module) !== null && _window2 !== void 0 && _window2.getIndextagSync) && login.checkLogin() && getUser()) {
|
|
59357
59438
|
window.aPaaS = {
|
|
59358
59439
|
getWebInitParams: getWebInitParams
|
|
59359
59440
|
};
|
|
@@ -59437,10 +59518,10 @@ var initApaasSpuTrack = function initApaasSpuTrack() {
|
|
|
59437
59518
|
apaasSpuTrack.start();
|
|
59438
59519
|
});
|
|
59439
59520
|
}
|
|
59440
|
-
},
|
|
59521
|
+
}, 3000);
|
|
59441
59522
|
};
|
|
59442
59523
|
var apaasSpuTrackSendLog = function apaasSpuTrackSendLog(data) {
|
|
59443
|
-
var
|
|
59524
|
+
var isnotretry = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
59444
59525
|
if (window.apaasSpuTrack) {
|
|
59445
59526
|
var logtime = Date.now().toString();
|
|
59446
59527
|
var baselog = cloneDeep$1(_objectSpread2$1(_objectSpread2$1({}, window.apaasSpuTrack.baseLog), {}, {
|
|
@@ -59467,7 +59548,7 @@ var apaasSpuTrackSendLog = function apaasSpuTrackSendLog(data) {
|
|
|
59467
59548
|
// debugger
|
|
59468
59549
|
window.apaasSpuTrack.addLogToQueue(mergedata, true);
|
|
59469
59550
|
} else {
|
|
59470
|
-
if (!
|
|
59551
|
+
if (!isnotretry) {
|
|
59471
59552
|
console.warn('window.apaasSpuTrack 不存在,导出日志延迟3秒后再次发送。');
|
|
59472
59553
|
setTimeout(function () {
|
|
59473
59554
|
apaasSpuTrackSendLog(data, true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smart100/spu-web-plugin",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.32",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "npm run build:types && rollup -c -w",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@amap/amap-jsapi-loader": "^1.0.1",
|
|
41
|
-
"@smart100/wxworksuite-plugin": "^0.0.
|
|
41
|
+
"@smart100/wxworksuite-plugin": "^0.0.11",
|
|
42
42
|
"axios": "^1.6.0",
|
|
43
43
|
"co": "^4.6.0",
|
|
44
44
|
"dayjs": "^1.11.10",
|
package/src/apaasSpuTrack.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { globalOptions, getUser, Module } from './index'
|
|
2
2
|
import { cloneDeep, merge } from 'lodash-es'
|
|
3
|
+
import login from './login'
|
|
3
4
|
|
|
4
5
|
// @ts-ignore
|
|
5
6
|
import ApaasSpuTrack from './package/apaas-track/apaas-spu/index.umd.js'
|
|
@@ -55,7 +56,7 @@ const getIndextagSync = (params: any) => {
|
|
|
55
56
|
// 兼容开启SPU日志
|
|
56
57
|
const initApaasSpuTrack = () => {
|
|
57
58
|
setTimeout(() => {
|
|
58
|
-
if (ApaasSpuTrack && !window.apaasSpuTrack && !window?.aPaaS?.getWebInitParams && !window?.Module?.getIndextagSync) {
|
|
59
|
+
if (ApaasSpuTrack && !window.apaasSpuTrack && !window?.aPaaS?.getWebInitParams && !window?.Module?.getIndextagSync && login.checkLogin() && getUser()) {
|
|
59
60
|
window.aPaaS = {
|
|
60
61
|
getWebInitParams
|
|
61
62
|
}
|
|
@@ -147,10 +148,10 @@ const initApaasSpuTrack = () => {
|
|
|
147
148
|
apaasSpuTrack.start()
|
|
148
149
|
})
|
|
149
150
|
}
|
|
150
|
-
},
|
|
151
|
+
}, 3000)
|
|
151
152
|
}
|
|
152
153
|
|
|
153
|
-
const apaasSpuTrackSendLog = (data: any,
|
|
154
|
+
const apaasSpuTrackSendLog = (data: any, isnotretry: boolean = false) => {
|
|
154
155
|
if (window.apaasSpuTrack) {
|
|
155
156
|
const logtime = Date.now().toString()
|
|
156
157
|
const baselog = cloneDeep({
|
|
@@ -178,7 +179,7 @@ const apaasSpuTrackSendLog = (data: any, end: boolean = false) => {
|
|
|
178
179
|
// debugger
|
|
179
180
|
window.apaasSpuTrack.addLogToQueue(mergedata, true)
|
|
180
181
|
} else {
|
|
181
|
-
if (!
|
|
182
|
+
if (!isnotretry) {
|
|
182
183
|
console.warn('window.apaasSpuTrack 不存在,导出日志延迟3秒后再次发送。')
|
|
183
184
|
setTimeout(() => {
|
|
184
185
|
apaasSpuTrackSendLog(data, true)
|