diff --git a/App.vue b/App.vue index e7fe2bae..9cc0fd28 100644 --- a/App.vue +++ b/App.vue @@ -7,10 +7,10 @@ data: { // 基础配置 // 数据接口请求地址 - request_url:'http://shopxo.com/', + request_url:'https://new.shopxo.vip/', // 静态资源地址(如系统根目录不在public目录下面请在静态地址后面加public目录、如:https://d1.shopxo.vip/public/) - static_url:'http://shopxo.com/', + static_url:'https://new.shopxo.vip/', // 系统类型(默认default、如额外独立小程序、可与程序分身插件实现不同主体小程序及支付独立) system_type: 'default', @@ -23,10 +23,10 @@ application_logo: '', // 版本号、如: v1.0.0 - version: 'v6.9.0', + version: 'v6.8.0', // app版本信息、如: v1.0.0 20180118 - app_version_info: 'v6.9.0 20260525', + app_version_info: 'v6.8.0 20260305', // 货币价格符号 currency_symbol: '¥', diff --git a/pages/diy/components/diy/notice.vue b/pages/diy/components/diy/notice.vue index 741077c5..917b89a5 100644 --- a/pages/diy/components/diy/notice.vue +++ b/pages/diy/components/diy/notice.vue @@ -62,23 +62,12 @@ diff --git a/pages/plugins/live/detail/components/live-content/live-content.vue b/pages/plugins/live/detail/components/live-content/live-content.vue index 1c9db549..17883508 100644 --- a/pages/plugins/live/detail/components/live-content/live-content.vue +++ b/pages/plugins/live/detail/components/live-content/live-content.vue @@ -168,9 +168,9 @@ - @@ -347,6 +346,8 @@ listener_height: 0, //#endregion reconnect_count: 0, + is_socket_closing: false, + socket_reconnect_timer: null, // socket连接错误 is_socket_error: false, socket_error_content: '连接失败点击重试', @@ -363,7 +364,6 @@ is_live_chat_on: false, is_live_goods_buy_on: false, is_live_like_on: false, - need_live_socket: false, //#region 顶部返回和搜索 menu_button_info: '', header_padding_left: '', @@ -396,15 +396,6 @@ this.live_goods_explain_auto_close_time = new_value.live_goods_explain_auto_close_time; // 直播提示语 this.live_tips = new_value?.live_tips || ''; - // 三项都关闭时不连接 socket - if (!this.need_live_socket) { - if (this.task != null) { - this.socket_close(); - } - this.is_socket_success = false; - this.is_socket_error = false; - return; - } // socket 地址更新 if (!isEmpty(new_value.socket_connect)) { const { host, port, is_wss } = new_value.socket_connect; @@ -412,9 +403,7 @@ const url = `${protocol}://${host}:${port}`; if (url != this.live_websocket_url) { - if (this.task != null) { - this.socket_close(); - } + this.socket_close(); this.live_websocket_url = url; this.socket_connect(); } else if (this.task == null) { @@ -468,7 +457,6 @@ this.is_live_chat_on = this.is_live_config_on(c.is_live_chat); this.is_live_goods_buy_on = this.is_live_config_on(c.is_live_goods_buy); this.is_live_like_on = this.is_live_config_on(c.is_live_like); - this.need_live_socket = this.is_live_chat_on || this.is_live_goods_buy_on || this.is_live_like_on; this.live_feature_ready = true; }, /** @@ -486,8 +474,6 @@ // 如果有胶囊的时候,做处理 if (is_current_single_page == 0) { const custom = uni.getMenuButtonBoundingClientRect(); - console.log(custom); - this.menu_button_info = `max-width:calc(100% - ${custom.width + 10}px);`; this.header_style = `padding-top: ${custom.top + custom.height}px;`; } @@ -612,6 +598,31 @@ // 连接socket this.socket_connect(); }, + clear_socket_reconnect_timer() { + if (this.socket_reconnect_timer != null) { + clearTimeout(this.socket_reconnect_timer); + this.socket_reconnect_timer = null; + } + }, + schedule_socket_reconnect() { + if (this.socket_reconnect_timer != null) { + return; + } + if ((this.reconnect_count + 1) >= 30) { + this.is_socket_error = false; + this.reconnect_count = 0; + this.socket_error_content = '连接失败点击重试'; + return; + } + this.is_socket_error = true; + this.is_socket_success = false; + this.socket_error_content = `第${this.reconnect_count + 1}次连接失败`; + this.socket_reconnect_timer = setTimeout(() => { + this.socket_reconnect_timer = null; + this.reconnect_count++; + this.socket_connect(); + }, 2000); + }, /** * 手动连接WebSocket */ @@ -625,13 +636,18 @@ * @param {Boolean} is_manual - 是否手动连接 */ socket_connect(is_manual = false) { - if (!this.need_live_socket) { - return; + this.clear_socket_reconnect_timer(); + if (this.task != null) { + this.is_socket_closing = true; + this.task.close(); + this.task = null; } - // 一开始就设置为false,避免连接失败时,页面显示错误 + if (is_manual) { + this.reconnect_count = 0; + } + this.is_socket_closing = false; this.is_socket_error = false; this.is_socket_success = false; - // 第一次连接时显示连接中... if (this.reconnect_count == 0) { this.socket_error_content = '连接中...'; } else { @@ -646,43 +662,32 @@ complete: () => {} }); - // 连接打开事件 this.task.onOpen((res) => { - // 连接成功后重置重连计数 this.reconnect_count = 0; this.is_socket_success = true; + this.is_socket_error = false; }); this.task.onMessage((res) => { this.socket_message_back_handle(res); }); this.task.onClose((res) => { - this.is_socket_error = true; - // 尝试重连,最多30次 - if ((this.reconnect_count + 1) < 30) { - const _this = this; - setTimeout(() => { - _this.is_socket_error = true; - _this.socket_error_content = `第${_this.reconnect_count + 1}次连接失败`; - console.log(`聊天第${_this.reconnect_count + 1}次连接失败`); - setTimeout(() => { - // 增加重连计数 - _this.reconnect_count++; - _this.socket_connect(); - console.log(`聊天第${_this.reconnect_count + 1}次连接`); - }, 1000); // 逐步增加重连间隔,最大10秒 - }, 1000); // 逐步增加重连间隔,最大10秒 - } else { + if (this.is_socket_closing) { + this.is_socket_closing = false; + return; + } + this.is_socket_success = false; + this.schedule_socket_reconnect(); + }); + this.task.onError((res) => { + this.is_socket_success = false; + if ((this.reconnect_count + 1) >= 30) { this.is_socket_error = false; this.reconnect_count = 0; this.socket_error_content = '连接失败点击重试'; + } else if (!this.is_socket_closing) { + this.schedule_socket_reconnect(); } - }); - this.task.onError((res) => { - this.socket_close(); - this.is_socket_error = false; - this.reconnect_count = 0; - this.socket_error_content = `连接失败点击重试`; if (is_manual) { uni.showModal({ title: '提示', @@ -692,8 +697,10 @@ } }); }, - socket_close() { + socket_close() { + this.clear_socket_reconnect_timer(); if (this.task != null) { + this.is_socket_closing = true; this.task.close(); this.task = null; } @@ -1023,7 +1030,7 @@ * @param {Event} e - 点击事件对象 */ like_button_click(e) { - if (!this.is_live_like_on || !this.need_live_socket) { + if (!this.is_live_like_on) { return; } // 临时存储点赞数量 @@ -1204,6 +1211,15 @@ justify-content: center; margin-left: 20rpx; } +.bottom-actions-icon-placeholder { + visibility: hidden; + pointer-events: none; +} +.bottom-actions-input-placeholder { + min-height: 72rpx; + visibility: hidden; + pointer-events: none; +} .keyboard-input { position: fixed; left: 0; diff --git a/pages/plugins/live/detail/mixins/mixins.js b/pages/plugins/live/detail/mixins/mixins.js index 9cf77b32..e24664ab 100644 --- a/pages/plugins/live/detail/mixins/mixins.js +++ b/pages/plugins/live/detail/mixins/mixins.js @@ -41,7 +41,6 @@ export default { is_live_chat_on: false, is_live_goods_buy_on: false, is_live_like_on: false, - need_live_socket: false, } }, @@ -119,7 +118,6 @@ export default { this.is_live_chat_on = this.is_live_config_on(c.is_live_chat); this.is_live_goods_buy_on = this.is_live_config_on(c.is_live_goods_buy); this.is_live_like_on = this.is_live_config_on(c.is_live_like); - this.need_live_socket = this.is_live_chat_on || this.is_live_goods_buy_on || this.is_live_like_on; this.live_feature_ready = true; }, /**