You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

124 lines
4.5 KiB

var loginKickUrl = "/webroot/decisoin/ssologout";
var t;
t = BI.inherit(BI.OB, {
showLastLoginInfo: function () {
Dec.system.loginInfoRemind && !BI.Cache.getCookie(DecCst.Cookie.LAST_LOGIN_INFO) && Dec.Utils.getLastLoginInfo((function (e) {
if (e.data) {
var t = e.data;
Dec.Msg.pop({
type: "dec.components.login.last.info",
time: t.time,
ip: t.ip,
address: t.city
}, {
height: 170,
width: 300
}),
BI.Cache.addCookie(DecCst.Cookie.LAST_LOGIN_INFO, !0, Dec.system.cookiePath, -1)
}
}))
},
loginKick: function (t, i) {
function e(e, t, i) {
return t in e ? Object.defineProperty(e, t, {
value: i,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[t] = i,
e
};
var n;
BI.contains([DecCst.ErrorCode.SINGLE_LOGIN_KICK], t) && Dec.Utils.clearLoginToken(),
BI.isNotNull(Dec.socket) && Dec.socket.disconnect();
var o = i || (n = {}, e(n, DecCst.ErrorCode.PLATFORM_USER_REMOVE, "Dec-Login_Account_Not_Available"), e(n, DecCst.ErrorCode.SINGLE_LOGIN_KICK, "Dec-Login_Single_Logged_Tip"), e(n, DecCst.ErrorCode.USERNAME_PASSWORD_ERROR, "Dec-Login_Password_Changed"), e(n, DecCst.ErrorCode.CANNOT_GET_TOKEN, {
type: "bi.center_adapt",
items: [{
type: "bi.label",
whiteSpace: "normal",
text: BI.i18nText("Dec-Login_Cannot_Get_Token")
}, {
type: "dec.link.button",
text: BI.i18nText("Dec-Basic_Click_Here_To_View_Help_Document"),
link: Dec.system[DecCst.Hyperlink.DECISION_HYPERLINK_CONFIG][DecCst.Hyperlink.CANNOT_GET_TOKEN]
}
]
}), n)[t] || "Dec-Login_Info_Not_Available",
r = "string" == typeof o ? {
type: "bi.label",
whiteSpace: "normal",
text: BI.i18nText(o)
}
: o,
s = "login.timeout";
BI.Popovers.create(s, {
header: BI.i18nText("BI-Basic_Prompt"),
size: "small",
closable: !1,
body: r,
footer: {
type: "bi.right_vertical_adapt",
items: [{
type: "bi.button",
$testId: "dec-login-kick-btn",
text: BI.i18nText("BI-Basic_OK"),
height: 24,
handler: function () {
BI.Popovers.remove(s),
window.location.href = loginKickUrl;
// window.location.reload(!0)
}
}
]
}
}, this).open(s)
},
showErrorMasker: function (e) {
var t = BI.UUID();
BI.Maskers.create(t, null, {
render: {
type: "dec.error_masker.single",
text: e
}
}),
BI.Maskers.show(t)
},
refreshToken: function () {
$(document).click((function () {
Dec.Utils.saveLastOperatingTime()
})),
Dec.Utils.initRefreshToken()
},
isAdmin: function () {
return BI.contains(Dec.system.adminUser, Dec.personal.username)
},
checkAdmin: function (e) {
return BI.contains(Dec.system.adminUser, e.username)
},
initUsebleModules: function (e) {
var t = this;
if (!this._useableModules)
return Dec.personal.modules ? (this._useableModules = Dec.personal.modules, void e(this._useableModules)) : void Dec.Utils.getUseAbleDecisionModules((function (i) {
t._useableModules = i.data,
e(t._useableModules)
}));
e(this._useableModules)
},
checkModulesUseable: function (e) {
return BI.some(this._useableModules, (function (t, i) {
return i.id === e
}))
},
getLanguage: function () {
return {
"默认": "zh_CN",
"預設": "zh_TW",
Default: "en_US",
"既定": "ja_JP",
"디폴트": "ko_KR"
}
[BI.i18nText("Dec-Basic_Default")]
}
}),
BI.service("dec.service.global", t)