From dc5d9c19e4d6e951242a450dde90d7ab831a68ba Mon Sep 17 00:00:00 2001 From: zhangzhen <525765282@qq.com> Date: Tue, 1 Jul 2025 10:55:38 +0800 Subject: [PATCH] 处理websocket断开问题; --- src/components/QuickQuote/index.jsx | 11 +++++++++++ 1 file changed, 11 insertions(+), 0 deletions(-) diff --git a/src/components/QuickQuote/index.jsx b/src/components/QuickQuote/index.jsx index 4126838..1a52803 100644 --- a/src/components/QuickQuote/index.jsx +++ b/src/components/QuickQuote/index.jsx @@ -502,6 +502,17 @@ const QuickQuoteEvent = props => { // 核价按钮 addState.handleCalcPrice = async () => { + if (props.app.webSocket === null || props.app.webSocket?.readyState !== WebSocket.OPEN) { + console.log("================webSocket连接======================"); + props.dispatch({ + type: "app/createWebSocket", + payload: { reStart: true, dispatch: props.dispatch }, + }); + + // 暂停2秒 + await new Promise(resolve => setTimeout(resolve, 2000)); + } + const { masterConfig, masterData = {}, slaveConfig, slaveData = [], selectedNode = {}, extraParts = {} } = state; const selectProduct = commonFunc.showLocalMessage(props, "selectProduct", "请先选择产品"); if (commonUtils.isEmptyObject(selectedNode)) { -- libgit2 0.22.2