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
aadf43ba
authored
Jul 22, 2021
by
panjiangyi
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
添加和删除成员新接口
parent
63ec25ed
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
49 deletions
components/chat-title.vue
store/index.ts
components/chat-title.vue
View file @
aadf43ba
...
@@ -82,9 +82,14 @@ export default class ChatTitle extends Vue {
...
@@ -82,9 +82,14 @@ export default class ChatTitle extends Vue {
}
}
private
async
addMember
(
users
:
string
[],
done
:
()
=>
void
)
{
private
async
addMember
(
users
:
string
[],
done
:
()
=>
void
)
{
try
{
await
this
.
_addMember
(
users
);
await
this
.
_addMember
(
users
);
done
();
this
.
hideAddMember
();
this
.
hideAddMember
();
}
catch
(
error
)
{
console
.
error
(
error
);
}
finally
{
done
();
}
}
}
}
}
</
script
>
</
script
>
...
...
store/index.ts
View file @
aadf43ba
...
@@ -408,19 +408,14 @@ export default {
...
@@ -408,19 +408,14 @@ export default {
{
state
,
commit
,
dispatch
},
{
state
,
commit
,
dispatch
},
params
:
Parameters
<
ChatStore
.
ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN
>
[
0
]
params
:
Parameters
<
ChatStore
.
ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN
>
[
0
]
)
{
)
{
const
{
id
}
=
await
sdk
().
model
(
params
.
modelName
).
createChat
({
const
{
id
}
=
await
sdk
().
model
(
params
.
modelName
).
chat
(
+
params
.
selectedListId
).
createChat
();
detailId
:
+
params
.
selectedListId
});
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
500
));
await
new
Promise
(
resolve
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
await
dispatch
(
ChatStore
.
ACTION_GET_MY_CHAT_LIST
);
console
.
log
(
"fuck 0"
);
const
newChatInfo
=
await
getChatModelInfo
(
params
.
modelName
,
params
.
selectedListId
);
const
newChatInfo
=
await
getChatModelInfo
(
params
.
modelName
,
params
.
selectedListId
);
const
roomList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
];
const
roomList
=
state
[
ChatStore
.
STATE_MY_CHAT_ROOM_LIST
];
if
(
roomList
==
null
)
return
;
if
(
roomList
==
null
)
return
;
console
.
log
(
"fuck 1"
);
const
newChat
=
roomList
.
list
.
find
((
k
)
=>
k
.
chat_id
===
newChatInfo
.
chat_id
);
const
newChat
=
roomList
.
list
.
find
((
k
)
=>
k
.
chat_id
===
newChatInfo
.
chat_id
);
if
(
newChat
==
null
)
return
;
if
(
newChat
==
null
)
return
;
console
.
log
(
"fuck 2"
);
commit
(
ChatStore
.
MUTATION_SHOW_CHAT
);
commit
(
ChatStore
.
MUTATION_SHOW_CHAT
);
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
{
await
dispatch
(
ChatStore
.
ACTION_SAVE_CURRENT_CHAT_ID_VERSION
,
{
chatId
:
newChat
.
chat_id
,
chatId
:
newChat
.
chat_id
,
...
@@ -569,56 +564,28 @@ export default {
...
@@ -569,56 +564,28 @@ export default {
});
});
},
},
async
[
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
](
async
[
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
](
{
state
,
dispatch
},
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
>
[
0
]
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
>
[
0
]
)
{
)
{
const
v
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
v
==
null
)
return
;
if
(
currentChat
==
null
)
return
;
const
id
=
Number
(
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
if
(
model_name
==
null
)
return
;
);
if
(
obj_id
==
null
)
return
;
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"update"
);
await
sdk
().
model
(
model_name
).
chat
(
obj_id
).
addMember
(
uids
.
map
(
id
=>
Number
(
id
)));
action
.
updateInitialParams
({
selected_list
:
[{
v
,
id
}],
});
const
detailManager
=
await
action
.
getDetailParametersManagerByName
(
"UniplatChatMember"
);
uids
.
forEach
((
Uid
)
=>
{
detailManager
.
add
({
OrgId
:
orgId
(),
Uid
,
type
:
ChatMemberType
.
member
,
});
});
detailManager
.
uniqBy
(
"Uid"
);
detailManager
.
done
();
await
action
.
execute
();
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
](
async
[
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
](
{
state
,
dispatch
},
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
>
[
0
]
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
>
[
0
]
)
{
)
{
const
v
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_VERSION
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
if
(
v
==
null
)
return
;
if
(
currentChat
==
null
)
return
;
const
id
=
Number
(
const
{
model_name
,
obj_id
}
=
currentChat
.
business_data
;
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_UNIPLAT_ID
]
if
(
model_name
==
null
)
return
;
);
if
(
obj_id
==
null
)
return
;
const
action
=
sdk
().
model
(
UniplatChatModelName
).
action
(
"update"
);
await
sdk
().
model
(
model_name
).
chat
(
obj_id
).
removeMember
(
uids
.
map
(
id
=>
Number
(
id
)));
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
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
500
));
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
await
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
);
},
},
...
...
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