var vm = new Vue({ el:'#vue-app-body', created: function () { this.service(); this.product(); this.solution(); this.news(); this.dustytnews(); }, data:{ serviceva1:[], serviceva2:[], serviceva3:[], serviceva4:[], serviceva5:[], serviceva6:[], servictitle:'', serviccontent:'', }, methods: { //鏈嶅姟 service: function () { // console.info(name + ", "+telpone); $.ajax({ type: "get", dataType: "json", url: "/app/serviceItem/frontPageList", // data: {"contactName":name,"contactTel":telpone}, success: function (res) { if(res.code==200){ $.each(res.serviceItemList, function(i,item) { if(item.type=='jtgl'){ vm.serviceva1.push(item); }else if(item.type=='zxsj'){ vm.serviceva2.push(item); }else if(item.type=='fzpg'){ vm.serviceva3.push(item); }else if(item.type=='sbwh'){ vm.serviceva4.push(item); }else if(item.type=='qwbz'){ vm.serviceva5.push(item); }else if(item.type=='rczs'){ vm.serviceva6.push(item); } }); }else{ alert('鍐呴儴鍑洪敊,璇疯仈绯荤鐞嗗憳'); } } }); }, //浜у搧 product: function () { // console.info(name + ", "+telpone); $.ajax({ type: "get", dataType: "json", url: "/app/product/getAllProducts", // data: {"contactName":name,"contactTel":telpone}, success: function (res) { if(res.code==200){ // alert('鎴愬姛'); product(res); }else{ alert('鍐呴儴鍑洪敊,璇疯仈绯荤鐞嗗憳'); } } }); }, //瑙e喅鏂规 solution: function () { var name= this.contactName; var telpone=this.contactTel; // console.info(name + ", "+telpone); $.ajax({ type: "get", dataType: "json", url: "/app/solution/getAllSolutions", // data: {"contactName":name,"contactTel":telpone}, success: function (res) { if(res.code==200){ // alert('鎴愬姛'); solution(res); }else{ alert('鍐呴儴鍑洪敊,璇疯仈绯荤鐞嗗憳'); } } }); }, //鏂伴椈 news: function () { var index=1; var showItem=5; // console.info(name + ", "+telpone); $.ajax({ type: "get", dataType: "json", url: "/app/news/pageDataComp?page="+index+"&limit="+showItem, // data: {"contactName":name,"contactTel":telpone}, success: function (res) { if(res.code==200){ news(res); }else{ alert('鍐呴儴鍑洪敊,璇疯仈绯荤鐞嗗憳'); } } }); }, //琛屼笟 dustytnews: function () { var index=1; var showItem=5; // console.info(name + ", "+telpone); $.ajax({ type: "get", dataType: "json", url: "/app/news/pageDataIndus?page="+index+"&limit="+showItem, // data: {"contactName":name,"contactTel":telpone}, success: function (res) { if(res.code==200){ dutynews(res); }else{ alert('鍐呴儴鍑洪敊,璇疯仈绯荤鐞嗗憳'); } } }); }, } }); //浜у搧 function product(res){ var productstr=''; $.each(res.productList, function(i,item) { if(i<3){ productstr=productstr+'
'; productstr=productstr+'
'; productstr=productstr+'
'; productstr=productstr+'
'; productstr=productstr+''; productstr=productstr+'
'; productstr=productstr+'
'; productstr=productstr+'
'; productstr=productstr+'

'+item.prodTitle+'

'; productstr=productstr+'

'+replaceImgTag(item.prodContent)+'

'; productstr=productstr+'
'; } }); $("#producbody").html(productstr); // $("#producbody").html(productstr); } //瑙e喅鏂规 function solution(res){ var solutionstr=''; $.each(res.solutionList, function(i,item) { if(i<6){ solutionstr=solutionstr+'
'; solutionstr=solutionstr+''; solutionstr=solutionstr+'鍩庡競缁煎悎浜ら€氱郴缁熻В鍐虫柟妗? class='+item.soluTitle+'
'; // solutionstr=solutionstr+''; // solutionstr=solutionstr+''+(i+1)+''+item.soluContent+''; solutionstr=solutionstr+'
'; } }); $("#solutionsbody").html(solutionstr); } function replaceImgTag(html0) { return html0; var html1 = ''; if(html0){ var html1 = html0.replace(/<\s?img[^>]*>/gi, ""); if(html1 && html1.length > 120){ html1 = html1.substring(0, 116)+"..." } } return html1; } //鏂伴椈 function news(res){ var newstr=''; // console.log(res.page.list); $.each(res.page.list, function(i,item) { if(item.newsType=="鍏徃鏂伴椈"){ // newstr=newstr+'
  • '+item.newsTitle+''+item.createDt+'
  • '; } }); $("#news1").html(newstr); } //琛屼笟鏂伴椈 function dutynews(res){ var dutynews=''; $.each(res.page.list, function(i,item) { if(item.newsType=="琛屼笟鏂伴椈"){ // dutynews=dutynews+'
  • '+item.newsTitle+''+item.createDt+'
  • '; } }); $("#article1").html(dutynews); }