/** * Created by lyf on 2015/7/12. */ require.config({ //baseUrl: "/", paths:{ Fjdz : "../fjdz/fjdz-1.0.js", jquery:"jquery-1.8.3.min.js", SuperSlide:"SuperSlide.2.1.1.js", dialog:"dialog-min.js" , ztree : "jquery.ztree.core-3.5.min.js" }, shim:{ "jquery":{ exports:"$" }, "SuperSlide":["jquery"], "dialog":{ exports : "dialog", deps:['jquery','css!ui-dialog.css'] }, "ztree":{ exports : "ztree", deps:['jquery','css!zTreeStyle.css'] } } }) var $Fjdz = {}; /*分页 根据参数,对Fjdz.pg的调用*/ $Fjdz.pg = function( FjdzPage ,callback ){ require(["pageBar","css!pgBar.css"],function( pageBar ){ if( avalon.type( FjdzPage )=='array' ){ var pgs = []; for( var i = 0 ; i < FjdzPage.length ; i++ ){ pgs.push(pageBar( FjdzPage[i] )); } //callback( pgs ) 当多个分页条的时候暂时不回调 }else if( avalon.type( FjdzPage )=='object' ){ callback( pageBar( FjdzPage ) ); } }) } $Fjdz.list = function( FjdzList ,callback ){ require(["list"],function( list ){ if( avalon.type( FjdzList )=='array' ){ //typeof [] var pgs = []; for( var i = 0 ; i < FjdzList.length ; i++ ){ pgs.push(list( FjdzList[i] )); } //callback( pgs ) 当多个分页条的时候暂时不回调 }else if( avalon.type( FjdzList )=='object' ){ if( FjdzList.ModeArg && !FjdzList.listArgs ){ FjdzList.listArgs = FjdzList.ModeArg ; } window.FjdzList.$list = list( FjdzList ); //callback( list( FjdzList ) ); } }) } require(["domReady!"],function(){ if( typeof FjdzPage =='undefined'){ avalon.log("FjdzPage is undefined") }else{ $Fjdz.pg( FjdzPage , function( obj ){ FjdzPage.$pageBar = obj ; }); } if( typeof FjdzList =='undefined'){ avalon.log("FjdzList is undefined") }else{ $Fjdz.list( FjdzList , function( obj ){ //FjdzPage.$pageBar = obj ; }); } if( typeof FjdzRun =='undefined'){ avalon.log("FjdzRun is undefined") }else{ FjdzRun(); } }); //增加时间过滤器,传入时间后,进行日期的对比 avalon.filters.getTimeStatus = function( time , vals ){ var TimeValue=0; if( /(\d{4})[^0-9]0?(\d{1,2}?)[^0-9]0?(\d{1,2}?)[^0-9]0?(\d{1,2}):0?(\d{1,2})/.test( time ) ) { TimeValue = new Date(RegExp.$1, RegExp.$2 - 1, RegExp.$3, RegExp.$4, RegExp.$5).getTime(); }else if( /(\d{4})[^0-9]0?(\d{1,2}?)[^0-9]0?(\d{1,2}?)/.test( time )){ TimeValue = new Date(RegExp.$1, RegExp.$2 - 1, RegExp.$3 ).getTime(); }else{ avalon.log("ERROR:时间格式无效,tools.js") } if( vals ){ if( TimeValue > Date.now() ){ return vals[0] ; }else{ return vals[1] ; } }else{ if( TimeValue > Date.now() ){ return true; }else{ return false; } } }