portal html css js resource

productPreview.js 6.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. $(document).ready(function() {
  2. loginStatus(); //判断个人是否登录
  3. valUser();
  4. var userid = $.cookie("userid");
  5. $(".jqzoom").imagezoom();
  6. $("#thumblist").on("click", "li a", function() {
  7. $(this).parents("li").addClass("tb-selected").siblings().removeClass("tb-selected");
  8. $(".jqzoom").attr('src', $(this).find("img").attr("src"));
  9. $(".jqzoom").attr('rel', $(this).find("img").attr("src"));
  10. });
  11. $('.shareWeixin').hover(function() {
  12. $('.shareCode').stop(true, false).fadeToggle();
  13. });
  14. var resourceId = GetQueryString("productId");
  15. var professorId = "";
  16. getRecourceMe();
  17. /*获取资源信息*/
  18. function getRecourceMe() {
  19. $.ajax({
  20. "url": "/ajax/product/qo",
  21. "type": "GET",
  22. "success": function(data) {
  23. console.log(data);
  24. if(data.success) {
  25. resourceHtml(data.data);
  26. var resourceName = data.data.name + "-科袖网";
  27. document.title = resourceName;
  28. }
  29. },
  30. "data": {
  31. "id": resourceId
  32. },
  33. dataType: "json",
  34. 'error': function() {
  35. $.MsgBox.Alert('提示', '服务器连接超时!');
  36. }
  37. });
  38. }
  39. /*合作备注及性能参数存储换行格式*/
  40. function outHTML(selecter) {
  41. var getValue = selecter;
  42. var aa = "";
  43. if(getValue) {
  44. var endValue = ((getValue.replace(/<(.+?)>/gi, "&lt;$1&gt;")).replace(/ /gi, "&nbsp;")).replace(/\n/gi, "|");
  45. var cc = endValue.split("|");
  46. for(var i = 0; i < cc.length; i++) {
  47. aa += cc[i] + '<br/>'
  48. }
  49. }
  50. return aa;
  51. }
  52. /*处理资源html代码*/
  53. function resourceHtml($da) {
  54. comMess($da.owner);
  55. $("#resourceName").text($da.name ); //名字
  56. $("#application").text($da.cnt); //应用用途
  57. if($da.producingArea) {
  58. $("#productArea").text($da.producingArea).parents("li").show();
  59. }
  60. if($da.price) {
  61. $("#officialPrice").text($da.price).parents("li").show();
  62. }
  63. if($da.spec) { //厂商型号
  64. $("#modelNumber").text($da.spec).parents("li").show();
  65. }
  66. if($da.parameter) { //性能参数
  67. $("#performancePa").html(outHTML($da.parameter)).parents("li").show();
  68. }
  69. if($da.keywords) {
  70. var oSub = $da.keywords.split(",");
  71. var oSt = "";
  72. for(var i = 0; i < oSub.length; i++) {
  73. oSt += '<li><p class="h2Font">' + oSub[i] + '</p></li>'
  74. }
  75. $(".tagList").html(oSt);
  76. }
  77. if($da.descp) { //编辑器
  78. $("#descp").html($da.descp).parents("li").show();
  79. }
  80. //return;
  81. if($da.images) {
  82. $("#firstFigure").attr({
  83. "src": "/data/product" + $da.images.split(',')[0],
  84. "rel": "/data/product" + $da.images.split(',')[0]
  85. }).parent().attr("href", "/data/product" + $da.images.split(',')[0]);
  86. var arr = "";
  87. var images = $da.images.split(',')
  88. for(var i = 0; i < images.length; i++) {
  89. if(i==0) {
  90. var oString = '<li class="tb-selected">' +
  91. '<div class="tb-pic tb-s66">' +
  92. '<a href="javascript:void(0);">' +
  93. '<img src="/data/product' + images[0] + '"/>' +
  94. '</a>' +
  95. '</div>' +
  96. '</li>'
  97. } else {
  98. var oString = '<li >' +
  99. '<div class="tb-pic tb-s66">' +
  100. '<a href="javascript:void(0);">' +
  101. '<img src="/data/product' + images[i] + '"/>' +
  102. '</a>' +
  103. '</div>' +
  104. '</li>'
  105. }
  106. arr += oString;
  107. }
  108. $("#thumblist").html(arr);
  109. }
  110. }
  111. selUse();
  112. function selUse() {
  113. $.ajax({
  114. url: "/ajax/product/pro",
  115. type: "GET",
  116. timeout: 10000,
  117. dataType: "json",
  118. async:true,
  119. data: {
  120. "id": resourceId,
  121. },
  122. success: function(data, textState) {
  123. console.log(data)
  124. if(data.success) {
  125. //unauthUser(data.data);
  126. var arr = [];
  127. for(var i=0;i<data.data.length;i++) {
  128. arr.push(data.data[i].professor)
  129. }
  130. console.log(arr)
  131. professorList(arr);
  132. }
  133. },
  134. error: function(XMLHttpRequest, textStats, errorThrown) {
  135. $.MsgBox.Alert('提示', '服务器请求失败')
  136. }
  137. })
  138. }
  139. function professorList(par) {
  140. $.ajax({
  141. url: "/ajax/professor/qm",
  142. type: "GET",
  143. timeout: 10000,
  144. dataType: "json",
  145. async:true,
  146. traditional:true,
  147. data: {
  148. "id": par,
  149. },
  150. success: function(data, textState) {
  151. console.log(data)
  152. if(data.success) {
  153. if(data.data.length) {
  154. unauthUser(data.data);
  155. $("#resPerson").show();
  156. }
  157. }
  158. },
  159. error: function(XMLHttpRequest, textStats, errorThrown) {
  160. $.MsgBox.Alert('提示', '服务器请求失败')
  161. }
  162. })
  163. }
  164. function unauthUser($res) {
  165. var osting=""
  166. for(var i = 0; i < $res.length; i++) {
  167. var img;
  168. var styC="";
  169. var oClass = autho($res[i].authType, $res[i].orgAuth, $res[i].authStatus);
  170. var oTitle="";
  171. if($res[i].title) {
  172. oTitle=$res[i].title;
  173. }else{
  174. if($res[i].office) {
  175. oTitle=$res[i].office;
  176. }
  177. }
  178. if($res[i].hasHeadImage) {
  179. img = "/images/head/" + $res[i].id + "_l.jpg";
  180. } else {
  181. img = "../images/default-photo.jpg"
  182. }
  183. var oSt = '<li>'
  184. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url('+img+');"></div>'
  185. oSt += '<div class = "madiaInfo">'
  186. oSt += '<p class = "ellipsisSty">'
  187. oSt += '<span class = "h1Font" id="name">'+$res[i].name+'</span><em class="authicon '+oClass.sty+'" title="'+oClass.title+'"></em >'
  188. oSt += '</p>'
  189. oSt += '<p class="h2Font ellipsisSty">'+oTitle+'</p>'
  190. oSt += '</div>'
  191. oSt += '<div class="'+styC+'" flag=1></div>'
  192. oSt += '</li>'
  193. osting+=oSt;
  194. }
  195. $("#expertli").html(osting);
  196. }
  197. function comMess(oid) {
  198. $.ajax({
  199. url: "/ajax/org/" +oid,
  200. type: "GET",
  201. timeout: 10000,
  202. dataType: "json",
  203. async:"true",
  204. success: function(data, textState) {
  205. if(data.success) {
  206. var $da = data.data;
  207. $("#enterprise,#resPerson").show();
  208. if($da.hasOrgLogo) {
  209. $("#companyImg").attr("src", "/images/org/" + $da.id + ".jpg");
  210. }else{
  211. $("#companyImg").attr("src", "/images/default-icon.jpg");
  212. }
  213. if($da.authStatus==3){
  214. $("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");
  215. }
  216. $("#Qname").text($da.name);
  217. $("#Qindustry").text($da.subject);
  218. $("#QorgType").text(orgTypeShow[$da.orgType])
  219. }
  220. },
  221. error: function(XMLHttpRequest, textStats, errorThrown) {
  222. $.MsgBox.Alert('提示', '服务器请求失败')
  223. }
  224. })
  225. }
  226. })