123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491 |
- $(document).ready(function() {
- loginStatus();
- var userid = $.cookie("userid");
- var resourceId = GetQueryString("productId");
- if(navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
- location.href = "http://" + window.location.host + "/e/pr.html?id=" + resourceId;
- }
- $(".jqzoom").imagezoom();
- $("#thumblist").on("click", "li a", function() {
- $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
- $(".jqzoom").attr('src', $(this).find("img").attr("src"));
- $(".jqzoom").attr('rel', $(this).find("img").attr("src"));
- });
- $('.shareWeixin').hover(function() {
- $('.shareCode').stop(true, false).fadeToggle();
- });
- ifcollectionAbout(resourceId, $("#attention").find("em"), 11)
- pageViewLog(resourceId, 11)
- var professorId = "";
- getRecourceMe();
-
- function recentlyRe(par) {
- var $info = {};
- $info.rows = 6;
- $info.owner = par;
- $.ajax({
- "url": '/ajax/product/publish',
- "type": "GET",
- "dataType": "json",
- "data": $info,
- "success": function(data) {
- if(data.success) {
- var $data = data.data;
- var only = false;
- if($data.length > 1) {
- if($data.length > 1 || ($data.length == 1 && resourceId == $data[0].id))
- $(".recentlyList").parents(".currentBlock").removeClass("displayNone");
- for(var i = 0; i < $data.length; i++) {
- if(resourceId == $data[i].id) {
- continue;
- }
- var resIM = '/data/product' + $data[i].images.split(",")[0];
- var str = '<li><a class="flexCenter" style="min-height:46px;" href="productShow.html?productId=' + $data[i].id + '">' +
- '<div class="madiaHead resourceHead" style="width:50px;height:36px;margin-top:-18px;background-image: url(' + resIM + ');"></div>' +
- '<div class="madiaInfo"><p class="h2Font ellipsisSty-2">' + $data[i].name + '</p></div></a></li>'
- $(".recentlyList").append(str);
- }
- }
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
-
- function getRecourceMe() {
- $.ajax({
- "url": "/ajax/product/qo",
- "type": "GET",
- "success": function(data) {
- console.log(data);
- if(data.success) {
- resourceHtml(data.data);
- var resourceName = data.data.name + "-科袖网";
- document.title = resourceName;
- }
- },
- "data": {
- "id": resourceId
- },
- dataType: "json",
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
-
- function outHTML(selecter) {
- var getValue = selecter;
- var aa = "";
- if(getValue) {
- var endValue = ((getValue.replace(/<(.+?)>/gi, "<$1>")).replace(/ /gi, " ")).replace(/\n/gi, "|");
- var cc = endValue.split("|");
- for(var i = 0; i < cc.length; i++) {
- aa += cc[i] + '<br/>'
- }
- }
- return aa;
- }
-
- function resourceHtml($da) {
- comMess($da.owner);
- recentlyRe($da.owner);
- $("#resourceName").text($da.name);
- $("#application").text($da.cnt);
- if($da.producingArea) {
- $("#productArea").text($da.producingArea).parents("li").show();
- }
- if($da.price) {
- $("#officialPrice").text($da.price).parents("li").show();
- }
- if($da.spec) {
- $("#modelNumber").text($da.spec).parents("li").show();
- }
- if($da.parameter) {
- $("#performancePa").html(outHTML($da.parameter)).parents("li").show();
- }
- if($da.pageViews > 0) {
- $("#pageView").html($da.pageViews)
- }
- if($da.keywords) {
- var oSub = $da.keywords.split(",");
- var oSt = "";
- for(var i = 0; i < oSub.length; i++) {
- oSt += '<li><p class="h2Font">' + oSub[i] + '</p></li>'
- }
- $(".tagList").html(oSt);
- }
- if($da.descp) {
- $("#descp").html($da.descp).parents("li").show();
- }
- var weibotitle = $da.name;
- var weibourl = window.location.href;
-
- if($da.images) {
- var weibopic = "http://" + window.location.host + "/data/product" + $da.images.split(',')[0];
- $("#firstFigure").attr({
- "src": "/data/product" + $da.images.split(',')[0],
- "rel": "/data/product" + $da.images.split(',')[0]
- }).parent().attr("href", "/data/product" + $da.images.split(',')[0]);
- var arr = "";
- var images = $da.images.split(',')
- for(var i = 0; i < images.length; i++) {
- if(i == 0) {
- var oString = '<li class="tb-selected">' +
- '<div class="tb-pic tb-s66">' +
- '<a href="javascript:void(0);">' +
- '<img src="/data/product' + images[0] + '"/>' +
- '</a>' +
- '</div>' +
- '</li>'
- } else {
- var oString = '<li >' +
- '<div class="tb-pic tb-s66">' +
- '<a href="javascript:void(0);">' +
- '<img src="/data/product' + images[i] + '"/>' +
- '</a>' +
- '</div>' +
- '</li>'
- }
- arr += oString;
- }
- $("#thumblist").html(arr);
- } else {
- var weibopic = "http://" + window.location.host + "../images/default-resource.jpg";
- $("#firstFigure").attr({
- "src": '../images/default-resource.jpg',
- "rel": '../images/default-resource.jpg'
- });
- }
- $("#weibo").attr("href", "http://service.weibo.com/share/share.php?appkey=3677230589&title=" + encodeURIComponent(weibotitle) + "&url=" + encodeURIComponent(weibourl) + "&pic=" + encodeURIComponent(weibopic) + "&content=utf-8" + "&ralateUid=6242830109&searchPic=false&style=simple");
- }
-
- $("#nameS,#headImg").click(function() {
- location.href = "userInforShow.html?professorId=" + professorId;
- })
-
- $("#consultin").on('click', function() {
- if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
- location.href = "tidings.html?id=" + professorId
- } else {
- quickLog();
- operatTab();
- closeLog();
- }
- });
- $("#expertli").on("click", ".addbtn", function(event) {
- if(userid && userid != null && userid != 'null' && userid != undefined && userid != 'undefined') {
- var id = $(this).attr("data-id");
- location.href = "tidings.html?id=" + id;
- } else {
- quickLog();
- operatTab();
- closeLog();
- }
- event.stopPropagation()
- });
- $("#enterprise").on("click", '.attenSpan', function() {
- if(userid && userid != "null" && userid != null) {
- if($(this).is('.attenedSpan')) {
- cancelCollectionAbout($(".qiyego").attr('dataid'), $(this), 6)
- } else {
- collectionAbout($(".qiyego").attr('dataid'), $(this), 6);
- }
- } else {
- quickLog();
- operatTab();
- closeLog();
- }
- })
-
- $('#attention em').click(function() {
- if(userid && userid != "null" && userid != null) {
- if($(this).is('.icon-collected')) {
- cancelCollectionAbout(resourceId, $(this), 11)
- } else {
- collectionAbout(resourceId, $(this), 11)
- }
- } else {
- quickLog();
- operatTab();
- closeLog();
- }
- })
- selUse();
- function selUse() {
- $.ajax({
- url: "/ajax/product/pro",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- async: true,
- data: {
- "id": resourceId,
- },
- success: function(data, textState) {
- console.log(data)
- if(data.success) {
- if(data.data.length > 0) {
- $("#expertli").parents(".currentBlock").removeClass("displayNone");
- } else {
- $("#expertli").parents(".currentBlock").addClass("displayNone");
- }
- var arr = [];
- for(var i = 0; i < data.data.length; i++) {
- arr.push(data.data[i].professor)
- }
- console.log(arr)
- professorList(arr);
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- function professorList(par) {
- $.ajax({
- url: "/ajax/professor/qm",
- type: "GET",
- timeout: 10000,
- dataType: "json",
- async: true,
- traditional: true,
- data: {
- "id": par,
- },
- success: function(data, textState) {
- console.log(data)
- if(data.success) {
- if(data.data.length) {
- unauthUser(data.data);
- $("#resPerson").show();
- }
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- function ajaxRequist(url, obj, type, fn) {
- $.ajax({
- url: url,
- data: obj,
- dataType: 'json',
- type: type,
- traditional: true,
- success: function(data) {
- if(data.success) {
- fn(data)
- }
- },
- error: function(xhr, type, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败');
- }
- });
- }
- function unauthUser($res) {
- var osting = ""
- for(var i = 0; i < $res.length; i++) {
- var img;
- var styC = "";
- var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
- var oTitle = "";
- if($res[i].title) {
- oTitle = $res[i].title;
- } else {
- if($res[i].office) {
- oTitle = $res[i].office;
- }
- }
- if($res[i].hasHeadImage) {
- img = "/images/head/" + $res[i].id + "_l.jpg";
- } else {
- img = "../images/default-photo.jpg"
- }
- var oSt = '<li data-id="' + $res[i].id + '" style="cursor:pointer;">'
- oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url(' + img + ');"></div>'
- oSt += '<div class = "madiaInfo">'
- oSt += '<p class = "ellipsisSty">'
- oSt += '<span class = "h1Font" id="name">' + $res[i].name + '</span><em class="authicon ' + oClass.sty + '" title="' + oClass.title + '"></em >'
- oSt += '</p>'
- oSt += '<p class="h2Font ellipsisSty">' + oTitle + '</p>'
- oSt += '</div>'
- if(userid != $res[i].id)
- oSt += '<span class="addbtn" data-id="' + $res[i].id + '">联系</span>'
- oSt += '</li>'
- osting += oSt;
- }
- $("#expertli").append(osting);
- }
- function comMess(oid) {
- $.ajax({
- url: "/ajax/org/" + oid,
- type: "GET",
- timeout: 10000,
- dataType: "json",
- async: "true",
- success: function(data, textState) {
- if(data.success) {
- var $da = data.data;
- $("#enterprise,#resPerson").show();
- if($da.hasOrgLogo) {
- $("#companyImg").attr("src", "/images/org/" + $da.id + ".jpg");
- } else {
- $("#companyImg").attr("src", "/images/default-icon.jpg");
- }
- if($da.authStatus == 3) {
- $("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");
- }
- $("#Qname").text($da.name);
- if($da.industry) {
- $("#Qindustry").text($da.industry.replace(/,/gi, " | "));
- }
- $(".qiyego").attr('dataid', $da.id);
- $(".qiyego").attr("href", "cmpInforShow.html?orgId=" + $da.id);
- if(userid) {
- ifcollectionAbout($da.id, $("#enterprise").find(".attenSpan"), 6)
- }
- }
- },
- error: function(XMLHttpRequest, textStats, errorThrown) {
- $.MsgBox.Alert('提示', '服务器请求失败')
- }
- })
- }
- $("#expertli").on("click",'li', function() {
- location.href = "userInforShow.html?professorId=" + $(this).attr("data-id");
- })
-
- $(".correctSubmit").on("click", function() {
- var cntCon = $(this).siblings(".correctCon").val();
- var cntUser = "";
- if(userid && userid != null && userid != "null") {
- cntUser = userid;
- }
- if(cntCon.length > 500) {
- $.MsgBox.Alert('提示', '纠错反馈内容不得超过500个字');
- return;
- } else {
- $.ajax({
- "url": "/ajax/feedback/error/product",
- "type": "POST",
- "dataType": "json",
- "async": true,
- "data": {
- "id": resourceId,
- "cnt": cntCon,
- "user": cntUser
- },
- "success": function(data) {
- if(data.success) {
- backSuccessed();
- }
- },
- "error": function() {
- $.MsgBox.Alert('提示', '链接服务器超时')
- }
- });
- }
- })
- relatedArticles()
-
- function relatedArticles() {
- $.ajax({
- "url": "/ajax/article/lq/byProduct",
- "type": "GET",
- "data": {
- "product": resourceId,
- "rows": 5
- },
- dataType: "json",
- "success": function(data) {
- if(data.success) {
- if(data.data.length > 0) {
- var $data = data.data;
- $("#oArticle").parents(".otherShow").removeClass("displayNone");
- for(var i = 0; i < $data.length; i++) {
- var str = "",
- ovel = "";
-
- ovel="阅读量 "+$data[i].pageViews;
- }*/
- str += '<li data-id="' + $data[i].articleId + '" data-createTime="' + $data[i].createTime + '" data-shareId="' + $data[i].shareId + '"><a class="flexCenter OflexCenter">'
- if($data[i].articleImg) {
- str += '<div class="madiaHead artHead" style="background-image: url(/data/article/' + $data[i].articleImg + ')"></div>'
- } else {
- str += '<div class="madiaHead artHead"></div>'
- }
- str += '<div class="madiaInfo" style="margin-top:18px;padding-bottom:8px">'
- str += '<p class="h1Font ellipsisSty">' + $data[i].articleTitle + '</p>'
- str += '<p class="h2Font"><span class=" name" style="margin-right:10px"></span><span class="time" style="margin-right:10px;">' + commenTime($data[i].publishTime) + '</span></p>'
- str += '</div></a></li>'
-
- var $str = $(str);
- $("#oArticle").append($str);
- (function($str, i) {
- if($data[i].articleType == "1") {
- ajaxRequist("/ajax/professor/baseInfo/" + $data[i].ownerId, {}, "get", function(data) {
- $str.find(".name").text(data.data.name);
- })
- } else if($data[i].articleType == "2") {
- ajaxRequist("/ajax/org/" + $data[i].ownerId, {}, "get", function(data) {
- if(data.data.forShort) {
- $str.find(".name").text(data.data.forShort);
- } else {
- $str.find(".name").text(data.data.name);
- }
- })
- } else if($data[i].articleType == "3") {
- ajaxRequist("/ajax/platform/info", {
- id: $data[i].ownerId
- }, "get", function(data) {
- $str.find(".name").text(data.data.name);
- })
- }
-
- $str.find(".zan").text('赞 ' + $data[i].articleAgree);
- }
- ajaxRequist("/ajax/leavemsg/count" , {sid:$data[i].articleId,stype:1}, "get", function(data) {
- if(data.data) {
- $str.find(".leword").text('留言 ' + data.data);
- }
- })*/
- })($str, i)
- }
- }
- }
- },
- 'error': function() {
- $.MsgBox.Alert('提示', '服务器连接超时!');
- }
- });
- }
-
- $("#oArticle").on("click", "li", function() {
- var oArticle = {
- shareId: $(this).attr("data-shareId"),
- createTime: $(this).attr("data-createTime")
- };
- location.href = "/" + pageUrl('a', oArticle)
- })
- })
|