From dc677002db831010a305644bfa70518a961663ac Mon Sep 17 00:00:00 2001 From: wangbing <1919101440@qq.com> Date: Mon, 20 Jan 2020 23:58:30 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81JS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Former-commit-id: 2b8e28e5f5348877107060e4092123f21db1ef94 --- .../resources/templates/control/nav.ftl | 31 +++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) 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 942d9409..fd5fed23 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl @@ -143,8 +143,16 @@ utils.blobtoDown(decodeURIComponent(fileName), new Blob([response.data])) return Promise.resolve({errors: []}); } - }, function (response) { - return Promise.resolve(handleError(response.response.status)); + }, function (error) { + nav.tipClose(); + nav.barError(); + const rsp = {errors: []}; + if (!error.response) { + rsp.errors.push({message: error.message}); + } else { + rsp.errors.push(handleError(error.response.status)); + } + return Promise.resolve(rsp); }) }; function Ajax(module, target, method) { @@ -261,8 +269,11 @@ .module(this.module) .target(this.target) .method("template") - .data({}) - .template() + .template(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } + }) }, onImport: function (item) { utils.selectFile(function (files) { @@ -270,7 +281,11 @@ .module(this.module) .target(this.target) .data(files[0]) - .imports(); + .imports(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } + }); }.bind(this)) }, onExport: function () { @@ -278,7 +293,11 @@ .module(this.module) .target(this.target) .data( this.vm) - .exports(); + .exports(function (response) { + if (response.errors.length > 0) { + nav.e(response.errors[0].message); + } + }); }, onSave: function () { this.$refs['form'].validate(function (valid) {