entportrait.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. var entType = "企业";
  2. var relation = null;
  3. var serviceList = null;
  4. with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
  5. //解析服务列表
  6. $(function(){
  7. //联系地址
  8. if(address){
  9. loadJS("/js/jquery.cxselect.js",function(){
  10. $('#city_china').cxSelect({
  11. selects: ['province', 'city', 'area'],
  12. required:0
  13. });
  14. $.cxSelect.setVal(province,city,area);
  15. var pt=province?($("#provincesel option[value="+province+"]").text()):"";
  16. var ct=city?($("#citysel option[value="+city+"]").text()):"";
  17. var at=area?($("#areasel option[value="+area+"]").text()):"";
  18. //设置地图上显示的位置
  19. $("#location").attr("value",as1);
  20. $("#cityname").attr("value",pt.trim()+ct.trim()+at.trim());
  21. //获取地图的经纬度
  22. loadJS("http://api.map.baidu.com/getscript?v=2&ak=AFd8b176f363f23e6a23d516f4cfb742&services=&t=20150522093217",function(){
  23. loadJS("/js/geocoder.js",function(){
  24. doOptions();
  25. });
  26. });
  27. $("#city_china").text(pt+ct+at+as1);
  28. });
  29. }
  30. //隐藏地图
  31. $("#fade").click(closeMap);
  32. //分享
  33. $(".entinfo-share").click(function(){
  34. $(".bdsharebuttonbox").show();
  35. });
  36. //切换
  37. $(".ent-tab>li").click(function(){
  38. $(".ent-tab>li").removeClass("ent-active");
  39. $(this).addClass("ent-active");
  40. $(".ent-tab-content>div").addClass("hide");
  41. $(".ent-tab-content>div:eq("+$(this).index()+")").removeClass("hide");
  42. if($(this).index() == 1){
  43. b_afterLogin();
  44. }else if($(this).index() == 5 && serviceList == null){
  45. //加载服务列表
  46. serviceList = new ServiceList();
  47. }
  48. });
  49. new ServiceList();
  50. });
  51. //显示地图
  52. function showMap(){
  53. document.getElementById('mapshowdiv').style.display = 'block';
  54. document.getElementById('closeshowmap').style.display = 'block';
  55. document.getElementById('fade').style.display = 'block';
  56. $("html,body").addClass("overflow-hidden");
  57. }
  58. //关闭地图
  59. function closeMap(){
  60. document.getElementById('mapshowdiv').style.display = 'none';
  61. document.getElementById('closeshowmap').style.display = 'none';
  62. document.getElementById('fade').style.display = 'none';
  63. $("html,body").removeClass("overflow-hidden");
  64. }
  65. function b_afterLogin(flag){
  66. if($(".ent-tab>li:eq(1)").hasClass("ent-active") && relation == null){
  67. initRelation();
  68. }
  69. }
  70. //加载关系网
  71. function initRelation(){
  72. if(isLogined){
  73. $.post("/member/getRelation",{regNo:regNo,entName:entName},function(r){
  74. if(r.flag == false){
  75. $("#entrelation-nologin").addClass("hide");
  76. $("#entrelation-limit,#entrelation-noauthe").removeClass("hide");
  77. $("#entrelation-infovis").hide();
  78. }else if(r.flag == true && (r == null || typeof(r) == "undefined" || typeof(r.links) == "undefined" || r.links.length == 0 || typeof(r.nodes) == "undefined" || r.nodes.length <= 1)){
  79. relation = "";
  80. $("#entrelation-infovis").hide();
  81. $("#entrelation-findnull").removeClass("hide");
  82. }else{
  83. loadJS("/js/d3.v3.min.js",function(){
  84. loadJS("/js/geometry.js",function(){
  85. loadJS("/js/relation.js",function(){
  86. $("#entrelation-limit").addClass("hide");
  87. $(".entrelation").height(500);
  88. relation = new Relation(legcerNo,regNo,r.relation);
  89. relation.init();
  90. });
  91. });
  92. });
  93. }
  94. });
  95. }else{
  96. $("#entrelation-limit,#entrelation-nologin").removeClass("hide");
  97. }
  98. }
  99. //服务列表
  100. function ServiceList(){
  101. loadJS("/js/paging.js",function(){
  102. paging = new Paging("serviceListPaging","/front/findServiceByEntId",{entId:entId},6,function(r){
  103. if(r.length == 0){
  104. $("#serviceList").next(".ent-findnull").removeClass("hide");
  105. }
  106. var html = '';
  107. for(var i=0;i<r.length;i++){
  108. html += '<tr>'
  109. +'<td rowspan="2" width="120"><img src="'+(r[i].s_images==""?"null":r[i].s_images)+'" onerror="this.src=\'/images/services/default.png\'"></td>'
  110. +'<td class="b-com-name"><a href="/market/detail/'+r[i]._id+'.html">'+r[i].s_name+'</a></td>'
  111. +'<td width="100" class="text-center">报价:<font class="text-primary">'+(r[i].s_pricemy==0?"面议":r[i].f_price+"元")+'</font></td>'
  112. +'<td width="100" class="text-center">评价:<font class="text-primary">'+r[i].i_comments+'</font></td>'
  113. +'<tr>'
  114. +'<td>'+r[i].s_introduction+'</td>'
  115. +'</tr>';
  116. }
  117. $("#serviceList").html(html);
  118. });
  119. });
  120. }