appCognizance.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. import '../../css/news/appCognizance.css';
  2. $(function(){
  3. var metas='';
  4. metas +='<meta http-equiv="Cache-Control" content="no-cache, must-revalidate">'+
  5. '<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />'+
  6. '<meta http-equiv="Pragma" content="no-cache" />'+
  7. '<meta http-equiv="Expires" content="0" />' ;
  8. $('head').append(metas);
  9. var colorArr=['#e22e2e','#2542ef','#10d4f1','#f9750b','#0bf964'];
  10. //获取id
  11. var https=window.location.href;
  12. var indexs = https.indexOf('id=');
  13. window.onload=function(){
  14. location.href = location.href + "tt=" + new Date().valueOf();
  15. }
  16. var tt = https.indexOf('tt=')!=-1?https.indexOf('tt='):https.length;
  17. var idk=parseInt(indexs)>0?https.substr(indexs+3,tt):'';
  18. let idtt=idk.split('tt=')[0] ;
  19. console.log(idtt)
  20. //数据获取
  21. function DataList(){
  22. if(idtt){
  23. $.ajax({
  24. type:"get",
  25. dataType:'json',
  26. url: globalConfig.context + "/portal/Service/ProjectDetail",
  27. data:{
  28. id:idtt
  29. },
  30. success:function(data){
  31. var theData=data.data;
  32. var describeList=[]; //需求描述
  33. var dataList=[]; //所需资料
  34. var specificationList=[]; //服务规格
  35. var promiseLsit=[];
  36. if(data.data&&data.data.length){
  37. var urls;
  38. if(theData[0].maxLogo&&theData[0].maxLogo!=null){
  39. urls=globalConfig.avatarHost+'/upload'+theData[0].maxLogo;
  40. $('#imgs').attr('src',urls)
  41. }
  42. var desArr=[];
  43. var dataArr=[];
  44. var proArr=[];
  45. //项目描述
  46. if(theData[0].introduce!=null){
  47. if(theData[0].introduce.match(/\n/g)){
  48. desArr=theData[0].introduce.split(/\n/g)
  49. }else{
  50. desArr.push(theData[0].introduce)
  51. };
  52. for (var i=0;i<desArr.length;i++){
  53. describeList.push([
  54. "<p>"+desArr[i]+"</p>",
  55. ].join(','));
  56. };
  57. }
  58. //项目价值
  59. if(theData[0].valueEffect!=null){
  60. if(theData[0].valueEffect.match(/\n/g)){
  61. dataArr=theData[0].valueEffect.split(/\n/g)
  62. }else{
  63. dataArr.push(theData[0].valueEffect)
  64. };
  65. for (var i=0;i<dataArr.length;i++){
  66. dataList.push([
  67. "<p>"+dataArr[i]+"</p>",
  68. ].join(','));
  69. };
  70. }
  71. //规格
  72. if(theData[1].length){
  73. for (var i=0;i<theData[1].length;i++){
  74. specificationList.push([
  75. "<div>"+theData[1][i]+"</div>",
  76. ].join(','));
  77. };
  78. }else{
  79. specificationList=[];
  80. }
  81. //所需资料
  82. if(theData[0].clientSize!=null){
  83. if(theData[0].clientSize.match(/\n/g)){
  84. proArr=theData[0].clientSize.split(/\n/g)
  85. }else{
  86. proArr.push(theData[0].clientSize)
  87. };
  88. for (var i=0;i<proArr.length;i++){
  89. promiseLsit.push([
  90. "<p>"+proArr[i]+"</p>",
  91. ].join(','));
  92. };
  93. }
  94. $('#describe').html(describeList);
  95. $('#data').html(dataList);
  96. $('.specifications').html(specificationList);
  97. $('#promise').html(promiseLsit);
  98. //规格添加颜色
  99. for(var i=0;i<$('.specifications div').length;i++){
  100. if(i>colorArr.length){
  101. i=0
  102. };
  103. $('.specifications div').eq(i).css({color:colorArr[i]})
  104. }
  105. }
  106. }
  107. });
  108. }
  109. };
  110. DataList();
  111. })