appCognizance.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import '../../css/news/appCognizance.css';
  2. $(function(){
  3. var colorArr=['#e22e2e','#2542ef','#10d4f1','#f9750b','#0bf964'];
  4. //获取id
  5. var https=window.location.href;
  6. var indexs = https.indexOf('id=');
  7. var ids=https.substr(indexs+3,https.length);
  8. //数据获取
  9. function DataList(){
  10. if(ids){
  11. $.ajax({
  12. type:"get",
  13. dataType:'json',
  14. url: globalConfig.context + "/portal/Service/ProjectDetail",
  15. data:{
  16. id:ids
  17. },
  18. success:function(data){
  19. var theData=data.data;
  20. var describeList=[]; //需求描述
  21. var dataList=[]; //所需资料
  22. var specificationList=[]; //服务规格
  23. var promiseLsit=[];
  24. if(data.data.length){
  25. describeList.push([
  26. "<div><p>"+theData[0].introduce!='null'?theData[0].introduce:''+"</p></div>",
  27. ].join(','));
  28. dataList.push([
  29. "<div><p>"+theData[0].valueEffect!='null'?theData[0].valueEffect:''+"</p></div>",
  30. ].join(','));
  31. if(theData[1].length){
  32. for (var i=0;i<theData[1].length;i++){
  33. specificationList.push([
  34. "<div>"+theData[1][i]+"</div>",
  35. ].join(','));
  36. };
  37. }else{
  38. specificationList=[];
  39. }
  40. promiseLsit.push([
  41. "<div><p>"+theData[0].clientSize!='null'?theData[0].clientSize:''+"</p></div>",
  42. ].join(','));
  43. $('#describe').html(describeList);
  44. $('#data').html(dataList);
  45. $('.specifications').html(specificationList);
  46. $('#promise').html(promiseLsit);
  47. //规格添加颜色
  48. for(var i=0;i<$('.specifications div').length;i++){
  49. if(i>colorArr.length){
  50. i=0
  51. };
  52. $('.specifications div').eq(i).css({color:colorArr[i]})
  53. }
  54. }
  55. }
  56. });
  57. }
  58. };
  59. DataList();
  60. })