Commit 9293df9d by 吴云建

会话调整

parent 3103284a
...@@ -11,6 +11,9 @@ ...@@ -11,6 +11,9 @@
<span class="member-phone ver-mid"> <span class="member-phone ver-mid">
{{ item.phone }} {{ item.phone }}
</span> </span>
<span class="member-type ver-mid">
{{ memberTypeStr(item.type) }}
</span>
<el-button class="ver-mid get-out" type="text" @click="getout(item)" <el-button class="ver-mid get-out" type="text" @click="getout(item)"
>踢出</el-button >踢出</el-button
> >
...@@ -31,8 +34,8 @@ export default class ChatMembers extends Vue { ...@@ -31,8 +34,8 @@ export default class ChatMembers extends Vue {
@chatStore.Action(ChatStore.ACTION_CHAT_REMOVE_MEMBER) @chatStore.Action(ChatStore.ACTION_CHAT_REMOVE_MEMBER)
private readonly _getout!: ChatStore.ACTION_CHAT_REMOVE_MEMBER; private readonly _getout!: ChatStore.ACTION_CHAT_REMOVE_MEMBER;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER) @chatStore.Action(ChatStore.ACTION_CHAT_REMOVE_CS)
private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER; private readonly _getoutCs!: ChatStore.ACTION_CHAT_REMOVE_CS;
private async getout(item: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS[number]) { private async getout(item: ChatStore.GETTER_CURRENT_CHAT_PRESENT_MEMBERS[number]) {
await this.$confirm(`确定要移除${item.name}?`, "提示", { await this.$confirm(`确定要移除${item.name}?`, "提示", {
...@@ -41,7 +44,20 @@ export default class ChatMembers extends Vue { ...@@ -41,7 +44,20 @@ export default class ChatMembers extends Vue {
type: "warning", type: "warning",
}); });
// xim里的eid等于uniplat里的uid // xim里的eid等于uniplat里的uid
this._getout([item.eid]); if (item.type == 25) { // 普通成员
this._getout([item.eid])
} else if (item.type == 92) { // 可否
this._getoutCs([item.eid])
}
}
private memberTypeStr(type: string | number) {
if (type.toString() === "25") {
return ""
} else if (type.toString() === "92") {
return "客服"
} else if (type.toString() === "85") {
return "管理员"
}
} }
} }
</script> </script>
...@@ -70,6 +86,9 @@ export default class ChatMembers extends Vue { ...@@ -70,6 +86,9 @@ export default class ChatMembers extends Vue {
white-space: pre-line; white-space: pre-line;
margin-right: 10px; margin-right: 10px;
} }
.member-type {
margin-left: 20px;
}
.get-out { .get-out {
display: none; display: none;
margin-left: auto; margin-left: auto;
......
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
</template> </template>
</div> </div>
<div class="title-buttons"> <div class="title-buttons">
<!-- <el-button class="button" round>开始接待</el-button> <el-button class="button" @click="startReception" round v-if="!isChatMember"
<el-button class="button" round>结束接待</el-button> --> >开始接待</el-button
<el-button class="button" @click="addMemberForMyself" round v-if="!isChatMember" >
>加入会话</el-button <el-button class="button" @click="finishReception" round v-if="isChatMember"
>结束接待</el-button
> >
<el-button class="button" @click="terminate" round <el-button class="button" @click="terminate" round
>结束会话</el-button >结束会话</el-button
...@@ -61,6 +62,12 @@ export default class ChatTitle extends Vue { ...@@ -61,6 +62,12 @@ export default class ChatTitle extends Vue {
@chatStore.Action(ChatStore.ACTION_CHAT_ADD_MEMBERS) @chatStore.Action(ChatStore.ACTION_CHAT_ADD_MEMBERS)
private readonly _addMember!: ChatStore.ACTION_CHAT_ADD_MEMBERS; private readonly _addMember!: ChatStore.ACTION_CHAT_ADD_MEMBERS;
@chatStore.Action(ChatStore.ACTION_CHAT_START_RECEPTION)
private readonly _startReception!: ChatStore.ACTION_CHAT_START_RECEPTION;
@chatStore.Action(ChatStore.ACTION_CHAT_FINISH_RECEPTION)
private readonly _finishReception!: ChatStore.ACTION_CHAT_FINISH_RECEPTION;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER) @chatStore.State(ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER)
private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER; private readonly isChatMember!: ChatStore.STATE_CHAT_CURRENT_IS_CHAT_MEMBER;
...@@ -104,13 +111,21 @@ export default class ChatTitle extends Vue { ...@@ -104,13 +111,21 @@ export default class ChatTitle extends Vue {
} }
} }
private async addMemberForMyself() { private async startReception() {
try {
await this._startReception();
} catch (error) {
console.error(error);
}
}
private async finishReception() {
try { try {
await this._addMember([this.operatorUid.toString()]); await this._finishReception();
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
......
...@@ -629,6 +629,38 @@ export default { ...@@ -629,6 +629,38 @@ export default {
); );
await dispatch(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, firstChat.chat_id); await dispatch(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION, firstChat.chat_id);
}, },
async [ChatStore.ACTION_CHAT_START_RECEPTION](
{ getters, dispatch }
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat.business_data;
if (model_name == null) return;
if (obj_id == null) return;
await sdk()
.model(model_name)
.chat(obj_id, orgId())
.startChat();
await new Promise((resolve) => setTimeout(resolve, 500));
await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS);
},
async [ChatStore.ACTION_CHAT_FINISH_RECEPTION](
{ getters, dispatch }
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat.business_data;
if (model_name == null) return;
if (obj_id == null) return;
await sdk()
.model(model_name)
.chat(obj_id, orgId())
.finishChat();
await new Promise((resolve) => setTimeout(resolve, 500));
await dispatch(ChatStore.ACTION_GET_CHAT_MEMBERS);
},
async [ChatStore.ACTION_CHAT_ADD_MEMBERS]( async [ChatStore.ACTION_CHAT_ADD_MEMBERS](
{ getters, dispatch }, { getters, dispatch },
uids: Parameters<ChatStore.ACTION_CHAT_ADD_MEMBERS>[0] uids: Parameters<ChatStore.ACTION_CHAT_ADD_MEMBERS>[0]
...@@ -662,6 +694,22 @@ export default { ...@@ -662,6 +694,22 @@ 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_CS](
{ getters, dispatch },
uids: Parameters<ChatStore.ACTION_CHAT_REMOVE_CS>[0]
) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
if (currentChat == null) return;
const { model_name, obj_id } = currentChat.business_data;
if (model_name == null) return;
if (obj_id == null) return;
await sdk()
.model(model_name)
.chat(obj_id, orgId())
.removeCs(uids.map((id) => Number(id)));
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) {
......
...@@ -276,6 +276,15 @@ export namespace ChatStore { ...@@ -276,6 +276,15 @@ export namespace ChatStore {
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 const ACTION_CHAT_REMOVE_MEMBER = "移除成员";
export type ACTION_CHAT_REMOVE_MEMBER = (uids: string[]) => Promise<void> export type ACTION_CHAT_REMOVE_MEMBER = (uids: string[]) => Promise<void>
export const ACTION_CHAT_START_RECEPTION = "开始接待";
export type ACTION_CHAT_START_RECEPTION = () => Promise<void>
export const ACTION_CHAT_FINISH_RECEPTION = "结束接待";
export type ACTION_CHAT_FINISH_RECEPTION = () => Promise<void>
export const ACTION_CHAT_REMOVE_CS = "移除客服";
export type ACTION_CHAT_REMOVE_CS = (uids: string[]) => Promise<void>
} }
export interface ChatStoreState { export interface ChatStoreState {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment