|
|
|
|
@ -41,21 +41,27 @@
|
|
|
|
|
>已读</Button
|
|
|
|
|
>
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
<template v-for="(item, index) in noticeData">
|
|
|
|
|
<el-dropdown-item :divided="!index">
|
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
|
<div v-for="(value, key) in item.data">
|
|
|
|
|
{{ key }} : {{ value }}
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
style="margin-left: 10px;"
|
|
|
|
|
size="small"
|
|
|
|
|
:type="item.read_at ? 'success' : 'primary'"
|
|
|
|
|
:icon="item.read_at ? 'md-checkmark' : 'ios-create-outline'"
|
|
|
|
|
<template v-if="noticeData.length > 0">
|
|
|
|
|
<template v-for="(item, index) in noticeData">
|
|
|
|
|
<el-dropdown-item :divided="!index">
|
|
|
|
|
<div style="display: flex; align-items: center">
|
|
|
|
|
<div v-for="(value, key) in item.data">
|
|
|
|
|
{{ key }} : {{ value }}
|
|
|
|
|
</div>
|
|
|
|
|
<Button
|
|
|
|
|
style="margin-left: 10px;"
|
|
|
|
|
size="small"
|
|
|
|
|
:type="item.read_at ? 'success' : 'primary'"
|
|
|
|
|
:icon="item.read_at ? 'md-checkmark' : 'ios-create-outline'"
|
|
|
|
|
@click="toggleMessage(item)"
|
|
|
|
|
>{{ item.read_at ? "已读" : "标为已读" }}</Button
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
>
|
|
|
|
|
</div>
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
</template>
|
|
|
|
|
</template>
|
|
|
|
|
<template v-else>
|
|
|
|
|
<div style="text-align: center;color: rgb(140,140,140);padding: 10px 0;">暂无通知</div>
|
|
|
|
|
</template>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</template>
|
|
|
|
|
@ -171,6 +177,19 @@ export default {
|
|
|
|
|
...mapGetters(["sidebar", "avatar"]),
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
toggleMessage(item){
|
|
|
|
|
if(item.read_at) return
|
|
|
|
|
toggleRead({
|
|
|
|
|
id:item.id
|
|
|
|
|
}).then(res => {
|
|
|
|
|
this.$message({
|
|
|
|
|
type:'success',
|
|
|
|
|
message:res?.msg || "成功"
|
|
|
|
|
})
|
|
|
|
|
this.getNotice()
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
async getNotice() {
|
|
|
|
|
let res = await getNotice({
|
|
|
|
|
read_state: this.messageStatus,
|
|
|
|
|
|