增加消息页面

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

@@ -1,139 +1,139 @@
<template> <template>
<j-modal <j-modal
:title="title" :title="title"
:width="modelStyle.width" :width="modelStyle.width"
:visible="visible" :visible="visible"
:bodyStyle ="bodyStyle" :bodyStyle ="bodyStyle"
:switchFullscreen="switchFullscreen" :switchFullscreen="switchFullscreen"
@cancel="handleCancel" @cancel="handleCancel"
> >
<template slot="footer"> <template slot="footer">
<a-button key="back" @click="handleCancel">关闭</a-button> <a-button key="back" @click="handleCancel">关闭</a-button>
<a-button v-if="record.openType==='url'" type="primary" @click="toHandle">去处理</a-button> <a-button v-if="record.openType==='url'" type="primary" @click="toHandle">去处理</a-button>
</template> </template>
<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>
</a-card> </a-card>
</j-modal> </j-modal>
</template> </template>
<script> <script>
export default { export default {
name: "SysAnnouncementModal", name: "SysAnnouncementModal",
components: { components: {
}, },
data () { data () {
return { return {
title:"通知消息", title:"通知消息",
record: {}, record: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 5 }, sm: { span: 5 },
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 16 }, sm: { span: 16 },
}, },
visible: false, visible: false,
switchFullscreen: true, switchFullscreen: true,
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",
}, },
modelStyle:{ modelStyle:{
width: '60%', width: '60%',
style: { top: '20px' }, style: { top: '20px' },
fullScreen: false fullScreen: false
} }
} }
}, },
created () { created () {
}, },
methods: { methods: {
detail (record) { detail (record) {
this.visible = true; this.visible = true;
this.record = record; this.record = record;
}, },
handleCancel () { handleCancel () {
this.visible = false; this.visible = false;
}, },
/** 切换全屏显示 */ /** 切换全屏显示 */
handleClickToggleFullScreen() { handleClickToggleFullScreen() {
let mode = !this.modelStyle.fullScreen let mode = !this.modelStyle.fullScreen
if (mode) { if (mode) {
this.modelStyle.width = '100%' this.modelStyle.width = '100%'
this.modelStyle.style.top = '20px' this.modelStyle.style.top = '20px'
} else { } else {
this.modelStyle.width = '60%' this.modelStyle.width = '60%'
this.modelStyle.style.top = '50px' this.modelStyle.style.top = '50px'
} }
this.modelStyle.fullScreen = mode this.modelStyle.fullScreen = mode
}, },
toHandle(){ toHandle(){
if(this.record.openType==='url'){ if(this.record.openType==='url'){
this.visible = false; this.visible = false;
//链接跳转 //链接跳转
this.$router.push({path: this.record.openPage}) this.$router.push({path: this.record.openPage})
} }
}, },
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
.announcementCustomModal{ .announcementCustomModal{
.ant-modal-header { .ant-modal-header {
border: none; border: none;
display: inline-block; display: inline-block;
position: absolute; position: absolute;
z-index: 1; z-index: 1;
right: 56px; right: 56px;
padding: 0; padding: 0;
.ant-modal-title{ .ant-modal-title{
.custom-btn{ .custom-btn{
width: 56px; width: 56px;
height: 56px; height: 56px;
border: none; border: none;
box-shadow: none; box-shadow: none;
} }
} }
} }
.daily-article{ .daily-article{
border-bottom: 0; border-bottom: 0;
} }
} }
</style> </style>
<style scoped lang="less"> <style scoped lang="less">
.daily-article { .daily-article {
.article-button { .article-button {
font-size: 1.2rem !important; font-size: 1.2rem !important;
} }
.ant-card-body { .ant-card-body {
padding: 18px !important; padding: 18px !important;
} }
.ant-card-head { .ant-card-head {
padding: 0 1rem; padding: 0 1rem;
} }
.ant-card-meta { .ant-card-meta {
margin-bottom: 1rem; margin-bottom: 1rem;
} }
.article-content { .article-content {
p { p {
word-wrap: break-word; word-wrap: break-word;
word-break: break-all; word-break: break-all;
text-overflow: initial; text-overflow: initial;
white-space: normal; white-space: normal;
font-size: .9rem !important; font-size: .9rem !important;
margin-bottom: .8rem; margin-bottom: .8rem;
} }
} }
} }
</style> </style>

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