123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860 |
- var articleId = GetQueryString("articleId");
- var userid = $.cookie("userid");
- var zjreturnId;
- var wzreturnId;
- var experarray = [];
- var createTime,orderKey;
- $(function() {
- loginStatus();
- articleshow();
- relevantExperts();
- relevantResources();
-
- if(userid && userid != "null" && userid != null){
- $(".ifLoginOn").removeClass("displayNone");
- }else{
- $(".ifLoginUn").removeClass("displayNone");
- }
-
- function articleshow(){
- $.ajax({
- "url" : "/ajax/article/query",
- "type" : "GET" ,
- "dataType" : "json",
- "data" :{"articleId":articleId},
- "success" : function(data) {
- if (data.success){
- $("#articleTitle").text(data.data.articleTitle);
- $("#pageViews").text("阅读量 "+data.data.pageViews);
- $("#publishTime").text(commenTime(data.data.publishTime));
- $("#articleContent").html(data.data.articleContent);
- $("#articleImg").attr("style", "background-image: url(/data/article/" + data.data.articleImg + ");");
- $("#tagList").text(industryShow(data.data.subject));
- if (userid && userid != "null" && userid != null) {
- isAgree(data.data.articleAgree)
- }else{
- $(".thumbBtn").html("赞 <span>"+data.data.articleAgree+"</span>");
- }
- ifCollection(articleId,2);
- if(data.data.articleType==1){
- $("#expert").removeClass("displayNone");
- relevantarticalList(data.data.professorId,1);
- expert(data.data.professorId);
- }
- if(data.data.articleType==2){
- $("#enterprise").removeClass("displayNone");
- relevantarticalList(data.data.orgId,2);
- cmpFun(data.data.orgId);
- }
- var weibotitle = data.data.articleTitle;
- var weibourl =window.location.href;
- var weibopic ="http://"+window.location.host+"/data/article/" + data.data.articleImg;
- $("#weibo").attr("href","http://service.weibo.com/share/share.php?appkey=3677230589&title="+weibotitle+"&url="+weibourl+"&pic="+weibopic+"&ralateUid=6242830109&searchPic=false&style=simple");
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
-
- function expert(professorId){
-
- $.ajax({
- "url" : "/ajax/professor/baseInfo/"+professorId,
- "type" : "GET" ,
- "dataType" : "json",
- "success" : function(data) {
- if (data.success && data.data){
- if(data.data.hasHeadImage==1) {
- $("#Zimg,.userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
- }
- if(data.data.title==""){
- var title = data.data.office;
- }else{
- var title = data.data.title;
- }
- $("#Zname,.username").text(data.data.name);
- $("#Zname").attr("dataid",data.data.id);
- $(".hrefgo,.useurl").attr("href", "information-brow.html?professorId="+data.data.id);
- $("#Ztitle").text(title);
- $("#ZorgName").text(data.data.orgName);
- var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
- $("#ZauthFlag,.labels").attr("title", userType.title);
- $("#ZauthFlag,.labels").addClass(userType.sty);
- if(data.data.id!=userid){
- $(".goSpan").removeClass("displayNone");
- ifCollection(data.data.id,1)
- }
-
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
-
- function cmpFun(orgId) {
- $.ajax({
- "url": "/ajax/org/" + orgId,
- "type": "get",
- "dataType" : "json",
- "success": function(data) {
- if(data.success && data.data) {
- $(".userimg").removeClass("useHead");
- $("#Qname,.username").text(data.data.name);
- $(".qiyego,.useurl").attr("href", "companybrowinfor.html?orgId="+data.data.id);
- if(data.data.hasOrgLogo) {
- $("#Qimg,.userimg").attr("style", "background-image: url(/images/org/" + data.data.id + ".jpg);");
- }
- if(data.data.authStatus==3){
- $("#QauthFlag,.labels").addClass("authicon-com-ok").attr("title", "认证企业");;
- }
- $("#Qindustry").text(QindustryShow(data.data.industry));
- if(data.data.orgType==2){
- $("#QorgType").text("上市企业");
- }else if(data.data.orgType==3){
- $("#QorgType").text("国有企业");
- }else if(data.data.orgType==4){
- $("#QorgType").text("合资企业");
- }else if(data.data.orgType==5){
- $("#QorgType").text("私人企业");
- }else if(data.data.orgType==6){
- $("#QorgType").text("外资企业");
- }else if(data.data.orgType==7){
- $("#QorgType").text("初创企业");
- }else{
- $("#QorgType").text("");
- }
-
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
- function relevantExperts(){
- $.ajax({
- "url": "/ajax/article/ralatePro",
- "type": "get",
- "dataType" : "json",
- "data" :{"articleId":articleId},
- "success": function(data) {
- if(data.success && data.data) {
- for(var i = 0; i < data.data.length; i++) {
- var professorId = data.data[i].professorId;
- relevantExpertsList(professorId)
- }
-
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
-
- function relevantExpertsList(professorId){
- $.ajax({
- "url" : "/ajax/professor/info/"+professorId,
- "type" : "GET" ,
- "dataType" : "json",
- "success" : function(data) {
- if (data.success && data.data){
- var itemlist = '';
- $("#trelevantExperts").html("");
- var itemlist = '<li><a href="" class="flexCenter urlgo" style="min-height:80px;">';
- itemlist += '<div class="madiaHead useHead" id="userimg"></div>';
- itemlist += '<div class="madiaInfo">';
- itemlist += '<p><span class="h1Font" id="userName"></span><em class="authiconNew" title=""></em></p>';
- itemlist += '<p class="ellipsisSty h2Font" id="usertitle"></p>';
- itemlist += '<p class="h2Font ellipsisSty" id="researchAreas"></p>';
- itemlist += '</div></a></li>';
- $itemlist = $(itemlist);
- $("#relevantExperts").append($itemlist);
- var title = data.data.title || "";
- var office = data.data.office || "";
- if(title != "") {
- title = title + " , ";
- }
- $itemlist.find("#userName").text(data.data.name);
- $itemlist.find("#usertitle").text(title + office);
- $itemlist.find(".urlgo").attr("href", "information-brow.html?professorId="+data.data.id);
-
- var researchAreas = data.data.researchAreas;
- if(researchAreas != ""){
- var rlist = '研究方向:';
- }else{
- var rlist = '';
- }
- for(var n = 0; n < researchAreas.length; n++) {
-
- rlist += researchAreas[n].caption
- if(n < researchAreas.length - 1) {
- rlist += ";"
- }
- }
- $itemlist.find("#researchAreas").text(rlist);
- if(data.data.hasHeadImage == 1) {
- $itemlist.find("#userimg").attr("style", "background-image: url(/images/head/" + data.data.id + "_l.jpg);");
- }
- var userType = autho(data.data.authType, data.data.orgAuth, data.data.authStatus);
- $itemlist.find(".authiconNew").attr("title", userType.title);
- $itemlist.find(".authiconNew").addClass(userType.sty);
-
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
-
- function relevantResources(){
- $.ajax({
- "url": "/ajax/article/ralateRes",
- "type": "get",
- "dataType" : "json",
- "data" :{"articleId":articleId},
- "success": function(data) {
- if(data.success && data.data) {
- for(var i = 0; i < data.data.length; i++) {
- var resourceId = data.data[i].resourceId;
- relevantResourcesList(resourceId)
- }
-
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
-
- function relevantResourcesList(resourceId){
- $.ajax({
- "url" : "/ajax/resource/resourceInfo",
- "type" : "GET" ,
- "dataType" : "json",
- "data" :{"resourceId":resourceId},
- "success" : function(data) {
- console.log(data);
- if (data.success && data.data){
- var itemlist = '<li><a href="" class="flexCenter urlgo">';
- itemlist += '<div class="madiaHead resouseHead" id="userimg"></div>';
- itemlist += '<div class="madiaInfo">';
- itemlist += '<p class="h1Font" id="resourceName"></p>';
- itemlist += '<p class="h2Font ellipsisSty" id="name"></p>';
- itemlist += '<p><span class="h2Font uname"></span><em class="authiconNew" title="科袖认证专家"></em></p>';
- itemlist += '</div></a></li>';
- $itemlist = $(itemlist);
- $("#resources").append($itemlist);
- var datalist = data.data;
- $itemlist.find("#resourceName").text(datalist.resourceName);
- $itemlist.find("#name").text("用途:"+datalist.supportedServices);
- $itemlist.find(".uname").text(datalist.editProfessor.name);
- $itemlist.find(".urlgo").attr("href", "resourceShow.html?resourceId="+datalist.resourceId);
- var userType = autho(datalist.editProfessor.authType, datalist.editProfessor.orgAuth, datalist.editProfessor.authStatus);
- $itemlist.find(".authiconNew").attr("title", userType.title);
- $itemlist.find(".authiconNew").addClass(userType.sty);
- if(datalist.images.length > 0) {
- $itemlist.find("#userimg").attr("style", "background-image: url(/data/resource/" + datalist.images[0].imageSrc + ");");
- }
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
- function keysli() {
- $("#tagList li").each(function(i) {
- var liid = $(this).text();
- experarray.push(liid);
- });
- return $.unique(experarray);
- }
-
-
- function relevantarticalList(id,num){
- keysli();
- if(num==1){
- var data = {"keys":experarray,"professorId":id,"articleId":articleId,"rows":10}
- }
- if(num==2){
- var data = {"keys":experarray,"orgId":id,"articleId":articleId,"rows":10}
- }
- $.ajax({
- "url" : "/ajax/article/ralateArticles",
- "type" : "GET" ,
- "dataType" : "json",
- "data" :data,
-
- "traditional": true,
- "success" : function(data) {
- console.log(data);
- if (data.success && data.data){
- var itemlist = '';
- $("#abutartical").html("");
- for(var i = 0; i < data.data.length; i++) {
- var itemlist = '<li><a href="" class="flexCenter urlgo">';
- itemlist += '<div class="madiaHead artHead" id="userimg"></div>';
- itemlist += '<div class="madiaInfo">';
- itemlist += '<p class="h1Font ellipsisSty" id="resourceName"></p>';
- itemlist += '<p><span class="h1Font username2"></span><em class="authiconNew" id="relatedLabels" title="科袖认证专家"></em></p>';
- itemlist += '</div></a></li>';
- $itemlist = $(itemlist);
- $("#abutartical").append($itemlist);
- var datalist = data.data[i];
- $itemlist.find("#resourceName").text(datalist.articleTitle);
- $itemlist.find(".urlgo").attr("href", "articalShow.html?articleId="+datalist.articleId);
- if(datalist.articleImg!=undefined){
- $itemlist.find("#userimg").attr("style", "background-image: url(/data/article/" + datalist.articleImg + ");");
- }
- if(datalist.articleType==1){
- $.ajax({
- "url" : "/ajax/professor/baseInfo/"+datalist.professorId,
- "type" : "GET" ,
- "dataType" : "json",
- "async":false,
- "success" : function($data) {
- if ($data.success && $data.data){
- $itemlist.find(".username2").text($data.data.name);
- var userType = autho($data.data.authType, $data.data.orgAuth, $data.data.authStatus);
- $itemlist.find("#relatedLabels").attr("title", userType.title);
- $itemlist.find("#relatedLabels").addClass(userType.sty);
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
- if(datalist.articleType==2){
- $.ajax({
- "url" : "/ajax/org/"+datalist.orgId,
- "type" : "GET" ,
- "dataType" : "json",
- "async":false,
- "success" : function($data) {
- console.log($data)
- if ($data.success && $data.data){
- $itemlist.find(".username2").text($data.data.name);
- $itemlist.find("#relatedLabels").addClass("authicon-com-ok").attr("title", "认证企业");
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
- }
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
- function Time(dealtime) {
- var s = dealtime;
- var m = s.substr(4, 2);
- var d = s.substr(6, 2);
- var h = s.substr(8, 2);
- var minute = s.substr(10, 2);
- var formatTime = m.replace(/\b(0+)/gi, "") + "月" + d + "日 " + h + ":" + minute;
- return formatTime;
- }
-
-
- function industryShow(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++)
- {
- $("#tagList").append('<li class="delkeylist"><p class="h2Font">'+ subs[i] +'</p></li>');
- };
- }
- }
- }
-
-
-
- function QindustryShow(data){
- if(data != undefined && data.length != 0 ){
- var subs = new Array();
- subs = data.replace(',',' | ');
- if(subs.length>0){
- for (var i = 0; i < subs.length; i++)
- {
- $("#Qindustry").append(subs[i]);
- };
- }
- }
- }
-
- });
- $('.thumbBlock').on("click",".thunbgo",function(){
- if (userid && userid != "null" && userid != null) {
- addAgree();
- }else{
- $.MsgBox.Alert('提示',"请先登录再进行关注");
- $("#mb_btn_ok").val("去登录");
- var aele = document.createElement('a');
- $("#mb_btnbox").append(aele);
- $("#mb_btnbox a").css({
- 'display': "block",
- 'width': '100%',
- 'height': '40px',
- 'position': 'absolute',
- 'bottom': '-6px',
- 'left': '0'
- });
- aele.setAttribute('href', '../login.html');
- }
- })
- function isAgree(articleAgree) {
- var data = {"operateId": userid,"articleId": articleId}
- $.ajax({
- url:"/ajax/article/isAgree",
- data:data,
- dataType: 'json',
- type: 'get',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success){
- if(data.data!= null){
- $(".thumbBtn").html("已赞 <span>"+articleAgree+"</span>");
- $(".thumbBtn").addClass("thumbedBtn");
- }else{
- $(".thumbBtn").html("赞 <span>"+articleAgree+"</span>");
- $(".thumbBtn").addClass("thunbgo");
- }
- }
- },
- error: function() {
- $.MsgBox.Alert('提示',"服务器链接超时");
- }
- });
- }
- function addAgree() {
- var data = {"operateId": userid,"articleId": articleId}
- $.ajax({
- url:"/ajax/article/agree",
- data:data,
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(data.success){
- var articleAgreeval = $(".thumbBtn span").text();
- $(".thumbBtn").html("已赞 <span>"+parseInt(articleAgreeval+1)+"</span>");
- $(".thumbBtn").addClass("thumbedBtn");
- $(".thumbBtn").removeClass("thunbgo");
- }
- },
- error: function() {
- $.MsgBox.Alert('提示',"服务器链接超时");
- }
- });
- }
- $('.attenSpan').click(function(){
- if (userid && userid != "null" && userid != null) {
- if($(this).is('.attenSpanyes')){
- cancelCollectionExpert($("#Zname").attr("dataid"),1)
- }else{
- collectionExpert($("#Zname").attr("dataid"),1);
- }
- }else{
- $.MsgBox.Alert('提示',"请先登录再进行关注");
- $("#mb_btn_ok").val("去登录");
- var aele = document.createElement('a');
- $("#mb_btnbox").append(aele);
- $("#mb_btnbox a").css({
- 'display': "block",
- 'width': '100%',
- 'height': '40px',
- 'position': 'absolute',
- 'bottom': '-6px',
- 'left': '0'
- });
- aele.setAttribute('href', '../login.html');
- }
- })
- $('#attention em').click(function(){
- if (userid && userid != "null" && userid != null) {
- if($(this).is('.icon-collected')){
- cancelCollectionExpert(articleId,2)
- }else{
- collectionExpert(articleId,2);
- }
- }else{
- $.MsgBox.Alert('提示',"请先登录再进行收藏");
- $("#mb_btn_ok").val("去登录");
- var aele = document.createElement('a');
- $("#mb_btnbox").append(aele);
- $("#mb_btnbox a").css({
- 'display': "block",
- 'width': '100%',
- 'height': '40px',
- 'position': 'absolute',
- 'bottom': '-6px',
- 'left': '0'
- });
- aele.setAttribute('href', '../login.html');
- }
- })
- function ifCollection(getid,num) {
- var data = {"professorId": userid,"watchObject": getid}
-
- $.ajax({
- url:"/ajax/watch/hasWatch",
- data:data,
- dataType: 'json',
- type: 'get',
- timeout: 10000,
- async: false,
- success: function(data) {
- if(num==1){
- if(data.success && data.data != null) {
- $('.attenSpan').addClass("attenSpanyes");
- $('.attenSpan').text('已关注');
- zjreturnId = data.data.watchObject;
- } else {
- $('.attenSpan').removeClass("attenSpanyes");
- $('.attenSpan').text('关注');
- }
- }
- if(num==2){
- if(data.success && data.data != null) {
- $('#attention em').addClass("icon-collected");
- wzreturnId = data.data.watchObject;
- } else {
- $('#attention em').removeClass("icon-collected");
- }
- }
-
- },
- error: function() {
- $.MsgBox.Alert('提示',"服务器链接超时");
- }
- });
- }
- function collectionExpert(watchObject,num) {
- if(num==1){
- var data = {"professorId": userid,"watchObject": watchObject,"watchType": 1}
- }else{
- var data = {"professorId": userid,"watchObject": watchObject,"watchType": 2}
- }
- $.ajax({
- url:"/ajax/watch",
- data:data,
- dataType: 'json',
- type: 'POST',
- timeout: 10000,
- async: false,
- success: function(data) {
- console.log(data.success)
- if(num==1){
- if(data.success) {
- $('.attenSpan').addClass("attenSpanyes");
- $('.attenSpan').text('已关注');
- zjreturnId = data.data.watchObject;
- }
- }
-
- if(num==2){
- if(data.success) {
- $('#attention em').addClass("icon-collected");
- wzreturnId = data.data.watchObject;
- }
- }
-
- },
- error: function() {
- $.MsgBox.Alert('提示',"服务器链接超时");
- }
- });
- }
- function cancelCollectionExpert(watchObject,num) {
- $.ajax({
- url:"/ajax/watch/delete",
- data: {
- professorId: userid,
- watchObject: watchObject
- },
- dataType: 'json',
- type: 'post',
- timeout: 10000,
- async: true,
- success: function(data) {
- console.log(data.success)
- if(num==1){
- if(data.success) {
- $('.attenSpan').removeClass("attenSpanyes");
- $('.attenSpan').text('关注');
- }
- }
- if(num==2){
- if(data.success) {
- $('#attention em').removeClass("icon-collected");
- }
- }
-
- },
- error: function(data) {
- $.MsgBox.Alert('提示',"服务器链接超时");
- }
- });
- }
-
- function pageViewsVal(){
- $.ajax({
- "url" : "/ajax/article/pageViews",
- "type" : "POST" ,
- "dataType" : "json",
- "data" :{"articleId":articleId},
- "success" : function(data) {
- console.log(data);
- if (data.success){
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
- ArticleMessagesNumbe();
- function ArticleMessagesNumbe(){
- $.ajax({
- "url" : "/ajax/leaveWord/lwCount",
- "type" : "GET" ,
- "dataType" : "json",
- "data" :{"articleId":articleId},
- "success" : function(data) {
- console.log(data);
- if (data.success){
- $(".message").text(data.data);
- }
- },
- "error":function(){
- $.MsgBox.Alert('提示','链接服务器超时')
- }
- });
- }
-
-
- $(".msgCont").on("keyup", function() {
- $(".msgconNum span").text($(this).val().length);
- if($(this).val().length > 200) {
- $(this).val($(this).val().substr(0, 200));
- }
- if($(this).val().length <= 0){
- $("#meSendtt").css("background", "#ccc");
- }else{
- $("#meSendtt").css("background", "#ff9900");
- }
- })
- $("#meSendtt").on("click", function() {
- article();
- })
- $("#moreArtical").on("click",function(){
- vcreateTime = $(".commentList li").last().attr("data-time");
- orderKey = $(".commentList li").last().attr("data-key");
- message(5,1);
- })
- $(".commentList").on("click",".messageDel",function(){
- var commenid = $(this).attr("data-id");
- articledel(commenid)
- })
- function article() {
- $.ajax({
- url:"/ajax/leaveWord",
- dataType: 'json',
- type: 'POST',
- data: {
- "articleId": articleId,
- "sender": userid,
- "content": $(".msgCont").val(),
- },
- timeout: 10000,
- success: function(data) {
- var $info = data.data || {};
- if(data.success && data.data) {
- message(5,2);
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- });
- }
- message(5,2);
- function message(rows,num) {
- if(num==1){
- var data = {"articleId": articleId,"createTime": vcreateTime,"orderKey": orderKey,"rows": rows}
- }else{
- var data = {"articleId": articleId,"rows": rows}
- }
- $.ajax({
- url: "/ajax/leaveWord/ql",
- dataType: 'json',
- type: 'GET',
- data: data,
- timeout: 10000,
- success: function(data) {
- if(data.success) {
- if(data.data != ""){
- if(num==2){
- $(".commentList").html("");
- }
- if(data.data.length > 4){
- $("#moreArtical").removeClass("displayNone");
- }else{
- $("#moreArtical").addClass("displayNone");
- }
- for(var i = 0; i < data.data.length; i++) {
- var itemlist = '<li data-time="" data-key="">';
- itemlist += '<a href class="userhref"> <div class="madiaHead useHead"></div></a>';
- itemlist += '<div class="madiaInfo">';
- itemlist += '<p><a href class="userhref"><span class="h1Font messageName">张某某</span></a><em class="authiconNew" title="科袖认证专家"></em><span class="commenttime">9月30号 12:00</span></p>';
- itemlist += '<p class="h2Font messageContent">sdfsdfs</p>';
- itemlist += '<div class="operateSpan"><span class="callBack">回复</span><span class="messageDel">删除</span></div>';
- itemlist += '</div></li>';
- $itemlist = $(itemlist);
- $(".commentList").append($itemlist);
- var datalist = data.data[i];
- $itemlist.find(".messageName").text(datalist.professor.name);
- $itemlist.find(".messageContent").text(datalist.content);
- var userType = autho(datalist.professor.authType, datalist.professor.orgAuth, datalist.professor.authStatus);
- $itemlist.find(".authiconNew").attr("title", userType.title);
- $itemlist.find(".authiconNew").addClass(userType.sty);
- if(datalist.professor.hasHeadImage==1) {
- $(".useHead").attr("style", "background-image: url(/images/head/" + datalist.professor.id + "_l.jpg);");
- }
- if(datalist.professor.id!=userid){
- $(".messageDel").hide();
- }
- $itemlist.attr("data-time", datalist.createTime);
- $itemlist.attr("data-key", datalist.orderKey);
- $itemlist.find(".messageDel").attr("data-id", datalist.id);
- $itemlist.find(".userhref").attr("href", "information-brow.html?professorId="+datalist.professor.id);
- var createtime = datalist.createTime;
- $itemlist.find(".commenttime").text(commenTime(createtime));
- }
- }else{
- if(num==2){
- $(".commentList").html("");
- }else{
- $("#moreArtical").addClass("displayNone");
- }
-
- }
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- });
- }
-
- function articledel(commenid) {
- $.ajax({
- url:"/ajax/leaveWord/delete",
- dataType: 'json',
- type: 'POST',
- data: {
- "id": commenid,
- },
- timeout: 10000,
- success: function(data) {
- if(data.success) {
- message(5,2);
- }
- },
- error: function() {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- });
- }
- function commenTime(startTime){
- var nowTimg = new Date();
- var startdate = new Date();
- startdate.setFullYear(parseInt(startTime.substring(0,4)));
- startdate.setMonth(parseInt(startTime.substring(4,6))-1);
- startdate.setDate(parseInt(startTime.substring(6,8)));
- startdate.setHours(parseInt(startTime.substring(8,10)));
- startdate.setMinutes(parseInt(startTime.substring(10,12)));
- startdate.setSeconds(parseInt(startTime.substring(12,14)));
- var date3=nowTimg.getTime()-startdate.getTime();
- var hours = parseInt((date3 % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
- var minutes = parseInt((date3 % (1000 * 60 * 60)) / (1000 * 60));
- if(date3 < 60000){
- return "刚刚";
- }else if(date3 > 60000 && date3 < 3600000){
- return minutes + "分钟前";
- }else if(date3 > 3600000 && date3 < 86400000){
- return hours + "小钟前";
- }else if(date3 > 86400000 && date3 < 172800000){
- return "昨天 " + startTime.substring(10,12) + ":" +startTime.substring(12,14);
-
- }else{
- return startTime.substring(4,6) + "月" + startTime.substring(6,8) + "日 " + startTime.substring(8,10) + ":" + startTime.substring(10,12);
- }
-
- }
- window.onload=function(){
- pageViewsVal();
- }
|