portal html css js resource

resourcePreview.js 7.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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("resourceId");
  15. var professorId = "";
  16. getRecourceMe();
  17. /*获取资源信息*/
  18. function getRecourceMe() {
  19. $.ajax({
  20. "url": "/ajax/resource/queryOne",
  21. "type": "GET",
  22. "success": function(data) {
  23. console.log(data);
  24. if(data.success) {
  25. resourceHtml(data.data);
  26. var resourceName = data.data.resourceName + "-科袖网";
  27. window.setTimeout(function() {
  28. document.title = resourceName;
  29. }, 500);
  30. }
  31. },
  32. "data": {
  33. "resourceId": resourceId
  34. },
  35. dataType: "json",
  36. 'error': function() {
  37. $.MsgBox.Alert('提示', '服务器连接超时!');
  38. }
  39. });
  40. }
  41. /*合作备注及性能参数存储换行格式*/
  42. function outHTML(selecter) {
  43. var getValue = selecter;
  44. var aa = "";
  45. if(getValue) {
  46. var endValue = ((getValue.replace(/<(.+?)>/gi, "&lt;$1&gt;")).replace(/ /gi, "&nbsp;")).replace(/\n/gi, "|");
  47. var cc = endValue.split("|");
  48. for(var i = 0; i < cc.length; i++) {
  49. aa += cc[i] + '<br/>'
  50. }
  51. }
  52. return aa;
  53. }
  54. /*处理资源html代码*/
  55. function resourceHtml($da) {
  56. $("#resourceName").text($da.resourceName); //名字
  57. $("#application").text($da.supportedServices); //应用用途
  58. if($da.editProfessor) {
  59. $("#person").show();
  60. if($da.orgName) { //所属机构
  61. $("#organizationName").text($da.orgName).parents("li").show();
  62. }
  63. $("#nameS").text($da.editProfessor.name); //"office": "", //职位 "title": "", //职称
  64. if($da.editProfessor.title) {
  65. $("#titleOffice").text($da.editProfessor.title);
  66. } else {
  67. if($da.editProfessor.office) {
  68. $("#titleOffice").text($da.editProfessor.office);
  69. }
  70. }
  71. if($da.editProfessor.orgName) {
  72. $("#orgType").text($da.editProfessor.orgName);
  73. }
  74. professorId = $da.editProfessor.id;
  75. /*if(userid!=professorId) {
  76. $(".goSpan").show();
  77. }*/
  78. var professorFlag = autho($da.editProfessor.authType, $da.editProfessor.orgAuth, $da.editProfessor.authStatus);
  79. $("#authFlag").addClass(professorFlag.sty).attr("title", professorFlag.title);
  80. if($da.editProfessor.hasHeadImage == 1) {
  81. $("#headImg").css("background-image", 'url(/images/head/' + $da.editProfessor.id + '_l.jpg)');
  82. }
  83. }else {
  84. $("#enterprise,#resPerson").show();
  85. if($da.organization.hasOrgLogo) {
  86. $("#companyImg").attr("src", "/images/org/" + $da.organization.id + ".jpg");
  87. }else{
  88. $("#companyImg").attr("src", "/images/default-icon.jpg");
  89. }
  90. if($da.organization.authStatus==3){
  91. $("#QauthFlag").addClass("authicon-com-ok").attr("title", "认证企业");
  92. }
  93. $("#Qname").text($da.organization.name);
  94. $("#Qindustry").text($da.organization.subject);
  95. $("#QorgType").text(orgTypeShow[$da.organization.orgType])
  96. }
  97. if($da.spec) { //厂商型号
  98. $("#modelNumber").text($da.spec).parents("li").show();
  99. }
  100. if($da.parameter) { //性能参数
  101. $("#performancePa").html(outHTML($da.parameter)).parents("li").show();
  102. }
  103. if($da.cooperationNotes) { //合作备注
  104. $("#remarkContent").html(outHTML($da.cooperationNotes)).parents("li").show();
  105. }
  106. if($da.subject) {
  107. var oSub = $da.subject.split(",");
  108. var oSt = "";
  109. for(var i = 0; i < oSub.length; i++) {
  110. oSt += '<li><p class="h2Font">' + oSub[i] + '</p></li>'
  111. }
  112. $(".tagList").html(oSt);
  113. }
  114. if($da.descp) { //编辑器
  115. $("#descp").html($da.descp).parents("li").show();
  116. }
  117. //return;
  118. if($da.images.length) {
  119. $("#firstFigure").attr({
  120. "src": "/data/resource/" + $da.images[0].imageSrc,
  121. "rel": "/data/resource/" + $da.images[0].imageSrc
  122. }).parent().attr("href", "/data/resource/" + $da.images[0].imageSrc);
  123. var arr = "";
  124. for(var i = 0; i < $da.images.length; i++) {
  125. if($da.images[i] == $da.images[0]) {
  126. var oString = '<li class="tb-selected">' +
  127. '<div class="tb-pic tb-s66">' +
  128. '<a href="javascript:void(0);">' +
  129. '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
  130. '</a>' +
  131. '</div>' +
  132. '</li>'
  133. } else {
  134. var oString = '<li >' +
  135. '<div class="tb-pic tb-s66">' +
  136. '<a href="javascript:void(0);">' +
  137. '<img src="/data/resource/' + $da.images[i].imageSrc + '"/>' +
  138. '</a>' +
  139. '</div>' +
  140. '</li>'
  141. }
  142. arr += oString;
  143. }
  144. $("#thumblist").html(arr);
  145. }
  146. }
  147. /*点击名字及头像跳转个人浏览页面*/
  148. $("#nameS,#headImg").click(function() {
  149. location.href = "userInforShow.html?professorId=" + professorId;
  150. })
  151. /*点击咨询*/
  152. $("#consultin").on("click", function() {
  153. clickResouceConsultHandler();
  154. });
  155. /*咨询函数*/
  156. function clickResouceConsultHandler() {
  157. if(userid && userid != "null" && userid != null) {
  158. ConsultApply();
  159. concultProInfo(professorId); //专家信息common.js中
  160. //默认选中资源咨询和标题
  161. for(var i = 0; i < $("ul.menucon").children().length; i++) {
  162. $("ul.menucon").children().eq(i).removeClass("clicknow");
  163. $("ul.menucon").children().eq(1).addClass("clicknow");
  164. }
  165. var consultTitleVal = $(".h2Font").text();
  166. $("#consultTitle").val("关于" + consultTitleVal + "的咨询");
  167. //点击的发送
  168. $("#sendConsultBtn").click(function() {
  169. sendConsultHandler(professorId); //common.js中
  170. });
  171. } else {
  172. $.MsgBox.Alert("消息提醒", "请先登录再进行咨询");
  173. $("#mb_btn_ok").val("去登录");
  174. var aele = document.createElement('a');
  175. $("#mb_btnbox").append(aele);
  176. $("#mb_btnbox a").css({
  177. 'display': "block",
  178. 'width': '100%',
  179. 'height': '40px',
  180. 'position': 'absolute',
  181. 'bottom': '-6px',
  182. 'left': '0'
  183. });
  184. aele.setAttribute('href', '../login.html');
  185. }
  186. };
  187. selUse();
  188. function selUse() {
  189. $.ajax({
  190. url: "/ajax/resource/qaLinkman",
  191. type: "GET",
  192. timeout: 10000,
  193. dataType: "json",
  194. async:true,
  195. data: {
  196. "resourceId": resourceId,
  197. },
  198. success: function(data, textState) {
  199. console.log(data)
  200. if(data.success) {
  201. unauthUser(data.data);
  202. }
  203. },
  204. error: function(XMLHttpRequest, textStats, errorThrown) {
  205. $.MsgBox.Alert('提示', '服务器请求失败')
  206. }
  207. })
  208. }
  209. function unauthUser($res) {
  210. var osting=""
  211. for(var i = 0; i < $res.length; i++) {
  212. var img;
  213. var styC="";
  214. var oClass = autho($res[i].professor.authType, $res[i].professor.orgAuth, $res[i].professor.authStatus);
  215. var oTitle="";
  216. if($res[i].professor.title) {
  217. oTitle=$res[i].professor.title;
  218. }else{
  219. if($res[i].professor.office) {
  220. oTitle=$res[i].professor.office;
  221. }
  222. }
  223. if($res[i].professor.hasHeadImage) {
  224. img = "/images/head/" + $res[i].professor.id + "_l.jpg";
  225. } else {
  226. img = "../images/default-photo.jpg"
  227. }
  228. var oSt = '<li>'
  229. oSt += '<div class="madiaHead useHead" id="userimg" style="background-image: url('+img+');"></div>'
  230. oSt += '<div class = "madiaInfo">'
  231. oSt += '<p class = "ellipsisSty">'
  232. oSt += '<span class = "h1Font" id="name">'+$res[i].professor.name+'</span><em class="authicon '+oClass.sty+'" title="'+oClass.title+'"></em >'
  233. oSt += '</p>'
  234. oSt += '<p class="h2Font ellipsisSty">'+oTitle+'</p>'
  235. oSt += '</div>'
  236. oSt += '<div class="'+styC+'" flag=1></div>'
  237. oSt += '</li>'
  238. osting+=oSt;
  239. }
  240. $("#expertli").html(osting);
  241. }
  242. })