Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
087b2b2b
authored
Dec 06, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
2c7c0c2b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
components/controller/index.ts
model/card.ts
components/controller/index.ts
View file @
087b2b2b
import
{
MessageType
}
from
"@/customer-service/model"
;
import
{
CardMessage
}
from
'@/customer-service/model/card'
;
const
mapping
=
new
Map
<
MessageType
,
string
>
([
[
MessageType
.
Image
,
'图片'
],
...
...
@@ -29,6 +30,12 @@ export function parserMessage(type: MessageType, rawMsg: string) {
if
(
type
===
MessageType
.
Notify
)
{
return
rawMsg
;
}
if
(
type
===
MessageType
.
Card
)
{
const
p
=
JSON
.
parse
(
rawMsg
)
as
CardMessage
;
if
(
p
&&
p
.
title
)
{
return
p
.
title
||
'通知'
;
}
}
const
t
=
mapping
.
get
(
type
)
if
(
t
)
{
return
`[
${
t
}
]`
;
...
...
model/card.ts
0 → 100644
View file @
087b2b2b
export
interface
CardMessage
{
title
:
string
;
date
:
string
;
desc
?:
string
;
desc1
?:
string
;
desc2
?:
string
;
values
?:
{
key
:
string
;
value
:
string
}[];
params
?:
any
;
path
?:
string
;
}
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