$(function(){
//默认分页
var pageIndex = 1;
var columnId = '';
var letters = '';
var siteId1 = 95;
var box2 = '';
var box3 = '';
var rows1 = 999
columnId = $('li.wp_column.selected').attr('data-ids');
//默认执行检索
loadContents(pageIndex,columnId,siteId1,rows1);
//点击事件执行函数
$(".jz_1").click(function(){
$(this).siblings().removeClass("selected");
$(this).addClass("selected");
$(".jz_2").find("img").attr("src","/_upload/tpl/01/71/369/template369/images/jz_2.png");
$(".jz_1").find("img").attr("src","/_upload/tpl/01/71/369/template369/images/jz_1s.png");
loadContents(pageIndex,columnId,siteId1,rows1);
});
$('.search_i').click(function(){
$(this).siblings().slideToggle();
});
$('#box2 .list_items').click(function(){
var $text = $(this).text();
$(this).parent().siblings().text($text);
$(this).parent().slideUp();
if($(this).text().split("(")[0] != undefined){
box2 = $(this).text().split("(")[0];
}
console.log(box2);
loadContents(pageIndex,columnId,siteId1,rows1);
});
$('#box3 .list_items').click(function(){
var $text = $(this).text();
$(this).parent().siblings().text($text);
$(this).parent().slideUp();
if($(this).text() != '全部'){
box3 = $(this).text().split("(")[0];
}else{
box3 = '';
}
loadContents(pageIndex,columnId,siteId1,rows1);
});
$(".jz_2").click(function(){
$(this).siblings().removeClass("selected");
$(this).addClass("selected");
$(".conz").each(function(){
$(this).children("li").remove();
})
$(".jz_1").find("img").attr("src","/_upload/tpl/01/71/369/template369/images/jz_1.png");
$(".jz_2").find("img").attr("src","/_upload/tpl/01/71/369/template369/images/jz_2s.png");
$(".jz_js1").children().children().remove();
loadContents2(pageIndex,columnId);
$("#wp_paging_w6").html('');
});
$(".txt").click(function(){
$(this).siblings().removeClass("selected");
$(this).addClass("selected");
if($(this).text() != '全部'){
var cc = $(this).text();
$(".conz").each(function(){
$(this).hide();
if($(this).children(".news_letters").text() == cc){
$(this).show();
}
if($(this).children().length<2){
$(this).hide();
}
});
}else{
$(".conz").each(function(){
$(this).show();
if($(this).children().length<2){
$(this).hide();
}
});
}
});
//执行检索的函数
function loadContents(pageIndex,columnId,siteId1,rows1){
var conditions = JSON.stringify(getConditions());
var returnInfos = JSON.stringify(getReturnInfos());
var re=/^[a-zA-Z]+$/;
$.ajax({
url: "/_wp3services/generalQuery?queryObj=articles",
type: "POST",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
cache: true,
dataType: "json",
data: {
siteId: siteId1,
columnId: columnId,
conditions: conditions,
returnInfos: returnInfos,
pageIndex: pageIndex,
rows: rows1,
scope:1,
reqModule: 1 //检索文章内容是使用,不检索文章内容时删除
},
success: function(result) {
var html = '
';
var total = result.total;
if(result != null) {
var arm = result.data;
for(i=0;i' +
'' +
'
' +
'
' +
'
姓名:'+ '
' + arm[i].title + ''+'职称:' + arm[i].f9 +'
' +
'
'+'研究方向:' + arm[i].f8 + '
' +
'
'+'工作单位:' + arm[i].f11 + '
' +
'
'+'联系邮箱:' + arm[i].f2 + '
' +
'
'+'联系电话:' + arm[i].f1 +'
' +
'
'+'职位:' + arm[i].f12 + '
' +
'
' +
'
' +
'';
}
html += '
';
$('.jz_js1').html(html);
$(".jz_js").hide();
$(".jz_js1").show();
}
}
});
//检索条件的函数
function getConditions(){
var conditdata = [];
var keyJson = [];
var letter = letters; //输入框的值
if(box2 != '全部'){
if(box3 == '教授'){
var conditdata = [
{field: "scope", value: 0, judge: "="},
];
if(box2.trim()!=""){
conditdata.push({field: "f5",value: '%' + box2 + '%',judge: "like"});
}
if(box3.trim()!=""){
conditdata.push({field: "f9", value:box3 + '%', judge: "like"});
}
}else{
var conditdata = [
{field: "scope", value: 0, judge: "="},
];
if(box2.trim()!=""){
conditdata.push({field: "f5",value: '%' + box2 + '%',judge: "like"});
}
if(box3.trim()!=""){
conditdata.push({field: "f9", value: '%' +box3 + '%', judge: "like"});
}
}
}else{
if(box3 == '教授'){
var conditdata = [
{field: "scope", value: 0, judge: "="},
];
if(box3.trim()!=""){
conditdata.push({field: "f9", value:'%' +box3 + '%', judge: "like"});
}
}else{
var conditdata = [
{field: "scope", value: 0, judge: "="},
];
if(box3.trim()!=""){
conditdata.push({field: "f9", value:'%' +box3 + '%', judge: "like"});
}
}
}
if(letter.trim()!=""){
conditdata.push({field: "letter",value: letter,judge: "like"});
}
return conditdata;
}
function getReturnInfos() {
var returnInfosdata = [
{ field: "title", name: "title" },
{ field: "url", name: "url" },
{ field: "summary", name: "summary" },
{ field: "subTitle", name: "subTitle" },
{ field: "f1", name: "f1" },
{ field: "f2", name: "f2" },
{ field: "f3", name: "f3" },
{ field: "f4", name: "f4" },
{ field: "f5", name: "f5" },
{ field: "f6", name: "f6" },
{ field: "f7", name: "f7" },
{ field: "f8", name: "f8" },
{ field: "f9", name: "f9" },
{ field: "f11", name: "f11" },
{ field: "f12", name: "f12" },
];
return returnInfosdata;
}
}
function loadContents2(pageIndex,columnId){
var html = "";
/*var conditions = JSON.stringify(getConditions());*/
var returnInfos = JSON.stringify(getReturnInfos());
var re=/^[a-zA-Z]+$/;
$.ajax({
url: "/_wp3services/generalQuery?queryObj=articles",
type: "POST",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
cache: true,
dataType: "json",
data: {
siteId: 95,
columnId: columnId,
/*conditions: conditions,*/
returnInfos: returnInfos,
pageIndex: pageIndex,
rows: 999,
reqModule: 1 //检索文章内容是使用,不检索文章内容时删除
},
success: function(result) {
console.log(result);
if(result != null) {
var arn = result.data;
for(i=0;i' +
'' +
'';
$(".conz").each(function(){
if($(this).find(".news_letters").text() == ConvertPinyin(arn[i].title.split(' ')[2]).split("")[0]){
$(this).append(html);
}
});
}}else{ //两个英文名
html = '' +
'';
$(".conz").each(function(){
if($(this).find(".news_letters").text() == ConvertPinyin(arn[i].title.split(' ')[1]).split("")[0]){
$(this).append(html);
}
});
}
}else{ //中文名
html = '' +
'';
$(".conz").each(function(){
if($(this).find(".news_letters").text() == ConvertPinyin(arn[i].title.split(' ')[0]).split("")[0]){
$(this).append(html);
}
});
}
}
$(".jz_js1").children().children().remove();
$(".jz_js").show();
$(".conz").each(function(){
if($(this).children().length<2){
$(this).hide();
}
});
}
}
});
//检索条件的函数
/*function getConditions(){
var conditdata = [];
var keyJson = [];
var letter = letters; //输入框的值
//标题的条件放入数组
if(letter != ''){
letter = '%' + letter + '%'; //使用like模糊查询需要在前后增加 %,用来匹配获取的值前后的空格,=不需要增加 %
keyJson.push({field: "letter", value: letter, judge: "like"});
}
//keyJson数组传入条件
if (keyJson != null && keyJson.length > 0){
conditdata.push({orConditions: keyJson});
}
//检索条件是否为当前及子,可增加或减少
//conditdata.push({field: "scope", value: 1, judge: "="});
return conditdata;
}*/
function getReturnInfos() {
var returnInfosdata = [
{field: "letter", name: "letter"},
];
return returnInfosdata
}
}
})