From b80d0c5dd5ca242427a07f4891e8a0dc354889b3 Mon Sep 17 00:00:00 2001
From: 明梦爽 <2972214568@qq.com>
Date: 星期三, 19 一月 2022 23:46:29 +0800
Subject: [PATCH] 后台查看功能完成
---
src/components/page/zhengce.vue | 128 ++++++++++++++++++++++--------------------
1 files changed, 66 insertions(+), 62 deletions(-)
diff --git a/src/components/page/zhengce.vue b/src/components/page/zhengce.vue
index 02e7cb6..c7d547f 100644
--- a/src/components/page/zhengce.vue
+++ b/src/components/page/zhengce.vue
@@ -7,38 +7,30 @@
<!-- 灏忔爣棰� -->
<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 class="marb10" :key="index" v-for="(item, index) in newsList">
+ <div class="flex-v flex-between marb5 cursor" @click="show(item)">
+ <div>{{ item.title }}</div>
+ <div>{{ item.releaseTime }}</div>
+ </div>
</el-row>
</div>
<!-- 鍒嗛〉 -->
- <div>
+ <div class="fenye">
<el-pagination
+ background
@current-change="handleCurrentChange"
:current-page.sync="currentPage"
- :page-size="20"
- layout="total, pager, next"
- :total="total"
- >
+ :page-size="pageSize"
+ layout="prev, pager, next,total"
+ :total="total">
</el-pagination>
</div>
</el-col>
@@ -59,62 +51,66 @@
return {
cont: '',
menuList: [],
- newsList: [],
- total: 0,
- currentPage: 1
+ newsList:[],
+ pageSize:2,
+ currentPage:1,
+ total:0,
+ item:{},
}
},
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}`)
+ console.log(`褰撳墠椤�: ${val}`);
+ this.getnews(this.item);
+ },
+ 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.item = val
+ this.currentPage = 1
+ 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:this.currentPage,
+ newsCategoryId:item.id,
+ size:this.pageSize
+ };
+ getNewsList(data).then(res => {
+ console.log(res);
+ if(res.code == 200){
+ this.newsList = res.data.records
+ this.total = Number(res.data.total)
+ }
+ }).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)
- })
+ // 璺宠浆鍒版柊闂诲睍绀洪〉闈�
+ show(item){
+ // console.log(item.id);
+ this.$router.push({path:'/home/news',query:{id:item.id}})
}
}
}
@@ -136,4 +132,12 @@
.ft-black{
color: #000;
}
+.box-card{
+ height: 600px;
+ position: relative;
+ .fenye{
+ position: absolute;
+ bottom: 2px;
+ }
+}
</style>
\ No newline at end of file
--
Gitblit v1.8.0