Commit 952dd869 by 吴云建

接待时,自动跳转到我的接待

parent e4d592fa
<template> <template>
<div class="chat-con" :class="{ userMode, isSingle: isSingleChat }" v-if="chatId != null"> <div class="chat-con" :class="{ userMode, isSingle: isSingleChat }" v-if="chatId != null">
<ChatTitle :close="hide" class="chat-title" /> <ChatTitle :close="hide" class="chat-title" @updateActive="$emit('updateActive', $event)" />
<div class="chat-area-con" :class="{isSingle: isSingleChat, needSearch: !modelName}"> <div class="chat-area-con" :class="{isSingle: isSingleChat, needSearch: !modelName}">
<div v-if="chatId != null" class="h-100 chat-area"> <div v-if="chatId != null" class="h-100 chat-area">
<chat-room /> <chat-room />
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<chat-list v-if="!modelName" ref="chatListComp" @list-count-update="$emit('list-count-update', $event)" /> <chat-list v-if="!modelName" ref="chatListComp" @list-count-update="$emit('list-count-update', $event)" />
<chat-list-model v-if="modelName" @list-count-update="$emit('list-count-update', $event)" ref="chatListModel" :modelName="modelName" :listName="listName" /> <chat-list-model v-if="modelName" @list-count-update="$emit('list-count-update', $event)" ref="chatListModel" :modelName="modelName" :listName="listName" />
<div class="chat-content-wrap" v-if="chatVisible && onShow" > <div class="chat-content-wrap" v-if="chatVisible && onShow" >
<chat :modelName="modelName"/> <chat :modelName="modelName" @updateActive="$emit('updateActive', $event)" />
</div> </div>
</div> </div>
</template> </template>
...@@ -27,7 +27,6 @@ import ChatList from "@/customer-service/components/chat-list.vue"; ...@@ -27,7 +27,6 @@ import ChatList from "@/customer-service/components/chat-list.vue";
import ChatListModel from "@/customer-service/components/chat-list-model.vue"; import ChatListModel from "@/customer-service/components/chat-list-model.vue";
import chat from "@/customer-service/chat.vue"; import chat from "@/customer-service/chat.vue";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { ChatStore, chatStore } from "@/customer-service/store/model";
import buttonThrottle from "../utils/button-throttle";
@Component({ @Component({
name: "ChatContainer", name: "ChatContainer",
...@@ -41,6 +40,7 @@ export default class ChatContainer extends Vue { ...@@ -41,6 +40,7 @@ export default class ChatContainer extends Vue {
@Prop(Boolean) isInPage: boolean; @Prop(Boolean) isInPage: boolean;
@Prop(String) modelName: string; @Prop(String) modelName: string;
@Prop(String) listName: string; @Prop(String) listName: string;
@Prop(String) activeName: string;
@Prop(Boolean) isActive: boolean; @Prop(Boolean) isActive: boolean;
private onShow = false; private onShow = false;
...@@ -62,7 +62,7 @@ export default class ChatContainer extends Vue { ...@@ -62,7 +62,7 @@ export default class ChatContainer extends Vue {
@Watch("isActive", {immediate: true}) isActiveUpdate() { @Watch("isActive", {immediate: true}) isActiveUpdate() {
this.onShow = this.isActive; this.onShow = this.isActive;
if (!this.onShow) { if (!this.onShow && this.activeName !== "my_receiving" || this.onShow && this.listName) {
this.chatListModel && this.chatListModel.clearActiveId(); this.chatListModel && this.chatListModel.clearActiveId();
} }
} }
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
:current-page.sync="currentPage" :current-page.sync="currentPage"
@current-change="getList" @current-change="getList"
:page-sizes="[10, 20, 50]" :page-sizes="[10, 20, 50]"
:pager-count="3" :pager-count="5"
layout="total, prev, pager, next" layout="total, prev, pager, next"
></el-pagination> ></el-pagination>
</div> </div>
...@@ -84,35 +84,27 @@ export function parserMessage(type: string, rawMsg: string) { ...@@ -84,35 +84,27 @@ export function parserMessage(type: string, rawMsg: string) {
@Component({ components: {} }) @Component({ components: {} })
export default class ModelChatList extends Vue { export default class ModelChatList extends Vue {
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.Action(ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN) @chatStore.Action(ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN)
private readonly _createChat!: ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN; private readonly _createChat!: ChatStore.ACTION_CREATE_NEW_CHAT_BY_SERVICE_MAN;
private chatList: ChatType[] = []; private chatList: ChatType[] = [];
@chatStore.Action(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION)
private readonly saveChatId!: ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION;
@chatStore.Mutation(ChatStore.MUTATION_SAVE_MYSELF_ID) @chatStore.Mutation(ChatStore.MUTATION_SAVE_MYSELF_ID)
private readonly saveMyId!: ChatStore.MUTATION_SAVE_MYSELF_ID; private readonly saveMyId!: ChatStore.MUTATION_SAVE_MYSELF_ID;
@chatStore.Mutation(ChatStore.MUTATION_SET_CHAT_SOURCE) @chatStore.Mutation(ChatStore.MUTATION_SET_CHAT_SOURCE)
private readonly setSource!: ChatStore.MUTATION_SET_CHAT_SOURCE; private readonly setSource!: ChatStore.MUTATION_SET_CHAT_SOURCE;
@chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT)
private readonly showChat: ChatStore.MUTATION_SHOW_CHAT;
@chatStore.Mutation(ChatStore.MUTATION_HIDE_CHAT)
private readonly hideChat: ChatStore.MUTATION_HIDE_CHAT;
@chatStore.State(ChatStore.STATE_CHAT_USERNAME) @chatStore.State(ChatStore.STATE_CHAT_USERNAME)
private readonly userNames!: ChatStore.STATE_CHAT_USERNAME; private readonly userNames!: ChatStore.STATE_CHAT_USERNAME;
@chatStore.Mutation(ChatStore.MUTATION_SAVE_USERNAME) @chatStore.Mutation(ChatStore.MUTATION_SAVE_USERNAME)
private readonly updateUserName!: ChatStore.MUTATION_SAVE_USERNAME; private readonly updateUserName!: ChatStore.MUTATION_SAVE_USERNAME;
@chatStore.Action(ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA)
private readonly clearChatId!: ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA;
@Prop({ type: Number, default: -1 }) @Prop({ type: Number, default: -1 })
private selected!: number; private selected!: number;
...@@ -137,7 +129,7 @@ export default class ModelChatList extends Vue { ...@@ -137,7 +129,7 @@ export default class ModelChatList extends Vue {
} }
public clearActiveId() { public clearActiveId() {
this.activeId = ""; this.clearChatId();
} }
private async getList() { private async getList() {
......
...@@ -40,9 +40,6 @@ ...@@ -40,9 +40,6 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
import buttonThrottle from "../utils/button-throttle";
import ChatCreator from "@/customer-service/components/create-chat.vue"; import ChatCreator from "@/customer-service/components/create-chat.vue";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { ChatStore, chatStore } from "@/customer-service/store/model";
...@@ -132,6 +129,7 @@ export default class ChatTitle extends Vue { ...@@ -132,6 +129,7 @@ export default class ChatTitle extends Vue {
private async startReception() { private async startReception() {
try { try {
await this._startReception(); await this._startReception();
this.$emit("updateActive", "my_receiving")
} catch (error) { } catch (error) {
console.error(error); console.error(error);
} }
......
...@@ -182,7 +182,7 @@ export default class MessageList extends Vue { ...@@ -182,7 +182,7 @@ export default class MessageList extends Vue {
this.scollWrapper && this.scollWrapper &&
this.scollWrapper.removeEventListener("scroll", this.handleScroll); this.scollWrapper.removeEventListener("scroll", this.handleScroll);
this.clearScrollToBottomFunc(); this.clearScrollToBottomFunc();
this.clearChatId(); // this.clearChatId();
} }
public scroll2End(delay?: number) { public scroll2End(delay?: number) {
......
...@@ -324,7 +324,7 @@ export default { ...@@ -324,7 +324,7 @@ export default {
const data = await xim.fetchChatList(); const data = await xim.fetchChatList();
if (data == null) return; if (data == null) return;
const chatList = data.args[0]; const chatList = data.args[0];
console.log("testing", chatList); console.log("chatList:", chatList);
commit(ChatStore.MUTATION_SAVE_CHAT_LIST, { commit(ChatStore.MUTATION_SAVE_CHAT_LIST, {
list: chatList.map((chat: any) => { list: chatList.map((chat: any) => {
let business_data; let business_data;
...@@ -720,7 +720,6 @@ export default { ...@@ -720,7 +720,6 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_ADD_MEMBERS>[0] uids: Parameters<ChatStore.ACTION_CHAT_ADD_MEMBERS>[0]
) { ) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT]; const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
console.log(currentChat)
if (currentChat == null) return; if (currentChat == null) return;
const { model_name, obj_id } = currentChat.business_data; const { model_name, obj_id } = currentChat.business_data;
if (model_name == null) return; if (model_name == null) return;
...@@ -754,7 +753,6 @@ export default { ...@@ -754,7 +753,6 @@ export default {
uids: Parameters<ChatStore.ACTION_CHAT_ADD_CS>[0] uids: Parameters<ChatStore.ACTION_CHAT_ADD_CS>[0]
) { ) {
const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT]; const currentChat = getters[ChatStore.GETTER_CURRENT_CURRENT_CHAT];
console.log(currentChat)
if (currentChat == null) return; if (currentChat == null) return;
const { model_name, obj_id } = currentChat.business_data; const { model_name, obj_id } = currentChat.business_data;
if (model_name == null) return; if (model_name == null) return;
......
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