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
87a5c843
authored
Jan 06, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
577c6bcc
d1f6c56f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
69 deletions
components/image-preview.vue
service/monitor.ts
utils/chat-info.ts
utils/user-info.ts
components/image-preview.vue
View file @
87a5c843
...
@@ -3,21 +3,17 @@
...
@@ -3,21 +3,17 @@
:modal=
"false"
:modal=
"false"
:before-close=
"close"
:before-close=
"close"
:visible=
"value"
:visible=
"value"
custom-class=
"hide-header show-close padding-0 width-auto"
:show-close=
"false"
custom-class=
"transparent"
width=
"90%"
>
>
<div
class=
"d-flex flex-column"
>
<div
class=
"d-flex flex-column"
>
<div
class=
"preview-title text-center"
>
图片预览
</div>
<div
class=
"d-flex justify-content-center"
>
<img
v-if=
"file"
:src=
"file.url"
/>
<div
class=
"d-flex justify-content-center"
style=
"min-width: 300px"
>
<i
class=
"el-icon-close"
@
click=
"close"
></i>
<img
v-if=
"file"
:src=
"file.url"
:style=
"style"
/>
</div>
</div>
<div
class=
"d-flex justify-content-center actions"
>
<div
class=
"d-flex justify-content-center actions"
>
<span
class=
"d-flex align-items-center justify-content-center"
@
click=
"set2Default"
>
1:1
</span
>
<a
<a
class=
"d-flex align-items-center justify-content-center"
class=
"d-flex align-items-center justify-content-center"
:href=
"file.url"
:href=
"file.url"
...
@@ -31,60 +27,55 @@
...
@@ -31,60 +27,55 @@
</
template
>
</
template
>
<
script
lang=
"ts"
>
<
script
lang=
"ts"
>
import
{
Component
,
Model
,
Prop
,
Vue
}
from
"vue-property-decorator"
;
import
{
Component
,
Model
,
Prop
,
Vue
}
from
"vue-property-decorator"
;
@
Component
({
components
:
{}
})
@
Component
({
components
:
{}
})
export
default
class
ImagePreview
extends
Vue
{
export
default
class
ImagePreview
extends
Vue
{
@
Model
(
"update"
)
@
Model
(
"update"
)
private
value
!
:
boolean
;
private
value
!
:
boolean
;
@
Prop
()
@
Prop
()
private
file
!
:
{
name
:
string
;
url
:
string
};
private
file
!
:
{
name
:
string
;
url
:
string
};
private
style
:
{
"max-height"
:
number
|
string
;
"max-width"
:
number
|
string
;
}
=
{
"max-height"
:
"300px"
,
"max-width"
:
"600px"
,
};
private
close
()
{
private
close
()
{
setTimeout
(
()
=>
(
this
.
style
=
{
"max-height"
:
"300px"
,
"max-width"
:
"600px"
}),
300
);
this
.
$emit
(
"update"
,
false
);
this
.
$emit
(
"update"
,
false
);
}
}
private
set2Default
()
{
this
.
style
=
{
"max-height"
:
"1600px"
,
"max-width"
:
"1600px"
};
}
private
get
getAttachment
()
{
private
get
getAttachment
()
{
if
(
this
.
file
)
{
if
(
this
.
file
)
{
return
this
.
file
.
name
;
return
this
.
file
.
name
;
}
}
return
"文件下载"
;
return
"文件下载"
;
}
}
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.preview-title
{
img
{
font-size
:
18px
;
max-width
:
100%
;
color
:
#333
;
max-height
:
100%
;
margin-bottom
:
15px
;
}
.actions
{
&
+
i
{
top
:
-25px
;
right
:
20px
;
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
border-radius
:
50%
;
padding
:
5px
;
font-size
:
40px
;
color
:
#fff
;
display
:
table
;
position
:
relative
;
z-index
:
1
;
cursor
:
pointer
;
}
}
.actions
{
margin
:
15px
0
;
margin
:
15px
0
;
>
span,
a
{
a
{
width
:
3
0px
;
width
:
5
0px
;
height
:
3
0px
;
height
:
5
0px
;
background-color
:
#7a7b7d
;
background-color
:
#7a7b7d
;
color
:
#fff
;
color
:
#fff
;
border-radius
:
50%
;
border-radius
:
50%
;
...
@@ -92,16 +83,12 @@ export default class ImagePreview extends Vue {
...
@@ -92,16 +83,12 @@ export default class ImagePreview extends Vue {
i
{
i
{
color
:
#fff
;
color
:
#fff
;
font-size
:
2
0px
;
font-size
:
3
0px
;
}
}
&
+
span
{
&
+
span
{
margin-left
:
15px
;
margin-left
:
15px
;
}
}
}
}
>
a
{
margin-left
:
15px
;
}
}
}
</
style
>
</
style
>
service/monitor.ts
View file @
87a5c843
...
@@ -3,17 +3,17 @@ import { UniplatSdk } from "uniplat-sdk";
...
@@ -3,17 +3,17 @@ import { UniplatSdk } from "uniplat-sdk";
import
{
ImEnvironment
}
from
"../model"
;
import
{
ImEnvironment
}
from
"../model"
;
export
const
enum
Product
{
export
const
enum
Product
{
Default
=
'default'
,
Default
=
"default"
,
QqxbWeixin
=
'qqxb-weixin'
,
QqxbWeixin
=
"qqxb-weixin"
,
QqxbApp
=
'qqxb-app'
,
QqxbApp
=
"qqxb-app"
,
Fulibao
=
'fulibao'
,
Fulibao
=
"fulibao"
,
HrManager
=
'hr-manager'
,
HrManager
=
"hr-manager"
,
Hrs100
=
'hrs100'
,
Hrs100
=
"hrs100"
,
HrsApp
=
'hrs-app'
,
HrsApp
=
"hrs-app"
,
BiJie
=
'bi-jie'
,
BiJie
=
"bi-jie"
,
Cashier
=
'cashier'
,
Cashier
=
"cashier"
,
Uniplat
=
"uniplat"
,
Uniplat
=
"uniplat"
,
DeShengJiuYeBao
=
'de-sheng-jiu-ye-bao'
DeShengJiuYeBao
=
"de-sheng-jiu-ye-bao"
,
}
}
const
enum
ProductTable
{
const
enum
ProductTable
{
...
@@ -88,10 +88,13 @@ class WebMonitor {
...
@@ -88,10 +88,13 @@ class WebMonitor {
public
useSdk
(
sdk
:
UniplatSdk
,
options
:
SdkMonitorOption
)
{
public
useSdk
(
sdk
:
UniplatSdk
,
options
:
SdkMonitorOption
)
{
this
.
envir
=
options
.
envir
;
this
.
envir
=
options
.
envir
;
this
.
product
=
options
.
product
;
this
.
product
=
options
.
product
;
sdk
.
events
.
addUniversalErrorResponseCallback
((
r
:
AxiosResponse
<
any
>
)
=>
{
sdk
.
events
.
addUniversalErrorResponseCallback
(
(
r
:
AxiosResponse
<
any
>
)
=>
{
if
(
this
.
enable
())
{
if
(
this
.
enable
())
{
const
msg
:
string
[]
=
[];
const
msg
:
string
[]
=
[];
msg
.
push
(
`URL:
${
decodeURIComponent
(
r
.
config
.
url
as
string
)}
`
);
msg
.
push
(
`URL:
${
decodeURIComponent
(
r
.
config
.
url
as
string
)}
`
);
msg
.
push
(
`Token:
${
sdk
.
global
.
jwtToken
}
`
);
msg
.
push
(
`Token:
${
sdk
.
global
.
jwtToken
}
`
);
const
header
=
r
.
config
.
headers
;
const
header
=
r
.
config
.
headers
;
if
(
header
)
{
if
(
header
)
{
...
@@ -102,19 +105,23 @@ class WebMonitor {
...
@@ -102,19 +105,23 @@ class WebMonitor {
options
&&
options
&&
options
.
userAgent
&&
options
.
userAgent
&&
msg
.
push
(
`UserAgent:
${
window
.
navigator
.
userAgent
}
`
);
msg
.
push
(
`UserAgent:
${
window
.
navigator
.
userAgent
}
`
);
r
.
config
&&
r
.
config
.
params
&&
msg
.
push
(
`Params:
${
r
.
config
.
params
}
`
);
r
.
config
&&
r
.
config
&&
r
.
config
.
data
&&
msg
.
push
(
`Payload:
${
JSON
.
stringify
(
r
.
config
.
data
)}
`
);
r
.
config
.
params
&&
msg
.
push
(
`Params:
${
JSON
.
stringify
(
r
.
config
.
params
)}
`
);
r
.
config
&&
r
.
config
.
data
&&
msg
.
push
(
`Payload:
${
JSON
.
stringify
(
r
.
config
.
data
)}
`
);
msg
.
push
(
msg
.
push
(
`Exception:
${((
r
.
data
.
error
as
string
)
||
""
).
substring
(
`Exception:
${(
0
,
(
r
.
data
.
error
as
string
)
||
""
500
).
substring
(
0
,
500
)}
`
)}
`
);
);
r
&&
r
.
config
&&
this
.
error
(
msg
.
join
(
"\n"
));
r
&&
r
.
config
&&
this
.
error
(
msg
.
join
(
"\n"
));
}
}
});
}
);
}
}
}
}
...
...
utils/chat-info.ts
View file @
87a5c843
...
@@ -88,7 +88,7 @@ export async function getChatModelInfo(
...
@@ -88,7 +88,7 @@ export async function getChatModelInfo(
}
}
)
as
ChatModelInfoData
;
)
as
ChatModelInfoData
;
le
t
removing
=
[];
cons
t
removing
=
[];
for
(
const
item
of
waitingAction
)
{
for
(
const
item
of
waitingAction
)
{
if
(
item
.
key
===
key
)
{
if
(
item
.
key
===
key
)
{
item
.
resolve
(
o
);
item
.
resolve
(
o
);
...
...
utils/user-info.ts
View file @
87a5c843
import
{
UniplatSdk
}
from
"uniplat-sdk"
;
import
{
UniplatSdk
}
from
"uniplat-sdk"
;
import
Chat
from
"../xim"
;
import
Chat
from
"../xim"
;
export
type
UserMapping
=
{
export
interface
ChatUserSummaryInfo
{
[
eid
:
string
]:
{
name
:
string
;
name
:
string
;
phone
:
string
;
phone
:
string
;
icon
:
string
;
icon
:
string
;
alias_name
:
string
;
alias_name
:
string
;
};
}
};
export
type
UserMapping
=
{
[
eid
:
string
]:
ChatUserSummaryInfo
};
const
userMapping
:
UserMapping
=
{};
const
userMapping
:
UserMapping
=
{};
...
@@ -25,6 +25,12 @@ interface UserInfo {
...
@@ -25,6 +25,12 @@ interface UserInfo {
export
const
getUserMapping
=
()
=>
userMapping
;
export
const
getUserMapping
=
()
=>
userMapping
;
const
loadingKeys
=
new
Set
<
string
>
();
let
waitingAction
:
{
key
:
string
;
resolve
:
(
d
:
ChatUserSummaryInfo
)
=>
void
;
}[]
=
[];
export
class
ChatUserInfoService
{
export
class
ChatUserInfoService
{
public
static
async
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
public
static
async
getUserInfo
(
eid
:
string
,
sdk
?:
UniplatSdk
)
{
if
(
userMapping
[
eid
])
{
if
(
userMapping
[
eid
])
{
...
@@ -33,6 +39,15 @@ export class ChatUserInfoService {
...
@@ -33,6 +39,15 @@ export class ChatUserInfoService {
if
(
!+
eid
||
+
eid
<
0
)
{
if
(
!+
eid
||
+
eid
<
0
)
{
return
{
name
:
""
,
phone
:
""
,
icon
:
""
,
alias_name
:
""
};
return
{
name
:
""
,
phone
:
""
,
icon
:
""
,
alias_name
:
""
};
}
}
if
(
loadingKeys
.
has
(
eid
))
{
return
new
Promise
<
ChatUserSummaryInfo
>
((
resolve
)
=>
waitingAction
.
push
({
key
:
eid
,
resolve
})
);
}
loadingKeys
.
add
(
eid
);
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
const
info
=
await
(
sdk
||
Chat
.
getSdk
())
.
domainService
(
.
domainService
(
"passport"
,
"passport"
,
...
@@ -47,6 +62,21 @@ export class ChatUserInfoService {
...
@@ -47,6 +62,21 @@ export class ChatUserInfoService {
alias_name
:
info
.
alias_name
,
alias_name
:
info
.
alias_name
,
};
};
userMapping
[
eid
]
=
data
;
userMapping
[
eid
]
=
data
;
const
removing
=
[];
for
(
const
item
of
waitingAction
)
{
if
(
item
.
key
===
eid
)
{
item
.
resolve
(
data
);
removing
.
push
(
item
.
key
);
}
}
for
(
const
item
of
removing
)
{
waitingAction
=
waitingAction
.
filter
((
i
)
=>
i
.
key
!==
item
);
}
loadingKeys
.
delete
(
eid
);
return
data
;
return
data
;
}
}
...
...
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