Compare commits
No commits in common. "main" and "wyfMain-dev" have entirely different histories.
main
...
wyfMain-de
@ -164,18 +164,9 @@ const onSendVideoEvent = async ({ data }) => {
|
|||||||
const onSendCodeEvent = ({ data, callBack }) => {
|
const onSendCodeEvent = ({ data, callBack }) => {
|
||||||
onSendMessage({ type: 'code', code: data.code, lang: data.lang }, callBack)
|
onSendMessage({ type: 'code', code: data.code, lang: data.lang }, callBack)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发送文件消息
|
// 发送文件消息
|
||||||
const onSendFileEvent = ({ data }) => {
|
const onSendFileEvent = ({ data }) => {
|
||||||
const fn = (e) => {
|
|
||||||
const confirmationMessage = '文件上传中请勿离开';
|
|
||||||
e.returnValue = confirmationMessage; // 兼容旧版本浏览器
|
|
||||||
return confirmationMessage; // 现代浏览器
|
|
||||||
}
|
|
||||||
window.addEventListener('beforeunload', fn);
|
|
||||||
|
|
||||||
if (data.size / (1024 * 1024) > 100) {
|
|
||||||
return window['$message'].warning('只能上传100MB以内的文件!')
|
|
||||||
}
|
|
||||||
const clientUploadId = `file-${Date.now()}-${Math.floor(Math.random() * 1000)}`
|
const clientUploadId = `file-${Date.now()}-${Math.floor(Math.random() * 1000)}`
|
||||||
const tempMessage = {
|
const tempMessage = {
|
||||||
msg_id: clientUploadId,
|
msg_id: clientUploadId,
|
||||||
@ -214,7 +205,6 @@ const onSendFileEvent = ({ data }) => {
|
|||||||
async () => {
|
async () => {
|
||||||
// 上传完成后,上传任务已经被removeUploadTask方法移除
|
// 上传完成后,上传任务已经被removeUploadTask方法移除
|
||||||
// 不需要再次从records中删除
|
// 不需要再次从records中删除
|
||||||
window.removeEventListener('beforeunload', fn);
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user