$(function(){ consultData(0,10); // 详情 $('.box-content ul').on('click','li', function() { var id = $(this).find("a").attr('id'); detailConsultInfo(id); }); }); /** * 加载咨询答疑列表数据 */ function consultData(pageindex, pagesize) { var helpType =$("#helpType").val(); $('input[name=page]').val(pageindex+1); $('input[name=rows]').val(pagesize); var url; if(helpType==1){ url="queryArticleInfo"; //$(".title h3").html("业务流程") }else{ url="queryExperienceInfo"; //$(".title h3").html("经验分享") } $.ajax({ url: url, type: 'post', data: $('#stateForm').serializeArray(), dataType: 'json', beforeSend: function(xhr) { $('.box-content ul li').remove(); $("#Pagination").html(""); }, success: function(result) { var total = result.queryResult.total; var data = result.queryResult.data; $('#consultDiv').css('display', ''); $('#serviceDiv').css('display', 'none'); if (total == 0 || null ==data) { $('
  • ').append($('

    ').html(message.defaults.queryTip)).appendTo($('.box-content ul')); $("#Pagination").html(""); return; } $.each(data, function(i, item) { var liObj = $('

  • '); var name = item.name; liObj.append(''+item.title+'') .append($('').append(formatterTime(item.createDate, 'yyyy-MM-dd'))) .append($('').append(stateView(item.state))).appendTo($('.box-content ul')); }); $("#Pagination").pagination(total, { callback : pageCallback, page_index : pageindex, page_size : pagesize, pagesize_show_always : false//是否显示下拉每页多少条 }); } }); } function pageCallback(pageindex, pagesize, jq) { consultData(pageindex, pagesize,"-1"); } /** * 显示问题类别 */ function typeView(type){ var rst = ''; switch (type) { case 0: rst = message.serviceCenter.typeofService; break; case 1: rst = message.serviceCenter.feedbackTheProblem; break; default: break; } return rst; } /** * 显示解答状态 */ function stateView(state){ var rst = ''; switch (state) { case 0: rst = message.serviceCenter.noToAnswer; break; case 1: rst = message.serviceCenter.haveToAnswer; break; default: break; } return rst; } /** * 查看详情 * @param id id */ function detailConsultInfo(id) { var helpType =$("#helpType").val(); if(helpType==1){ window.location.href = "queryWorkFlowDetail?id=-998&did=" + id; }else{ window.location.href = "queryExperienceDetail?id=-998&did=" + id; } } /** * 进入我要提问界面 */ function addConsult() { window.location.href = "addConsultView?id=-998"; } /** * 返回指定格式日期 * @param time 时间 长整型 * @param fmt 格式,如:yyyy-MM-dd HH:mm:ss * @returns */ function formatterTime(time, fmt) { var time = new Date(time); var z = { M: time.getMonth() + 1, d: time.getDate(), h: time.getHours(), m: time.getMinutes(), s: time.getSeconds() }; fmt = fmt.replace(/(M+|d+|h+|m+|s+)/g, function(v) { return ((v.length > 1 ? "0" : "") + eval('z.' + v.slice(-1))).slice(-2); }); return fmt.replace(/(y+)/g, function(v) { return time.getFullYear().toString().slice(-v.length); }); }