增加消息页面

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

View File

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

View File

@@ -99,7 +99,7 @@
import Trend from '@/components/Trend' import Trend from '@/components/Trend'
import { getBuyAndSaleStatistics, buyOrSalePrice, getPlatformConfigByKey } from '@/api/api' import { getBuyAndSaleStatistics, buyOrSalePrice, getPlatformConfigByKey } from '@/api/api'
import { handleIntroJs } from "@/utils/util" import { handleIntroJs } from "@/utils/util"
import { getAction } from '../../api/manage' import { getAction,postAction } from '../../api/manage'
export default { export default {
name: "IndexChart", name: "IndexChart",
@@ -179,6 +179,27 @@
//如果距离到期还剩5天就进行提示续费 //如果距离到期还剩5天就进行提示续费
if(difftime<86400000*5) { if(difftime<86400000*5) {
this.hasExpire = true 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,64 +1,73 @@
<template> <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"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
<a-col :span="12">
<a-col :span="6">
<a-form-item label="标题"> <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-form-item>
</a-col> </a-col>
<a-col :span="6"> <a-col :span="12" >
<a-form-item label="发布人">
<a-input placeholder="请输入发布人" v-model="queryParam.sender"></a-input>
</a-form-item>
</a-col>
<a-col :span="8" >
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <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="searchQuery">查询</a-button>
<a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button> <a-button @click="searchReset" style="margin-left: 8px">重置</a-button>
</span> </span>
</a-col> </a-col>
</a-row> </a-row>
</a-form> </a-form>
</div> </div>
<!-- <div class="table-operator">-->
<div class="table-operator"> <!-- <a-button type="primary" @click="readAll" icon="book">全部标注已读</a-button>-->
<a-button type="primary" @click="readAll" icon="book">全部标注已读</a-button> <!-- </div>-->
</div> <div style="margin-top: 5px">
<a-table
<a-table ref="table"
ref="table" size="default"
size="default" bordered
bordered rowKey="id"
rowKey="id" :columns="columns"
:columns="columns" :dataSource="dataSource"
:dataSource="dataSource" :pagination="ipagination"
:pagination="ipagination" :loading="loading"
:loading="loading" @change="handleTableChange">
@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"> <span slot="action" slot-scope="text, record">
<a @click="showAnnouncement(record)">查看</a> <a @click="showAnnouncement(record)">查看</a>
</span> </span>
</a-table> </a-table>
</div>
<show-announcement ref="ShowAnnouncement"></show-announcement> <show-announcement ref="ShowAnnouncement"></show-announcement>
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/> <dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
</a-card> </a-modal>
</template> </template>
<script> <script>
import { filterObj } from '@/utils/util' 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 ShowAnnouncement from '@/components/tools/ShowAnnouncement'
import {JeecgListMixin} from '@/mixins/JeecgListMixin' import {JeecgListMixin} from '@/mixins/JeecgListMixin'
import DynamicNotice from '../../components/tools/DynamicNotice' import DynamicNotice from '../../components/tools/DynamicNotice'
export default { export default {
name: "UserAnnouncementList", name: "MsgList",
mixins: [JeecgListMixin], mixins: [JeecgListMixin],
components: { components: {
DynamicNotice, DynamicNotice,
@@ -66,69 +75,39 @@
}, },
data () { data () {
return { return {
description: '系统通告表管理页面', title:"通知",
queryParam: {}, modalWidth:800,
visible: false,
confirmLoading: false,
queryParam: {
name: ''
},
columns: [{ columns: [{
title: '标题', title: '标题',
align:"center", dataIndex: 'msgTitle',
dataIndex: 'titile' scopedSlots: { customRender: 'customRenderTitle' },
},{ width: 200
},
{
title: '消息类型', title: '消息类型',
align: "center", dataIndex: 'type',
dataIndex: 'msgCategory', width: 80
customRender: function (text) { },
if (text == '1') { {
return "通知公告"; title: '时间',
} else if (text == "2") { dataIndex: 'createTimeStr',
return "系统消息"; width: 90
} 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;
}
}
},{
title: '操作', title: '操作',
dataIndex: 'action', dataIndex: 'action',
align:"center", align:"center",
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
width: 50
}], }],
url: { url: {
list: "/sys/sysAnnouncementSend/getMyAnnouncementSend", list: "/msg/list",
batchUpdateStatus:"/msg/batchUpdateStatus",
editCementSend:"sys/sysAnnouncementSend/editByAnntIdAndUserId", editCementSend:"sys/sysAnnouncementSend/editByAnntIdAndUserId",
readAllMsg:"sys/sysAnnouncementSend/readAll", readAllMsg:"sys/sysAnnouncementSend/readAll",
}, },
@@ -138,15 +117,14 @@
} }
}, },
methods: { methods: {
handleDetail: function(record){ handleDetail: function(){
this.$refs.sysAnnouncementModal.detail(record); this.visible = true
this.$refs.sysAnnouncementModal.title="查看";
}, },
showAnnouncement(record){ showAnnouncement(record){
putAction(this.url.editCementSend,{anntId:record.anntId}).then((res)=>{ postAction(this.url.batchUpdateStatus,{ids:record.id, status: '2'}).then((res)=>{
if(res.success){ if(res && res.code === 200){
this.loadData(); this.loadData();
this.syncHeadNotic(record.anntId) //this.syncHeadNotic(record.anntId)
} }
}); });
if(record.openType==='component'){ if(record.openType==='component'){
@@ -176,6 +154,13 @@
} }
}); });
}, },
close () {
this.$emit('close');
this.visible = false;
},
handleCancel () {
this.close()
}
} }
} }
</script> </script>