Commit 71626bbb by 吴云建

fix

parent 42874e39
<template> <template>
<div class="chat-con" :class="{ userMode, isSingle: isSingleChat }"> <div class="chat-con" :class="{ userMode, isSingle: isSingleChat }" v-if="chatId != null">
<ChatTitle :close="hide" class="chat-title" /> <ChatTitle :close="hide" class="chat-title" />
<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">
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
<i v-if="!isInPage" class="close-btn el-icon-close" @click="$emit('close')"></i> <i v-if="!isInPage" class="close-btn el-icon-close" @click="$emit('close')"></i>
</div> </div>
<chat-list v-if="!modelName" :searchKeyword="searchKeyword" ref="chatListComp" /> <chat-list v-if="!modelName" :searchKeyword="searchKeyword" ref="chatListComp" />
<chat-list-model v-if="modelName" @update-page-info="$emit('update-page-info', $event)"/> <chat-list-model v-if="modelName" @update-page-info="$emit('update-page-info', $event)" ref="chatListModel"/>
<div class="chat-content-wrap"> <div class="chat-content-wrap" v-if="chatVisible && onShow" >
<chat v-if="chatVisible && onShow" :modelName="modelName"/> <chat :modelName="modelName"/>
</div> </div>
</div> </div>
</template> </template>
...@@ -52,6 +52,8 @@ export default class ChatContainer extends Vue { ...@@ -52,6 +52,8 @@ export default class ChatContainer extends Vue {
@Ref("chatListComp") chatListComp: ChatList; @Ref("chatListComp") chatListComp: ChatList;
private searchKeyword = ""; private searchKeyword = "";
@Ref("chatListModel") chatListModel: ChatListModel;
@buttonThrottle() @buttonThrottle()
private search() { private search() {
this.chatListComp.search() this.chatListComp.search()
...@@ -60,6 +62,7 @@ export default class ChatContainer extends Vue { ...@@ -60,6 +62,7 @@ export default class ChatContainer extends Vue {
@Watch("$route") routeUpdate() { @Watch("$route") routeUpdate() {
if (this.$route.fullPath !== this.orginPath) { if (this.$route.fullPath !== this.orginPath) {
this.onShow = false; this.onShow = false;
this.chatListModel.clearActiveId();
} else { } else {
this.onShow = true this.onShow = true
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
v-for="item in chatRooms" v-for="item in chatRooms"
:key="'room_' + item.id" :key="'room_' + item.id"
class="chat-item" class="chat-item"
:class="{ selected: isSelected(item) }" :class="{ selected: item.chat_id == activeId }"
@click="goToChatRoom(item)" @click="goToChatRoom(item)"
> >
<div class="chat-info"> <div class="chat-info">
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
无接待 无接待
</div> </div>
</el-scrollbar> </el-scrollbar>
<el-button class="refresh-btn" title="刷新列表" @click="getList">
<i class="el-icon-refresh-right"></i>
</el-button>
<el-pagination <el-pagination
background background
@size-change="handleSizeChange" @size-change="handleSizeChange"
...@@ -116,11 +119,8 @@ export default class ModelChatList extends Vue { ...@@ -116,11 +119,8 @@ export default class ModelChatList extends Vue {
return this.chatList || []; return this.chatList || [];
} }
private isSelected(item: ChatType) { public clearActiveId() {
if (this.chatId) { this.activeId = "";
return item.chat_id === this.chatId;
}
return this.selected === item.chat_id;
} }
private async getList() { private async getList() {
...@@ -131,6 +131,7 @@ export default class ModelChatList extends Vue { ...@@ -131,6 +131,7 @@ export default class ModelChatList extends Vue {
this.chatList = result.pageData.rows.map(it => { this.chatList = result.pageData.rows.map(it => {
return { return {
id: it.id.value, id: it.id.value,
chat_id: it.ImChatId.value,
business_data: { business_data: {
model_name: it.ModelName.value, model_name: it.ModelName.value,
obj_id: it.ObjId.value, obj_id: it.ObjId.value,
...@@ -164,13 +165,13 @@ export default class ModelChatList extends Vue { ...@@ -164,13 +165,13 @@ export default class ModelChatList extends Vue {
} }
private async goToChatRoom(data: ChatType) { private async goToChatRoom(data: ChatType) {
await this._createChat({ const chatInfo = await this._createChat({
modelName: data.business_data.model_name, modelName: data.business_data.model_name,
selectedListId: data.business_data.obj_id, selectedListId: data.business_data.obj_id,
uids:[], uids:[],
showByPage: true showByPage: true
}); });
this.activeId = data.id.toString(); this.activeId = data.chat_id.toString();
} }
private raiseChatIdChanged() { private raiseChatIdChanged() {
...@@ -197,6 +198,7 @@ export default class ModelChatList extends Vue { ...@@ -197,6 +198,7 @@ export default class ModelChatList extends Vue {
<style lang="less" scoped> <style lang="less" scoped>
.chat-list-con { .chat-list-con {
display: inline-block; display: inline-block;
position: relative;
width: 25%; width: 25%;
box-sizing: border-box; box-sizing: border-box;
height: 100%; height: 100%;
...@@ -290,4 +292,14 @@ export default class ModelChatList extends Vue { ...@@ -290,4 +292,14 @@ export default class ModelChatList extends Vue {
.chat-check-detail { .chat-check-detail {
margin-left: 10px; margin-left: 10px;
} }
.refresh-btn {
position: absolute;
top: 0;
left: 0;
border-radius: 50%;
width: 24px;
height: 24px;
padding: 0;
border-color: #ccc;
}
</style> </style>
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