$.fn.extend({ common:function(pageid,team_id,type){ var datahtml = ''; if(type==''){ var action='comment'; }else{ var action='commentcate'; } $.post("/ajax/ajaxfront.php?action="+action+"&type=user", { pageid : pageid, team_id : team_id, type:type, } , function(data){ if(data['result']==1) { $("#curpage").val(pageid); $.each(data['data'], function(i, item){ datahtml = datahtml + '
  • '+ '
    '+ '
    '+ ''+item["username"]+'--------'+item['add_time']+''+ '

    '+item['content']+'

    '+ '
    '; if(item['reply']!=null && item['reply_time']!=null) { datahtml = datahtml + '
    '+ '管理员--------'+item["reply_time"]+''+ '

    '+item['reply']+'

    '+ '
    '; } datahtml = datahtml + '
  • '; }); $(".mx_xp_ping").html(datahtml); } else { } },'json'); }, firstbtn:function(team_id,totalpage,type){ //更改标识为1 $.fn.common(1,team_id,type); $('.mx_fenye').children('span').removeclass("po de"); $('#last,#next').addclass("po"); $('#first,#prev').addclass("de"); }, prevbtn:function(team_id,totalpage,type){ var pageid = parseint($("#curpage").val())-1; pageid = (pageid<=0)?1:pageid; $.fn.common(pageid,team_id,type); if(pageid==1) { $('.mx_fenye').children('span').removeclass("po de"); $('#first,#prev').addclass("de"); $('#last,#next').addclass("po"); }else{ $('.mx_fenye').children('span').removeclass("po de"); $('.mx_fenye').children('span').addclass("po"); } }, nextbtn:function(team_id,totalpage,type){ var pageid = parseint($("#curpage").val())+1; pageid = (pageid>=totalpage)?totalpage:pageid; $.fn.common(pageid,team_id,type); if(pageid==totalpage) { $('.mx_fenye').children('span').removeclass("po de"); $('#last,#next').addclass("de"); $('#first,#prev').addclass("po"); }else{ $('.mx_fenye').children('span').removeclass("po de"); $('.mx_fenye').children('span').addclass("po"); } }, lastbtn:function(team_id,totalpage,type){ this.common(totalpage,team_id,type); $('.mx_fenye').children('span').removeclass("po de"); $('#last,#next').addclass("de"); $('#first,#prev').addclass("po"); } }); /***评价分页面处理***/ $("#last").on("click",function(){ $.fn.lastbtn(team_id,totalpage,type); }); $("#next").on("click",function(){ $.fn.nextbtn(team_id,totalpage,type); }); $("#prev").on("click",function(){ $.fn.prevbtn(team_id,totalpage,type); }); $("#first").on("click",function(){ $.fn.firstbtn(team_id,totalpage,type); }); /***************/ $(function(){ (function($){ var $box=$('.mx_xp'); var $li=$box.find('.mx_xp_ul').find('li'); var $div=$box.find('.mx_xp_div'); $li.on('click',function(){ $(this).addclass('active').siblings().removeclass('active'); $div.hide().eq($(this).index()).show(); }) })(jquery); }); $(document).ready(function(){ $("#pro_add").click(function(){ $.post("/order/commentcate.php",{ content:$('#p_content').val(), id:$('#pid').val(), category:$('#p_cate').val() },function(data){ if(data['result']==1){ alert("评论添加成功"); window.location.reload(); }else if(data['result']==3){ alert("您已发表评论,不能在继续添加!!"); }else if(data['result']==4){ $.layer({ shade: [0], dialog: { msg: '您还没有登录,不能发表评论!', btns: 1, type: 3, btn: ['去登录'], yes: function(){ $.layer({ type : 2, title: '用户登陆', shadeclose: false, maxmin: false, fix : true, fadein: 500, area: ['600px', '350px'], iframe: { src : "/account/logined.php" } }); } } }); }else{ alert("评论添加失败"); } },'json'); }); });