123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726 |
- $(function(){
- loginStatus();
- var userid = $.cookie("userid");
- var professorId = GetQueryString("professorId");
- var name;
- if(professorId){
- var subjectShow = function (data){
- if(data != undefined && data.length != 0 ){
- var subs = new Array();
- if(data.indexOf(',')){
- subs = data.split(',');
- }else{
- subs[0] = data;
- }
- if(subs.length>0){
- for (var i = 0; i < subs.length; i++) {
- $("#subjectShow").append("<div class='acad'>"+subs[i]+"</div>");
-
- };
- }
- }
- }
- var industryShow = function (data){
- if(data != undefined && data.length != 0 ){
- var subs = new Array();
- if(data.indexOf(',')){
- subs = data.split(',');
- }else{
- subs[0] = data;
- }
- if(subs.length>0){
- for (var i = 0; i < subs.length; i++) {
-
- $("#industryShow").append("<li>"+subs[i]+"</li>");
-
- };
- }
- }
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- var eduBgShow = function(data) {
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- var showHtml = "<li>";
- if(typeof(data[i].school) !== "undefined"){
- showHtml += data[i].school;
- }else{
- showHtml += "不详";
- }
- showHtml += "-";
- if(typeof(data[i].college) !== "undefined"){
-
- showHtml += data[i].college;
- }else{
- showHtml += "不详";
- }
- showHtml += "-";
- if(typeof(data[i].major) !== "undefined"){
-
- showHtml += data[i].major;
- }else{
- showHtml += "不详";
- }
- showHtml += "-";
- if(typeof(data[i].degree) !== "undefined"){
-
- showHtml += data[i].degree;
- }else{
- showHtml += "不详";
- }
- showHtml += "-";
- if(typeof(data[i].year) !== "undefined"){
-
- showHtml += data[i].year;
- }else{
- showHtml += "不详";
- }
- showHtml += "</li>";
- $("#eduBgShow").append(showHtml);
-
-
- }
- }
- }
- var timeJobShow = function(data) {
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#timeJobShow").append("<li>"+data[i].company+"-"+data[i].title+"-"+data[i].startMonth+"-"+data[i].stopMonth+"</li>");
- }
- }
- }
- var projectShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- if(data[i].descp=="undefined"){
- $('.spancon').css({display:"none"});
- }
- $("#projectShow").append("<li>名称:"+data[i].name+"<br><span class='spancon'>内容:"+data[i].descp+"</span></li>");
- }
- }
- }
- var paperShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#paperShow").append("<li>"+data[i].name+"</li>");
-
- }
- }
- }
- var patentShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#patentShow").append("<li>"+data[i].name+"</li>");
-
- }
- }
- }
- var honorShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#honorShow").append("<li>"+data[i].name+"</li>");
-
- }
- }
- }
- var researchAreaShow = function ($datas,$datarecords){
- if($datas != undefined && $datas.length != 0 ){
- for(var i =0 ; i< $datas.length;++i){
- var $data = $datas[i];
- var $photos = [];
-
- if($datarecords.length>0){
- $photos = getRecords($datarecords,$data.caption);
- }
- var isAgree = $.inArray(userid, $photos);
- var showDiv= "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>"+$data.count+"</span>"+$data.caption+"</div><span class='plus' data-pid='"+$data.professorId+"' data-caption='"+$data.caption+"' data-isagree='"+isAgree+"'></span><div class='like-num'>";
- if($photos.length>10){
- showDiv += "<div class='triangleR'></div>";
- }
-
- if($photos.length>0){
- for(var j =0 ; j< $photos.length;++j){
- showDiv += "<span class='like-people'><img class='like-h' src='/images/head/"+$photos[j]+"_s.jpg'></span>";
-
- }
- }
- showDiv += "</div></div>";
- $("#researchAreaShow").append(showDiv);
-
- $(".like-h").load(function(){
- })
- .error(function(){
- $(this).attr("src","/images/default-photo.jpg");
- });
-
- }
- }
- }
- var getRecords = function ($researchAreaLogs,caption){
- var ret=[];
- for(var i = 0 ;i < $researchAreaLogs.length ; i++){
- if(caption==$researchAreaLogs[i].caption){
- ret.push($researchAreaLogs[i].opreteProfessorId);
- }
- }
- return ret;
- }
- $("#researchAreaShow").on("click",".plus",function(){
- if(userid && userid != null && userid != "null"){
- $.ajax({
- "url" : $(this).data("isagree")>-1?"/ajax/researchArea/unAgree":"/ajax/researchArea/agree",
- "type" : "POST",
- "data" : {"targetId":$(this).data("pid"),"targetCaption":$(this).data("caption"),"opId":userid},
- "contentType" : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- location.reload(true);
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- }else{
- $.MsgBox.Alert("消息","请登录后点赞");
-
- }
-
- })
- $.get("/ajax/professor/info/" + professorId, function($data) {
- if ($data.success) {
- var $info = $data.data;
- if ($info) {
-
- $("#nameS").text($info.name);
- $("#titleS").text($info.title);
- $("#orgNameS").text($info.orgName);
- $("#headImage").attr("src","/images/head/"+professorId+"_l.jpg");
- $("#headImage").load(function(){
- })
- .error(function(){
- $("#headImage").attr("src","/images/default-photo.jpg");
- });
- $("#orgImage").attr("src","/images/org/"+$info.orgId+".jpg");
- $("#orgImage").load(function(){
- })
- .error(function(){
- $("#orgImage").attr("src","/images/default-icon.jpg");
- });
- $("#descpS").text($info.descp);
-
- name=$info.name;
- $("#name").val($info.name);
- $("#title").val($info.title);
- $("#orgId").val($info.orgId);
-
-
- $("#orgName").val($info.orgName);
- $("#department").val($info.department);
- $("#descp").val($info.descp);
-
- subjectShow($info.subject);
-
- if ($info.researchAreas) {
- researchAreaShow($info.researchAreas,$info.researchAreaLogs);
- }
-
- industryShow($info.industry);
-
- if ($info.edus) {
- eduBgShow($info.edus);
- }
-
- if ($info.jobs) {
- timeJobShow($info.jobs);
- }
-
- if ($info.projects) {
- projectShow($info.projects)
- }
-
- if ($info.papers) {
- paperShow($info.papers);
- }
-
- if ($info.patents) {
- patentShow($info.patents);
- }
-
- if ($info.honors) {
- honorShow($info.honors);
- }
-
-
- var d;
- var t;
- $(function(){
-
- var top5=$(".content-left").height();
-
- var top4=$("#container").height();
- var top3=$(window).height();
- $(document).scroll(function(){
- var top1 =$(document).scrollTop();
- var top2=$("#container").height()-top3+(top3-80-top5)-10;
- if(top1>=300){
- $(".content-left").css({"position":"fixed","top":"80px"});
- if(top1>=top2)
- {
- $('.information-content').css("position","static");
- $(".content-left").css("position", "absolute");
- $(".content-left").css("top", top4-top5-10+"px");
- }
- else{
- $('.information-content').css("position","relative");
- $(".content-left").css({"position":"fixed","top":"80px"});
- }
- }
- else{
- $(".content-left").css({"position":"static"});
-
- }
-
- })
- });
-
- }
- }
- }
- );
- }
- $("#hsearch").on("click",function (){
- var searchContent = $("#hsearchContent").val();
- location.href = "search.html?searchContent="+searchContent;
- });
- $(".head-left").hover(function(){
- $(".replace-photo").animate({"bottom":"0px"});
- },function(){
- $(".replace-photo").animate({"bottom":"-50px"});
-
- })
- $(".subsidebar").click(function(){
- $(".subsidebar").removeClass("subcolor");
- $(".subsidebar").eq($(".subsidebar").index(this)).addClass("subcolor");
- });
- $(".subsidebar").click(function(){
- var index=$(".subsidebar").index(this);
- var offset=$(".introduction").eq(index).offset();
- $("body").animate({
- scrollTop:offset.top-80
- },1000);
-
- })
- $.ajax({
- "url":"/ajax/resource/qapro",
- "type":"get",
- "data":{"professorId":professorId},
- "async": true,
- "success":function(data){
- if(data.data.length==0){
- $("#infor-browse").css("display","none");
- $(".resoubtn").css("display","none");
- }
- if(data.data.length > 0 && data.data.length <= 3){
- $("#infor-browse").css("display","block");
- $(".resoubtn").css("display","none");
- }
- var add="";
- if(data.success)
- {
- for(var i=0;i<data.data.length;i++){
- add='<div class="sharesrc">'
- add+='<div class="shareshow">'
- add+='<a class="remess" resourceId='+data.data[i].resourceId+'><img src="/images/resource/'+data.data[i].resourceId+'.jpg" width="100%" height="100%" class="resourceImg"></a>'
- add+='<div class="shareopeart"><a class="sharebtn resourceConsult" professorId='+data.data[i]["professorId"]+'>咨询</a><a class="sharebtn applicant">申请</a></div>'
- add+='</div>'
- add+='<p>资源名称:<span class="presou consultTitleVal" resourceConsultTitle = "">'+ data.data[i].resourceName+'</span></p>'
- add+='<p class="briefinfor">简介:'+data.data[i].supportedServices+'</p>'
- add+='</div>'
- $("#sharescrollbox").append(add);
- $('.applicant').eq(i).attr("resourceId",data.data[i].resourceId);
-
- $(".resourceImg").eq(i).attr("src","/images/resource/"+data.data[i].resourceId+".jpg");
- $(".resourceImg").load(function(){})
- .error(function(){
- $(this).attr("src","/images/default-resource.jpg");
- });
-
- add="";
- }
-
- var $content = $(".sharescrollbox");
- var childcount = $content.find(".sharesrc").length;
- Carousel(3,3, childcount, $content, $(".resounext"), $(".resouprev"));
-
- $(".introduction").find(".resourceConsult").bind("click",clickResourceConsult);
-
- function Carousel(inde, num, childcount, obj, next, prev) {
- next.click(function() {
- if (!obj.is(":animated")) {
- if (num < childcount) {
-
- num++;
- obj.animate({
- left: "-=212px"
- }, 600);
- }
- }
- });
- prev.click(function() {
- if (!obj.is(":animated")) {
- if (num > inde) {
- num--;
- obj.animate({
- left: "+=212px"
- }, 600);
- }
- }
- });
- }
- }
- else
- {
- $.MsgBox.Alert("消息","系统异常!");
- }
- },
- "error":function(){$.MsgBox.Alert('message','failddd')}
- });
-
- function getIdentity(professorId){
- $.ajax({
- "url":"ajax/professor/"+professorId,
- "type":"get",
- "async": false,
- "success":function(data){
- if(data.success)
- {
-
- $("option")[0].value=data.data.name;
- $("option")[1].value=data.data.organization.name;
-
-
- }
- else
- {
- $.MsgBox.Alert("消息","系统异常!");
- }
- },
- "error":function(){$.MsgBox.Alert('message','failddd')}
- })
- }
-
- $('#sharescrollbox').on("click",'.remess',function(){
- var resourceID=$(this).attr("resourceId");
- ResourceMessage();
- $.ajax({
- "url":"/ajax/resource/"+resourceID,
- "type":"get",
- "async": true,
- "success":function(info){
- if(info.success)
- {
- console.log(info);
- $("#resourceName").text(info.data.resourceName);
- $("#supportedServices").text(info.data.supportedServices);
- $("#hopePayMethod").text(info.data.hopePayMethod) ;
- $("#cooperationNotes").text(info.data.cooperationNotes) ;
- $("#subject").text(info.data.subject);
- $("#industry").text(info.data.industry);
- $("#descp").text(info.data.descp);
- $("#professor").text(name);
- $(".resouImage").attr("src","/images/resource/"+resourceID+".jpg");
- $(".resouImage").load(function(){})
- .error(function(){
- $(this).attr("src","/images/default-resource.jpg");
- });
- }
- else
- {
- $.MsgBox.Alert('message',"系统异常!");
- }
- },
- "error":function(){$.MsgBox.Alert('message','failed')}
- });
- })
- $('.introduction').on("click",'.applicant',function(){
- if(userid && userid != null && userid != "null"){
- ResourceApply();
- $(".limitBox").removeClass("limitBox");
- $(".limitwords").removeClass("limitwords");
- $(".limitwordbox").removeClass("limitwordbox");
-
- var myDate = new Date();
- var nowYear = myDate.getFullYear();
- var nowMonth = myDate.getMonth()+1;
- var nowDate = myDate.getDate();
- if(nowMonth<10){
- nowMonth="0"+nowMonth.toString();
- }
- if(nowDate<10){
- nowDate="0"+nowDate.toString();
- }
- var now = nowYear + "-" + nowMonth + "-" + nowDate;
- $( "#datepicker").val(now);
- $( "#datepicker" ).datepicker({ "dateFormat":" yy-mm-dd"});
- $(".timelo").css("display","none");
- $(".namecon").text(name);
- $(".applysure").hide();
- $(".btnboxup").hide();
- var index1=$(this).parent().parent().parent().index();
- var resName=$('.presou').eq(index1).text();
- var resourceID=$(this).attr("resourceId");
- $.ajax({
- "url":"/ajax/resource/"+resourceID,
- "type":"get",
- "async": false,
- "success":function(info)
- {
- if(info.success)
- {
- if(info.data.images.length)
- {
- $(".resouImage").attr("src","/images/resource/"+resourceID+".jpg");
- }
- else{
- $(".resouImage").attr("src","/images/default-resource.jpg");
- }
- }
- }
- })
- $(".log").text(resName);
- getIdentity(userid);
- $("#deliver").on("click",function()
- {
-
- var $data = {};
- $data.demandId = userid;
- $data.resourceId=resourceID;
- $data.detailDemand=$(".detail").val();
-
- $data.deliverTime=replaceStr($.trim($(".dealTime").val()));
-
-
-
- $data.operationStatus=1;
- $data.applysquare=$("select option:selected").val();
-
-
-
- $.ajax({
- "url" : "/ajax/operation",
- "type" : "POST",
- "success" : function(rdata) {
- if (rdata.success) {
- $.MsgBox.Alert('message','资源"'+ resName +'"申请发送成功!');
- $(".blackcover").remove();
- $("body").css("position","static");
-
- } else {
- $.MsgBox.Alert('message','资源"'+ resName +'"申请发送失败,请重新申请!');
- }
- },
- "data" : $data,
- "beforeSend":function(){},
- "contentType" : "application/x-www-form-urlencoded",
- dataType : "json"
- });
- });
- }else{
- $.MsgBox.Alert("消息","您还未登录,请登录之后进行资源申请");
- }
- });
-
-
- function clickResourceConsult(){
- var professorId = $(this).attr("professorId");
- consultHandler();
-
- $("ul.menucon").children().eq(1).addClass("clicknow");
- var consultTitleVal = $(this).parent().parent().parent().find(".consultTitleVal").text();
- $("#consultTitle").val("关于"+consultTitleVal+"的咨询");
-
- };
-
-
-
-
-
-
- var userid = $.cookie("userid");
- var professorId = GetQueryString("professorId");
-
- $("#consultbtn").bind('click',consultHandler);
-
-
-
- function limitFontCountFn(){
- var curLength=$(this).val().length;
- if(curLength>500){
- var num=$(this).val().substr(0,500);
- $(this).val(num);
- $.MsgBox.Alert('提醒',"已经超过500字");
- }
- else{
- $("#textCount").text(500-$(this).val().length);
- }
- }
-
- function consultHandler(){
- ConsultApply();
- $("#consultContent").bind("keyup",limitFontCountFn);
-
- $("#sendConsultBtn").on("click",sendConsultHandler);
-
- if(userid && userid != null && userid != "null"){
- $.ajax({
- "url" :"/ajax/professor/"+ professorId,
- "type" : "get",
- "data" : {"professorId":professorId},
- "contentType" : "application/x-www-form-urlencoded",
- "success" : function(response) {
- if (response.success) {
-
- $("#professorName").text(response.data["name"]);
- $("#professorTitle").text(response.data["title"]);
-
- if(response.data["department"] == "" || response.data["department"] == null){
- $("#profOrganization").text(response.data["organization"]["name"]);
- }else{
- $("#profDepartment").text(response.data["department"]+",");
- $("#profOrganization").text(response.data["organization"]["name"]);
-
- }
- if(response.data["adress"] == "" || response.data["adress"] == null ){
- $("#adress").html("");
- }else{
- $("#profAdress").text(response.data["adress"]);
- }
-
- } else {
- $.MsgBox.Alert("message","请登录");
- }
- },
- "complete":function(){
-
- }
- });
- }
- };
-
- var consultId;
-
- function sendConsultHandler(){
- var consult_type = $(".clicknow").text();
- var consult_title = $("#consultTitle").val();
- var consult_content = $("#consultContent").val();
- var consultStr = {
- "consultType":consult_type,
- "consultTitle":consult_title,
- "consultContant":consult_content,
- "professorId":professorId,
- "consultantId":userid
- };
-
- if(consult_type == ''){
- $.MsgBox.Alert("消息","请选择联系目的");
- }
- if(consult_title == ''){
- $.MsgBox.Alert("消息","请填写咨询目的");
- }
- if(consult_content == ''){
- $.MsgBox.Alert("消息","请填写咨询内容");
- }
-
- if(userid && userid != null && userid != "null" && consult_type != '' &&
- consult_title != '' && consult_content != ''
- ){
-
- $.ajax({
- "url" :"/ajax/consult",
- "type" : "post",
-
- "data" : consultStr,
- "contentType" : "application/x-www-form-urlencoded",
- "beforeSend":function(){},
- "dataType" : "json",
- "success" : function(response) {
-
-
- consultId = response.data;
-
-
- },
- "error":function (){
- $.MsgBox.Alert("消息","咨询申请失败");
- },
-
- "complete":function(){
-
- $(".blackcover").remove();
- $("body").css("position","static");
- $.MsgBox.Alert("消息","咨询申请成功");
- },
- });
- }
- }
-
-
-
- })
|