增加消息页面

This commit is contained in:
季圣华
2021-12-10 00:47:48 +08:00
parent a0bad81d5c
commit 3bca1e6b6d
4 changed files with 361 additions and 389 deletions

View File

@@ -1,7 +1,7 @@
<template>
<a-popover
trigger="click"
placement="bottomRight"
placement="bottom"
:autoAdjustOverflow="true"
:arrowPointAtCenter="true"
overlayClassName="header-notice-wrapper"
@@ -14,35 +14,12 @@
<a-list>
<a-list-item :key="index" v-for="(record, index) in announcement1">
<div style="margin-left: 5%;width: 80%">
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>
</div>
<div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
<p><a @click="showAnnouncement(record)">{{ record.msgTitle }}</a></p>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTimeStr }} 发布</p>
</div>
</a-list-item>
<div style="margin-top: 5px;text-align: center">
<!-- <a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>-->
</div>
</a-list>
</a-tab-pane>
<a-tab-pane :tab="msg2Title" key="2">
<a-list>
<a-list-item :key="index" v-for="(record, index) in announcement2">
<div style="margin-left: 5%;width: 80%">
<p><a @click="showAnnouncement(record)">{{ record.titile }}</a></p>
<p style="color: rgba(0,0,0,.45);margin-bottom: 0px">{{ record.createTime }} 发布</p>
</div>
<div style="text-align: right">
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'L'" color="blue">一般消息</a-tag>
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'M'" color="orange">重要消息</a-tag>
<a-tag @click="showAnnouncement(record)" v-if="record.priority === 'H'" color="red">紧急消息</a-tag>
</div>
</a-list-item>
<div style="margin-top: 5px;text-align: center">
<!-- <a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>-->
<a-button @click="toMyAnnouncement()" type="dashed" block>查看更多</a-button>
</div>
</a-list>
</a-tab-pane>
@@ -56,37 +33,36 @@
</span>
<show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
<msg-list ref="modalList" @close="modalListCancel()"></msg-list>
</a-popover>
</template>
<script>
import { getAction,putAction } from '@/api/manage'
import { getAction,postAction } from '@/api/manage'
import ShowAnnouncement from './ShowAnnouncement'
import store from '@/store/'
import DynamicNotice from './DynamicNotice'
import MsgList from '@/views/system/MsgList'
export default {
name: "HeaderNotice",
components: {
DynamicNotice,
ShowAnnouncement,
MsgList
},
data () {
return {
loadding: false,
url:{
listCementByUser:"/sys/annountCement/listByUser",
editCementSend:"/sys/sysAnnouncementSend/editByAnntIdAndUserId",
getMsgByStatus:"/msg/getMsgByStatus",
batchUpdateStatus:"/msg/batchUpdateStatus",
queryById:"/sys/annountCement/queryById",
},
hovered: false,
announcement1:[],
announcement2:[],
msg1Count:"0",
msg2Count:"0",
msg1Title:"通知(0)",
msg2Title:"",
stopTimer:false,
websock: null,
lockReconnect:false,
@@ -97,11 +73,11 @@
},
computed:{
msgTotal () {
return parseInt(this.msg1Count)+parseInt(this.msg2Count);
return parseInt(this.msg1Count);
}
},
mounted() {
//this.loadData();
this.loadData();
//this.timerFun();
//this.initWebSocket(); //注释by jishenghua 2021年1月13日
// this.heartCheckFun();
@@ -124,14 +100,11 @@
loadData (){
try {
// 获取系统消息
getAction(this.url.listCementByUser).then((res) => {
if (res.success) {
this.announcement1 = res.result.anntMsgList;
this.msg1Count = res.result.anntMsgTotal;
this.msg1Title = "通知(" + res.result.anntMsgTotal + ")";
this.announcement2 = res.result.sysMsgList;
this.msg2Count = res.result.sysMsgTotal;
this.msg2Title = "系统消息(" + res.result.sysMsgTotal + ")";
getAction(this.url.getMsgByStatus, { status: '1'}).then((res) => {
if (res && res.code === 200) {
this.announcement1 = res.data;
this.msg1Count = res.data.length;
this.msg1Title = "通知(" + res.data.length + ")";
}
}).catch(error => {
console.log("系统消息通知异常",error);//这行打印permissionName is undefined
@@ -154,29 +127,22 @@
}, 200)
},
showAnnouncement(record){
putAction(this.url.editCementSend,{anntId:record.id}).then((res)=>{
if(res.success){
postAction(this.url.batchUpdateStatus,{ids:record.id, status: '2'}).then((res)=>{
if(res && res.code === 200){
this.loadData();
}
});
this.hovered = false;
if(record.openType==='component'){
this.openPath = record.openPage;
this.formData = {id:record.busId};
this.$refs.showDynamNotice.detail(record.openPage);
}else{
this.$refs.ShowAnnouncement.detail(record);
}
},
toMyAnnouncement(){
this.$router.push({
path: '/isps/userAnnouncement',
name: 'isps-userAnnouncement'
});
this.$refs.modalList.handleDetail();
},
modalFormOk(){
},
modalListCancel(){
this.loadData()
},
handleHoverChange (visible) {
this.hovered = visible;
},

View File

@@ -14,7 +14,7 @@
<a-card class="daily-article" :loading="loading">
<a-card-meta
:title="record.titile"
:description="'发布人'+record.sender + ' 发布时间 ' + record.sendTime">
:description="'标题'+record.msgTitle">
</a-card-meta>
<a-divider />
<span v-html="record.msgContent" class="article-content"></span>
@@ -44,7 +44,7 @@
loading: false,
bodyStyle:{
padding: "0",
height:(window.innerHeight*0.8)+"px",
height:(window.innerHeight*0.6)+"px",
"overflow-y":"auto",
},

View File

@@ -99,7 +99,7 @@
import Trend from '@/components/Trend'
import { getBuyAndSaleStatistics, buyOrSalePrice, getPlatformConfigByKey } from '@/api/api'
import { handleIntroJs } from "@/utils/util"
import { getAction } from '../../api/manage'
import { getAction,postAction } from '../../api/manage'
export default {
name: "IndexChart",
@@ -179,6 +179,27 @@
//如果距离到期还剩5天就进行提示续费
if(difftime<86400000*5) {
this.hasExpire = true
//针对免费租户发送试用到期的消息提醒
if(res.data.type === '0') {
//先检查有无发送过,只发送一次
getAction("/msg/getMsgCountByType",{'type': '试用到期'}).then(res=>{
if(res && res.code === 200) {
if(res.data.count === 0) {
//发送消息
let msgParam = {
'msgTitle': '试用到期提醒',
'msgContent': '试用期即将结束,请您及时续费,过期将会影响正常使用!',
'type': '试用到期'
}
postAction("/msg/add",msgParam).then(res=>{
if(res && res.code === 200) {
}
})
}
}
})
}
}
}
})

View File

@@ -1,36 +1,40 @@
<template>
<a-card :bordered="false">
<a-modal
:title="title"
:width="modalWidth"
:visible="visible"
:confirmLoading="confirmLoading"
@ok="handleOk"
@cancel="handleCancel"
cancelText="关闭"
style="top:20%;height: 60%;overflow-y: hidden">
<template slot="footer">
<a-button key="back" @click="handleCancel">
关闭
</a-button>
</template>
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :span="6">
<a-col :span="12">
<a-form-item label="标题">
<a-input placeholder="请输入标题" v-model="queryParam.titile"></a-input>
<a-input placeholder="请输入标题" v-model="queryParam.name"></a-input>
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="发布人">
<a-input placeholder="请输入发布人" v-model="queryParam.sender"></a-input>
</a-form-item>
</a-col>
<a-col :span="8" >
<a-col :span="12" >
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button @click="searchReset" style="margin-left: 8px">重置</a-button>
</span>
</a-col>
</a-row>
</a-form>
</div>
<div class="table-operator">
<a-button type="primary" @click="readAll" icon="book">全部标注已读</a-button>
</div>
<!-- <div class="table-operator">-->
<!-- <a-button type="primary" @click="readAll" icon="book">全部标注已读</a-button>-->
<!-- </div>-->
<div style="margin-top: 5px">
<a-table
ref="table"
size="default"
@@ -41,24 +45,29 @@
:pagination="ipagination"
:loading="loading"
@change="handleTableChange">
<template slot="customRenderTitle" slot-scope="text, record">
<span v-if="record.status =='1'" style="font-weight: bold">{{text}}</span>
<span v-if="record.status =='2'">{{text}}</span>
</template>
<span slot="action" slot-scope="text, record">
<a @click="showAnnouncement(record)">查看</a>
</span>
</a-table>
</div>
<show-announcement ref="ShowAnnouncement"></show-announcement>
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
</a-card>
</a-modal>
</template>
<script>
import { filterObj } from '@/utils/util'
import { getAction,putAction } from '@/api/manage'
import { getAction,putAction,postAction } from '@/api/manage'
import ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DynamicNotice from '../../components/tools/DynamicNotice'
export default {
name: "UserAnnouncementList",
name: "MsgList",
mixins: [JeecgListMixin],
components: {
DynamicNotice,
@@ -66,69 +75,39 @@
},
data () {
return {
description: '系统通告表管理页面',
queryParam: {},
title:"通知",
modalWidth:800,
visible: false,
confirmLoading: false,
queryParam: {
name: ''
},
columns: [{
title: '标题',
align:"center",
dataIndex: 'titile'
},{
dataIndex: 'msgTitle',
scopedSlots: { customRender: 'customRenderTitle' },
width: 200
},
{
title: '消息类型',
align: "center",
dataIndex: 'msgCategory',
customRender: function (text) {
if (text == '1') {
return "通知公告";
} else if (text == "2") {
return "系统消息";
} else {
return text;
}
}
},{
title: '发布人',
align:"center",
dataIndex: 'sender'
},{
title: '发布时间',
align:"center",
dataIndex: 'sendTime'
},{
title: '优先级',
align:"center",
dataIndex: 'priority',
customRender:function (text) {
if(text=='L'){
return "";
}else if(text=="M"){
return "";
}else if(text=="H"){
return "";
} else {
return text;
}
}
},{
title: '阅读状态',
align:"center",
dataIndex: 'readFlag',
customRender:function (text) {
if(text=='0'){
return "未读";
}else if(text=="1"){
return "已读";
} else {
return text;
}
}
},{
dataIndex: 'type',
width: 80
},
{
title: '时间',
dataIndex: 'createTimeStr',
width: 90
},
{
title: '操作',
dataIndex: 'action',
align:"center",
scopedSlots: { customRender: 'action' },
width: 50
}],
url: {
list: "/sys/sysAnnouncementSend/getMyAnnouncementSend",
list: "/msg/list",
batchUpdateStatus:"/msg/batchUpdateStatus",
editCementSend:"sys/sysAnnouncementSend/editByAnntIdAndUserId",
readAllMsg:"sys/sysAnnouncementSend/readAll",
},
@@ -138,15 +117,14 @@
}
},
methods: {
handleDetail: function(record){
this.$refs.sysAnnouncementModal.detail(record);
this.$refs.sysAnnouncementModal.title="查看";
handleDetail: function(){
this.visible = true
},
showAnnouncement(record){
putAction(this.url.editCementSend,{anntId:record.anntId}).then((res)=>{
if(res.success){
postAction(this.url.batchUpdateStatus,{ids:record.id, status: '2'}).then((res)=>{
if(res && res.code === 200){
this.loadData();
this.syncHeadNotic(record.anntId)
//this.syncHeadNotic(record.anntId)
}
});
if(record.openType==='component'){
@@ -176,6 +154,13 @@
}
});
},
close () {
this.$emit('close');
this.visible = false;
},
handleCancel () {
this.close()
}
}
}
</script>