Commit 952dd869 by 吴云建

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

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