diff --git a/src/main/java/xyz/wbsite/dbtool/web/frame/utils/Base64Util.java b/src/main/java/xyz/wbsite/dbtool/web/frame/utils/Base64Util.java index 5ef2533a..988bdf57 100644 --- a/src/main/java/xyz/wbsite/dbtool/web/frame/utils/Base64Util.java +++ b/src/main/java/xyz/wbsite/dbtool/web/frame/utils/Base64Util.java @@ -1,5 +1,7 @@ package xyz.wbsite.dbtool.web.frame.utils; +import java.io.File; +import java.io.IOException; import java.util.Arrays; /** @@ -494,4 +496,20 @@ public class Base64Util { return dArr; } + + public static void main(String[] args) throws IOException { + + try { + byte[] bytes = FileUtil.readFileToByteArray(new File("E:\\patt.png")); + + String string = Base64Util.encodeToString(bytes); + + + System.out.println(string); + + } catch (IOException e) { + e.printStackTrace(); + } + + } } 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 2a367b99..e01d1d02 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/control/nav.ftl @@ -229,7 +229,7 @@ }).then(callback); break; default: - jsonRequest({ + return jsonRequest({ url: '/ajax/' + this.mModule + "/" + this.mTarget + "/" + this.mMethod, data: JSON.stringify(data) }).then(callback); @@ -307,7 +307,7 @@ this.select = select; }, onTemplate: function () { - new Ajax(this.module, this.target, "template").post(function (response) { + new Ajax(this.module, this.target).method("template").post({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } @@ -315,7 +315,7 @@ }, onImport: function (item) { utils.selectFile(function (files) { - new Ajax(this.module, this.target, "imports", files[0]).post(function (response) { + new Ajax(this.module, this.target).method("imports").post(files[0], function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } @@ -323,7 +323,7 @@ }.bind(this)) }, onExport: function () { - new Ajax(this.module, this.target, "exports", this.vm).post(function (response) { + new Ajax(this.module, this.target).method("exports").post(this.vm, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } @@ -333,7 +333,7 @@ this.$refs['form'].validate(function (valid) { if (valid) { if (this.form.id) { - new Ajax(this.module, this.target, "update", this.form).post(function (response) { + new Ajax(this.module, this.target).update(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -343,7 +343,7 @@ } }.bind(this)) } else { - new Ajax(this.module, this.target, "create", this.form).post(function (response) { + new Ajax(this.module, this.target).create(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -359,7 +359,7 @@ }.bind(this)); }, onFind: function () { - new Ajax(this.module, this.target, "find", this.vm).post(function (response) { + new Ajax(this.module, this.target).find(this.vm, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -374,7 +374,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax(this.module, this.target, "delete", {id: item.id}).post(function (response) { + new Ajax(this.module, this.target).delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -397,7 +397,7 @@ }).then(function () { for (var i = 0; i < this.select.length; i++) { (function (obj) { - new Ajax(this.module, this.target, "delete", {id: obj.id}).post(function (response) { + new Ajax(this.module, this.target).delete({id: obj.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -698,7 +698,9 @@ }, created: function () { if (this.dictName) { - new Ajax("system", "dict", "load").data({dictName: this.dictName}).post(function (response) { + new Ajax("system", "dict").method("load").post({ + dictName: this.dictName + },function (response) { if (response.errors.length > 0) { console.error(response.errors[0].message) } else { @@ -750,7 +752,9 @@ } }, created: function () { - new Ajax("system", "dept", "tree").data({dictName: this.dictName}).post(function (response) { + new Ajax("system", "dept").method("tree").post({ + dictName: this.dictName + },function (response) { if (response.errors.length > 0) { console.error(response.errors[0].message) } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/home.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/home.ftl index 58321130..d1972c8a 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/home.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/home.ftl @@ -1029,7 +1029,7 @@ }, methods: { doAjax: function () { - new Ajax("system", "user","find").post(function (response) { + new Ajax("system", "user").find({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { 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 590d1b33..ef8509d2 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/index.ftl @@ -374,7 +374,7 @@ onCommand: function (cmd) { switch (cmd) { case "logout": - new Ajax("system", "User", "logout").post(function (response) { + new Ajax("system", "User").method("logout").post({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/login.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/login.ftl index 05ecd2ae..a9fbe413 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/login.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/login.ftl @@ -110,7 +110,7 @@ this.$refs[formName].validate(function (valid) { if (valid) { this.isSubmit = true; - new Ajax("system", "User", "login", this.form).post(function (response) { + new Ajax("system", "User").method("login").post(this.form, function (response) { this.isSubmit = false; if (response.errors.length > 0) { nav.e(response.errors[0].message); diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl index d915dfca..dd8ab8ba 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/mgr.ftl @@ -313,7 +313,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax(this.module, this.target, "delete", {id: item.id}).post(function (response) { + new Ajax("${module}", "${table.getFName()}").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl index d88bc501..cdadcaa2 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dept.ftl @@ -305,7 +305,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "dept", "delete").post({id: item.id}, function (response) { + new Ajax("system", "dept").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -344,7 +344,7 @@ return data.deptName.indexOf(value) !== -1; }, onLoadTree: function () { - new Ajax("system", "dept", "tree").post(function (response) { + new Ajax("system", "dept").method("tree").post({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -356,7 +356,7 @@ this.$refs['form'].validate(function (valid) { if (valid) { if (this.form.id) { - new Ajax("system", "dept").data(this.form).update(function (response) { + new Ajax("system", "dept").update(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -367,7 +367,7 @@ } }.bind(this)) } else { - new Ajax("system", "dept").data(this.form).create(function (response) { + new Ajax("system", "dept").create(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl index d1908eae..92ab8969 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dict.ftl @@ -234,9 +234,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "dict").delete({ - id: item.id - }, function (response) { + new Ajax("system", "dict").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl index 22fe8a15..b76eaa95 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/dictItem.ftl @@ -230,7 +230,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "dictItem", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "dictItem").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl index 0c11a2b6..f374d47e 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/file.ftl @@ -238,7 +238,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "file", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "file").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { 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 d428b63a..4cc26a71 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 @@ -260,7 +260,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "logErr", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "logErr").delete({id: item.id},function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl index 2b9e16a2..b00d04cc 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/res.ftl @@ -311,7 +311,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "res", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "res").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -352,7 +352,7 @@ return data.comment.indexOf(value) !== -1; }, onLoadTree: function () { - new Ajax("system", "res", "tree").post(function (response) { + new Ajax("system", "res").method("tree").post({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -364,7 +364,7 @@ this.$refs['form'].validate(function (valid) { if (valid) { if (this.form.id) { - new Ajax("system", "res", "update", this.form).post(function (response) { + new Ajax("system", "res").update(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -375,7 +375,7 @@ } }.bind(this)) } else { - new Ajax("system", "res", "create", this.form).post(function (response) { + new Ajax("system", "res").create(this.form, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl index 2e57d238..293a84d5 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/role.ftl @@ -227,7 +227,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "role", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "role").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -244,7 +244,10 @@ this.formResource.dialog = true; this.formResource.roleId = item.id; this.formResource.roleCode = item.code; - new Ajax("system", "roleRes", "find", {roleId: item.id, pageSize: 0}).post(function (response) { + new Ajax("system", "roleRes").find({ + roleId: item.id, + pageSize: 0 + }, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -258,14 +261,13 @@ }.bind(this)) }, onCheck: function (item, status) { - var param = { + new Ajax("system", "roleRes").method("check").post({ roleId: this.formResource.roleId, roleCode: this.formResource.roleCode, resId: item.id, resCode: item.resCode, checked: status.checkedKeys.indexOf(item.id) !== -1 - } - new Ajax("system", "roleRes", "check", param).post(function (response) { + }, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -274,7 +276,7 @@ }.bind(this)) }, onLoadTree: function () { - new Ajax("system", "res", "tree").post(function (response) { + new Ajax("system", "res").method("tree").post({}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/schedule.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/schedule.ftl index 0a976192..1cd83863 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/schedule.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/schedule.ftl @@ -55,7 +55,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "schedule", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "schedule").delete({id: item.id},function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl index c10fda55..737ceb25 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/tokens.ftl @@ -249,7 +249,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "tokens", "logout", {token: item.token}).post(function (response) { + new Ajax("system", "tokens").method("logout").post({token: item.token}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { diff --git a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl index 34a7989b..9cef0f26 100644 --- a/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl +++ b/src/main/resources/modules/SpringBoot/resources/templates/screen/module/system/user.ftl @@ -269,7 +269,7 @@ cancelButtonText: '取消', type: 'warning' }).then(function () { - new Ajax("system", "user", "delete", {id: item.id}).post(function (response) { + new Ajax("system", "user").delete({id: item.id}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else { @@ -282,7 +282,7 @@ }); }, loadRoles: function () { - new Ajax("system", "role", "find", {pageSize: 0}).post(function (response) { + new Ajax("system", "role").find({pageSize: 0}, function (response) { if (response.errors.length > 0) { nav.e(response.errors[0].message); } else {