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
d4ea4c8a
authored
Jan 06, 2022
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge branch 'master' into pre
parents
87a5c843
445768a5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
84 additions
and
21 deletions
components/message-item/position-message.vue
components/message.vue
store/index.ts
utils/index.ts
xim/models/chat.ts
xim/xim.ts
components/message-item/position-message.vue
View file @
d4ea4c8a
<
template
>
<div
class=
"position-message"
@
click=
"openPosition"
>
<div
class=
"d-flex justify-content-between align-items-center"
>
<span
class=
"d-flex align-items-center"
>
<span
class=
"title"
>
{{
title
}}
</span>
<span
class=
"d-flex align-items-center
flex-fill
"
>
<span
class=
"title
flex-fill
"
>
{{
title
}}
</span>
<span
v-for=
"item in tags"
:key=
"item.title"
...
...
@@ -46,7 +46,43 @@
}
private
get
salary
()
{
return
this
.
positionData
.
salary
;
const
max
=
this
.
positionData
.
max_salary
;
const
min
=
this
.
positionData
.
min_salary
;
const
formatSalary
=
(
v
:
number
,
type
?:
"Y"
|
"K"
)
=>
{
if
(
type
===
"K"
)
{
return
{
v
:
parseFloat
((
v
/
1000
).
toFixed
(
2
)),
unit
:
"K"
,
};
}
if
(
+
v
<
1000
)
{
return
{
v
,
unit
:
""
,
};
}
else
{
return
{
v
:
parseFloat
((
v
/
1000
).
toFixed
(
2
)),
unit
:
"K"
,
};
}
};
if
(
!
max
&&
!
min
)
{
return
"面议"
;
}
if
(
+
min
>=
+
max
)
{
const
v
=
formatSalary
(
min
);
return
`
${
v
.
v
}${
v
.
unit
}
`
;
}
const
formatMin
=
formatSalary
(
min
);
const
formatMax
=
formatSalary
(
max
);
if
(
formatMin
.
unit
===
formatMax
.
unit
)
{
return
`
${
formatMin
.
v
}
-
${
formatMax
.
v
}
${
formatMax
.
unit
}
`
;
}
else
{
const
formatMin
=
formatSalary
(
min
,
"K"
);
const
formatMax
=
formatSalary
(
max
,
"K"
);
return
`
${
formatMin
.
v
}
-
${
formatMax
.
v
}
K`
;
}
}
private
get
positionBody
()
{
...
...
@@ -64,7 +100,9 @@
private
get
tail
()
{
return
[
this
.
positionData
.
company_name
,
this
.
positionData
.
business_scope
,
this
.
positionData
.
business_scope
!==
'0'
?
this
.
positionData
.
business_scope
:
""
,
];
}
...
...
components/message.vue
View file @
d4ea4c8a
...
...
@@ -33,8 +33,10 @@
<div
v-if=
"isMyMessage"
class=
"msg-read pos-rel"
>
<span
@
click=
"openReaderList"
class=
"pointer"
:class=
"isAllRead ? 'all' : 'not-all'"
:class=
"[
isAllRead ? 'all' : 'not-all',
{ pointer: isChatMember },
]"
>
<template
v-if=
"isAllRead"
>
<i
...
...
@@ -582,9 +584,11 @@
}
private
openReaderList
(
e
:
MouseEvent
)
{
if
(
this
.
isChatMember
)
{
this
.
readerListOffset
=
e
.
x
<
450
;
this
.
readListVisibility
=
true
;
}
}
private
executeHandled
()
{
this
.
setHandled
({
...
...
store/index.ts
View file @
d4ea4c8a
...
...
@@ -225,12 +225,17 @@ export default {
if
(
chatid
)
{
// 移除撤回的消息
const
newItems
=
data
||
[];
const
withdraw
=
newItems
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
map
((
i
)
=>
+
i
.
msg
);
const
filterout
=
newItems
.
filter
(
(
i
)
=>
!
withdraw
.
includes
(
i
.
id
)
const
hasWithdraw
=
newItems
.
find
(
(
i
)
=>
i
.
type
===
MessageType
.
Withdraw
);
const
withdraw
=
hasWithdraw
?
newItems
.
filter
((
i
)
=>
i
.
type
===
MessageType
.
Withdraw
)
.
map
((
i
)
=>
+
i
.
msg
)
:
[];
const
filterout
=
withdraw
.
length
?
newItems
.
filter
((
i
)
=>
!
withdraw
.
includes
(
i
.
id
))
:
newItems
;
state
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
]
=
Object
.
freeze
(
filterMessages
([...
old
,
...
filterout
],
chatid
)
);
...
...
@@ -610,16 +615,11 @@ export default {
data
=
await
getMessages
();
}
try
{
commit
(
ChatStore
.
MUTATION_PUSH_CHAT_MSG_HISTORY
,
data
);
dbController
.
saveChatMessages
(
chatId
,
data
);
await
preCacheImgs
(
data
);
commit
(
ChatStore
.
MUTATION_SCROLL_TO_BOTTOM
);
return
data
;
}
catch
(
error
)
{
// eslint-disable-next-line no-console
console
.
error
(
error
);
}
},
async
[
ChatStore
.
ACTION_GET_CHAT_MESSAGES_BEFORE_SPECIFIC_ID
](
{
state
,
commit
,
getters
},
...
...
utils/index.ts
View file @
d4ea4c8a
...
...
@@ -56,6 +56,17 @@ export function uuid() {
return
s
.
join
(
""
)
}
export
function
copyTextToClipboard
(
text
:
string
)
{
const
input
=
document
.
createElement
(
"input"
);
input
.
setAttribute
(
"readonly"
,
"readonly"
);
input
.
setAttribute
(
"value"
,
text
);
document
.
body
.
appendChild
(
input
);
input
.
select
();
const
ret
=
document
.
execCommand
(
"copy"
);
document
.
body
.
removeChild
(
input
);
return
ret
;
}
const
URL_REGEX
=
/
((?:(?:
https
?
|ftp|file
)
:
\/\/
|www
\.
|ftp
\.)(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
-A-Z0-9+&@#
\/
%=~_|$?!:,.
])
*
(?:\([
-A-Z0-9+&@#
\/
%=~_|$?!:,.
]
*
\)
|
[
A-Z0-9+&@#
\/
%=~_|$
]))
/gim
...
...
xim/models/chat.ts
View file @
d4ea4c8a
...
...
@@ -230,6 +230,8 @@ export interface PositionMessage {
company_name
:
string
;
business_scope
:
string
;
post_id
:
number
;
max_salary
:
number
;
min_salary
:
number
;
}
export
interface
CsUser
{
...
...
xim/xim.ts
View file @
d4ea4c8a
...
...
@@ -165,6 +165,7 @@ export class Xim {
lid
=
0
,
rid
=
0
,
limit
=
DefaultMsgPageSize
,
// = 0 正序(最新的消息在最下面),=1 倒序(最新的消息在最上面)
desc
:
boolean
,
p
?:
{
isMember
:
boolean
;
model
:
string
;
obj
:
string
}
):
Promise
<
Message
[]
>
{
...
...
@@ -195,8 +196,12 @@ export class Xim {
.
getSdk
()
.
getAxios
()
.
get
<
any
,
Message
[]
>
(
`/general/xim/model/
${
p
.
model
}
/
${
p
.
obj
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
0
:
1
}
`
)
`/general/xim/model/
${
p
.
model
}
/
${
p
.
obj
}
/msgs?lid=
${
lid
}
&rid=
${
rid
}
&limit=
${
limit
}
&desc=
${
desc
?
1
:
0
}
`
);
}
private
setMessagesRead
(
chatId
:
number
,
msg
:
Message
[])
{
...
...
@@ -431,9 +436,12 @@ export class Xim {
vue
.
$once
(
"hook:beforeDestroy"
,
()
=>
this
.
off
(
"msg"
,
action
));
}
public
withDrawMsgHandle
(
e
:
Message
)
{
const
ids
=
e
.
ref_id
?
[
e
.
ref_id
]
:
e
.
msg
.
startsWith
(
"["
)
?
JSON
.
parse
(
e
.
msg
)
:
[
+
e
.
msg
];
return
ids
;
public
withDrawMsgHandle
(
e
:
Message
):
number
[]
{
return
e
.
ref_id
?
[
e
.
ref_id
]
:
e
.
msg
.
startsWith
(
"["
)
?
JSON
.
parse
(
e
.
msg
)
:
[
+
e
.
msg
];
}
}
...
...
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