From 6748bd905cbba6ef9459f2cc7d6b833a110b08d0 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期六, 22 一月 2022 23:03:12 +0800
Subject: [PATCH] 完善了一些
---
src/components/page/introduce.vue | 131 +++++++++++++++++++------------------------
1 files changed, 57 insertions(+), 74 deletions(-)
diff --git a/src/components/page/introduce.vue b/src/components/page/introduce.vue
index 45694b9..7ffe283 100644
--- a/src/components/page/introduce.vue
+++ b/src/components/page/introduce.vue
@@ -7,40 +7,15 @@
<!-- 灏忔爣棰� -->
<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 v-for="(item, index) in menuList" :key="index" class="liStylenone liPointer marb10" @click="changeMenu(item)">
+ <b :class="cont == item.name ? 'ft-blue' : 'ft-black'">{{item.name}}</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>
+ <div v-html="this.new.content"></div>
</el-col>
</el-card>
</el-row>
@@ -49,7 +24,7 @@
<script>
import globalTitle from '../globalTitle.vue'
-import { getMinTitle, getNewsList } from '../../api/api'
+import {getMinTitle,getNewsList,getnew} from '../../api/api'
export default {
name: 'introduce',
components: {
@@ -59,62 +34,67 @@
return {
cont: '',
menuList: [],
- newsList: [],
- total: 0,
- currentPage: 1
+ newsList:[],
+ new:{} //鏂伴椈瀵硅薄
}
},
created() {
- this.getMinTitleList()
},
- mounted() {},
+ mounted() {
+ this.getTitle();
+ },
watch: {
- menuList(newval, oldval) {
- this.getAllNewsList(this.menuList[0])
- this.cont = this.menuList[0].categoryName
+ menuList(n,o){
+ this.cont = this.menuList[0].name;
+ this.getnews(this.menuList[0]); //鏀瑰彉瀵硅薄锛岃彍鍗曟爮鐨勪笢瑗胯鍐欏埌鐩戝惉灞炴�ч噷杈�
}
},
methods: {
- handleCurrentChange(val) {
- console.log(`褰撳墠椤�: ${val}`)
+ //鑾峰彇灏忔爣棰樼殑id
+ getTitle(){
+ const data = Number(this.$route.query.id);
+ getMinTitle(data).then(res => {
+ // console.log(res);
+ if(res.code == 200){
+ this.menuList = res.data
+ }
+ }).catch(err => {
+ console.log(err);
+ })
},
+ //灏忔爣棰樿彍鍗曠殑鐞冨垏鎹�
changeMenu(val) {
- this.getAllNewsList(val)
- this.cont = val.categoryName
+ this.cont = val.name;
+ this.getnews(val)
},
- getMinTitleList() {
+ //鑾峰彇鍒颁簡鏂伴椈鍒楄〃锛岄噷杈瑰彧鏈変竴涓璞�
+ getnews(item){
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)
- })
+ current:1,
+ newsCategoryId:item.id,
+ size:5
+ };
+ getNewsList(data).then(res => {
+ // console.log(res);
+ if(res.code == 200){
+ this.newsList = res.data.records
+ this.getalone(this.newsList[0].id)
+ }
+ }).catch(error => {
+ console.log(error);
+ })
},
- 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)
- })
+ //鑾峰彇鏂伴椈鍐呭,寰楀埌涓�涓柊闂诲璞�
+ getalone(id){
+ const data = id;
+ getnew(data).then(res => {
+ // console.log(res);
+ if(res.code == 200){
+ this.new = res.data;
+ }
+ }).catch(error => {
+ console.log(error);
+ })
}
}
}
@@ -129,6 +109,9 @@
text-align: center;
}
}
+.box-card{
+ // background-color: rgb(131, 212, 115);
+}
.ft-blue {
color: rgb(9, 143, 252);
}
--
Gitblit v1.8.0