From e80a38fa789207039040c1d5253d326f78a48260 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Sun, 3 Jul 2022 21:42:59 +0800 Subject: [PATCH] no message --- resources/assets/js/functions/web.js | 43 ++++++++++--------- .../pages/manage/components/DialogUpload.vue | 4 +- resources/assets/js/store/actions.js | 2 +- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/resources/assets/js/functions/web.js b/resources/assets/js/functions/web.js index 9f0b4e3ee..89840f147 100755 --- a/resources/assets/js/functions/web.js +++ b/resources/assets/js/functions/web.js @@ -76,26 +76,6 @@ } }, - /** - * 格式化websocket的消息 - * @param data - */ - formatWebsocketMessageDetail(data) { - if ($A.isJson(data)) { - for (let key in data) { - if (!data.hasOwnProperty(key)) continue; - data[key] = $A.formatWebsocketMessageDetail(data[key]); - } - } else if ($A.isArray(data)) { - data.forEach((val, index) => { - data[index] = $A.formatWebsocketMessageDetail(val); - }); - } else if (typeof data === "string") { - data = data.replace(/\{\{RemoteURL\}\}/g, this.apiUrl('../')) - } - return data; - }, - /** * 格式化时间 * @param date @@ -391,6 +371,29 @@ return text.replace(/<[^>]+>/g,"") }, + /** + * 消息格式化处理(将消息内的RemoteURL换成真实地址) + * @param data + */ + formatMsgBasic(data) { + if (!data) { + return data + } + if ($A.isJson(data)) { + for (let key in data) { + if (!data.hasOwnProperty(key)) continue; + data[key] = $A.formatMsgBasic(data[key]); + } + } else if ($A.isArray(data)) { + data.forEach((val, index) => { + data[index] = $A.formatMsgBasic(val); + }); + } else if (typeof data === "string") { + data = data.replace(/\{\{RemoteURL\}\}/g, this.apiUrl('../')) + } + return data + }, + /** * 消息格式化处理 * @param text diff --git a/resources/assets/js/pages/manage/components/DialogUpload.vue b/resources/assets/js/pages/manage/components/DialogUpload.vue index 7ad3ef906..f49464e2f 100644 --- a/resources/assets/js/pages/manage/components/DialogUpload.vue +++ b/resources/assets/js/pages/manage/components/DialogUpload.vue @@ -84,8 +84,8 @@ export default { handleProgress(event, file) { //上传时 if (file.tempId === undefined) { - file.tempId = $A.randomString(8); - this.$emit('on-progress', file); + file.tempId = $A.randNum(1000000000, 9999999999) + this.$emit('on-progress', file) } }, diff --git a/resources/assets/js/store/actions.js b/resources/assets/js/store/actions.js index 0976f810c..d886168d1 100644 --- a/resources/assets/js/store/actions.js +++ b/resources/assets/js/store/actions.js @@ -2392,7 +2392,7 @@ export default { }; state.ws.onmessage = (e) => { wgLog && console.log("[WS] Message", e); - const msgDetail = $A.formatWebsocketMessageDetail($A.jsonParse(e.data)); + const msgDetail = $A.formatMsgBasic($A.jsonParse(e.data)); const {type, msgId} = msgDetail; switch (type) { case "open":