Skip to content

Commit c3a014d

Browse files
YunaiVgitee-org
authored andcommitted
!387 新增站内信
Merge pull request !387 from 芋道源码/feature/notify
2 parents 473de10 + 882d559 commit c3a014d

File tree

13 files changed

+915
-38
lines changed

13 files changed

+915
-38
lines changed

src/api/system/notify/message.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import request from '@/utils/request'
2+
import qs from 'qs'
3+
4+
// 获得我的站内信分页
5+
export function getNotifyMessagePage(query) {
6+
return request({
7+
url: '/system/notify-message/page',
8+
method: 'get',
9+
params: query
10+
})
11+
}
12+
13+
// 获得我的站内信分页
14+
export function getMyNotifyMessagePage(query) {
15+
return request({
16+
url: '/system/notify-message/my-page',
17+
method: 'get',
18+
params: query
19+
})
20+
}
21+
22+
// 批量标记已读
23+
export function updateNotifyMessageRead(ids) {
24+
return request({
25+
url: '/system/notify-message/update-read?' + qs.stringify({ids: ids}, { indices: false }),
26+
method: 'put'
27+
})
28+
}
29+
30+
// 标记所有站内信为已读
31+
export function updateAllNotifyMessageRead() {
32+
return request({
33+
url: '/system/notify-message/update-all-read',
34+
method: 'put'
35+
})
36+
}
37+
38+
// 获取当前用户的最新站内信列表
39+
export function getUnreadNotifyMessageList() {
40+
return request({
41+
url: '/system/notify-message/get-unread-list',
42+
method: 'get'
43+
})
44+
}
45+
46+
// 获得当前用户的未读站内信数量
47+
export function getUnreadNotifyMessageCount() {
48+
return request({
49+
url: '/system/notify-message/get-unread-count',
50+
method: 'get'
51+
})
52+
}

src/api/system/notify/template.js

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import request from '@/utils/request'
2+
3+
// 创建站内信模板
4+
export function createNotifyTemplate(data) {
5+
return request({
6+
url: '/system/notify-template/create',
7+
method: 'post',
8+
data: data
9+
})
10+
}
11+
12+
// 更新站内信模板
13+
export function updateNotifyTemplate(data) {
14+
return request({
15+
url: '/system/notify-template/update',
16+
method: 'put',
17+
data: data
18+
})
19+
}
20+
21+
// 删除站内信模板
22+
export function deleteNotifyTemplate(id) {
23+
return request({
24+
url: '/system/notify-template/delete?id=' + id,
25+
method: 'delete'
26+
})
27+
}
28+
29+
// 获得站内信模板
30+
export function getNotifyTemplate(id) {
31+
return request({
32+
url: '/system/notify-template/get?id=' + id,
33+
method: 'get'
34+
})
35+
}
36+
37+
// 获得站内信模板分页
38+
export function getNotifyTemplatePage(query) {
39+
return request({
40+
url: '/system/notify-template/page',
41+
method: 'get',
42+
params: query
43+
})
44+
}
45+
46+
// 创建站内信模板
47+
export function sendNotify(data) {
48+
return request({
49+
url: '/system/notify-template/send-notify',
50+
method: 'post',
51+
data: data
52+
})
53+
}
54+
55+
// 导出站内信模板 Excel
56+
export function exportNotifyTemplateExcel(query) {
57+
return request({
58+
url: '/system/notify-template/export-excel',
59+
method: 'get',
60+
params: query,
61+
responseType: 'blob'
62+
})
63+
}
64+

