From 55213fd6d8958e922c13e2c50c8423c9e459ede2 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期三, 24 十一月 2021 20:55:42 +0800
Subject: [PATCH] 前台项目基本完成

---
 src/components/page/xueShuJiaoLiu.vue |  171 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 122 insertions(+), 49 deletions(-)

diff --git a/src/components/page/xueShuJiaoLiu.vue b/src/components/page/xueShuJiaoLiu.vue
index b13e877..3e0aad4 100644
--- a/src/components/page/xueShuJiaoLiu.vue
+++ b/src/components/page/xueShuJiaoLiu.vue
@@ -1,68 +1,141 @@
 <template>
   <div>
-    <globalTitle />
-  
-    <el-tabs :tab-position="tabPosition" style="height: 400px; width=500px">
-      <el-tab-pane label="瀛︽湳淇℃伅">
-        <template>
-          <el-table :data="xueshuData" style="width: 100%">
-            <el-table-column prop="date" label="瀛︽湳淇℃伅" width="">
-            </el-table-column>
-          </el-table>
-        </template>
-      </el-tab-pane>
-      <el-tab-pane label="绉戞妧绔炶禌">
-        <template>
-          <el-table :data="kejiData" style="width: 100%">
-            <el-table-column prop="date" label="绉戞妧绔炶禌" width="">
-            </el-table-column>
-          </el-table>
-        </template>
-      </el-tab-pane>
-    </el-tabs>
+    <el-row>
+      <globalTitle />
+    </el-row>
+    <el-row class="mart10">
+      <!-- 灏忔爣棰� -->
+      <el-col :span="4" class="marr10">
+        <ul>
+          <li
+            v-for="(item, index) in menuList"
+            :key="index"
+            class="liStylenone liPointer marb10"
+            @click="changeMenu(item)"
+          >
+            <b :class="cont == item.categoryName ? 'ft-blue' : 'ft-black'">{{
+              item.categoryName
+            }}</b>
+          </li>
+        </ul>
+      </el-col>
+       <!-- 鏂伴椈鍐呭 -->
+      <el-card class="box-card">
+        <el-col :span="18">
+          <div>
+            <el-row
+              class="marb10"
+              :key="index"
+              v-for="(item, index) in newsList"
+            >
+              {{ item.title }}
+            </el-row>
+          </div>
+          <!-- 鍒嗛〉 -->
+          <div>
+            <el-pagination
+              @current-change="handleCurrentChange"
+              :current-page.sync="currentPage"
+              :page-size="20"
+              layout="total, pager, next"
+              :total="total"
+            >
+            </el-pagination>
+          </div>
+        </el-col>
+      </el-card>
+    </el-row>
   </div>
 </template>
 
 <script>
 import globalTitle from '../globalTitle.vue'
+import { getMinTitle, getNewsList } from '../../api/api'
 export default {
   components: { globalTitle },
   name: 'xueShuJiaoLiu',
   data() {
     return {
-      tabPosition: 'left',
-      xueshuData: [
-        {
-          date: '甯傛斂鍗忓壇涓诲腑鐜嬭憲涓�琛屾潵鎴戞牎鑰冨療璋冪爺',
-        },
-        {
-          date: '閮戝窞澶у鍗氬+鐢熷甯堝垬蹇椾紵鏁欐巿鏉ユ垜鏍¤瀛�',
-        },
-        {
-          date: '鍗椾含澶у鍗氬+鐢熷甯堢繜鍥芥柟鏁欐巿鏉ユ垜鏍¤瀛�',
-        },
-        {
-          date: '鍗庝腑绉戞妧澶у鍗氬+鐢熷甯堝緪鏅撴灄鍙楄仒鎴戞牎鐗硅仒鏁欐巿',
-        }
-      ],
-      kejiData: [
-        {
-          date: '鎴戞牎椴查箯浜т笟瀛﹂櫌鍦ㄦ渤鍗楃渷椴查箯浜т笟瀛﹂櫌寤鸿鑰冩牳涓幏寰椾紭绉�',
-        },
-        {
-          date: '2021绾т复搴婂尰瀛︽湰绉戠敓瀛︿笟瀵煎笀鍙婄彮涓讳换鑱樹换浠紡涓捐',
-        },
-        {
-          date: '鎴戞牎绗崄涓�娆″鐢熶唬琛ㄥぇ浼氫妇琛�',
-        },
-        {
-          date: '娌冲崡鐪侀珮绛夋暀鑲插浜嬪伐浣滀笟鍔″煿璁細鍦ㄦ垜鏍″彫寮�',
-        }
-      ]
+      cont: '',
+      menuList: [],
+      newsList: [],
+      total: 0,
+      currentPage: 1
+    }
+  },
+  created() {
+    this.getMinTitleList()
+  },
+  mounted() {},
+  watch: {
+    menuList(newval, oldval) {
+      this.getAllNewsList(this.menuList[0])
+      this.cont = this.menuList[0].categoryName
+    }
+  },
+  methods: {
+    handleCurrentChange(val) {
+      console.log(`褰撳墠椤�: ${val}`)
+    },
+    //鏀瑰彉 灏忔爣棰樿幏鍙栦笉鍚岀殑鏂伴椈鍐呭
+    changeMenu(val) {
+      this.getAllNewsList(val)
+      this.cont = val.categoryName
+    },
+    //鑾峰彇灏忔爣棰樺垪琛�
+    getMinTitleList() {
+      const data = {
+        contypeId: this.$route.query.id,
+        p: 1
+      }
+      getMinTitle(data)
+        .then((res) => {
+          console.log('res', res)
+          if (res.code == 200) {
+            this.menuList = res.data.records
+          }
+        })
+        .catch((err) => {
+          console.log('err', err)
+        })
+    },
+    //鑾峰彇鏂伴椈鍒楄〃
+    getAllNewsList(item) {
+      const data = {
+        categoryId: item.id,
+        contypeId: item.contypeId,
+        p: this.currentPage
+      }
+      getNewsList(data)
+        .then((res) => {
+          console.log('res', res)
+          if (res.code == 200) {
+            this.newsList = res.data.records
+            this.total = Number(res.data.total)
+          }
+        })
+        .catch((err) => {
+          console.log('err', err)
+        })
     }
   }
 }
 </script>
 
 <style lang="less" scoped>
+ul {
+  width: 200px;
+  li {
+    background-color: rgb(242, 243, 245);
+    height: 50px;
+    line-height: 50px;
+    text-align: center;
+  }
+}
+.ft-blue {
+  color: rgb(9, 143, 252);
+}
+.ft-black {
+  color: #000;
+}
 </style>
\ No newline at end of file

--
Gitblit v1.8.0