diff --git a/im-ui/src/components/chat/ChatBox.vue b/im-ui/src/components/chat/ChatBox.vue
index c49de90..6a7e33c 100644
--- a/im-ui/src/components/chat/ChatBox.vue
+++ b/im-ui/src/components/chat/ChatBox.vue
@@ -48,7 +48,7 @@
+ placeholder="温馨提示:可以粘贴截图了哦~">
@@ -120,6 +120,7 @@
},
methods: {
handlePaste(e) {
+ console.log(e);
let txt = event.clipboardData.getData('Text')
if (typeof(txt) == 'string') {
this.sendText += txt
@@ -308,21 +309,23 @@
}
},
sendImageMessage() {
+ let file = this.sendImageFile;
this.handleImageBefore(this.sendImageFile);
let formData = new FormData()
- formData.append('file', this.sendImageFile.raw || this.sendImageFile)
+ formData.append('file', file.raw || file)
this.$http.post("/image/upload", formData, {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then((data) => {
- this.handleImageSuccess(data, this.sendImageFile);
+ this.handleImageSuccess(data, file);
}).catch((res) => {
- this.handleImageSuccess(res, this.sendImageFile);
- }).finally(() => {
- this.sendImageFile = null;
- this.sendImageUrl= ""
- });
+ this.handleImageSuccess(res, file);
+ })
+ this.sendImageFile = null;
+ this.sendImageUrl= "";
+ this.$nextTick(() => this.$refs.sendBox.focus());
+ this.scrollToBottom();
},
sendTextMessage() {
if (!this.sendText.trim()) {
diff --git a/im-ui/src/store/chatStore.js b/im-ui/src/store/chatStore.js
index be37c70..2c8d764 100644
--- a/im-ui/src/store/chatStore.js
+++ b/im-ui/src/store/chatStore.js
@@ -8,7 +8,14 @@ export default {
mutations: {
initChatStore(state) {
-
+ // 防止图片一直处在加载中状态
+ state.chats.forEach((chat)=>{
+ chat.messages.forEach((msg)=>{
+ if(msg.loadStatus == "loading"){
+ msg.loadStatus = "fail"
+ }
+ })
+ })
},
openChat(state, chatInfo) {
let chat = null;
diff --git a/im-uniapp/components/chat-message-item/chat-message-item.vue b/im-uniapp/components/chat-message-item/chat-message-item.vue
index fcc805a..7a4893b 100644
--- a/im-uniapp/components/chat-message-item/chat-message-item.vue
+++ b/im-uniapp/components/chat-message-item/chat-message-item.vue
@@ -137,7 +137,7 @@
return this.msgInfo.loadStatus && this.msgInfo.loadStatus === "loading";
},
loadFail() {
- return this.msgInfo.loadStatus && (this.msgInfo.loadStatus === "fail");
+ return this.msgInfo.loadStatus && this.msgInfo.loadStatus === "fail";
},
data() {
return JSON.parse(this.msgInfo.content)