Sfoglia il codice sorgente

获取四园一港子页面的数据

xyg 7 mesi fa
parent
commit
a050973e5c

+ 38 - 6
nngkxxdp/src/main/resources/static/naxsb/indexcygyy.html

@@ -12,6 +12,8 @@
     <!-- 引入组件库 -->
     <script src="https://unpkg.com/element-ui/lib/index.js"></script>
     <link rel="stylesheet" href="swiper/swiper-bundle.css">
+    <!-- jquery-->
+    <script src="js/jquery-3.5.1.min.js"></script>
     <style>
         * {
             padding: 0;
@@ -204,12 +206,8 @@
                 <span>重庆市南岸区人民政府</span>
             </div>
             <ul class="menu">
-                <li class="active">茶园工业园</li>
-                <li>先进汽车电子产业园</li>
-                <li>长江绿色创新产业园</li>
-                <li>南坪西区产业园</li>
-                <li>迎龙创新港</li>
-                <li>大学科技园</li>
+                <li :class="{ active: currentTab == tab.id }" v-for="(tab, index)  in this.titleList" :key="index">
+                    {{tab.title}}</li>
             </ul>
         </div>
         <div class="content">
@@ -241,6 +239,8 @@
         el: '#indexcygyy',
         data: function () {
             return {
+                currentTab: -1,
+                titleList: [],
                 swiperList: [
                     {
                         bgsrc: "images/slide1.png",
@@ -272,6 +272,38 @@
             cheakmore() {
                 window.location.href = "syyggyy.html"
             },
+            getParkData() {
+                let that = this;
+                $.ajax({
+                    url: "http://172.16.99.105:8082/parkData/",
+                    type: "get",
+                    dataType: "json",
+                    success: function (data) {
+                        data.forEach(function (item) {
+                            item.subtitleList = item.subtitle ? item.subtitle.split(",") : [];
+                        })
+                        that.titleList = data;
+                    }
+                })
+            },
+            getDetailData(id) {
+                let that = this;
+                $.ajax({
+                    url: "http://172.16.99.105:8082/parkData/" + id,
+                    type: "get",
+                    dataType: "json",
+                    success: function (data) {
+                        console.log(data)
+                    }
+                })
+            }
+        },
+        mounted() {
+            const url = new URL(window.location.href);
+            const id = url.searchParams.get('id');
+            this.currentTab = id;
+            this.getDetailData(id);
+            this.getParkData();
         }
     });
 

+ 2 - 2
nngkxxdp/src/main/resources/static/naxsb/indexsyyg.html

@@ -205,7 +205,7 @@
                 <div class="tab-items" :class="{ active: currentTab === tab.id }"
                     v-for="(tab, index)  in this.titleList" :key="index" @mouseenter="currentTab = tab.id"
                     @mouseleave="currentTab = -1">
-                    <div class="name" @click="tsmore()">
+                    <div class="name" @click="tsmore(tab.id)">
                         {{tab.title}}
                     </div>
                     <ul class="tab-contents">
@@ -243,7 +243,7 @@
         },
         methods: {
             tsmore(id) {
-                window.location.href = "indexcygyy.html?id="+this.currentTab;
+                window.location.href = "indexcygyy.html?id=" + this.currentTab;
             },
             getParkData() {
                 let that = this;