From c590aaeca3e0a066016d2ff2c7c4cf96a7ca446f Mon Sep 17 00:00:00 2001
From: wl <173@qq.com>
Date: 星期三, 16 十一月 2022 09:35:29 +0800
Subject: [PATCH] first commit

---
 src/components/Home.vue |  148 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 105 insertions(+), 43 deletions(-)

diff --git a/src/components/Home.vue b/src/components/Home.vue
index 6c99a06..d969782 100644
--- a/src/components/Home.vue
+++ b/src/components/Home.vue
@@ -5,53 +5,115 @@
       <div>
         <img src="../assets/xiaohui4.png" alt="" />
       </div>
-      <div class="bg"></div>
+      <div>
+        <img src="../assets/bg.png" alt="" />
+      </div>
     </el-header>
     <!-- 涓婚〉瀵艰埅鏍� -->
     <el-row>
-      <el-menu
-        mode="horizontal"
-        background-color="rgb(64, 112, 186)"
-        text-color="white"
-        class="menu"
-        :default-active="activeIndex"
-        @select="handleSelect"
-      >
-        <el-menu-item index="index">棣栭〉</el-menu-item>
-        <el-menu-item index="introduce">绉戝崗姒傚喌</el-menu-item>
-        <el-menu-item index="zhengce">鏀跨瓥娉曡</el-menu-item>
-        <el-menu-item index="keXieXiangMu">绉戝崗椤圭洰</el-menu-item>
-        <el-menu-item index="xueShuJiaoLiu">瀛︽湳浜ゆ祦</el-menu-item>
-        <el-menu-item index="banShiZhiNan">鍔炰簨鎸囧崡</el-menu-item>
-        <el-menu-item index="kePu">绉戞櫘椋庨噰</el-menu-item>
-        <el-menu-item index="xueXiaoShouYe">瀛︽牎棣栭〉</el-menu-item>
-        <el-menu-item index="telephone">鑱旂郴鎴戜滑</el-menu-item>
+      <el-menu mode="horizontal" background-color="rgb(64, 112, 186)" text-color="white" class="menu" active-text-color="#000000" :default-active="activeIndex" @select="handleSelect">
+        <el-menu-item :key="index" v-for="(item, index) in menuList" :index="item.id.toString()">
+          {{ item.name }}
+        </el-menu-item>
       </el-menu>
     </el-row>
     <el-container>
       <!-- 鏇村彉鐨勫唴瀹瑰尯鍩� -->
       <el-main class="main">
-        <router-view></router-view>
+        <router-view class="box"></router-view>
       </el-main>
     </el-container>
-    <el-footer>Footer</el-footer>
+    <el-footer>@骞抽《灞卞闄㈢瀛︽妧鏈崗浼�</el-footer>
   </el-container>
 </template>
 
 <script>
+import { getNavList } from '../api/api'
+import axios from 'axios'
 export default {
   name: '',
   data() {
     return {
-      activeIndex: 'index'
+      activeIndex: '1',
+      menuList: [
+        { name: '棣栭〉', id: 1 },
+        { name: '绉戝崗姒傚喌', id: 22 },
+        { name: '鏀跨瓥娉曡', id: 23 },
+        { name: '绉戝崗椤圭洰', id: 24 },
+        { name: '瀛︽湳浜ゆ祦', id: 25 },
+        { name: '鍔炰簨鎸囧崡', id: 26 },
+        { name: '绉戞櫘椋庨噰', id: 27 },
+        { name: '瀛︽牎棣栭〉', id: 28 },
+        { name: '鑱旂郴鎴戜滑', id: 29 }
+      ],
+      menuList2: []
     }
   },
-  methods: {
-    handleSelect(key, keyPath) {
-      console.log(key, keyPath)
-      this.$router.push({
-        path: '/home/' + keyPath
+  created() {
+    // this.getNavArr();
+  },
+  mounted() {
+    let api3 = 'http://localhost:7070/news_type/all'
+    axios
+      .get(api3)
+      .then(res => {
+        // console.log(res);
+        this.menuList2 = res.data.data
       })
+      .catch(error => {
+        console.log(error)
+      })
+  },
+  watch: {},
+  methods: {
+    // //鑾峰彇瀵艰埅鏍�
+    // getNavArr(){
+    //   const data ={};
+    //   getNavList(data).then(res => {
+    //     console.log('res', res)
+    //     if(res.code == 200){
+    //       this.menuList2 = res.data.data
+    //     }
+    //     this.menuList2 = res.data.data
+    //   }).catch(err => {
+    //     console.log('err', err)
+    //   })
+    // },
+
+    formatterTitle(t) {
+      switch (t) {
+        case '1':
+          return 'index'
+        case '22':
+          return 'introduce'
+        case '23':
+          return 'zhengce'
+        case '24':
+          return 'keXieXiangMu'
+        case '25':
+          return 'xueShuJiaoLiu'
+        case '26':
+          return 'banShiZhiNan'
+        case '27':
+          return 'kePuFengCai'
+        case '28':
+          return 'xueXiaoShouYe'
+        case '29':
+          return 'telephone'
+      }
+    },
+    handleSelect(key, keyPath) {
+      if (key == '28') {
+        window.open('https://www.pdsu.edu.cn/#')
+      } else {
+        this.$router.push({
+          path: '/home/' + this.formatterTitle(key),
+          query: {
+            title: this.formatterTitle(key),
+            id: key
+          }
+        })
+      }
     }
   }
 }
@@ -62,25 +124,15 @@
   height: 100%;
 }
 .el-header {
-  background: -webkit-linear-gradient(
-    left,
-    rgb(5, 102, 141),
-    rgb(240, 243, 189)
-  );
-
-  background: -o-linear-gradient(right, rgb(5, 102, 141), rgb(240, 243, 189));
-
-  background: -moz-linear-gradient(right, rgb(5, 102, 141), rgb(240, 243, 189));
-
-  background: linear-gradient(to right, rgb(5, 102, 141), rgb(240, 243, 189));
+  background-color: rgb(1, 72, 153);
 }
 .el-header {
-  height: 93px !important;
+  height: 120px !important;
+  padding: 0 80px 0 120px;
   overflow: hidden;
-  div {
-    display: flex;
-    justify-content: left;
-  }
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
 }
 .el-menu {
   .el-menu-item {
@@ -99,4 +151,14 @@
 .main {
   padding: 20px 5px;
 }
-</style>
\ No newline at end of file
+.el-footer {
+  font-size: 15px;
+  color: white;
+  text-align: center;
+  line-height: 60px;
+}
+.box {
+  width: 1200px;
+  margin: 0 auto;
+}
+</style>

--
Gitblit v1.8.0