(function(){ X.pageLogic['userlabelinfo'] = { init : function(parms){ var me = this; var userlabelid = X.DATA.userlabelid; var page = 1; //设置首页页码 var limit = 10; //设置每页显示条数 var total; //总条数 X.api("user_label/detail","post",{label_id: userlabelid},function(val){ X.api("user_label/cluster_user_count","post",{cluster_name:val.cluster_name},function(d){ val['num'] = d.num; total = d.num; X.laytpldata('#userlabelinfo-right-box-dot',val,'.userlabel-right-box'); cluster_user_list_data(val); layui.laypage.render({ elem: 'laypage' //注意,这里的 test1 是 ID,不用加 # 号 ,count: total, //数据总数,从服务端得到 limit:limit, //每页条数设置 jump: function(obj, first){ //obj包含了当前分页的所有参数,比如: // console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。 // console.log(obj.limit); //得到每页显示的条数 page=obj.curr; //改变当前页码 limit=obj.limit; //首次不执行 if(!first){ cluster_user_list_data(val); //加载数据 } } }); }) }); function cluster_user_list_data(val){ X.api('user_label/cluster_user_list',"post",{cluster_name: val.cluster_name,page: page,limit: limit},function(d){ X.laytpldata("#table-fenxi-th-dot",d.columns,".table-fenxi-th"); X.laytpldata("#table-fenxi-td-dot",d.values ,".table-fenxi-td"); }); }; // 返回上一页 $(document).off("click",".userlabel-right-fanhui").on("click",".userlabel-right-fanhui",function(){ X.gourl('userlabel','conetnt'); }); } }; })();