From ddfc75ed45d427bb8b407133b5e2bde0e6ec581a Mon Sep 17 00:00:00 2001 From: 明梦爽 <2972214568@qq.com> Date: 星期六, 22 一月 2022 16:22:45 +0800 Subject: [PATCH] 新闻查询功能完毕 --- src/views/homePage/moreMessage.vue | 250 ++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 191 insertions(+), 59 deletions(-) diff --git a/src/views/homePage/moreMessage.vue b/src/views/homePage/moreMessage.vue index 3142aab..43978e9 100644 --- a/src/views/homePage/moreMessage.vue +++ b/src/views/homePage/moreMessage.vue @@ -5,81 +5,204 @@ </el-row> <div class="mart15"> <div v-if="this.$route.query.type == '閫氱煡鍏憡'"> - <ul> - <li - class="lieBiao flex-v flex-conter padt10 liPointer" - :key="index" - v-for="(item, index) in noticeList" - > - <div class="time"> - <span>{{ item.date }}</span> - <span>{{ item.years }}</span> - </div> - <div class="title" @click="toNoticeMsg(item.title)"> - {{ item.title }} - </div> - </li> - </ul> + <el-card> + <ul class="ul"> + <li class="lieBiao liPointer flex-v flex-between" :key="index" v-for="(item, index) in noticeList"> + <div class="time"> + {{ item.releaseTime }} + </div> + <div class="title" @click="toNoticeMsg(item.id)"> + {{ item.title }} + </div> + </li> + </ul> + <!-- 鍒嗛〉 --> + <div> + <el-pagination + background + @current-change="handleCurrentChange1" + :current-page="currentPagenotice" + :page-size="pageSize" + layout="prev, pager, next,total" + :total="totalnotice"> + </el-pagination> + </div> + </el-card> </div> <div v-if="this.$route.query.type == '瀛﹂櫌鍔ㄦ��'"> <ul> - <li :key="index" v-for="(item, index) in schoolList" class="liPointer"> - <!-- <a href="item.path"> {{ item.title }} </a> --> - <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> --> - <div @click="toNoticeMsg(item.title)">{{ item.title }}</div> - </li> + <el-card> + <ul class="ul"> + <li class="lieBiao liPointer flex-v flex-between" :key="index" v-for="(item, index) in schoolList"> + <div class="time"> + {{ item.releaseTime }} + </div> + <div class="title" @click="toSchoolMsg(item.id)"> + {{ item.title }} + </div> + </li> + </ul> + <!-- 鍒嗛〉 --> + <div> + <el-pagination + background + @current-change="handleCurrentChange2" + :current-page.sync="currentPageschool" + :page-size="pageSize" + layout="prev, pager, next,total" + :total="totalschool"> + </el-pagination> + </div> + </el-card> </ul> </div> <div v-if="this.$route.query.type == '宸ヤ綔鐘舵��'"> - <ul> - <li :key="index" v-for="(item, index) in workList" class="liPointer"> - <!-- <a href="item.path"> {{ item.title }} </a> --> - <!-- <router-link :to="{name:'schoolMessage',params:{id:item.id}}" >{{ item.title }} </router-link> --> - <div @click="toNoticeMsg(item.title)">{{ item.title }}</div> - </li> + <ul> + <el-card> + <ul class="ul"> + <li class="lieBiao liPointer flex-v flex-between" :key="index" v-for="(item, index) in workList"> + <div class="time"> + {{ item.releaseTime }} + </div> + <div class="title" @click="toWorkMsg(item.id)"> + {{ item.title }} + </div> + </li> + </ul> + <!-- 鍒嗛〉 --> + <div> + <el-pagination + background + @current-change="handleCurrentChange3" + :current-page.sync="currentPagework" + :page-size="pageSize" + layout="prev, pager, next,total" + :total="totalwork"> + </el-pagination> + </div> + </el-card> </ul> </div> </div> </div> </template> <script> +import {getNewsList} from '../../api/api' export default { name: 'moreMessage', data() { return { - noticeList: [ - { years: '2021', date: '11-2', title: '鎴戞槸鏍囬1' }, - { years: '2021', date: '11-2', title: '鎴戞槸鏍囬2' }, - { years: '2021', date: '11-2', title: '鎴戞槸鏍囬3' }, - { years: '2021', date: '11-2', title: '鎴戞槸鏍囬4' }, - { years: '2021', date: '11-2', title: '鎴戞槸鏍囬5' } - ], - schoolList: [ - { id: '1', title: '瀛︽牎鐘舵��1' }, - { id: '2', title: '瀛︽牎鐘舵��2' }, - { id: '3', title: '瀛︽牎鐘舵��3' }, - { id: '4', title: '瀛︽牎鐘舵��4' }, - { id: '5', title: '瀛︽牎鐘舵��5' }, - { id: '6', title: '瀛︽牎鐘舵��6' } - ], - workList: [ - { id:'1', title: '宸ヤ綔鐘舵��1' }, - { id:'2', title: '宸ヤ綔鐘舵��2' }, - { id:'3', title: '宸ヤ綔鐘舵��3' }, - { id:'4', title: '宸ヤ綔鐘舵��4' }, - { id:'5', title: '宸ヤ綔鐘舵��5' }, - { id:'6', title: '宸ヤ綔鐘舵��6' }, - ] + noticeList: [], + schoolList: [], + workList: [], + currentPagenotice:1, //閫氱煡鍏憡鐨勫綋鍓嶉〉 + currentPageschool:1, //瀛﹂櫌鍔ㄦ�佺殑褰撳墠椤� + currentPagework:1, //宸ヤ綔鍔ㄦ�佺殑褰撳墠椤� + pageSize:4, + totalnotice:0, //閫氱煡鍏憡鏂伴椈鐨勬�绘潯鏁� + totalschool:0, //瀛﹂櫌鍔ㄦ�佹柊闂荤殑鎬绘潯鏁� + totalwork:0, //宸ヤ綔鍔ㄦ�佹柊闂荤殑鎬绘潯鏁� } }, + mounted(){ + this.getnotice(); + this.getwork(); + this.getschool(); + }, methods: { - toNoticeMsg(t) { + //閫氱煡鍏憡鐨勫垎椤靛垏鎹� + handleCurrentChange1(val){ + // console.log(`褰撳墠椤�: ${val}`); + this.currentPagenotice = val; + this.getnotice(); + }, + //瀛﹂櫌鍔ㄦ�佺殑鍒嗛〉鍒囨崲 + handleCurrentChange2(val){ + // console.log(`褰撳墠椤�: ${val}`); + this.currentPageschool = val; + this.getschool(); + }, + //宸ヤ綔鍔ㄦ�佺殑鍒嗛〉鍒囨崲 + handleCurrentChange3(val){ + // console.log(`褰撳墠椤�: ${val}`); + this.currentPagework = val; + this.getwork(); + }, + //鑾峰彇鏂伴椈鍒楄〃 + getnotice(){ + const data = { + current:this.currentPagenotice, + newsCategoryId:42, + size:this.pageSize + } + getNewsList(data).then(res => { + // console.log(res); + if(res.code == 200){ + this.noticeList = res.data.records + this.totalnotice = res.data.total + } + }).catch(error => { + console.log(error); + }) + }, + getwork(){ + const data = { + current:this.currentPagework, + newsCategoryId:43, + size:this.pageSize + } + getNewsList(data).then(res => { + // console.log(res); + if(res.code == 200){ + this.workList = res.data.records + this.totalwork = Number(res.data.total) + } + }).catch(error => { + console.log(error); + }) + }, + getschool(){ + const data = { + current:this.currentPageschool, + newsCategoryId:44, + size:this.pageSize + } + getNewsList(data).then(res => { + // console.log(res); + if(res.code == 200){ + this.schoolList = res.data.records + this.totalschool = Number(res.data.total) + } + }).catch(error => { + console.log(error); + }) + }, + toNoticeMsg(id) { this.$router.push({ - path: '/home/noticeMessage', + path: '/home/news', query: { - title: t + id: id, } }) + window.location.reload() + }, + toSchoolMsg(id) { + this.$router.push({ + path: '/home/news', + query: { + id: id, + } + }) + window.location.reload() + }, + toWorkMsg(id) { + this.$router.push({ + path: '/home/news', + query: { + id: id, + } + }) + window.location.reload() } } } @@ -90,20 +213,29 @@ } .lieBiao { width: 95%; - height: 80px; - background: rgb(202, 202, 202); - overflow: hidden; + height: 60px; + background: rgb(241, 241, 241); margin-bottom: 10px; } .time { width: 100px; - overflow: hidden; + padding: 17px 0px; display: flex; flex-direction: column; + background-color: rgb(1, 72, 153); + color: white; + text-align: center; } .title { - width: 500px; - height: 70px; + width: 550px; + height: 50px; overflow: hidden; + line-height: 60px; + /* // background-color: rgb(179, 19, 19); */ + padding: 0 0 0 10px; } -</style> \ No newline at end of file +.ul{ + width: 700px; + margin: 0 auto; +} +</style> \ No newline at end of file -- Gitblit v1.8.0