this.include("initscript") //脚本配置的名称、别名或id //如果需要引用其他应用的脚本配置,将options设置为jsonobject this.include({ type : "portal", //应用类型。可以为 portal process cms。如果没有该选项或者值为空字符串,则表示应用脚本和被应用的脚本配置类型相同;比如在门户的a应用脚本中引用门户b应用的脚本配置,则type可以省略。 application : "九游会ag8九游会j9登录入口官网登录入口网页首页", // 门户、流程、cms的名称、别名、id。 默认为当前应用 name : "initscript" // 脚本配置的名称、别名或id })
this.define("xxx",function(){}.bind(this))
//定义一个方法 this.define("getusername", function(){ return ( layout.desktop.session.user || layout.user ).name }.bind(this))
接口地址:
http://hostip:20030/x_program_center/jest/list.html
this.action("xxx服务根")或者mwf.actions.get("xxxx服务根");
例如:引入了cms的文档服务方法,删除,修改,取消发布等方法。
var action = new this.action("x_cms_assemble_control", { "del":{"uri": "/jaxrs/document/{id}", "method": "delete"}, "change":{"uri": "/jaxrs/document/category/change", "method": "put"}, "cancel":{"uri": "/jaxrs/document/publish/{id}/cancel", "method": "put"} } );
定义方法调用服务
this.define("change",function(data,callback){ action.invoke({"name": "change","data":data,"parameter": {},"async": true, "success": function(json){ if(callback)callback(json); }.bind(this)}); }.bind(this)
或者也可以直接调用系统内置的方法例如
mwf.actions.get("x_cms_assemble_control").getdocument(id,function(json){ //code }.bind(this))
getdocument是系统中已经定义的方法,具体可以查看服务调用文件o2_core/o2/xaction/service目录下的服务文件
var action = new this.action("x_cms_assemble_control", { "del":{"uri": "/jaxrs/document/{id}", "method": "delete"}, "change":{"uri": "/jaxrs/document/category/change", "method": "put"}, "cancel":{"uri": "/jaxrs/document/publish/{id}/cancel", "method": "put"}, // 获取未读消息 "info":{"uri": "/jaxrs/viewrecord/unread", "method": "put"}, // 获取文档 "list":{"uri": "/jaxrs/document/filter/list/{id}/next/{count}", "method": "put"}, "publish":{"uri": "/jaxrs/document/publish/content", "method": "put"}, }); this.data.add("curid","(0)"); this.data.add("pagecount","10"); this.define("loadlist",function(id,count,data,callback){ action.invoke({"name": "list","parameter":{"id":id,"count":count},"data":data,"async": true, "success": function(json){if(callback)callback(json);}.bind(this)}); }.bind(this)); this.define("showlist",function(json){ //alert(json.stringify(json)); var content = this.form.get("content").node; json.data.each(function(data){ new element("div",{text:data.title}).inject(content); }.bind(this)) }.bind(this))
o2.load("/o2_lib/jquery/jquery.min.js",function(){ var jq = jquery.noconflict(true); //alert(jq("#aaa").find("input").val()) jq(document).ready(function(){ //window.settimeout(function(){ var tab = jq("table"); var tr = tab.find("tr"); tr.mouseover(function(){ jq(this).css("background-color","#ff0") }); tr.mouseout(function(){ jq(this).css("background-color","") }) //},2000); }) }.bind(this))
1、门户页面跳转,参数传递
this.page.topage("页面名称", {"keyword": “value”});
获取: var par = this.page.parameters; //par的内容:{"type": "my type"}
2、使用系统内置组件模板
mwf.xdesktop.requireapp("template", "mtooltips", null, false); var tt = new class({ extends: mtooltips, _gethtml : function(){ var html = "
title:" " | test" " | time:" " | 2019-08-21" ""; return html; }, }); var pc = new tt(this.form.getapp().content,this.target.node,this.form.app,{},{ axis : "x" }); pc.create(); |
上一篇:门户开发-页面部件设计
下一篇:门户开发-页面及元素组件介绍