V3.3以及之后的版本要实现不同的人登陆后打开不同的首页可以修改/UI2/portal/base/base.js中
Model.prototype.createFunctionTree = function() {这个函数的实现的代码实现
1.在这个函数的实现中找到pageMappings
[mainPageKey] = param2pageMapping(this._cfg.main);
在这句的前面加上人的判断并设置不同的首页如下:
在这句的前面加上人的判断并设置不同的首页如下:
var pageMappings = {}; if (this.getContext().getCurrentPersonMemberFID() == "/ORG01.ogn/9B38128D8B33435DBB6781B6E04AE7FE@ORG01.psm") { this._cfg.main.url = "$UI/portal/sample/main/main.w"; }else{ this._cfg.main.url = "$UI/portal/pc/main/main.w"; } pageMappings[mainPageKey] = param2pageMapping(this._cfg.main);
2.在这个函数的实现中找到this.shellImpl.addPageMappings(pageMappings);在这句代码的前面加上
this.shellImpl.pageMappings = {};
完整的修改如下:
var pageMappings = {}; if (this.getContext().getCurrentPersonMemberFID() == "/ORG01.ogn/9B38128D8B33435DBB6781B6E04AE7FE@ORG01.psm") { this._cfg.main.url = "$UI/portal/sample/main/main.w"; }else{ this._cfg.main.url = "$UI/portal/pc/main/main.w"; } pageMappings[mainPageKey] = param2pageMapping(this._cfg.main); pageMappings[changePasswordPageKey] = param2pageMapping(this._cfg.changePassword); if(this._cfg.waitTask && this._cfg.waitTask.enabled) pageMappings[this._cfg.waitTask.xid] = param2pageMapping(this._cfg.waitTask); // 遍历功能树生成mapping var model = this; this.eachFuncs(funcsData.$children, function(params) { if (model.isFunc(params.func)) { var func = params.func; var key = createPageKey(func,model._cfg.iframeFuncURL); pageMappings[key] = func2pageMapping(func,model._cfg.iframeFuncURL); } }); this.shellImpl.pageMappings = {}; this.shellImpl.addPageMappings(pageMappings);
评一波