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
70752c4d
authored
Dec 13, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
消息适配
parent
defd3bfd
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
77 additions
and
16 deletions
components/controller/index.ts
components/message-item/notify-message.vue
components/message-item/pay-message.vue
components/message.vue
model/index.ts
utils/user-info.ts
xim/models/chat.ts
components/controller/index.ts
View file @
70752c4d
...
@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([
...
@@ -14,6 +14,7 @@ const mapping = new Map<MessageType, string>([
[
MessageType
.
PayV1
,
'付款通知'
],
[
MessageType
.
PayV1
,
'付款通知'
],
[
MessageType
.
Refund
,
'退款通知'
],
[
MessageType
.
Refund
,
'退款通知'
],
[
MessageType
.
RefundV1
,
'退款通知'
],
[
MessageType
.
RefundV1
,
'退款通知'
],
[
MessageType
.
Notify
,
'通知'
],
])
])
export
function
parserMessage
(
type
:
MessageType
,
rawMsg
:
string
)
{
export
function
parserMessage
(
type
:
MessageType
,
rawMsg
:
string
)
{
...
...
components/message-item/notify-message.vue
0 → 100644
View file @
70752c4d
<
template
>
<div
class=
"msg-detail inline-text"
v-html=
"notifyMessage"
></div>
</
template
>
<
script
lang=
"ts"
>
import
{
Component
}
from
"vue-property-decorator"
;
import
BaseMessage
from
"./index"
;
@
Component
({
components
:
{}
})
export
default
class
Index
extends
BaseMessage
{
private
get
notifyData
()
{
return
this
.
messageBody
.
msg
as
{
text
:
string
;
remark
:
string
;
resultId
:
string
;
};
}
private
get
notifyMessage
()
{
return
this
.
notifyData
?
this
.
notifyData
.
text
||
`
${
this
.
notifyData
.
remark
}
, 工单ID
${
this
.
notifyData
.
resultId
||
"无"
}
`
:
"[通知消息]"
;
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.inline-text
{
display
:
inline-block
;
white-space
:
pre-wrap
;
text-align
:
left
;
/deep/
.highlight
{
color
:
#e87005
;
}
}
</
style
>
\ No newline at end of file
components/message-item/pay-message.vue
View file @
70752c4d
...
@@ -46,11 +46,11 @@
...
@@ -46,11 +46,11 @@
}
}
private
get
title
()
{
private
get
title
()
{
return
this
.
payData
.
itemName
;
return
this
.
payData
.
itemName
||
this
.
payData
.
totalName
;
}
}
private
get
amount
()
{
private
get
amount
()
{
return
+
this
.
payData
.
amount
;
return
+
this
.
payData
.
amount
||
this
.
payData
.
totalMoney
;
}
}
private
get
status
()
{
private
get
status
()
{
...
...
components/message.vue
View file @
70752c4d
...
@@ -165,6 +165,7 @@
...
@@ -165,6 +165,7 @@
import
MyWelfareMessage
from
"./message-item/my-welfare-message.vue"
;
import
MyWelfareMessage
from
"./message-item/my-welfare-message.vue"
;
import
QuestionAnswerMessage
from
"./message-item/question-answer-message.vue"
;
import
QuestionAnswerMessage
from
"./message-item/question-answer-message.vue"
;
import
PayMessage
from
"./message-item/pay-message.vue"
;
import
PayMessage
from
"./message-item/pay-message.vue"
;
import
NotifyMessage
from
"./message-item/notify-message.vue"
;
import
{
ChatRole
}
from
"@/customer-service/model"
;
import
{
ChatRole
}
from
"@/customer-service/model"
;
import
{
getUserMapping
}
from
"../utils/user-info"
;
import
{
getUserMapping
}
from
"../utils/user-info"
;
import
Xim
from
"@/customer-service/xim"
;
import
Xim
from
"@/customer-service/xim"
;
...
@@ -187,6 +188,8 @@
...
@@ -187,6 +188,8 @@
[
dto
.
MessageType
.
PayV1
,
"pay-message"
],
[
dto
.
MessageType
.
PayV1
,
"pay-message"
],
[
dto
.
MessageType
.
Refund
,
"pay-message"
],
[
dto
.
MessageType
.
Refund
,
"pay-message"
],
[
dto
.
MessageType
.
RefundV1
,
"pay-message"
],
[
dto
.
MessageType
.
RefundV1
,
"pay-message"
],
[
dto
.
MessageType
.
PayResult
,
"notify-message"
],
[
dto
.
MessageType
.
Notify
,
"notify-message"
],
]);
]);
@
Component
({
@
Component
({
...
@@ -204,6 +207,7 @@
...
@@ -204,6 +207,7 @@
QuestionAnswerMessage
,
QuestionAnswerMessage
,
ActionMessage
,
ActionMessage
,
PayMessage
,
PayMessage
,
NotifyMessage
},
},
})
})
export
default
class
Message
extends
Vue
{
export
default
class
Message
extends
Vue
{
...
...
model/index.ts
View file @
70752c4d
...
@@ -117,6 +117,7 @@ export const enum MessageType {
...
@@ -117,6 +117,7 @@ export const enum MessageType {
MpNavigate
=
"mp-navigate"
,
MpNavigate
=
"mp-navigate"
,
PayV1
=
'gpay'
,
PayV1
=
'gpay'
,
Pay
=
"gpay2"
,
Pay
=
"gpay2"
,
PayResult
=
"gresult"
,
RefundV1
=
'grefund'
,
RefundV1
=
'grefund'
,
Refund
=
"grefund2"
,
Refund
=
"grefund2"
,
Card
=
'card'
Card
=
'card'
...
...
utils/user-info.ts
View file @
70752c4d
...
@@ -11,30 +11,36 @@ export type UserMapping = {
...
@@ -11,30 +11,36 @@ export type UserMapping = {
const
userMapping
:
UserMapping
=
{};
const
userMapping
:
UserMapping
=
{};
interface
UserInfo
{
avatar_url
:
string
;
email
:
string
;
id
:
string
;
mobile
:
string
;
realname
:
string
;
uniplatId
:
string
;
username
:
string
;
}
export
const
getUserMapping
=
()
=>
userMapping
;
export
const
getUserMapping
=
()
=>
userMapping
;
export
async
function
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
export
async
function
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
if
(
userMapping
[
eid
])
{
if
(
userMapping
[
eid
])
{
return
userMapping
[
eid
];
return
userMapping
[
eid
];
}
}
if
(
!+
eid
)
{
if
(
!+
eid
||
+
eid
<
0
)
{
return
{
name
:
''
,
phone
:
''
,
icon
:
''
};
return
{
name
:
""
,
phone
:
""
,
icon
:
""
};
}
}
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
.
domainService
(
'passport'
,
'anonymous'
,
`oidc.account/user_info?id=
${
eid
}
`
)
.
domainService
(
.
request
<
any
,
any
,
{
"passport"
,
avatar_url
:
string
;
"anonymous"
,
email
:
string
;
`oidc.account/user_info?id=
${
eid
}
`
id
:
string
;
)
mobile
:
string
;
.
request
<
any
,
any
,
UserInfo
>
(
"get"
);
realname
:
string
;
uniplatId
:
string
;
username
:
string
;
}
>
(
'get'
);
const
data
=
{
const
data
=
{
name
:
info
.
username
||
info
.
realname
||
info
.
mobile
||
info
.
mobile
,
name
:
info
.
username
||
info
.
realname
||
info
.
mobile
||
info
.
mobile
,
phone
:
info
.
mobile
,
phone
:
info
.
mobile
,
icon
:
info
.
avatar_url
icon
:
info
.
avatar_url
,
};
};
userMapping
[
eid
]
=
data
;
userMapping
[
eid
]
=
data
;
return
data
;
return
data
;
...
...
xim/models/chat.ts
View file @
70752c4d
...
@@ -2,7 +2,7 @@ import {
...
@@ -2,7 +2,7 @@ import {
MessageHandled
,
MessageHandled
,
MessageType
,
MessageType
,
PayMethod
,
PayMethod
,
PayStatus
PayStatus
,
}
from
"@/customer-service/model"
;
}
from
"@/customer-service/model"
;
export
interface
Chat
{
export
interface
Chat
{
...
@@ -208,6 +208,15 @@ export interface PayMessageBody {
...
@@ -208,6 +208,15 @@ export interface PayMessageBody {
itemName
:
string
;
itemName
:
string
;
amount
:
string
;
amount
:
string
;
paymentId
:
string
;
paymentId
:
string
;
/**
* 对应v1版本itemName
*/
totalName
?:
string
;
/**
* 对应v1版本amount
*/
totalMoney
?:
string
;
}
}
export
interface
CsUser
{
export
interface
CsUser
{
...
...
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