src/components/RuoYi/Doc/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default {
99
name: 'YudaoDoc',
1010
data() {
1111
return {
12-
url: 'http://www.iocoder.cn/Yudao/build-debugger-environment/?yudao'
12+
url: 'https://doc.iocoder.cn/'
1313
}
1414
},
1515
methods: {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
<template>
2+
<div>
3+
<el-popover placement="bottom" width="600" trigger="click">
4+
<!-- icon 展示 -->
5+
<el-badge slot="reference" :is-dot="unreadCount > 0" type="danger">
6+
<svg-icon icon-class="message" @click="getList"/>
7+
</el-badge>
8+
9+
<!-- 弹出列表 -->
10+
<el-table v-loading="loading" :data="list">
11+
<el-table-column width="120" property="templateNickname" label="发送人" />
12+
<el-table-column width="180" property="createTime" label="发送时间">
13+
<template slot-scope="scope">
14+
<span>{{ parseTime(scope.row.createTime) }}</span>
15+
</template>
16+
</el-table-column>
17+
<el-table-column label="类型" align="center" prop="templateType" width="100">
18+
<template v-slot="scope">
19+
<dict-tag :type="DICT_TYPE.SYSTEM_NOTIFY_TEMPLATE_TYPE" :value="scope.row.templateType" />
20+
</template>
21+
</el-table-column>
22+
<el-table-column property="templateContent" label="内容" />
23+
</el-table>
24+
25+
<!-- 更多 -->
26+
<div style="text-align: right; margin-top: 10px">
27+
<el-button type="primary" size="mini" @click="goMyList">查看全部</el-button>
28+
</div>
29+
</el-popover>
30+
</div>
31+
</template>
32+
33+
<script>
34+
import {getUnreadNotifyMessageCount, getUnreadNotifyMessageList} from "@/api/system/notify/message";
35+
36+
export default {
37+
name: 'NotifyMessage',
38+
data() {
39+
return {
40+
// 遮罩层
41+
loading: false,
42+
// 列表
43+
list: [],
44+
// 未读数量,
45+
unreadCount: 0,
46+
}
47+
},
48+
created() {
49+
// 首次加载小红点
50+
this.getUnreadCount()
51+
// 轮询刷新小红点
52+
setInterval(() => {
53+
this.getUnreadCount()
54+
},1000 * 60 * 2)
55+
},
56+
methods: {
57+
getList: function() {
58+
this.loading = true;
59+
getUnreadNotifyMessageList().then(response => {
60+
this.list = response.data;
61+
this.loading = false;
62+
// 强制设置 unreadCount 为 0,避免小红点因为轮询太慢,不消除
63+
this.unreadCount = 0
64+
});
65+
},
66+
getUnreadCount: function() {
67+
getUnreadNotifyMessageCount().then(response => {
68+
this.unreadCount = response.data;
69+
})
70+
},
71+
goMyList: function() {
72+
this.$router.push({
73+
name: 'MyNotifyMessage'
74+
});
75+
}
76+
}
77+
}
78+
</script>
79+
<style>
80+
.el-badge__content.is-fixed {
81+
top: 10px; /* 保证徽章的位置 */
82+
}
83+
</style>

src/layout/components/Navbar.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
<template v-if="device!=='mobile'">
1010
<search id="header-search" class="right-menu-item" />
1111

12+
<!-- 站内信 -->
13+
<notify-message class="right-menu-item hover-effect" />
14+
1215
<el-tooltip content="源码地址" effect="dark" placement="bottom">
1316
<ruo-yi-git id="ruoyi-git" class="right-menu-item hover-effect" />
1417
</el-tooltip>
@@ -57,6 +60,7 @@ import SizeSelect from '@/components/SizeSelect'
5760
import Search from '@/components/HeaderSearch'
5861
import RuoYiGit from '@/components/RuoYi/Git'
5962
import RuoYiDoc from '@/components/RuoYi/Doc'
63+
import NotifyMessage from '@/layout/components/Message'
6064
import {getPath} from "@/utils/ruoyi";
6165
6266
export default {
@@ -68,7 +72,8 @@ export default {
6872
SizeSelect,
6973
Search,
7074
RuoYiGit,
71-
RuoYiDoc
75+
RuoYiDoc,
76+
NotifyMessage
7277
},
7378
computed: {
7479
...mapGetters([

src/router/index.js

Lines changed: 46 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ export const constantRoutes = [
7575
meta: {title: '首页', icon: 'dashboard', affix: true}
7676
}
7777
]
78-
}, {
78+
},
79+
{
7980
path: '/user',
8081
component: Layout,
8182
hidden: true,
@@ -85,9 +86,14 @@ export const constantRoutes = [
8586
component: (resolve) => require(['@/views/system/user/profile/index'], resolve),
8687
name: 'Profile',
8788
meta: {title: '个人中心', icon: 'user'}
88-
}
89-
]
90-
}, {
89+
}, {
90+
path: 'notify-message',
91+
component: (resolve) => require(['@/views/system/notify/my/index'], resolve),
92+
name: 'MyNotifyMessage',
93+
meta: { title: '我的站内信', icon: 'message' },
94+
}]
95+
},
96+
{
9197
path: '/dict',
9298
component: Layout,
9399
hidden: true,
@@ -98,18 +104,8 @@ export const constantRoutes = [
98104
meta: {title: '字典数据', icon: '', activeMenu: '/system/dict'}
99105
}
100106
]
101-
}, {
102-
path: '/property',
103-
component: Layout,
104-
hidden: true,
105-
children: [{
106-
path: 'value/:propertyId(\\d+)',
107-
component: (resolve) => require(['@/views/mall/product/property/value'], resolve),
108-
name: 'PropertyValue',
109-
meta: {title: '商品属性值', icon: '', activeMenu: '/product/property'}
110-
}
111-
]
112-
}, {
107+
},
108+
{
113109
path: '/job',
114110
component: Layout,
115111
hidden: true,
@@ -131,24 +127,8 @@ export const constantRoutes = [
131127
meta: {title: '修改生成配置', activeMenu: '/infra/codegen'}
132128
}
133129
]
134-
}, {
135-
path: '/spu',
136-
component: Layout,
137-
hidden: true,
138-
children: [{
139-
path: 'edit/:spuId(\\d+)',
140-
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
141-
name: 'SpuEdit',
142-
meta: {title: '修改商品', activeMenu: '/product/spu'}
143-
},
144-
{
145-
path: 'add',
146-
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
147-
name: 'SpuAdd',
148-
meta: {title: '添加商品', activeMenu: '/product/spu'}
149-
}
150-
]
151-
}, {
130+
},
131+
{
152132
path: '/bpm',
153133
component: Layout,
154134
hidden: true,
@@ -165,7 +145,8 @@ export const constantRoutes = [
165145
meta: {title: '查看 OA 请假', icon: 'view', activeMenu: '/bpm/oa/leave'}
166146
}
167147
]
168-
}, {
148+
},
149+
{
169150
path: '/bpm',
170151
component: Layout,
171152
hidden: true,
@@ -197,6 +178,36 @@ export const constantRoutes = [
197178
}
198179
]
199180
},
181+
{
182+
path: '/property',
183+
component: Layout,
184+
hidden: true,
185+
children: [{
186+
path: 'value/:propertyId(\\d+)',
187+
component: (resolve) => require(['@/views/mall/product/property/value'], resolve),
188+
name: 'PropertyValue',
189+
meta: {title: '商品属性值', icon: '', activeMenu: '/product/property'}
190+
}
191+
]
192+
},
193+
{
194+
path: '/spu',
195+
component: Layout,
196+
hidden: true,
197+
children: [{
198+
path: 'edit/:spuId(\\d+)',
199+
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
200+
name: 'SpuEdit',
201+
meta: {title: '修改商品', activeMenu: '/product/spu'}
202+
},
203+
{
204+
path: 'add',
205+
component: (resolve) => require(['@/views/mall/product/spu/save'], resolve),
206+
name: 'SpuAdd',
207+
meta: {title: '添加商品', activeMenu: '/product/spu'}
208+
}
209+
]
210+
},
200211
{
201212
path: '/trade/order',
202213
component: Layout,

src/utils/dict.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const DICT_TYPE = {
2626
SYSTEM_ERROR_CODE_TYPE: 'system_error_code_type',
2727
SYSTEM_OAUTH2_GRANT_TYPE: 'system_oauth2_grant_type',
2828
SYSTEM_MAIL_SEND_STATUS: 'system_mail_send_status',
29+
SYSTEM_NOTIFY_TEMPLATE_TYPE: 'system_notify_template_type',
2930

3031
// ========== INFRA 模块 ==========
3132
INFRA_BOOLEAN_STRING: 'infra_boolean_string',

src/views/system/mail/log/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export default {
140140
// 邮件日志列表
141141
list: [],
142142
// 弹出层标题
143-
title: "",
143+
title: "邮件发送日志详细",
144144
// 是否显示弹出层
145145
open: false,
146146
// 查询参数

0 commit comments

Comments
 (0)