Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
A
alumni-show-h5
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
EzijingWeb
alumni-show-h5
Commits
b4e70605
提交
b4e70605
authored
6月 19, 2020
作者:
王鹏飞
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: 消息增加未读统计
上级
340bba26
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
55 行增加
和
7 行删除
+55
-7
account.js
src/api/account.js
+1
-1
index.js
src/api/index.js
+5
-0
axios.js
src/utils/axios.js
+5
-5
Index.vue
src/views/message/Index.vue
+44
-1
没有找到文件。
src/api/account.js
浏览文件 @
b4e70605
...
...
@@ -34,5 +34,5 @@ export function sendResetPasswordCode(data) {
}
// 登出
export
function
logout
()
{
return
httpRequest
.
get
(
'/api/passport/rest
/logout'
)
return
httpRequest
.
post
(
'/api/alumni/site
/logout'
)
}
src/api/index.js
浏览文件 @
b4e70605
...
...
@@ -240,6 +240,11 @@ export function updateActivityStatus(id, data) {
return
httpRequest
.
post
(
`/api/alumni/v1/activities2/check/
${
id
}
`
,
data
)
}
// 获取未读消息
export
function
getUnreadMessage
()
{
return
httpRequest
.
get
(
'/api/alumni/v1/student/unread'
)
}
// 获取消息列表
export
function
getMessageList
(
params
)
{
return
httpRequest
.
get
(
'/api/alumni/v1/student/messages'
,
{
params
})
...
...
src/utils/axios.js
浏览文件 @
b4e70605
...
...
@@ -2,14 +2,14 @@ import axios from 'axios'
import
qs
from
'qs'
import
{
Notify
}
from
'vant'
import
router
from
'@/router'
import
{
logout
}
from
'@/api/account'
//
import { logout } from '@/api/account'
const
httpRequest
=
axios
.
create
({
baseURL
:
process
.
env
.
VUE_APP_BASE_API
,
timeout
:
60000
,
withCredentials
:
true
,
headers
:
{
'Content-Type'
:
'application/x-www-form-urlencoded'
,
tenant
:
'sofia'
'Content-Type'
:
'application/x-www-form-urlencoded'
//
tenant: 'sofia'
}
})
...
...
@@ -39,12 +39,12 @@ httpRequest.interceptors.response.use(
if
(
status
===
400
)
{
Notify
(
message
)
}
else
if
(
status
===
403
)
{
logout
().
then
(()
=>
{
// logout().then(() => {
// })
router
.
replace
({
path
:
'/login'
,
query
:
{
redirect_uri
:
encodeURIComponent
(
window
.
location
.
href
)
}
})
})
}
}
else
{
Notify
(
error
)
...
...
src/views/message/Index.vue
浏览文件 @
b4e70605
...
...
@@ -8,6 +8,7 @@
<div
class=
"message-card-content"
>
<h4>
系统消息
</h4>
<!--
<p>
紫荆官方发布了一条新消息,点击查看
</p>
-->
<span
class=
"num"
v-if=
"total.system"
>
{{
total
.
system
}}
</span>
</div>
</div>
<div
class=
"message-card"
@
click=
"onClick('1')"
>
...
...
@@ -17,6 +18,7 @@
<div
class=
"message-card-content"
>
<h4>
组织消息
</h4>
<!--
<p>
您创建的组织有新的人员加入请求
</p>
-->
<span
class=
"num"
v-if=
"total.group"
>
{{
total
.
group
}}
</span>
</div>
</div>
<div
class=
"message-card"
@
click=
"onClick('2')"
>
...
...
@@ -26,6 +28,7 @@
<div
class=
"message-card-content"
>
<h4>
活动消息
</h4>
<!--
<p>
您创建的活动有新的人员加入请求
</p>
-->
<span
class=
"num"
v-if=
"total.activity"
>
{{
total
.
activity
}}
</span>
</div>
</div>
</card>
...
...
@@ -34,16 +37,39 @@
<
script
>
import
Card
from
'@/components/Card'
import
*
as
api
from
'@/api'
export
default
{
name
:
'MessageIndex'
,
components
:
{
Card
},
data
()
{
return
{}
return
{
unreadList
:
[]
}
},
computed
:
{
total
()
{
return
this
.
unreadList
.
reduce
(
(
result
,
item
)
=>
{
const
map
=
{
1
:
'group'
,
2
:
'activity'
,
3
:
'system'
}
result
[
map
[
item
.
type
]]
=
item
.
sum
return
result
},
{
activity
:
0
,
system
:
0
,
group
:
0
}
)
}
},
methods
:
{
onClick
(
type
)
{
this
.
$router
.
push
({
name
:
'messageList'
,
params
:
{
type
}
})
},
getUnreadMessage
()
{
api
.
getUnreadMessage
().
then
(
response
=>
{
this
.
unreadList
=
response
})
}
},
beforeMount
()
{
this
.
getUnreadMessage
()
}
}
</
script
>
...
...
@@ -65,6 +91,8 @@ export default {
}
}
.message-card-content
{
position
:
relative
;
flex
:
1
;
margin-left
:
10px
;
h4
{
font-size
:
14px
;
...
...
@@ -76,5 +104,20 @@ export default {
font-size
:
12px
;
color
:
#999
;
}
.num
{
position
:
absolute
;
right
:
0
;
top
:
50%
;
transform
:
translateY
(
-50%
);
width
:
20px
;
height
:
20px
;
font-size
:
12px
;
color
:
#fff
;
line-height
:
20px
;
text-align
:
center
;
background-color
:
#ff6767
;
border-radius
:
50%
;
overflow
:
hidden
;
}
}
</
style
>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论