自定义用户认证方式demo。
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.
 

138 lines
5.2 KiB

!(function () {
BI.config("dec.user.setting.authentications", function (items) {
items.push({
value: "Enterprise_WeChat", // value 值
text: "企业微信认证", // 认证方式名,需国际化
"@class": "com.fr.decision.webservice.bean.authentication.EnterpriseWeChatAuthentication", // 不知干什么的,反正要有啦
component: {
type: "dec.plugin.enterprise_weChat_authentication"
}
});
return items;
});
// 自定义的component组件接受configs props,需要实现getValue方法读取配置
var WIDTH = 125;
var Demo = BI.inherit(BI.Widget, {
props: {
baseCls: "",
configs: {
CorpID: "",
secret: "",
showWay: ""
}
},
render: function () {
var self = this, o = this.options;
return {
type: "bi.vertical",
bgap: 15,
items: [
{
type: "bi.vertical_adapt",
items: [
{
type: "bi.layout",
width: WIDTH
}, {
type: "bi.label",
textAlign: "left",
cls: "dec-font-weight-bold",
text: "CorpID:",
width: 100
}, {
type: "bi.editor",
ref: function (_ref) {
self.CorpID = _ref;
},
width: 400,
height: 24,
watermark: "",
value: o.configs.CorpID
}
]
}, {
type: "bi.htape",
height: 300,
items: [
{
type: "bi.layout",
width: WIDTH
}, {
type: "bi.vertical",
items: [
{
type: "bi.label",
textAlign: "left",
cls: "dec-font-weight-bold",
text: "secret:"
}
],
width: 100
}, {
type: "bi.textarea_editor",
cls: "bi-border",
ref: function (_ref) {
self.secret = _ref;
},
width: 400,
height: 300,
watermark: "",
value: o.configs.secret
}
]
}, {
type: "bi.htape",
height: 300,
items: [
{
type: "bi.layout",
width: WIDTH
}, {
type: "bi.vertical",
items: [
{
type: "bi.label",
textAlign: "left",
cls: "dec-font-weight-bold",
text: "显示方式:"
}
],
width: 100
}, {
type: "bi.text_value_combo",
ref: function (_ref) {
self.showWay = _ref;
},
items: [
{
text: "1",
value: "1"
}, {
text: "2",
value: "2"
}
],
width: 400,
value: o.configs.showWay
}
]
}
]
};
},
getValue: function () {
return {
CorpID: this.CorpID.getValue(),
secret: this.secret.getValue(),
showWay: this.showWay.getValue()[0]
};
}
});
BI.shortcut("dec.plugin.enterprise_weChat_authentication", Demo);
})();