commonVue.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. var app = new Vue({
  2. el: '#app',
  3. data: {
  4. title123: 'sss',
  5. backBanner: "",
  6. solution: [],
  7. solution_type: 1,
  8. id: null,
  9. array: [],
  10. solutionTypes: [],
  11. colin: '0'
  12. },
  13. computed: {
  14. },
  15. created: function () {
  16. this.solution_type = this.getQueryVariable('solution_type')
  17. this.id = this.getQueryVariable('id')
  18. this.backBanner = '../assets/img/solution/solution-banner1.jpg'
  19. },
  20. mounted: function () {
  21. console.log(this.solution_type)
  22. this.getColumnData()
  23. $.ajax({
  24. type: 'POST',
  25. dataType: 'json',
  26. url: window.FQDN + 'Solution/index',
  27. data: {
  28. id: '1'
  29. }
  30. }).done(function (arr) {
  31. _this.array = arr;
  32. }).fail(function (err) {});
  33. },
  34. methods: {
  35. getColumnData() {
  36. _this=this;
  37. $.ajax({
  38. type: 'get',
  39. dataType: 'json',
  40. url: window.FQDN2 + 'siteCategory/siteCategoryList',
  41. }).done(function (res) {
  42. for (let i = 0; i < res.data.length; i++) {
  43. // console.log('存值')
  44. console.log(res.data[i].sname)
  45. console.log(window.location.pathname)
  46. if (res.data[i].children.length > 0) {
  47. if (res.data[i].categoryName == '解决方案') {
  48. // console.log(res.data[i].children)
  49. _this.solutionTypes=res.data[i].children
  50. _this.colin=_this.getQueryVariable('id')
  51. }
  52. }
  53. }
  54. $.ajax({
  55. type: 'GET',
  56. dataType: 'json',
  57. url: window.FQDN2 + 'siteArticle/siteArticleList',
  58. data: {
  59. categoryid: _this.id ? _this.id : _this.solutionTypes[0].id
  60. }
  61. }).done(function (arr) {
  62. // _this.array = arr;
  63. }).fail(function (err) {});
  64. })
  65. },
  66. facilityClick(e, item) {
  67. this.colin = e
  68. },
  69. getQueryVariable: function (variable) {
  70. var query = window.location.search.substring(1);
  71. var vars = query.split("&");
  72. for (var i = 0; i < vars.length; i++) {
  73. var pair = vars[i].split("=");
  74. if (pair[0] == variable) {
  75. return pair[1];
  76. }
  77. }
  78. return (false);
  79. }
  80. }
  81. });