From db0b5d7050cbd101a6c42a411787e84e7d3c7300 Mon Sep 17 00:00:00 2001 From: zhengpengju Date: Mon, 18 May 2020 14:06:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=81=E7=94=A8loading=20bar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: d5e208cfa1ad9760fe4bdfdbaea5059948190ce8 --- projects/WebSPA/wwwroot/js/app.js | 5 ++++- projects/WebSPA/wwwroot/js/message.js | 9 ++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/projects/WebSPA/wwwroot/js/app.js b/projects/WebSPA/wwwroot/js/app.js index e5d92483..d8f7092d 100644 --- a/projects/WebSPA/wwwroot/js/app.js +++ b/projects/WebSPA/wwwroot/js/app.js @@ -27,7 +27,7 @@ axios.interceptors.request.use( }else{ config.url += `?v=${version}` } - $('#loading').show(); + // $('#loading').show(); return config; }, function (error) { @@ -291,6 +291,9 @@ const app = new Vue({ // router.push({path:'/pages/login'}) } + }, + destroyed: function(){ + alert('des'); }, methods: { }, diff --git a/projects/WebSPA/wwwroot/js/message.js b/projects/WebSPA/wwwroot/js/message.js index c9a463f9..e9281d2f 100644 --- a/projects/WebSPA/wwwroot/js/message.js +++ b/projects/WebSPA/wwwroot/js/message.js @@ -1,5 +1,5 @@ var hubUrl = config.hubUrl; -var connection = new signalR.HubConnectionBuilder().withUrl(hubUrl).withAutomaticReconnect().build(); +var connection = new signalR.HubConnectionBuilder().withUrl(hubUrl).build(); var connectionId; function connect() { @@ -8,11 +8,14 @@ function connect() { console.log('signalR 连接成功'); }).catch(function (err) { console.log(err); - setTimeout(connect, 15 * 1000); + setTimeout(connect, 5000); }); } } -connection.on('Connected', function (id) { +connection.onclose(function () { + console.log('connect closed'); + connect(); +});connection.on('Connected', function (id) { connectionId = id; console.log('signalR 连接Id:' + connectionId); });