diff --git a/src/main/java/com/huaheng/common/utils/file/FileUploadUtils.java b/src/main/java/com/huaheng/common/utils/file/FileUploadUtils.java index 4a49fa6..e20cde4 100644 --- a/src/main/java/com/huaheng/common/utils/file/FileUploadUtils.java +++ b/src/main/java/com/huaheng/common/utils/file/FileUploadUtils.java @@ -130,7 +130,7 @@ public class FileUploadUtils } if (!desc.exists()) { - desc.createNewFile(); +// desc.createNewFile(); } return desc; } diff --git a/src/main/java/com/huaheng/pc/system/user/controller/ProfileController.java b/src/main/java/com/huaheng/pc/system/user/controller/ProfileController.java index 00e3490..f8dd617 100644 --- a/src/main/java/com/huaheng/pc/system/user/controller/ProfileController.java +++ b/src/main/java/com/huaheng/pc/system/user/controller/ProfileController.java @@ -138,6 +138,7 @@ public class ProfileController extends BaseController if (!file.isEmpty()) { String avatar = FileUploadUtils.upload(file); + user.setId(getUser().getId()); user.setAvatar(avatar); if (userService.updateUserInfo(user) > 0) { diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index a35a52d..3751cf0 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -11,7 +11,7 @@ huaheng: #版权年份 copyrightYear: 2020 # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) - profile: D:/Huaheng/uploadPath + profile: D:/Huaheng/uploadPath/ # 获取ip地址开关 addressEnabled: false diff --git a/src/main/resources/static/huaheng/js/huahengUI.js b/src/main/resources/static/huaheng/js/huahengUI.js index 0136f4e..073754b 100644 --- a/src/main/resources/static/huaheng/js/huahengUI.js +++ b/src/main/resources/static/huaheng/js/huahengUI.js @@ -110,7 +110,11 @@ var table = { clickToSelect: options.clickToSelect, // 是否启用点击选中行 mobileResponsive: options.mobileResponsive, // 是否支持移动端适配 onClickRow: options.onClickRow, // 点击某行触发的事件 - onDblClickRow: options.onDblClickRow, // 双击某行触发的事件 + onDblClickRow:function(row){ + if (typeof detail != 'undefined') { + detail(row.id, row.code) + } + }, // 双击某行触发的事件 onClickCell: options.onClickCell, // 单击某格触发的事件 onDblClickCell: options.onDblClickCell, // 双击某格触发的事件 onEditableSave: options.onEditableSave, // 行内编辑保存的事件 @@ -139,6 +143,7 @@ var table = { }); return optionsIds.substring(0, optionsIds.length - 1); }, + // 查询条件 queryParams: function(params) { var curParams = { @@ -901,21 +906,23 @@ var table = { }, // 删除信息 remove: function(id) { - $.modal.confirm("确定删除该条" + $.table.options.modalName + "信息吗?", function() { - var url = $.common.isEmpty(id) ? $.table.options.removeUrl : $.table.options.removeUrl.replace("{id}", id); + table.set(); + $.modal.confirm("确定删除该条" + table.options.modalName + "信息吗?", function() { + var url = $.common.isEmpty(id) ? table.options.removeUrl : table.options.removeUrl.replace("{id}", id); var data = { "ids": id }; $.operate.submit(url, "post", "json", data); }); }, // 批量删除信息 batRemove: function() { - var rows = $.common.isEmpty($.table.options.id) ? $.table.selectFirstColumns() : $.table.selectColumns($.table.options.id); + table.set(); + var rows = $.common.isEmpty(table.options.id) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.id); if (rows.length == 0) { $.modal.alertWarning("请至少选择一条记录"); return; } $.modal.confirm("确认要删除选中的" + rows.length + "条数据吗?", function() { - var url = $.table.options.removeUrl; + var url = table.options.removeUrl; var data = { "ids": rows.join() }; $.operate.submit(url, "post", "json", data); }); @@ -923,7 +930,7 @@ var table = { // 添加信息 add: function(id) { table.set(); - var url = $.common.isEmpty(id) ? table.options.createUrl : $.table.options.createUrl.replace("{id}", id); + var url = $.common.isEmpty(id) ? table.options.createUrl : table.options.createUrl.replace("{id}", id); $.modal.open("添加" + table.options.modalName, url); }, // 修改信息 diff --git a/src/main/resources/templates/system/user/profile/avatar.html b/src/main/resources/templates/system/user/profile/avatar.html index dd68e22..320ff72 100644 --- a/src/main/resources/templates/system/user/profile/avatar.html +++ b/src/main/resources/templates/system/user/profile/avatar.html @@ -24,12 +24,12 @@ </div> <div th:include="include::footer"></div> <script th:src="@{/ajax/libs/cropbox/cropbox.js}"></script> -<script type="text/javascript"> + <script th:inline="javascript"> $(window).load(function() { var options = { thumbBox: '.thumbBox', spinner: '.spinner', - imgSrc: '/wms/img/profile.jpg' + imgSrc: '/wms/profile/' + [[${user.avatar}]] } var cropper = $('.imageBox').cropbox(options); $('#avatar').on('change', diff --git a/src/main/resources/templates/system/user/profile/profile.html b/src/main/resources/templates/system/user/profile/profile.html index 37892d7..fd972b7 100644 --- a/src/main/resources/templates/system/user/profile/profile.html +++ b/src/main/resources/templates/system/user/profile/profile.html @@ -35,7 +35,7 @@ <div class="contact-box"> <div class="col-sm-4"> <div class="text-center"> - <img alt="image" class="img-circle m-t-xs img-responsive" th:src="(${user.avatar} == '') ? '../../img/profiles.jpg' : '/profile/' + ${user.avatar}"> + <img alt="image" class="img-circle m-t-xs img-responsive" th:src="(${user.avatar} == '') ? '../../img/profiles.jpg' : '../../profile/' + ${user.avatar}"> <div class="m-t-xs font-bold">[[${user.loginIp}]]</div> </div> </div>