Commit 39bbc202 by Sixong.Zhu

cs

parent 474ad190
...@@ -53,23 +53,23 @@ ...@@ -53,23 +53,23 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Ref, Vue } from "vue-property-decorator"; import { Component, Prop, Ref, Vue } from "vue-property-decorator";
import Controller from "./controller/chat-list"; import Controller from "./controller/chat-list";
import { EVENTS } from "@/EventConsts"; import { EVENTS } from "@/EventConsts";
import avatar from "@/customer-service/components/avatar.vue"; import avatar from "@/customer-service/components/avatar.vue";
import { Chat as ChatType } from "@/customer-service/xim/models/chat"; import { Chat as ChatType } from "@/customer-service/xim/models/chat";
import { ServiceType } from "../model"; import { ServiceType } from "../model";
import xim from "@/customer-service/xim"; import xim from "@/customer-service/xim";
@Component({ components: { avatar } }) @Component({ components: { avatar } })
export default class ChatList extends Controller { export default class ChatList extends Controller {
private searchKeyword = ""; private searchKeyword = "";
@Prop({ type: Number, default: -1 }) @Prop({ type: Number, default: -1 })
private selected!: number; private selected!: number;
@Ref("scrollbar") @Ref("scrollbar")
private scrollbar: Vue & { update: () => void }; private readonly scrollbar!: Vue & { update: () => void };
private unReadMsgCount = 0; private unReadMsgCount = 0;
...@@ -140,11 +140,11 @@ export default class ChatList extends Controller { ...@@ -140,11 +140,11 @@ export default class ChatList extends Controller {
); );
this.close(); this.close();
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.chat-list-con { .chat-list-con {
display: inline-block; display: inline-block;
width: 25%; width: 25%;
box-sizing: border-box; box-sizing: border-box;
...@@ -156,18 +156,18 @@ export default class ChatList extends Controller { ...@@ -156,18 +156,18 @@ export default class ChatList extends Controller {
font-size: 18px; font-size: 18px;
border-bottom: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1;
} }
} }
.chat-list { .chat-list {
text-align: center; text-align: center;
} }
.chat-list-scroll { .chat-list-scroll {
height: 100%; height: 100%;
.empty { .empty {
margin-top: 100%; margin-top: 100%;
} }
} }
.keyword-input { .keyword-input {
width: 90%; width: 90%;
margin: 15px; margin: 15px;
/deep/ .el-input__inner { /deep/ .el-input__inner {
...@@ -183,8 +183,8 @@ export default class ChatList extends Controller { ...@@ -183,8 +183,8 @@ export default class ChatList extends Controller {
/deep/ .el-input__icon { /deep/ .el-input__icon {
line-height: 32px; line-height: 32px;
} }
} }
.chat-list { .chat-list {
.chat-item { .chat-item {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
...@@ -243,8 +243,8 @@ export default class ChatList extends Controller { ...@@ -243,8 +243,8 @@ export default class ChatList extends Controller {
margin-top: -15px; margin-top: -15px;
} }
} }
} }
.chat-check-detail { .chat-check-detail {
margin-left: 10px; margin-left: 10px;
} }
</style> </style>
...@@ -3,6 +3,7 @@ import { parserMessage } from "."; ...@@ -3,6 +3,7 @@ import { parserMessage } from ".";
import { chatStore, ChatStore } from "@/customer-service/store/model"; import { chatStore, ChatStore } from "@/customer-service/store/model";
import { formatTime, TimeFormatRule } from "@/customer-service/utils/time"; import { formatTime, TimeFormatRule } from "@/customer-service/utils/time";
import { Chat as ChatItem } from "@/customer-service/xim/models/chat"; import { Chat as ChatItem } from "@/customer-service/xim/models/chat";
import Xim from "@/customer-service/xim";
@Component({ components: {} }) @Component({ components: {} })
export default class ChatList extends Vue { export default class ChatList extends Vue {
...@@ -48,11 +49,13 @@ export default class ChatList extends Vue { ...@@ -48,11 +49,13 @@ export default class ChatList extends Vue {
@chatStore.Action(ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA) @chatStore.Action(ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA)
protected readonly reset!: ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA; protected readonly reset!: ChatStore.ACTION_CLEAR_CURRENT_CHAT_DATA;
private readonly invoker = Xim.getSdk();
protected parseMesage(data: ChatItem) { protected parseMesage(data: ChatItem) {
if (data.last_msg_sender && data.last_msg_sender !== "0") { if (data.last_msg_sender && data.last_msg_sender !== "0") {
if (!this.userNames[data.last_msg_sender]) { if (!this.userNames[data.last_msg_sender]) {
this.updateUserName({ id: data.last_msg_sender, name: "" }); this.updateUserName({ id: data.last_msg_sender, name: "" });
this.sdk this.invoker
.model("user") .model("user")
.detail(data.last_msg_sender) .detail(data.last_msg_sender)
.query() .query()
...@@ -62,7 +65,7 @@ export default class ChatList extends Vue { ...@@ -62,7 +65,7 @@ export default class ChatList extends Vue {
name: userInfo.row.first_name.display as string, name: userInfo.row.first_name.display as string,
}); });
}) })
.catch(() => {}); .catch(() => { });
} }
} }
if (data.last_msg_content === "") { if (data.last_msg_content === "") {
......
...@@ -38,18 +38,18 @@ ...@@ -38,18 +38,18 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Ref, Vue, Watch } from "vue-property-decorator"; import { Component, Prop, Ref, Vue, Watch } from "vue-property-decorator";
import { Message, MessageType } from "../model"; import { Message, MessageType } from "../model";
import { throttle } from "../utils"; import { throttle } from "../utils";
import { formatTime } from "../utils/time"; import { formatTime } from "../utils/time";
import ImagePreview from "./image-preview.vue"; import ImagePreview from "./image-preview.vue";
import message from "./message.vue"; import message from "./message.vue";
import VideoPreview from "./video-preview.vue"; import VideoPreview from "./video-preview.vue";
import { ChatStore, chatStore } from "@/customer-service/store/model"; import { ChatStore, chatStore } from "@/customer-service/store/model";
import { dbController } from "../database"; import { dbController } from "../database";
@Component({ components: { message, ImagePreview, VideoPreview } }) @Component({ components: { message, ImagePreview, VideoPreview } })
export default class MessageList extends Vue { export default class MessageList extends Vue {
@chatStore.Getter(ChatStore.STATE_CHAT_MSG_HISTORY) @chatStore.Getter(ChatStore.STATE_CHAT_MSG_HISTORY)
private readonly historyMessage!: ChatStore.STATE_CHAT_MSG_HISTORY; private readonly historyMessage!: ChatStore.STATE_CHAT_MSG_HISTORY;
...@@ -93,7 +93,7 @@ export default class MessageList extends Vue { ...@@ -93,7 +93,7 @@ export default class MessageList extends Vue {
if (this.historyMessage) { if (this.historyMessage) {
if (this.sendingMessages) { if (this.sendingMessages) {
return [...this.historyMessage, ...this.sendingMessages].filter( return [...this.historyMessage, ...this.sendingMessages].filter(
(i) => i.chat_id === this.chatId (i) => i.chat_id === this.chatId && i.id > 0
); );
} }
return this.historyMessage; return this.historyMessage;
...@@ -101,7 +101,7 @@ export default class MessageList extends Vue { ...@@ -101,7 +101,7 @@ export default class MessageList extends Vue {
if (this.sendingMessages) { if (this.sendingMessages) {
return this.sendingMessages.filter( return this.sendingMessages.filter(
(i) => i.chat_id === this.chatId (i) => i.chat_id === this.chatId && i.id > 0
); );
} }
...@@ -375,23 +375,25 @@ export default class MessageList extends Vue { ...@@ -375,23 +375,25 @@ export default class MessageList extends Vue {
private refresh() { private refresh() {
this.fetchNewMsg(); this.fetchNewMsg();
} }
} }
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.message-list { .message-list {
padding: 0 20px; padding: 0 20px;
padding-right: 0; padding-right: 0;
} }
.loading-mask { .loading-mask {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
text-align: center; text-align: center;
} }
.message-template { .message-template {
&:first-child { &:first-child {
padding-top: 10px;
.timestamp { .timestamp {
margin-top: 20px; margin-top: 20px;
} }
...@@ -405,5 +407,5 @@ export default class MessageList extends Vue { ...@@ -405,5 +407,5 @@ export default class MessageList extends Vue {
font-size: 12px; font-size: 12px;
user-select: none; user-select: none;
} }
} }
</style> </style>
import Vue from "vue"; import Chat from "@/customer-service/xim";
import { UniplatSdk } from "uniplat-sdk"
const orgId = () => Vue.prototype.global.org?.id ?? "0";
export async function uploadFile(file: File) { export async function uploadFile(file: File) {
let { url } = await (Vue.prototype.sdk as UniplatSdk).uploadFileV2(file) const sdk = Chat.getSdk();
const realUrl = `${Vue.prototype.sdk.global.baseUrl}${url}`; let { url } = await sdk.uploadFileV2(file)
return realUrl; return `${sdk.global.baseUrl}${url}`;
} }
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