entportrait.js 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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. initRelation();
  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 && (typeof(r) == "undefined" || r == null || r == "")){
  79. $("#entrelation-infovis").hide();
  80. $("#entrelation-findnull").removeClass("hide");
  81. }else{
  82. loadJS("/js/d3.v3.min.js",function(){
  83. loadJS("/js/geometry.js",function(){
  84. loadJS("/js/relation.js",function(){
  85. $("#entrelation-limit").addClass("hide");
  86. $(".entrelation").height(500);
  87. relation = new Relation(legcerNo,regNo,r.relation);
  88. relation.init();
  89. });
  90. });
  91. });
  92. }
  93. });
  94. }else{
  95. $("#entrelation-limit,#entrelation-nologin").removeClass("hide");
  96. }
  97. }
  98. //服务列表
  99. function ServiceList(){
  100. loadJS("/js/paging.js",function(){
  101. paging = new Paging("serviceList","/front/findServiceByEntId",{entId:entId},6,function(r){
  102. var html = '';
  103. for(var i=0;i<r.length;i++){
  104. }
  105. $("#serviceList").html(html);
  106. });
  107. });
  108. }
  109. /*
  110. function getCityN(code){
  111. if(code){
  112. var n=code.substring(0,2)
  113. for(var i=0;i<citySim.length;i++){
  114. if (citySim[i].k==n) {
  115. return citySim[i].n;
  116. }
  117. }
  118. }
  119. return "";
  120. }
  121. function reloadData(obj,name){
  122. name=name||obj.attr("name")
  123. var val=(obj.attr("value")||obj.val());
  124. if (val==0) val=""
  125. if(name=="city"&&!val){
  126. var pids=obj.attr("id")
  127. if(pids=="c_area"){
  128. var v=obj.prev("select").val()
  129. if(!v){
  130. v=obj.prev("select").prev("select").val()
  131. }
  132. if(v){
  133. val=v
  134. }
  135. }else if(pids=="c_city"){
  136. var v=obj.prev("select").val()
  137. if(v){
  138. val=v
  139. }
  140. }
  141. }else if(name=="c_author"){
  142. if(!obj.prop("checked")){
  143. val="";
  144. }
  145. }
  146. //调整value 值
  147. if(val==10){
  148. val = "10-100"
  149. }else if(val ==100){
  150. val = "100-1000"
  151. }else if(val ==1000){
  152. val = "1000-10000"
  153. }
  154. //搜索表单提交
  155. $("#searchForm input[name="+name+"]").val(val);
  156. document.forms['searchForm'].submit();
  157. }
  158. function setLocation(entsel,serviceloc){
  159. //所在地处理
  160. var le = entsel.length
  161. var sel1 = "";
  162. var sel2 = "";
  163. var sel3 = "";
  164. if (le == 2) {
  165. sel1 = entsel.substring(0,2);
  166. sel2 = 0;
  167. sel3 = 0;
  168. }else if (le == 4){
  169. sel1 = entsel.substring(0,2);
  170. sel2 = entsel.substring(0,4);
  171. sel3 = 0;
  172. }else{
  173. sel1 = entsel.substring(0,2);
  174. sel2 = entsel.substring(0,4);
  175. sel3 = entsel.substring(0,6);
  176. }
  177. $.cxSelect.setVal(sel1,sel2,sel3);
  178. if(serviceloc){
  179. //添加编辑服务中的省
  180. $("#servicecity_china .province option").each(function(){
  181. if(sel1 == $(this).val()){
  182. $(this).attr("selected","selected");
  183. }
  184. });
  185. //添加编辑服务中的市
  186. $("#servicecity_china .city option").each(function(){
  187. if(sel2 == $(this).val()){
  188. $(this).attr("selected","selected");
  189. }
  190. });
  191. //添加编辑服务中的县
  192. $("#servicecity_china .area option").each(function(){
  193. if(sel3 == $(this).val()){
  194. $(this).attr("selected","selected");
  195. }
  196. });
  197. }
  198. }
  199. cityMouse="";
  200. $(function(){
  201. ////推荐企业
  202. loadImg(1);
  203. //行业类别 注册资本 加载
  204. makeFl();
  205. //所在地信息加载
  206. if($chiancity){
  207. $('#city_china').cxSelect({
  208. selects: ['province', 'city', 'area'],
  209. required:0,
  210. somep:true,
  211. someps:[41,45]
  212. });
  213. setLocation(entsel)
  214. }
  215. //处理点击重新加载
  216. $("div[id^=c_] li,li[id^=c_],input[id^=c_]").click(function(){
  217. if(this.id=="c_words"){
  218. reloadData($("#header-searchInputs"))
  219. }else{
  220. reloadData($(this))
  221. }
  222. })
  223. $("select[id^=c_]").click(function(){
  224. cityMouse=this.id
  225. }).change(function(){
  226. if(this.id==cityMouse){
  227. reloadData($(this),"city")
  228. }
  229. })
  230. //处理选择样式
  231. $("div[id^=c_] li").click(function(){
  232. $("li",$(this).closest("div")).removeClass("text-primary");
  233. $(this).addClass("text-primary");
  234. })
  235. //搜索关键字
  236. var words=""
  237. if(btempwords){
  238. words=btempwords
  239. $("#header-searchInput").val(words);
  240. }
  241. })
  242. function makeFl(){
  243. //行业类别
  244. $(["c_hfl"]).each(function(i,ad){
  245. var str="<ul>";
  246. var tmp=eval(ad)
  247. for(var i=0;i<tmp.length;i++){
  248. var val = chf1;
  249. if (val !=""){
  250. if (val == tmp[i][1]){
  251. str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
  252. var j ="J"
  253. if (val > j || val == "D" || val == "E" || val == "F" || val == "G" ){
  254. $("#c_hfl").next().find("small").text("收起<")
  255. $("#c_hfl").removeClass("less")
  256. }
  257. }else{
  258. str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
  259. }
  260. }else{
  261. str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
  262. }
  263. }
  264. str+="</ul>"
  265. $("#"+ad).html(str)
  266. })
  267. //注册资本
  268. $(["c_zb"]).each(function(i,ad){
  269. var str="<ul>";
  270. var tmp=eval(ad)
  271. for(var i=0;i<tmp.length;i++){
  272. var val = czb;
  273. if (val !=""){
  274. if (val == tmp[i][1]){
  275. str+="<li name='"+ad+"' value='"+tmp[i][1]+"' class='text-primary'>"+tmp[i][0]+"</li>"
  276. }else{
  277. str+="<li name='"+ad+"' value='"+tmp[i][1]+"'>"+tmp[i][0]+"</li>"
  278. }
  279. }else{
  280. str+="<li name='"+ad+"' value='"+tmp[i][1]+"' "+(i==0?"class='text-primary'":"")+">"+tmp[i][0]+"</li>"
  281. }
  282. }
  283. str+="</ul>"
  284. $("#"+ad).html(str)
  285. })
  286. }
  287. function less(obj){
  288. pred=$(obj).prev()
  289. obj=$(obj).find("small")
  290. var text=obj.text()
  291. if(text=="更多>"){
  292. obj.text("收起<")
  293. pred.removeClass("less")
  294. }else{
  295. obj.text("更多>")
  296. pred.addClass("less")
  297. }
  298. }
  299. //推荐企业
  300. function loadImg(n){
  301. var str=""
  302. for(var i=0;i<n;i++){
  303. str+="<img src='/images/right_ad.png'>"
  304. }
  305. $("#tjqy").html(str)
  306. }
  307. function GetDiffName(i) {
  308. ret=["法定代表人"]
  309. //ret=["法定代表人","住所","成立日期"]
  310. switch (i) {
  311. case "9600":
  312. {
  313. ret[0] = "经营者"
  314. //ret[1] = "经营场所"
  315. //ret[2] = "注册日期"
  316. break;
  317. }
  318. case "4500":
  319. case "6800":
  320. case "6810":
  321. case "6820":
  322. case "7100":
  323. case "7110":
  324. case "7120":
  325. case "7130":
  326. case "7190":
  327. case "9200":
  328. case "6840":
  329. case "2100":
  330. case "2110":
  331. case "2120":
  332. case "2121":
  333. case "2122":
  334. case "2123":
  335. case "2130":
  336. case "2140":
  337. case "2150":
  338. case "2151":
  339. case "2152":
  340. case "2190":
  341. case "2200":
  342. case "2210":
  343. case "2211":
  344. case "2212":
  345. case "2213":
  346. case "2219":
  347. case "2220":
  348. case "2221":
  349. case "2222":
  350. case "2223":
  351. case "2229":
  352. case "4000":
  353. case "4300":
  354. case "4310":
  355. case "4320":
  356. case "4330":
  357. case "4340":
  358. case "4550":
  359. case "4551":
  360. case "4552":
  361. case "4553":
  362. case "4560":
  363. case "5800":
  364. case "5810":
  365. case "5820":{
  366. ret[0] = "负责人"
  367. //ret[1] = "营业场所"
  368. //ret[2] = "成立日期"
  369. break;
  370. }
  371. }
  372. return ret
  373. }
  374. //公式信息是否显示
  375. if(!$gs){
  376. $("#ags").parent().hide();
  377. $("#gs").hide();
  378. }
  379. */
  380. var perPage=5,currentPage=1
  381. //点击服务标题展示服务信息
  382. function clickservicename(id,isshow){
  383. if(isshow.indexOf("3")>-1){
  384. window.location.href="/market/detail/"+id+".html"
  385. }else{
  386. window.location.href="/market/showservice/"+id+".html"
  387. }
  388. }
  389. //显示二维码图片
  390. function viewBarCode(bcpath){
  391. if(bcpath){
  392. $('#myModal').modal({
  393. keyboard: true
  394. })
  395. $("#viewImgs").html("<img style='width:300px;height:300px;' src='"+bcpath+"'/>")
  396. }
  397. }
  398. function analyList(rowHtml, rowData) {
  399. var t="";
  400. if(rowData.i_status==1){
  401. t=template_content.replace("<a class='text-primary' value='${_id}' data-id='${s_isEdit}' onclick='removeservice(this)'>下架</a>","");
  402. }else{
  403. t=template_content.replace("已下架","");
  404. }
  405. return t.replace(/\$\{(.*?)\}/g,
  406. function(a, b, c) {
  407. var res = rowData[b]||"";
  408. //去掉后台服务列表中的图片
  409. var data = res.replace(/<img.*>.*<\/img>/ig,""); //过滤如<img></img>形式的图片元素
  410. res = data.replace(/<img.*\/>/ig, ""); //过滤如<img />形式的元素
  411. if (!res&&b=="s_images"){
  412. res="/images/services/default.png"
  413. }else{
  414. res = res.replace(/\n/g,"");
  415. }
  416. return res;
  417. });
  418. }
  419. //加载更多
  420. function loadMore(){
  421. $.post('/searchEntSer/'+entId ,{currentPage:currentPage+1,perPage:perPage},function(data){
  422. if(data){
  423. var res=data["data"]
  424. if(!res || res === undefined || res.length == 0) {
  425. $("#loadMore").hide();
  426. return;
  427. }else if(data.totalRows<=(perPage*data.currentPage)){
  428. $("#loadMore").hide();
  429. }else{
  430. $("#loadMore").show();
  431. }
  432. currentPage=data["currentPage"];
  433. var str="";
  434. for(var i=0;i<res.length;i++){
  435. var temp=res[i];
  436. str+=analyList("",temp)
  437. }
  438. $("#service_list table tbody").append(str);
  439. }
  440. })
  441. }