提交 439415e5 authored 作者: 王鹏飞's avatar 王鹏飞

优化消息通知页面

上级 47567066
<template> <template>
<div> <div>
<div class="con-title">消息通知</div> <div class="con-title">通知</div>
<div class="con-box"> <div class="con-box">
<el-collapse accordion v-model="activeNames" @change="handleChange"> <el-collapse accordion v-model="activeName" @change="handleChange" v-if="msgList.length">
<template v-for="(item, index) in msgList"> <template v-for="(item, index) in msgList">
<el-collapse-item v-bind:key="index" :name="index"> <el-collapse-item v-bind:key="index" :name="index">
<template slot="title"> <template slot="title">
<template v-if="!item.isShow"> <el-badge :is-dot="!item.isShow" class="item">系统通知</el-badge>
<el-badge is-dot class="item">系统通知</el-badge>
</template>
<template v-if="item.isShow">
系统通知
</template>
</template> </template>
<div v-html="item.text"></div> <div v-html="item.text"></div>
</el-collapse-item> </el-collapse-item>
</template> </template>
</el-collapse> </el-collapse>
<div style="height: 0.3rem;"></div> <div class="empty" v-else>您没有收到任何通知</div>
<el-pagination <el-pagination
background
layout="prev, pager, next"
:current-page.sync="page.currentPage" :current-page.sync="page.currentPage"
:page-size="page.limit" :page-size="page.limit"
layout="total, prev, pager, next, jumper"
:total="page.total" :total="page.total"
:hide-on-single-page="true"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
style="margin:0 auto;padding:40px 0;text-align:center;"
></el-pagination> ></el-pagination>
</div> </div>
</div> </div>
...@@ -33,10 +31,9 @@ ...@@ -33,10 +31,9 @@
import cAction from '@action' import cAction from '@action'
export default { export default {
components: { }, data() {
data () {
return { return {
activeNames: ['1'], activeName: null,
msgList: [], msgList: [],
page: { page: {
offset: 0, offset: 0,
...@@ -46,29 +43,26 @@ export default { ...@@ -46,29 +43,26 @@ export default {
} }
} }
}, },
mounted () { beforeMount() {
this.getData() this.getData()
}, },
methods: { methods: {
handleChange (val) { handleChange(val) {
if (typeof val === 'number' && this.msgList[val].isShow === 0) { if (typeof val === 'number' && this.msgList[val].isShow === 0) {
cAction.Other.setMyMsg(this.msgList[val].id).then(json => { cAction.Other.setMyMsg(this.msgList[val].id).then(json => {
this.getData() this.getData()
cAction.Other.getNavMsg().then(data => { cAction.Other.getNavMsg().then(data => {
this.$store.commit('myMsg', data.num) this.$store.commit('myMsg', data.num)
}).catch(e => { this.$message.error(e.message) }).finally(() => { }) })
}).catch(e => { this.$message.error(e.message) }).finally(() => { }) })
} }
}, },
getData () { getData() {
const pageParam = { const params = { offset: this.page.offset, limit: this.page.limit }
offset: this.page.offset, cAction.Other.getMyMsg(params).then(response => {
limit: this.page.limit this.msgList = response.list
} this.page.total = parseInt(response.count)
cAction.Other.getMyMsg(pageParam).then(json => { })
this.msgList = json.list
this.page.total = parseInt(json.count)
}).catch(e => { this.$message.error(e.message) }).finally(() => { })
}, },
handleCurrentChange() { handleCurrentChange() {
this.page.offset = (this.page.currentPage - 1) * this.page.limit this.page.offset = (this.page.currentPage - 1) * this.page.limit
...@@ -79,37 +73,13 @@ export default { ...@@ -79,37 +73,13 @@ export default {
</script> </script>
<style lang="scss"> <style lang="scss">
.el-collapse-item__header{ .el-collapse-item__header {
line-height: 15px; line-height: 15px;
} }
.total-core, .compulsory-core, .elective-core { .empty {
margin-top: 0.1rem; padding: 100px;
font-size: 16px; font-size: 18px;
line-height: 36px; color: #5f6368;
.title { text-align: center;
float: left;
// margin-left: 5px;
}
.core {
float: right;
margin-right: 3px;
font-size: 12px;
}
}
.color-box {
padding: 0.1rem 0 0.2rem 0;
text-align: right;
.color {
display: inline-block;
vertical-align: text-bottom;
width: 14px;
height: 14px;
}
.txt {
display: inline-block;
padding: 0 0.2rem 0 0.1rem;
font-size: 14px;
line-height: 36px;
}
} }
</style> </style>
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论