diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java index 28be0fec..09886560 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CaptchaController.java @@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.HashMap; +import java.util.Map; import java.util.concurrent.TimeUnit; /** @@ -88,10 +90,10 @@ public class CaptchaController { code = captcha.getCode(); } redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("uuid", uuid); ajax.put("img", captcha.getImageBase64()); - return ajax; + return AjaxResult.success(ajax); } private String getCodeResult(String capStr) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java index c69cdf2a..7418a2cd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java @@ -18,10 +18,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.HashMap; +import java.util.Map; /** * 通用请求处理 - * + * * @author ruoyi */ @RestController @@ -34,7 +36,7 @@ public class CommonController /** * 通用下载请求 - * + * * @param fileName 文件名称 * @param delete 是否删除 */ @@ -77,10 +79,10 @@ public class CommonController // 上传并返回新文件名称 String fileName = FileUploadUtils.upload(filePath, file); String url = serverConfig.getUrl() + fileName; - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("fileName", fileName); ajax.put("url", url); - return ajax; + return AjaxResult.success(ajax); } catch (Exception e) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java index 719012b8..c3fdf83f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDeptController.java @@ -15,12 +15,14 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.Iterator; import java.util.List; +import java.util.Map; /** * 部门信息 - * + * * @author ruoyi */ @RestController @@ -89,10 +91,10 @@ public class SysDeptController extends BaseController public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) { List depts = deptService.selectDeptList(new SysDept()); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId)); ajax.put("depts", deptService.buildDeptTreeSelect(depts)); - return ajax; + return AjaxResult.success(ajax); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java index b2df9550..b2b9efb3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysLoginController.java @@ -17,12 +17,14 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Set; /** * 登录验证 - * + * * @author ruoyi */ @RestController @@ -42,24 +44,24 @@ public class SysLoginController /** * 登录方法 - * + * * @param loginBody 登录信息 * @return 结果 */ @PostMapping("/login") public AjaxResult login(@RequestBody LoginBody loginBody) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); // 生成令牌 String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(), loginBody.getUuid()); ajax.put(Constants.TOKEN, token); - return ajax; + return AjaxResult.success(ajax); } /** * 获取用户信息 - * + * * @return 用户信息 */ @GetMapping("getInfo") @@ -71,16 +73,16 @@ public class SysLoginController Set roles = permissionService.getRolePermission(user); // 权限集合 Set permissions = permissionService.getMenuPermission(user); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("user", user); ajax.put("roles", roles); ajax.put("permissions", permissions); - return ajax; + return AjaxResult.success(ajax); } /** * 获取路由信息 - * + * * @return 路由信息 */ @GetMapping("getRouters") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java index 547368bf..00f14642 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysMenuController.java @@ -18,11 +18,13 @@ import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 菜单信息 - * + * * @author ruoyi */ @RestController @@ -78,10 +80,10 @@ public class SysMenuController extends BaseController { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); List menus = menuService.selectMenuList(loginUser.getUser().getUserId()); - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId)); ajax.put("menus", menuService.buildMenuTreeSelect(menus)); - return ajax; + return AjaxResult.success(ajax); } /** @@ -148,4 +150,4 @@ public class SysMenuController extends BaseController } return toAjax(menuService.deleteMenuById(menuId)); } -} \ No newline at end of file +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java index 7c65a9b0..31ca6dda 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysProfileController.java @@ -19,10 +19,12 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.IOException; +import java.util.HashMap; +import java.util.Map; /** * 个人信息 业务处理 - * + * * @author ruoyi */ @RestController @@ -43,10 +45,11 @@ public class SysProfileController extends BaseController { LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); SysUser user = loginUser.getUser(); - AjaxResult ajax = AjaxResult.success(user); + Map ajax = new HashMap<>(); + ajax.put("user", user); ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername())); ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername())); - return ajax; + return AjaxResult.success(ajax); } /** @@ -121,12 +124,12 @@ public class SysProfileController extends BaseController String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file); if (userService.updateUserAvatar(loginUser.getUsername(), avatar)) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); ajax.put("imgUrl", avatar); // 更新缓存用户头像 loginUser.getUser().setAvatar(avatar); tokenService.setLoginUser(loginUser); - return ajax; + return AjaxResult.success(ajax); } } return AjaxResult.error("上传图片异常,请联系管理员"); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 7e743999..079c15ac 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -23,12 +23,14 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** * 用户信息 - * + * * @author ruoyi */ @RestController @@ -94,17 +96,17 @@ public class SysUserController extends BaseController @GetMapping(value = { "/", "/{userId}" }) public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) { - AjaxResult ajax = AjaxResult.success(); + Map ajax = new HashMap<>(); List roles = roleService.selectRoleAll(); ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); ajax.put("posts", postService.selectPostAll()); if (Validator.isNotNull(userId)) { - ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId)); + ajax.put("user", userService.selectUserById(userId)); ajax.put("postIds", postService.selectPostListByUserId(userId)); ajax.put("roleIds", roleService.selectRoleListByUserId(userId)); } - return ajax; + return AjaxResult.success(ajax); } /** diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java index a7d2297b..7c388c5e 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/AjaxResult.java @@ -1,161 +1,134 @@ package com.ruoyi.common.core.domain; -import cn.hutool.core.lang.Validator; import cn.hutool.http.HttpStatus; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; import lombok.Data; - -import java.util.HashMap; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; /** * 操作消息提醒 - * - * @author ruoyi + * + * @author Lion Li */ -public class AjaxResult extends HashMap -{ - private static final long serialVersionUID = 1L; +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@ApiModel("请求响应对象") +public class AjaxResult { - /** 状态码 */ - public static final String CODE_TAG = "code"; + private static final long serialVersionUID = 1L; - /** 返回内容 */ - public static final String MSG_TAG = "msg"; + /** + * 状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** 数据对象 */ - public static final String DATA_TAG = "data"; + /** + * 返回内容 + */ + @ApiModelProperty("消息内容") + private String msg; - public Integer getCode(){ - return (Integer) super.get(CODE_TAG); - } + /** + * 数据对象 + */ + @ApiModelProperty("数据对象") + private T data; - public String getMsg(){ - return (String) super.get(MSG_TAG); - } - public T getData(){ - return (T) super.get(DATA_TAG); - } + /** + * 初始化一个新创建的 AjaxResult 对象 + * + * @param code 状态码 + * @param msg 返回内容 + */ + public AjaxResult(int code, String msg) { + this.code = code; + this.msg = msg; + } - /** - * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。 - */ - public AjaxResult() - { - } + /** + * 返回成功消息 + * + * @return 成功消息 + */ + public static AjaxResult success() { + return AjaxResult.success("操作成功"); + } - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - */ - public AjaxResult(int code, String msg) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - } + /** + * 返回成功数据 + * + * @return 成功消息 + */ + public static AjaxResult success(T data) { + return AjaxResult.success("操作成功", data); + } - /** - * 初始化一个新创建的 AjaxResult 对象 - * - * @param code 状态码 - * @param msg 返回内容 - * @param data 数据对象 - */ - public AjaxResult(int code, String msg, T data) - { - super.put(CODE_TAG, code); - super.put(MSG_TAG, msg); - if (Validator.isNotNull(data)) - { - super.put(DATA_TAG, data); - } - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @return 成功消息 + */ + public static AjaxResult success(String msg) { + return AjaxResult.success(msg, null); + } - /** - * 返回成功消息 - * - * @return 成功消息 - */ - public static AjaxResult success() - { - return AjaxResult.success("操作成功"); - } + /** + * 返回成功消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 成功消息 + */ + public static AjaxResult success(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_OK, msg, data); + } - /** - * 返回成功数据 - * - * @return 成功消息 - */ - public static AjaxResult success(T data) - { - return AjaxResult.success("操作成功", data); - } + /** + * 返回错误消息 + * + * @return + */ + public static AjaxResult error() { + return AjaxResult.error("操作失败"); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @return 成功消息 - */ - public static AjaxResult success(String msg) - { - return AjaxResult.success(msg, null); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(String msg) { + return AjaxResult.error(msg, null); + } - /** - * 返回成功消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 成功消息 - */ - public static AjaxResult success(String msg, T data) - { - return new AjaxResult(HttpStatus.HTTP_OK, msg, data); - } + /** + * 返回错误消息 + * + * @param msg 返回内容 + * @param data 数据对象 + * @return 警告消息 + */ + public static AjaxResult error(String msg, T data) { + return new AjaxResult<>(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); + } - /** - * 返回错误消息 - * - * @return - */ - public static AjaxResult error() - { - return AjaxResult.error("操作失败"); - } + /** + * 返回错误消息 + * + * @param code 状态码 + * @param msg 返回内容 + * @return 警告消息 + */ + public static AjaxResult error(int code, String msg) { + return new AjaxResult<>(code, msg, null); + } - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(String msg) - { - return AjaxResult.error(msg, null); - } - - /** - * 返回错误消息 - * - * @param msg 返回内容 - * @param data 数据对象 - * @return 警告消息 - */ - public static AjaxResult error(String msg, T data) - { - return new AjaxResult(HttpStatus.HTTP_INTERNAL_ERROR, msg, data); - } - - /** - * 返回错误消息 - * - * @param code 状态码 - * @param msg 返回内容 - * @return 警告消息 - */ - public static AjaxResult error(int code, String msg) - { - return new AjaxResult(code, msg, null); - } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java index 4e71fc15..81c596b4 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/page/TableDataInfo.java @@ -1,5 +1,7 @@ package com.ruoyi.common.core.page; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; @@ -9,39 +11,50 @@ import java.util.List; /** * 表格分页数据对象 - * - * @author ruoyi + * + * @author Lion Li */ @Data @NoArgsConstructor @Accessors(chain = true) -public class TableDataInfo implements Serializable -{ - private static final long serialVersionUID = 1L; +@ApiModel("分页响应对象") +public class TableDataInfo implements Serializable { + private static final long serialVersionUID = 1L; - /** 总记录数 */ - private long total; + /** + * 总记录数 + */ + @ApiModelProperty("总记录数") + private long total; - /** 列表数据 */ - private List rows; + /** + * 列表数据 + */ + @ApiModelProperty("列表数据") + private List rows; - /** 消息状态码 */ - private int code; + /** + * 消息状态码 + */ + @ApiModelProperty("消息状态码") + private int code; - /** 消息内容 */ - private String msg; + /** + * 消息内容 + */ + @ApiModelProperty("消息内容") + private String msg; - /** - * 分页 - * - * @param list 列表数据 - * @param total 总记录数 - */ - public TableDataInfo(List list, long total) - { - this.rows = list; - this.total = total; - } + /** + * 分页 + * + * @param list 列表数据 + * @param total 总记录数 + */ + public TableDataInfo(List list, long total) { + this.rows = list; + this.total = total; + } } diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index d19a0122..81e2b3a9 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -1,179 +1,179 @@ - - - - - \ No newline at end of file + + + + + diff --git a/ruoyi-ui/src/components/ImageUpload/index.vue b/ruoyi-ui/src/components/ImageUpload/index.vue index ce540eb8..17d30d84 100644 --- a/ruoyi-ui/src/components/ImageUpload/index.vue +++ b/ruoyi-ui/src/components/ImageUpload/index.vue @@ -1,100 +1,100 @@ - - - - - \ No newline at end of file + + + + + diff --git a/ruoyi-ui/src/store/modules/user.js b/ruoyi-ui/src/store/modules/user.js index 0e451572..c6624e3a 100644 --- a/ruoyi-ui/src/store/modules/user.js +++ b/ruoyi-ui/src/store/modules/user.js @@ -37,8 +37,8 @@ const user = { const uuid = userInfo.uuid return new Promise((resolve, reject) => { login(username, password, code, uuid).then(res => { - setToken(res.token) - commit('SET_TOKEN', res.token) + setToken(res.data.token) + commit('SET_TOKEN', res.data.token) resolve() }).catch(error => { reject(error) @@ -50,11 +50,11 @@ const user = { GetInfo({ commit, state }) { return new Promise((resolve, reject) => { getInfo().then(res => { - const user = res.user + const user = res.data.user const avatar = user.avatar == "" ? require("@/assets/images/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; - if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 - commit('SET_ROLES', res.roles) - commit('SET_PERMISSIONS', res.permissions) + if (res.data.roles && res.data.roles.length > 0) { // 验证返回的roles是否是一个非空数组 + commit('SET_ROLES', res.data.roles) + commit('SET_PERMISSIONS', res.data.permissions) } else { commit('SET_ROLES', ['ROLE_DEFAULT']) } diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index 147117f9..d68f614d 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -99,8 +99,8 @@ export default { methods: { getCode() { getCodeImg().then(res => { - this.codeUrl = "data:image/gif;base64," + res.img; - this.loginForm.uuid = res.uuid; + this.codeUrl = "data:image/gif;base64," + res.data.img; + this.loginForm.uuid = res.data.uuid; }); }, getCookie() { diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index 3cb6df90..84ba9812 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -390,14 +390,14 @@ export default { /** 根据角色ID查询菜单树结构 */ getRoleMenuTreeselect(roleId) { return roleMenuTreeselect(roleId).then(response => { - this.menuOptions = response.menus; + this.menuOptions = response.data.menus; return response; }); }, /** 根据角色ID查询部门树结构 */ getRoleDeptTreeselect(roleId) { return roleDeptTreeselect(roleId).then(response => { - this.deptOptions = response.depts; + this.deptOptions = response.data.depts; return response; }); }, @@ -513,7 +513,7 @@ export default { this.open = true; this.$nextTick(() => { roleMenu.then(res => { - let checkedKeys = res.checkedKeys + let checkedKeys = res.data.checkedKeys checkedKeys.forEach((v) => { this.$nextTick(()=>{ this.$refs.menu.setChecked(v, true ,false); @@ -539,7 +539,7 @@ export default { this.openDataScope = true; this.$nextTick(() => { roleDeptTreeselect.then(res => { - this.$refs.dept.setCheckedKeys(res.checkedKeys); + this.$refs.dept.setCheckedKeys(res.data.checkedKeys); }); }); this.title = "分配数据权限"; @@ -607,4 +607,4 @@ export default { } } }; - \ No newline at end of file + diff --git a/ruoyi-ui/src/views/system/user/index.vue b/ruoyi-ui/src/views/system/user/index.vue index 1a06eb30..ce1d6212 100644 --- a/ruoyi-ui/src/views/system/user/index.vue +++ b/ruoyi-ui/src/views/system/user/index.vue @@ -562,8 +562,8 @@ export default { this.reset(); this.getTreeselect(); getUser().then(response => { - this.postOptions = response.posts; - this.roleOptions = response.roles; + this.postOptions = response.data.posts; + this.roleOptions = response.data.roles; this.open = true; this.title = "添加用户"; this.form.password = this.initPassword; @@ -575,11 +575,11 @@ export default { this.getTreeselect(); const userId = row.userId || this.ids; getUser(userId).then(response => { - this.form = response.data; - this.postOptions = response.posts; - this.roleOptions = response.roles; - this.form.postIds = response.postIds; - this.form.roleIds = response.roleIds; + this.form = response.data.user; + this.postOptions = response.data.posts; + this.roleOptions = response.data.roles; + this.form.postIds = response.data.postIds; + this.form.roleIds = response.data.roleIds; this.open = true; this.title = "修改用户"; this.form.password = ""; diff --git a/ruoyi-ui/src/views/system/user/profile/index.vue b/ruoyi-ui/src/views/system/user/profile/index.vue index 8993cab7..7a3e295b 100644 --- a/ruoyi-ui/src/views/system/user/profile/index.vue +++ b/ruoyi-ui/src/views/system/user/profile/index.vue @@ -81,9 +81,9 @@ export default { methods: { getUser() { getUserProfile().then(response => { - this.user = response.data; - this.roleGroup = response.roleGroup; - this.postGroup = response.postGroup; + this.user = response.data.user; + this.roleGroup = response.data.roleGroup; + this.postGroup = response.data.postGroup; }); } } diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index 266183e6..6ed6314b 100644 --- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -126,7 +126,7 @@ export default { formData.append("avatarfile", data); uploadAvatar(formData).then(response => { this.open = false; - this.options.img = process.env.VUE_APP_BASE_API + response.imgUrl; + this.options.img = process.env.VUE_APP_BASE_API + response.data.imgUrl; store.commit('SET_AVATAR', this.options.img); this.msgSuccess("修改成功"); this.visible = false;