fix: 修复Bonree监控脚本加载问题并优化用户ID检查
This commit is contained in:
@@ -18,10 +18,9 @@
|
||||
@RenderSection("CSS", false)
|
||||
|
||||
<script src="~/statics/bundles/jquery.js?v=@(HtmlUtil.JsVersion)"></script>
|
||||
<script src="/BonreeSDK_JS_2.5.1_min.esm.js" type="module"></script>
|
||||
|
||||
<script>
|
||||
(function () {
|
||||
<script type="module">
|
||||
(async function () {
|
||||
const bonreeConfig = {
|
||||
appId: "@Configuration["Tracking:bonree:appId"]",
|
||||
uploadAddrHttp: "@Configuration["Tracking:bonree:uploadAddrHttp"]",
|
||||
@@ -43,7 +42,13 @@
|
||||
console.warn('Bonree appId or uploadAddrHttp or uploadAddrHttps missing, skip init');
|
||||
return;
|
||||
}
|
||||
window.BonreeAgent.BonreeStart(config);
|
||||
const BonreeModule = await import('/BonreeSDK_JS_2.5.1_min.esm.js');
|
||||
const BonreeAgent = BonreeModule.BonreeAgent || window.BonreeAgent;
|
||||
if (!BonreeAgent || !BonreeAgent.BonreeStart) {
|
||||
console.warn('BonreeAgent or BonreeAgent.BonreeStart missing, skip init');
|
||||
return;
|
||||
}
|
||||
BonreeAgent.BonreeStart(config);
|
||||
window.bonreeApplyUser = function (userId, userName) {
|
||||
if (!userId || !window.bonreeJsBridge) return;
|
||||
window.bonreeJsBridge.setUserID(userId);
|
||||
@@ -52,7 +57,7 @@
|
||||
}
|
||||
};
|
||||
|
||||
if ('@CurUser?.UserId') {
|
||||
if ('@CurUser.OaAccount') {
|
||||
window.bonreeApplyUser('@CurUser.OaAccount', '@CurUser.UserName');
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user