Commit d58cd01c by Sixong.Zhu

消息撤回机制修正

parent 8d03d0e7
...@@ -11,7 +11,7 @@ export function parserMessage(type: string, rawMsg: string) { ...@@ -11,7 +11,7 @@ export function parserMessage(type: string, rawMsg: string) {
} else if (type === MessageType.File) { } else if (type === MessageType.File) {
return `[文件]`; return `[文件]`;
} else if (type === MessageType.Withdraw) { } else if (type === MessageType.Withdraw) {
return `[撤回了一条消息]`; return `[撤回了一条消息]`;
} else { } else {
return `[系统自动回复]`; return `[系统自动回复]`;
} }
......
...@@ -355,7 +355,7 @@ export default class MessageList extends Vue { ...@@ -355,7 +355,7 @@ export default class MessageList extends Vue {
return v; return v;
} }
private refresh(msg: number) { private refresh() {
this.fetchNewMsg(); this.fetchNewMsg();
} }
} }
......
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
class="msg-detail withdraw-message" class="msg-detail withdraw-message"
v-else-if="messageType === 'withdraw'" v-else-if="messageType === 'withdraw'"
> >
撤回了一条消息 {{ userName }}撤回了一条消息
</div> </div>
<!-- Text --> <!-- Text -->
<div <div
...@@ -482,9 +482,7 @@ export default class Message extends Mixins(Filters) { ...@@ -482,9 +482,7 @@ export default class Message extends Mixins(Filters) {
<style lang="less" scoped> <style lang="less" scoped>
.message-con { .message-con {
margin: 20px 0;
padding-bottom: 20px; padding-bottom: 20px;
margin-bottom: 0;
margin-right: 15px; margin-right: 15px;
position: relative; position: relative;
......
...@@ -141,7 +141,7 @@ class ChatCacheDatabaseController { ...@@ -141,7 +141,7 @@ class ChatCacheDatabaseController {
this.setupChatMessageDatabase(chat).finally(() => { this.setupChatMessageDatabase(chat).finally(() => {
const store = this.buildChatMessageStore(chat); const store = this.buildChatMessageStore(chat);
for (const item of items) { for (const item of items) {
store.add(item, item.id); store.add(item);
} }
}); });
} }
...@@ -170,17 +170,21 @@ class ChatCacheDatabaseController { ...@@ -170,17 +170,21 @@ class ChatCacheDatabaseController {
} }
const store = this.buildChatMessageStore(chat); const store = this.buildChatMessageStore(chat);
for (const item of items) { for (const item of items) {
store.add(item, item.id); store.add(item);
} }
}); });
} }
public removeMessage(chat: number, msg: number) { public removeMessage(chat: number, msg: number) {
return new Promise<void>((resolve, reject) => { return new Promise<void>((resolve, reject) => {
const store = this.buildChatMessageStore(chat); if (this.db) {
const d = store.delete(msg); const store = this.buildChatMessageStore(chat);
d.onsuccess = () => resolve(); const d = store.delete(msg);
d.onerror = () => reject(); d.onsuccess = () => setTimeout(() => resolve(), 100);
d.onerror = () => reject();
} else {
resolve();
}
}); });
} }
......
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