多种方式打开IDE
系统提供/entry/manager-pcapp/manager-pc/ide.w页面用于在门户中打开IDE。
- 打开某个应用的IDE,可用于从菜单中直接打开
- 打开某个应用的IDE,同时打开某个页面
- 打开某个应用的IDE,同时打开“添加页面”对话框,用于新增页面
使用方法如下:
/entry/manager-pcapp/manager-pc/ide.w?serviceName=xx&action=openPage
- action不指定时,只是打开ide
- action=openPage时,需要参数:pagePath=xxx
- action=newPage时,需要参数:pageLabel=xxx,pagePath=xxx
- 其中pagePath以UI2/开头
案例代码如下:
打开应用ent4的IDE
window.open("/entry/manager-pcapp/manager-pc/ide.w?serviceName=ent4");
从菜单打开应用ent4的IDE
在应用中新建一个页面xxx.w,在“页面创建时”事件中重定向,代码如下
Model.prototype.onModelModelConstruct=function(event){ window.location.href="/entry/manager-pcapp/manager-pc/ide.w?serviceName=ent4"; }
设置菜单的打开方式为打开浏览器新的tab页 IDE需要在浏览器新的tab页中打开,因此需要如下设置。进入代码,打开页面对应的xxx.serviceMetaInfo.json文件,在types中增加openPage
"types":["pc","func","openPage"],
打开应用ent4的IDE,同时打开页面yonghu_ym.w
window.open("/entry/manager-pcapp/manager-pc/ide.w?serviceName=ent4&action=openPage&pagePath=UI2/mobile/yonghu_ym.w");
打开应用ent4的IDE,同时打开“添加页面”对话框,新增页面的文件名为shebei.w,页面名称为“设备”
window.open("/entry/manager-pcapp/manager-pc/ide.w?serviceName=ent4&action=newPage&pageLabel=设备&pagePath=UI2/mobile/shebei.w");
可使用下面的代码实现将中文转换成拼音
getNameByChinese: function(text){
if(text){
var str1 = text,str2;
if(text.length>2){
str1 = text.substring(0, 2);
str2 = text.substring(2);
}
var ret = ChinesePY.getPinyin(str1, "");
if(str2) ret += ChinesePY.getFirstLetter(str2);
return ret.replace(/[^a-zA-Z0-9]/g, "_").toLowerCase();
}
return text;
}