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
e3eb0c6d
authored
Jul 20, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
移除成员
parent
456f72e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
12 deletions
components/chat-members.vue
store/index.ts
store/model.ts
components/chat-members.vue
View file @
e3eb0c6d
<
template
>
<
template
>
<div
class=
"chat-members"
>
<div
class=
"chat-members"
>
<div
class=
"chat-member"
v-for=
"item in chatMembers"
:key=
"item.id"
>
<div
<avatar
shape=
"circle"
:src=
"item.avatar"
:size=
"40"
/>
class=
"chat-member pos-rel"
<div
class=
"member-name"
>
v-for=
"item in chatMembers"
:key=
"item.id"
>
<span
class=
"member-name ver-mid"
>
{{
item
.
name
||
item
.
eid
}}
{{
item
.
name
||
item
.
eid
}}
</div>
</span>
<span
class=
"member-phone ver-mid"
>
{{
item
.
phone
}}
</span>
<el-button
class=
"ver-mid get-out"
type=
"text"
@
click=
"getout(item)"
>
踢出
</el-button
>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
@@ -18,6 +27,18 @@ import avatar from "@/customer-service/components/avatar.vue";
...
@@ -18,6 +27,18 @@ import avatar from "@/customer-service/components/avatar.vue";
export
default
class
ChatMembers
extends
Vue
{
export
default
class
ChatMembers
extends
Vue
{
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
)
@
chatStore
.
Getter
(
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
)
private
readonly
chatMembers
!
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
;
private
readonly
chatMembers
!
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
;
@
chatStore
.
Action
(
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
)
private
readonly
_getout
!
:
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
;
private
async
getout
(
item
:
ChatStore
.
GETTER_CURRENT_CHAT_PRESENT_MEMBERS
[
number
])
{
await
this
.
$confirm
(
`确定要移除
${
item
.
name
}
?`
,
"提示"
,
{
confirmButtonText
:
"确定"
,
cancelButtonText
:
"取消"
,
type
:
"warning"
,
});
this
.
_getout
([
item
.
uid
]);
}
}
}
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
...
@@ -25,16 +46,33 @@ export default class ChatMembers extends Vue {
...
@@ -25,16 +46,33 @@ export default class ChatMembers extends Vue {
padding
:
30px
;
padding
:
30px
;
padding-bottom
:
0
;
padding-bottom
:
0
;
background
:
#fff
;
background
:
#fff
;
white-space
:
pre-line
;
.chat-member
{
.chat-member
{
width
:
33.33%
;
display
:
flex
;
text-align
:
center
;
display
:
inline-block
;
vertical-align
:
top
;
vertical-align
:
top
;
margin-bottom
:
30px
;
align-items
:
center
;
margin
:
10px
0
;
padding
:
10px
0
;
&:hover
{
background-color
:
#f5f7fa
;
.get-out
{
display
:
unset
;
}
}
}
}
.member-name
{
.member-name
{
margin-top
:
10px
;
display
:
inline-block
;
width
:
5em
;
word-break
:
break-word
;
white-space
:
pre-line
;
margin-right
:
10px
;
}
.get-out
{
display
:
none
;
margin-left
:
auto
;
padding
:
0
;
}
}
}
}
.ver-mid
{
vertical-align
:
middle
;
}
</
style
>
</
style
>
store/index.ts
View file @
e3eb0c6d
...
@@ -515,7 +515,6 @@ export default {
...
@@ -515,7 +515,6 @@ export default {
const
getChatMembersResult
=
await
xim
.
fetchChatMembers
(
chatId
);
const
getChatMembersResult
=
await
xim
.
fetchChatMembers
(
chatId
);
if
(
getChatMembersResult
==
null
)
return
;
if
(
getChatMembersResult
==
null
)
return
;
const
chatMembers
=
getChatMembersResult
.
args
[
0
]
as
ChatMember
[];
const
chatMembers
=
getChatMembersResult
.
args
[
0
]
as
ChatMember
[];
console
.
log
(
"fuck 1"
,
chatMembers
);
const
newChatMembers
=
await
Promise
.
all
(
const
newChatMembers
=
await
Promise
.
all
(
chatMembers
.
map
(
async
(
member
)
=>
{
chatMembers
.
map
(
async
(
member
)
=>
{
let
result
:
NonNullable
<
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
>
[
number
];
let
result
:
NonNullable
<
ChatStore
.
STATE_CURRENT_CHAT_MEMBERS
>
[
number
];
...
@@ -575,7 +574,6 @@ export default {
...
@@ -575,7 +574,6 @@ export default {
const
id
=
Number
(
const
id
=
Number
(
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
);
);
console
.
log
(
"fuck 0"
,
uids
,
v
,
id
);
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"update"
);
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"update"
);
action
.
updateInitialParams
({
action
.
updateInitialParams
({
selected_list
:
[{
v
,
id
}],
selected_list
:
[{
v
,
id
}],
...
@@ -596,6 +594,31 @@ export default {
...
@@ -596,6 +594,31 @@ export default {
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
500
));
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
},
},
async
[
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
](
{
state
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
>
[
0
]
)
{
const
v
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
];
if
(
v
==
null
)
return
;
const
id
=
Number
(
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
);
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"update"
);
action
.
updateInitialParams
({
selected_list
:
[{
v
,
id
}],
});
const
detailManager
=
await
action
.
getDetailParametersManagerByName
(
"UniplatChatMember"
);
uids
.
forEach
((
Uid
)
=>
{
detailManager
.
deleteByPropertyValue
(
"Uid"
,
Uid
);
});
detailManager
.
uniqBy
(
"Uid"
);
detailManager
.
done
();
await
action
.
execute
();
await
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
},
},
},
getters
:
{
getters
:
{
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
](
state
)
{
[
ChatStore
.
STATE_CHAT_MSG_HISTORY
](
state
)
{
...
...
store/model.ts
View file @
e3eb0c6d
...
@@ -251,6 +251,8 @@ export namespace ChatStore {
...
@@ -251,6 +251,8 @@ export namespace ChatStore {
export
type
ACTION_TERINATE_CHAT
=
()
=>
Promise
<
void
>
export
type
ACTION_TERINATE_CHAT
=
()
=>
Promise
<
void
>
export
const
ACTION_CHAT_ADD_MEMBERS
=
"添加成员"
;
export
const
ACTION_CHAT_ADD_MEMBERS
=
"添加成员"
;
export
type
ACTION_CHAT_ADD_MEMBERS
=
(
uids
:
string
[])
=>
Promise
<
void
>
export
type
ACTION_CHAT_ADD_MEMBERS
=
(
uids
:
string
[])
=>
Promise
<
void
>
export
const
ACTION_CHAT_REMOVE_MEMBER
=
"移除成员"
;
export
type
ACTION_CHAT_REMOVE_MEMBER
=
(
uids
:
string
[])
=>
Promise
<
void
>
}
}
export
interface
ChatStoreState
{
export
interface
ChatStoreState
{
...
...
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