Commit 9c1090fb by zhousil

合并

parents 11ecf879 164a8c45
...@@ -74,8 +74,5 @@ ...@@ -74,8 +74,5 @@
.item-title { .item-title {
font-weight: bold; font-weight: bold;
margin-bottom: 10px; margin-bottom: 10px;
text-decoration: underline;
cursor: pointer;
text-decoration: underline;
} }
} }
\ No newline at end of file
...@@ -128,7 +128,13 @@ ...@@ -128,7 +128,13 @@
}; };
img.remove(); img.remove();
} }
return uploadFile(file) return uploadFile(
file,
(p: number) =>
type === MessageType.File &&
this.chatInput &&
this.chatInput.updateUploadProgress(p)
)
.then((r) => { .then((r) => {
if (r) { if (r) {
const msg = { const msg = {
...@@ -160,6 +166,7 @@ ...@@ -160,6 +166,7 @@
console.error(e); console.error(e);
this.setMsg2Failed(index); this.setMsg2Failed(index);
this.chatInput && this.chatInput.updateUploadProgress(0);
}); });
} }
} }
......
...@@ -136,6 +136,9 @@ ...@@ -136,6 +136,9 @@
}; };
}) })
); );
if (!this.readlist.length) {
this.tab = 2;
}
this.unreadlist = await Promise.all( this.unreadlist = await Promise.all(
readerlist readerlist
.filter((k) => !k.is_read) .filter((k) => !k.is_read)
......
...@@ -29,6 +29,13 @@ ...@@ -29,6 +29,13 @@
/> />
</label> </label>
<el-progress
:percentage="percentage"
:show-text="false"
:format="formatPercentage"
v-if="percentage"
></el-progress>
<input <input
@change="onChange" @change="onChange"
:value="file" :value="file"
...@@ -69,7 +76,6 @@ ...@@ -69,7 +76,6 @@
import { Component, Ref, Vue, Watch } from "vue-property-decorator"; import { Component, Ref, Vue, Watch } from "vue-property-decorator";
import { namespace } from "vuex-class"; import { namespace } from "vuex-class";
import { import {
ERROR_IMAGE,
getFileType, getFileType,
getSvg, getSvg,
MAX_FILE_SIZE, MAX_FILE_SIZE,
...@@ -157,6 +163,7 @@ ...@@ -157,6 +163,7 @@
private tip4File = `发送文件(最大${MAX_FILE_SIZE_STRING})`; private tip4File = `发送文件(最大${MAX_FILE_SIZE_STRING})`;
private emoji: EmojiItem[] = []; private emoji: EmojiItem[] = [];
private percentage = 0;
@Watch("chatId") @Watch("chatId")
private onChatIdChanged(v: number, old: number) { private onChatIdChanged(v: number, old: number) {
...@@ -217,7 +224,8 @@ ...@@ -217,7 +224,8 @@
private allowLoadFile() { private allowLoadFile() {
this.acceptType = this.acceptType =
limitedFileExtension.map((i) => `.${i}`).join(",") + ",image/*,video/*"; limitedFileExtension.map((i) => `.${i}`).join(",") +
",image/*,video/*";
} }
private async handlePasteEvent(event: ClipboardEvent) { private async handlePasteEvent(event: ClipboardEvent) {
...@@ -566,6 +574,17 @@ ...@@ -566,6 +574,17 @@
}); });
}); });
} }
private formatPercentage(p: number) {
return `文件处理中 ${p}%`;
}
public updateUploadProgress(v: number) {
this.percentage = v;
if (v <= 0 || v >= 100) {
this.percentage = 0;
}
}
} }
</script> </script>
...@@ -662,6 +681,14 @@ ...@@ -662,6 +681,14 @@
.offset { .offset {
margin: 0 22px; margin: 0 22px;
} }
.el-progress {
display: inline-block;
margin-left: 20px;
width: 150px;
top: -4px;
position: relative;
}
} }
.emoji-picker { .emoji-picker {
......
import Chat from "@/customer-service/xim"; import Chat from "@/customer-service/xim";
export async function uploadFile(file: File) { export async function uploadFile(file: File, uploading?: (p: number) => void) {
const sdk = Chat.getSdk(); const sdk = Chat.getSdk();
let { url } = await sdk.uploadFileV2(file) const { url } = await sdk.uploadFileV2(file, {
onUploadProgress: (e) => uploading(e.percent),
});
return `${sdk.global.baseUrl}${url}`; 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