Commit 06599338 by 胡锦波

1. fix 报错去除

parent 3d94dda3
......@@ -56,10 +56,10 @@ type RoomInfoTab = "customer" | "order";
},
})
export default class ChatRoom extends Vue {
@Ref("chatBox") chatBox: Element;
@Ref("top") refTop: Element;
@Ref("bottom") refBottom: Element;
@Ref("resize") refResize: Element;
@Ref("chatBox") chatBox!: Element;
@Ref("top") refTop!: Element;
@Ref("bottom") refBottom!: Element;
@Ref("resize") refResize!: Element;
@chatStore.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
......
......@@ -18,7 +18,7 @@ export default class ChatList extends Vue {
protected readonly chatList!: ChatStore.STATE_MY_CHAT_ROOM_LIST;
@chatStore.State(ChatStore.STATE_CHAT_USERNAME)
protected readonly userNames!: ChatStore.STATE_CHAT_USERNAME;
protected readonly userNames!: ChatStore.STATE_CHAT_USERNAME | any;
@chatStore.Action(ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION)
protected readonly saveChatId!: ChatStore.ACTION_SAVE_CURRENT_CHAT_ID_VERSION;
......@@ -36,10 +36,10 @@ export default class ChatList extends Vue {
protected readonly saveChatTitle!: ChatStore.MUTATION_SAVE_CHAT_TITLE;
@chatStore.Mutation(ChatStore.MUTATION_SHOW_CHAT)
protected readonly showChat: ChatStore.MUTATION_SHOW_CHAT;
protected readonly showChat!: ChatStore.MUTATION_SHOW_CHAT;
@chatStore.Mutation(ChatStore.MUTATION_HIDE_CHAT)
protected readonly hideChat: ChatStore.MUTATION_HIDE_CHAT;
protected readonly hideChat!: ChatStore.MUTATION_HIDE_CHAT;
protected parseMesage(data: ChatItem) {
if (data.last_msg_sender && data.last_msg_sender !== "0") {
......@@ -49,7 +49,7 @@ export default class ChatList extends Vue {
.model("user")
.detail(data.last_msg_sender)
.query()
.then((userInfo) => {
.then((userInfo: any) => {
this.updateUserName({
id: data.last_msg_sender,
name: userInfo.row.first_name.display as string,
......
......@@ -81,13 +81,13 @@ export default class MessageList extends Vue {
private readonly clearScrollToBottomFunc!: ChatStore.MUTATION_CLEAR_FUNC_SCROLL_TO_BOTTOM;
@chatStore.Mutation(ChatStore.MUTATION_SAVE_FUNC_ON_NEW_MSG)
private readonly onNewMessage: ChatStore.MUTATION_SAVE_FUNC_ON_NEW_MSG;
private readonly onNewMessage!: ChatStore.MUTATION_SAVE_FUNC_ON_NEW_MSG;
@chatStore.Mutation(ChatStore.MUTATION_CLEAR_FUNC_ON_NEW_MSG)
private readonly clearNewMessage: ChatStore.MUTATION_CLEAR_FUNC_ON_NEW_MSG;
private readonly clearNewMessage!: ChatStore.MUTATION_CLEAR_FUNC_ON_NEW_MSG;
@chatStore.Mutation(ChatStore.MUTATION_WITHDRAW)
private readonly executeWithDraw: ChatStore.MUTATION_WITHDRAW;
private readonly executeWithDraw!: ChatStore.MUTATION_WITHDRAW;
@Prop({ default: "circle" })
private shape!: string;
......
......@@ -202,7 +202,7 @@ export default class Message extends Mixins(Filters) {
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStore.Mutation(ChatStore.MUTATION_WITHDRAW)
private readonly executeWithDraw: ChatStore.MUTATION_WITHDRAW;
private readonly executeWithDraw!: ChatStore.MUTATION_WITHDRAW;
/**
* tbd: 文件消息所在的域名的url,逻辑需要补充
......@@ -280,7 +280,7 @@ export default class Message extends Mixins(Filters) {
}
const senderEid = this.messageBody.eid;
return senderEid.toString() === this.chatMyId.toString();
return senderEid!.toString() === this.chatMyId!.toString();
// if (this.messageBody) {
// const msg = this.messageBody;
// if (this.chatSource) {
......@@ -304,13 +304,13 @@ export default class Message extends Mixins(Filters) {
// return false;
}
private mounted() {
mounted() {
this.buildMessageUrl();
}
private get userName() {
return (
this.chatMembers.find((member) => member.eid === this.data.eid)
this.chatMembers!.find((member) => member.eid === this.data.eid)
?.name ?? ""
);
}
......@@ -468,9 +468,9 @@ export default class Message extends Mixins(Filters) {
}
private withdraw() {
ximInstance.withdraw(this.chatId, this.data.id).finally(() => {
ximInstance.withdraw(this.chatId!, this.data.id).finally(() => {
dbController
.removeMessage(this.chatId, this.data.id)
.removeMessage(this.chatId!, this.data.id)
.finally(() => {
this.executeWithDraw(this.data.id);
this.$emit("withdraw", this.data.id);
......
import { Chat, Message } from "./../xim/models/chat";
class ChatCacheDatabaseController {
private db: IDBDatabase;
private db!: IDBDatabase;
private readonly messageDatabases = new Map<string, IDBDatabase>();
......@@ -60,7 +60,7 @@ class ChatCacheDatabaseController {
const setupDb = () => {
const db = that.messageDatabases.get(k);
try {
that.buildTables(db, this.chatMessageKey, "id");
that.buildTables(db!, this.chatMessageKey, "id");
} catch (e) {
console.error(e);
}
......
......@@ -279,7 +279,7 @@ export default class Input extends Vue {
const el = this.messageInputBox;
const range = document.createRange();
const sel = window.getSelection();
const offset = sel.focusOffset;
const offset = sel!.focusOffset;
const content = el.innerHTML;
el.innerHTML =
content.slice(0, offset) +
......@@ -287,8 +287,8 @@ export default class Input extends Vue {
(content.slice(offset) || "\n");
range.setStart(el.childNodes[0], offset + 1);
range.collapse(true);
sel.removeAllRanges();
sel.addRange(range);
sel!.removeAllRanges();
sel!.addRange(range);
return;
}
if (e.shiftKey) {
......
......@@ -369,7 +369,7 @@ export default {
const ts = cache.map((i) => i.last_msg_ts).sort();
const last = ts[ts.length - 1];
await xim.fetchChatListAfter(last).then((r) => {
await xim.fetchChatListAfter(last)!.then((r) => {
const list = r.args[0] as any[];
const items = list.map((i) => buildChatItem(i));
if (items && items.length) {
......
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