From fa88611d8a20f1833bcbd39009c94dd84fa1b8d5 Mon Sep 17 00:00:00 2001 From: wangbing Date: Mon, 3 Feb 2020 01:47:12 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81VUE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 205115f4a840698042784fb023a64d70e29ff135 --- .../SpringBoot/resources/static/css/base.css | 24 -------- .../resources/templates/control/nav.ftl | 45 +++++---------- .../resources/templates/screen/index.ftl | 55 +++++++++++++++++++ .../templates/screen/module/system/logErr.ftl | 4 +- 4 files changed, 72 insertions(+), 56 deletions(-) diff --git a/src/main/resources/modules/SpringBoot/resources/static/css/base.css b/src/main/resources/modules/SpringBoot/resources/static/css/base.css index 0d4a86e8..d241b201 100644 --- a/src/main/resources/modules/SpringBoot/resources/static/css/base.css +++ b/src/main/resources/modules/SpringBoot/resources/static/css/base.css @@ -632,30 +632,6 @@ code { box-shadow: 0 1px 6px rgba(0, 0, 0, .2); } -.loading-bar { - width: 100%; - padding: 0!important; - top: 0!important; - box-shadow: 0px 0px 0px 0px; - border: 0px; -} - -.loading-bar .el-message__content { - display: block; - width: 100%; - height: 2px; -} - -.loading-bar .el-message__content .bar { - display: block; - height: 2px; - background-color: #2d8cf0; -} - -.loading-bar .el-message__content .bar.error { - background-color: #ff1a0e; -} - /* 带有固定title布局,title保持固定*/ .wb-layout-title-fix { width: 100%; diff --git a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl index 2c2ede9c..403633d6 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl @@ -43,19 +43,18 @@ } function jsonRequest(data) { nav.barShow(); - nav.tipShow(); return jsonService.request(data) .then(function (response) { - nav.tipClose(); - if (response.data.errors) {// 确保服务器正确返回Json + if (response.data.errors && response.data.errors.length == 0) { nav.barFinish(); + } else if(response.data.errors && response.data.errors.length > 0) { + nav.barError(); } else { response.data = {errors: [{message: '服务器响应错误'}]}; nav.barError(); } return Promise.resolve(response.data); }, function (error) { - nav.tipClose(); nav.barError(); const rsp = {errors: []}; if (!error.response) { @@ -449,38 +448,24 @@ } }, barShow: function () { - if (!this.loadingBar) { - this.loadingBar = this.$message({ - type: '', - duration: 0, - customClass: 'loading-bar', - dangerouslyUseHTMLString: true, - message: '' - }); - } else { - this.loadingBar.message = '' + if (window.index) { + window.index.barStart(); + } else if (window.parent.index) { + window.parent.index.barStart(); } }, barFinish: function () { - if (this.loadingBar) { - this.loadingBar.message = '' - setTimeout(function () { - if (this.loadingBar) { - this.loadingBar.close(); - this.loadingBar = ''; - } - }.bind(this), 500); + if (window.index) { + window.index.barFinish(); + } else if (window.parent.index) { + window.parent.index.barFinish(); } }, barError: function () { - if (this.loadingBar) { - this.loadingBar.message = '' - setTimeout(function () { - if (this.loadingBar) { - this.loadingBar.close(); - this.loadingBar = ''; - } - }.bind(this), 500); + if (window.index) { + window.index.barError(); + } else if (window.parent.index) { + window.parent.index.barError(); } }, i: function (message, callback) { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl index b88cacef..92e93477 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl @@ -1,4 +1,13 @@
+
+ +
+
true<#else>false"}, coll: ${r"<#if prop.coll>true<#else>false"}, @@ -283,6 +315,29 @@ url: '${r"${contextPath}"}/home.htm' }) }, + barStart: function () { + clearInterval(this.barInterval); + this.barPercent = 10; + this.barInterval = setInterval(function () { + this.barPercent = this.barPercent + (90 - this.barPercent) * 0.01; + }.bind(this), 100) + }, + barFinish: function () { + clearInterval(this.barInterval); + this.barPercent = 100; + setTimeout(function () { + this.barPercent = 0; + }.bind(this), 1000); + }, + barError: function () { + clearInterval(this.barInterval); + this.barPercent = 100; + this.barStatus = 'exception' + setTimeout(function () { + this.barPercent = 0; + this.barStatus = null; + }.bind(this), 1000); + }, collapseSwitch: function () { this.prop.coll = !this.prop.coll; }, diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl index d39a95f9..5d45dc4a 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/logErr.ftl @@ -29,9 +29,9 @@ - 解决 + 解决 - 搁置 + 搁置