1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165 |
- $(function(){
-
- loginStatus();
- var userid = $.cookie("userid");
- if(userid){
-
- 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++) {
- $("#subjectList").append("<div class='acad'>"+ subs[i] +"<span class='remove'><img src='images/move.png'></span></div>");
- $("#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++) {
- $("#industryList").append("<div class='acad'>"+ subs[i] +"<span class='remove'><img src='images/move.png'></span></div>");
- $("#industryShow").append("<li>"+subs[i]+"</li>");
-
- };
- }
- }
- }
-
- var eduBgShow = function(data) {
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#eduBgShow").append("<li>"+data[i].school+"-"+data[i].college+"-"+data[i].major+"-"+data[i].degree+"-"+data[i].year+"</li>");
- $("#eduBgList").append("<li class='eg'>"+data[i].school+"-"+data[i].college+"-"+data[i].major+"-"+data[i].degree+"-"+data[i].year+"<span class='modi' title='"+data[i].id+"'><img src='images/madify.png'></span><span class='remove' title='"+data[i].id+"' ><img src='images/move.png'></span></li>");
- }
- }
- }
-
- 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>");
- $("#timeJobList").append("<li class='tj'>"+data[i].company+"-"+data[i].title+"-"+data[i].startMonth+"-"+data[i].stopMonth+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
- }
- }
- }
-
- var projectShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#projectShow").append("<li>名称:"+data[i].name+"<br>内容:"+data[i].descp+"</li>");
- $("#projectList").append("<li class='pro'>"+data[i].name+"<br>"+data[i].descp+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></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>");
- $("#paperList").append("<li class='pap'>"+data[i].name+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
- }
- }
- }
-
- var patentShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#patentShow").append("<li>"+data[i].name+"-"+data[i].year+"</li>");
- $("#patentList").append("<li class='pat'>"+data[i].name+"-"+data[i].year+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></li>");
- }
- }
- }
-
- var honorShow = function(data){
- if(data.length>0){
- for (var i = 0; i < data.length; i++) {
- $("#honorShow").append("<li>"+data[i].name+"</li>");
- $("#honorList").append("<li class='hon'>"+data[i].name+"<span class=\"modi\" title='"+data[i].id+"'><img src=\"images/madify.png\"></span><span class=\"remove\" title='"+data[i].id+"' ><img src=\"images/move.png\" ></span></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 showDiv= "<div class='listbox listbox-browse clear'><div class='list-browse'><span class='like'>"+$data.count+"</span>"+$data.caption+"</div><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);
- $("#researchAreaList").append("<div class='list'><span class='like'>"+$data.count+"</span><span class='ra'>"+$data.caption+"</span><span class='remove'><img src='images/move.png'></span></div>");
-
-
-
-
-
-
- $(".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;
- }
- $.get("/ajax/professor/info/" + userid, 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/" + userid + "_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").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;
-
-
- 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"
- });
- }
- })
-
-
- }
- }
- });
- }
- else {
- location.href = "login.html";
- return;
- }
-
- $("#hsearch").on("click", function() {
- var searchContent = $("#hsearchContent").val();
- location.href = "search.html?searchContent=" + searchContent;
- });
- $("#saveProfessor").on("click",function () {
- var $data = {};
- $data.name = $("#name").val();
- $data.orgId = $("#orgId").val();
- $data.orgName = $("#orgName").val();
- $data.title = $("#title").val();
- $data.department = $("#department").val();
- var userid = $.cookie("userid");
- if (userid) {
- $data.id = userid;
- }
- $.ajax({"url" : "../ajax/professor",
- "type" : userid ? "PUT" : "POST",
- "success" : function(rdata) {
- console.log(rdata);
- if (rdata.success) {
- if (userid) {
- location.reload(true);
- } else {
- location.href = "information.html?id="+ rdata.data;
- }
- } else {
- alert(rdata.msg);
- }
- },
- "data" : userid ? JSON.stringify($data) : $data,
- "contentType" : userid ? "application/json": "application/x-www-form-urlencoded",
- dataType : "json"
- });
- })
- $(".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);
-
- });
- var $content = $(".sharescrollbox");
- var childcount = $content.find(".sharesrc").length;
- Carousel(3,3, childcount, $content, $(".resounext"), $(".resouprev"));
-
- 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);
- }
- }
- });
- }
- $("#container .edit").hover(function(){
- $(this).addClass("edit-position-left")
- },function(){
- $(this).removeClass("edit-position-left")
- });
- $("#container .edit").click(function(){
- var edit =$(".edit").index(this);
- $(".right-title span").eq(edit-1).css("color","#3e3e3e");
- $(".infor-browse").eq(edit).hide();
- $(".modifybox").eq(edit).show();
-
- $(".close").click(function(){
- $(".modifybox").eq(edit).hide();
- $(".infor-browse").eq(edit).show();
- });
- });
- $("#saveDescp").on("click", function() {
- $.ajax({
- "url": "../ajax/professor/descp",
- "type": "POST",
- "data": {
- "id": userid,
- "descp": $("#descp").val()
- },
- "contentType": "application/x-www-form-urlencoded",
- "success": function($data) {
-
- if ($data.success) {
- $(".infor-browse").css("display","block");
- $(".modifybox").css("display","none");
- $("#descpS").text($("#descp").val());
- } else {
- $.MsgBox.Alert("message", $data.msg);
- }
- }
- })
- })
- $("#subjectAdd").click(function(){
- var val=$("#subject").val();
- $("#subjectList").append("<div class='acad'>"+ val +"<span class='remove'><img src='images/move.png'></span></div>")
- })
- $("#subjectList").on("click",".remove",function(){
- $(this).parent().remove();
- })
- $("#subjectSave").on("click",function () {
- var subjects = $("#subjectList .acad");
- var subjectAll = "";
- if(subjects.size()>0){
- for (var i = 0; i <subjects.size(); i++) {
- subjectAll += subjects[i].innerText;
- subjectAll += ',';
- };
- subjectAll = subjectAll.substring(0, subjectAll.length-1);
- }
- $.ajax({"url" : "/ajax/professor/subject",
- "type" : "POST",
- "data" : {"id":userid,"subject":subjectAll},
- "contentType" : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- $("#subject").val("");
- $("#subjectShow").empty();
- $("#subjectList").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- subjectShow(subjectAll);
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#industryAdd").click(function(){
- var val=$("#industry").val();
- $("#industryList").append("<div class='acad'>"+ val +"<span class='remove'><img src='images/move.png'></span></div>")
- })
- $("#industryList").on("click",".remove",function(){
- $(this).parent().remove();
- })
- $("#industrySave").on("click",function () {
- var industrys = $("#industryList .acad");
- var industryAll = "";
- if(industrys.size()>0){
- for (var i = 0; i <industrys.size(); i++) {
- industryAll += industrys[i].innerText;
- industryAll += ',';
- };
- industryAll = industryAll.substring(0, industryAll.length-1);
- }
- $.ajax({"url" : "/ajax/professor/industry",
- "type" : "POST",
- "data" : {"id":userid,"industry":industryAll},
- "contentType" : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- $("#industry").val("");
- $("#industryShow").empty();
- $("#industryList").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- industryShow(industryAll);
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#researchAreaAdd").click(function(){
- var researchArea=$("#researchArea").val();
- $("#researchAreaList").append("<div class='list'><span class='like'>0</span><span class='ra'>"+ researchArea +"</span><span class='remove'><img src='images/move.png'></span></div>")
- });
- $("#researchAreaList").on("click",".remove",function(){
- $(this).parent().remove();
- })
- $("#researchAreaSave").on("click",function () {
-
- var $data=[];
- var researchAreas = $("#researchAreaList .list .ra");
- if(researchAreas.length>0){
- for (var i = 0; i <researchAreas.length; i++) {
- var $rd ={};
- $rd.professorId = userid;
- $rd.caption= researchAreas[i].innerText;
- $data[i]=$rd;
- }
- }
- var $has = $data.length>0;
- $.ajax({
- "url" : $has?"../ajax/researchArea":"../ajax/researchArea/"+userid,
- "type" : $has? "PUT" : "DELETE",
- "data" : $has ? JSON.stringify($data) : null,
- "contentType" : $has ? "application/json": "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success)
- {
- $("#researchArea").val("");
- $("#researchAreaList").empty();
- $("#researchAreaShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success)
- {
- researchAreaShow($data.data.researchAreas, $data.data.researchAreaLogs);
- }
- });
-
- }
- else
- {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#other").click(function(){
- $(".addbox").toggle();
- });
- $("#eduBgList").on("mouseover mouseout",".eg",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updateEdu = function(data){
- $.get("/ajax/edu/" + data, function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#year").val($info.year ? $info.year : "");
- $("#school").val($info.school ? $info.school : "");
- $("#college").val($info.college ? $info.college : "");
- $("#major").val($info.major ? $info.major : "");
- $("#degree").val($info.degree ? $info.degree : "");
- $("#eduId").val(data);
- if($info.student){
- $("input[name='student'][value='1']").attr("checked","checked");
- }else{
- $("input[name='student'][value='0']").attr("checked","checked");
- }
-
- } else {
- alert($data.msg);
- }
- });
- }
- $("#eduBgList").on("click",".eg .modi",function(){
- updateEdu($(this)[0].title);
- });
- var delEdu = function(data){
- $.ajax({
- "url" : "/ajax/edu/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#eduBgList").on("click",".eg .remove",function(){
- $(this).parent().remove();
- delEdu($(this)[0].title);
- })
- $("#saveEduBg").on("click",function () {
- var $data = {};
- var $id = $("#eduId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.year = $("#year").val();
- $data.school = $("#school").val();
- $data.college = $("#college").val();
- $data.major = $("#major").val();
- $data.degree = $("#degree").val();
- $data.student = false;
- $.ajax({
- "url" : "/ajax/edu",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success)
- {
- $("#school").val("");
- $("#college").val("");
- $("#major").val("");
- $("#eduBgShow").empty();
- $("#eduBgList").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- eduBgShow($data.data.edus);
- }
- });
- }
- else
- {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#timeJobList").on("mouseover mouseout",".tj",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updateTimeJob = function(data){
- $.get("/ajax/job/" + data, function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#jobId").val(data);
- $("#startMonth").val($info.startMonth);
- $("#stopMonth").val($info.stopMonth ? $info.stopMonth: "");
- $("#jobCompany").val($info.company ? $info.company: "");
- $("#jobTitle").val($info.title ? $info.title: "");
- } else {
- alert($data.msg);
- }
- });
- }
- $("#timeJobList").on("click",".tj .modi",function(){
- updateTimeJob($(this)[0].title);
- })
- var delTimeJob = function(data){
- $.ajax({
- "url" : "/ajax/job/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#timeJobList").on("click",".tj .remove",function(){
- $(this).parent().remove();
- delTimeJob($(this)[0].title);
- })
- $("#timeJobSave").on("click",function () {
- var $data = {};
- var $id = $("#jobId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.company = $("#jobCompany").val();
- $data.startMonth = $("#startMonth").val();
- $data.stopMonth = $("#stopMonth").val();
- $data.title = $("#jobTitle").val();
- $.ajax({
- "url" : "/ajax/job",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success)
- {
- $("#jobCompany").val("");
- $("#jobTitle").val("");
- $("#timeJobList").empty();
- $("#timeJobShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- timeJobShow($data.data.jobs);
- }
- });
- }
- else
- {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#projectList").on("mouseover mouseout",".pro",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updateProject = function(data){
- $.get("/ajax/project/" + data,function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#projectStartMonth").val($info.startMonth ? $info.startMonth: "");
- $("#projectStopMonth").val($info.stopMonth ? $info.stopMonth: "");
- $("#projectName").val($info.name ? $info.name: "");
- $("#projectDescp").val($info.descp ? $info.descp: "");
- $("#projectId").val(data);
- } else {
- alert($data.msg);
- }
- });
- }
- $("#projectList").on("click",".pro .modi",function(){
- updateProject($(this)[0].title);
- })
- var delProject = function(data){
- $.ajax({
- "url" : "/ajax/project/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
- location.reload(true);
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#projectList").on("click",".pro .remove",function(){
- $(this).parent().remove();
- delProject($(this)[0].title);
- })
- $("#projectSave").on("click",function () {
- var $data = {};
- var $id = $("#projectId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.startMonth = $("#projectStartMonth").val();
- $data.stopMonth = $("#projectStopMonth").val();
- $data.name = $("#projectName").val();
- $data.descp = $("#projectDescp").val();
- $.ajax({
- "url" : "../ajax/project",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- $("#projectName").val("");
- $("#projectDescp").val("");
- $("#projectList").empty();
- $("#projectShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- projectShow($data.data.projects);
- }
- });
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#paperList").on("mouseover mouseout",".pap",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updatePaper = function(data){
- $.get("/ajax/paper/" + data, function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#paperYear").val($info.year ? $info.year : "");
- $("#paperName").val($info.name ? $info.name : "");
- $("#paperUrl").val($info.url ? $info.url : "");
- $("#paperDescp").val($info.descp ? $info.descp : "");
- $("#paperId").val(data);
- } else {
- alert($data.msg);
- }
- });
- }
- $("#paperList").on("click",".pap .modi",function(){
- updatePaper($(this)[0].title);
- })
- var delPaper = function(data){
- $.ajax({
- "url" : "../ajax/paper/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
-
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#paperList").on("click",".pap .remove",function(){
- $(this).parent().remove();
- delPaper($(this)[0].title);
- })
- $("#paperSave").on("click",function () {
- var $data = {};
- var $id = $("#paperId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.year = $("#paperYear").val();
- $data.name = $("#paperName").val();
- $data.descp = $("#paperDescp").val();
- $data.url = $("#paperUrl").val();
- $.ajax({
- "url" : "../ajax/paper",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- $("#paperName").val("");
- $("#paperDescp").val("");
- $("#paperUrl").val("");
- $("#paperList").empty();
- $("#paperShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- paperShow($data.data.papers);
- }
- });
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- });
- $("#patentList").on("mouseover mouseout",".pat",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updatePatent = function(data){
- $.get("/ajax/patent/" + data, function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#patentYear").val($info.year ? $info.year : "");
- $("#patentName").val($info.name ? $info.name : "");
- $("#patentUrl").val($info.url ? $info.url : "");
- $("#patentDescp").val($info.descp ? $info.descp : "");
- $("#patentId").val(data);
- } else {
- alert($data.msg);
- }
- });
- }
- $("#patentList").on("click",".pat .modi",function(){
- updatePatent($(this)[0].title);
- })
- var delPatent = function(data){
- $.ajax({
- "url" : "/ajax/patent/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
-
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#patentList").on("click",".pat .remove",function(){
- $(this).parent().remove();
- delPatent($(this)[0].title);
- })
- $("#patentSave").on("click",function () {
- var $data = {};
- var $id = $("#patentId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.year = $("#patentYear").val();
- $data.name = $("#patentName").val();
- $data.descp = $("#patentDescp").val();
- $data.url = $("#patentUrl").val();
- $.ajax({
- "url" : "../ajax/patent",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success) {
- $("#patentName").val("");
- $("#patentUrl").val("");
- $("#patentDescp").val("");
- $("#patentList").empty();
- $("#patentShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- patentShow($data.data.patents);
- }
- });
- } else {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $("#honorList").on("mouseover mouseout",".hon",function(even){
- if(event.type == "mouseover"){
- $(this).find("span").show();
- }else if(event.type == "mouseout"){
- $(this).find("span").hide();
- }
- })
- var updateHonor = function(data){
- $.get("/ajax/honor/" + data, function($data) {
- if ($data.success) {
- $info = $data.data;
- $("#honorYear").val($info.year ? $info.year : "");
- $("#honorName").val($info.name ? $info.name : "");
- $("#honorDescp").val($info.descp ? $info.descp : "");
- $("#honorId").val(data);
- } else {
- alert($data.msg);
- }
- });
- }
- $("#honorList").on("click",".hon .modi",function(){
- updateHonor($(this)[0].title);
- })
- var delHonor = function(data){
- $.ajax({
- "url" : "/ajax/honor/" + data,
- "type" : "DELETE",
- "success" : function($data) {
- if ($data.success) {
- } else {
- alert($data.msg);
- }
- }
- });
- }
- $("#honorList").on("click",".hon .remove",function(){
- $(this).parent().remove();
- delHonor($(this)[0].title);
- })
- function getProfessorData(){
- $.get("/ajax/professor/info/" + userid, function($data) {
- if ($data.success) {
- console.log($data)
- }
- });
- }
- getProfessorData()
- $("#honorSave").on("click",function () {
- var $data = {};
- var $id = $("#honorId").val();
- if ($id){
- $data.id = $id;
- }
- $data.professorId = userid;
- $data.year = $("#honorYear").val();
- $data.name = $("#honorName").val();
- $data.descp = $("#honorDescp").val();
- $.ajax({
- "url" : "../ajax/honor",
- "type" : $id ? "PUT" : "POST",
- "data" : $id ? JSON.stringify($data) : $data,
- "contentType" : $id ? "application/json"
- : "application/x-www-form-urlencoded",
- "success" : function($data) {
- if ($data.success)
- {
- $("#honorName").val("");
- $("#honorList").empty();
- $("#honorShow").empty();
- $(".modifybox").css("display","none");
- $(".infor-browse").css("display","block");
- $.get("/ajax/professor/info/" + userid, function($data)
- {
- if ($data.success) {
- honorShow($data.data.honors);
- }
- });
- }
- else
- {
- $.MsgBox.Alert("message",$data.msg);
- }
- }
- });
- })
- $.ajax({
- "url":"/ajax/resource/qapro",
- "type":"get",
- "data":{"professorId":userid},
- "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)
- {console.log(data);
- for(var i=0;i<data.data.length;i++){
- add='<div class="sharesrc">'
- add+='<div class="shareshow">'
- add+='<a href=""><img src="/images/resource/'+data.data[i].resourceId+'.jpg" width="100%" height="100%" class="resouImage"></a>'
- add+='<div class="shareopeart"></div>'
- add+='</div>'
- add+='<p>资源名称:<span class="presou">'+ data.data[i].resourceName+'</span></p>'
- if(data.data[i].descp==undefined){
- data.data[i].descp="";
- }
- add+='<p class="briefinfor">简介:'+data.data[i].descp+'</p>'
- add+='</div>'
- $(".sharescrollbox").append(add);
- $(".resouImage").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"));
-
- 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')}
- });
- $("#enterwork").on("click",function(){
- location.href="workspaces.html?"+userid;
- })
- var date = $(".present").index(this);
- $(".datebox").eq(date).find(".ago").remove();
- $(".datebox").eq(date).css("width","326px");
- })*/
- $(".present").change(function(){
- if($(".present").is(":checked"))
- {
- $(this).parent().parent().find('.ago').hide();
- $(this).parent().parent().find('.inputno').hide();
-
- }else{
-
- $(this).parent().parent().find('.ago').show();
- $(this).parent().parent().find('.inputno').show();
- }
- })
-
- $(".input_select").click(function(){
- var ul = $(this).next();
- if(ul.css("display")=="none"){
- ul.slideDown("fast");
- }else{
- ul.slideUp("fast");
- }
- });
-
- $(".divselect ul li a").click(function(){
- var txt = $(this).text();
- $(".divselect .input_select").val(txt);
- var value = $(this).attr("rel");
- $(".divselect ul").hide();
-
- });
- $("#aclick").on("click",function(){
- exit();
- });
- })
- function exit(){
- $.cookie('userid', null);
- $.cookie('userAuth', null);
- location.href="login.html"
- }
|