Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
smart-web-tabs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SVI
svi-templates
smart-web-tabs
Commits
8e15e91e
Commit
8e15e91e
authored
Nov 29, 2019
by
曾沂轮
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature-addMessageTip' into 'master'
Feat: 消息模块根据业务码跳转到指定tab页 See merge request
!4
parents
4d4ff769
a34f8a71
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
9 deletions
+93
-9
Header.vue
template/src/views/common/Header.vue
+93
-9
No files found.
template/src/views/common/Header.vue
View file @
8e15e91e
...
@@ -30,10 +30,6 @@
...
@@ -30,10 +30,6 @@
<span
v-if=
"userInfo.RealName"
@
click=
"handleUserClick"
>
{{
userInfo
.
RealName
}}
</span>
<span
v-if=
"userInfo.RealName"
@
click=
"handleUserClick"
>
{{
userInfo
.
RealName
}}
</span>
<span
v-else
@
click=
"handleRelogin"
>
登录
</span>
<span
v-else
@
click=
"handleRelogin"
>
登录
</span>
</a>
</a>
<!--
<a
href=
"javascript:;"
class=
"quit-user gutter"
@
click=
"logout"
>
<i
class=
"iconfont icon-tuichu"
></i>
<span>
退出
</span>
</a>
-->
<el-button
v-if=
"userInfo.RealName"
class=
"quit-user gutter"
type=
"text"
<el-button
v-if=
"userInfo.RealName"
class=
"quit-user gutter"
type=
"text"
size=
"small"
icon=
"iconfont icon-tuichu"
:loading=
"isLoadingout"
@
click=
"logout"
>
size=
"small"
icon=
"iconfont icon-tuichu"
:loading=
"isLoadingout"
@
click=
"logout"
>
退出
退出
...
@@ -78,7 +74,27 @@ export default {
...
@@ -78,7 +74,27 @@ export default {
return
{
return
{
serviceUrl
,
serviceUrl
,
isLoadingout
:
false
,
isLoadingout
:
false
,
websocket
:
null
websocket
:
null
,
messageType
:
[{
id
:
'doingWork'
,
name
:
'在办工作'
,
status
:
[
100
,
101
,
102
,
103
,
104
,
105
,
106
,
109
,
113
,
112
]
},
{
id
:
'returnBox'
,
name
:
'退件箱'
,
status
:
[
108
]
},
{
id
:
'suspendWork'
,
name
:
'已挂工作'
,
status
:
[
110
,
111
]
},
{
id
:
'finishedWork'
,
name
:
'办结工作'
,
status
:
[
107
]
}]
// 消息类型
};
};
},
},
...
@@ -103,20 +119,88 @@ export default {
...
@@ -103,20 +119,88 @@ export default {
methods
:
{
methods
:
{
init
()
{
init
()
{
if
(
this
.
userInfo
&&
this
.
userInfo
.
userId
&&
window
.
WebSocket
)
{
if
(
this
.
userInfo
&&
this
.
userInfo
.
userId
&&
window
.
WebSocket
)
{
const
that
=
this
;
this
.
websocket
=
new
WebSocket
(
`ws:
${
baseUrl
}
/MessageWebsocket?userId=
${
this
.
userInfo
.
userId
}
`
);
this
.
websocket
=
new
WebSocket
(
`ws:
${
baseUrl
}
/MessageWebsocket?userId=
${
this
.
userInfo
.
userId
}
`
);
this
.
websocket
.
onopen
=
function
(
event
)
{
this
.
websocket
.
onopen
=
function
(
event
)
{
};
};
this
.
websocket
.
onclose
=
function
(
event
)
{
this
.
websocket
.
onclose
=
function
(
event
)
{
};
};
this
.
websocket
.
onmessage
=
(
event
)
=>
{
this
.
websocket
.
onmessage
=
function
(
event
)
{
// state.unreadMessage = event.data
if
(
event
.
data
)
that
.
handleReceiveMessage
(
event
.
data
);
// this.unreadMessage = event.data;
this
.
$store
.
dispatch
(
'setUnreadMessage'
,
event
.
data
);
};
};
this
.
websocket
.
onerror
=
function
(
event
)
{
this
.
websocket
.
onerror
=
function
(
event
)
{
};
};
}
}
},
},
/**
* 接受消息后的处理
*/
handleReceiveMessage
(
data
)
{
// data = JSON.parse(data);
this
.
$store
.
dispatch
(
'setUnreadMessage'
,
data
.
count
);
const
type
=
data
.
content
?
this
.
handleMessageType
(
data
.
content
.
businessType
)
:
9999
;
const
h
=
this
.
$createElement
;
if
(
parseInt
(
data
.
count
,
10
)
===
0
)
return
false
;
this
.
$notify
({
title
:
data
.
content
?
data
.
content
.
title
:
this
.
convertTypeToObjectInfo
(
type
).
name
,
position
:
'bottom-right'
,
type
:
'info'
,
dangerouslyUseHTMLString
:
true
,
duration
:
5000
,
message
:
h
(
'div'
,
{
style
:
{
display
:
'flex'
,
alignItems
:
'center'
}
},
[
h
(
'span'
,
null
,
data
.
content
?
data
.
content
.
content
:
'您有新的处理任务,请及时处理!'
),
h
(
'el-button'
,
{
style
:
{
marginLeft
:
'5px'
},
attrs
:
{
size
:
'small'
,
type
:
'text'
},
on
:
{
click
:
()
=>
{
this
.
handleLinkToTargetTab
(
type
);}
}
},
'查看'
)
])
});
},
/**
* 跳转链接
*/
handleLinkToTargetTab
(
type
)
{
openTab
({
id
:
this
.
convertTypeToObjectInfo
(
type
).
id
,
name
:
this
.
convertTypeToObjectInfo
(
type
).
name
,
componentName
:
this
.
convertTypeToObjectInfo
(
type
).
id
});
},
/**
* 数据类型转换
*/
convertTypeToObjectInfo
(
type
)
{
return
this
.
messageType
[
type
]
||
{
id
:
'appMessage'
,
name
:
'我的消息'
};
},
/**
* 处理消息类型
*/
handleMessageType
(
type
)
{
type
=
parseInt
(
type
,
10
)
||
9999
;
let
flag
=
false
;
for
(
let
i
=
0
;
i
<
this
.
messageType
.
length
;
i
++
)
{
if
(
this
.
messageType
[
i
].
status
.
indexOf
(
type
)
>=
0
)
{
type
=
i
;
flag
=
true
;
}
if
(
flag
)
break
;
}
return
type
;
},
/**
/**
* 查看消息
* 查看消息
*/
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment