mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
no message
This commit is contained in:
parent
9c861ec58c
commit
e80a38fa78
43
resources/assets/js/functions/web.js
vendored
43
resources/assets/js/functions/web.js
vendored
@ -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
|
||||
|
||||
@ -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)
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
2
resources/assets/js/store/actions.js
vendored
2
resources/assets/js/store/actions.js
vendored
@ -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":
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user