Commit 06599338 by 胡锦波

1. fix 报错去除

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