From a254eafa8d230968a52b4b1f021d81f9869c0b3c Mon Sep 17 00:00:00 2001 From: "20932067@zju.edu.cn" Date: Mon, 22 Feb 2021 17:19:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=B4=E5=83=8F=E5=92=8C=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hchyun-ui/src/api/tool/regular.js | 12 ++-- hchyun-ui/src/store/modules/user.js | 5 +- hchyun-ui/src/utils/fileUtils.js | 2 +- .../views/system/user/profile/userAvatar.vue | 6 +- hchyun-ui/src/views/test/downloadtest.vue | 6 +- .../download.vue => utils/uploadFile.vue} | 37 ++++++++---- .../controller/system/LoginController.java | 4 ++ .../controller/system/ProfileController.java | 8 ++- .../src/main/resources/application.yml | 2 +- .../src/main/resources/generator.yml | 0 .../com/hchyun/system/entity/SysFile.java | 11 ++++ .../system/service/impl/FileServiceImpl.java | 9 +++ .../com/hchyun/system/utils/FtpUtils.java | 57 +++++++++++++++++-- .../resources/mapper/system/FileMapper.xml | 5 +- 14 files changed, 128 insertions(+), 36 deletions(-) rename hchyun-ui/src/views/{test/download.vue => utils/uploadFile.vue} (84%) rename hchyun/{hchyun-generator => hchyun-admin}/src/main/resources/generator.yml (100%) diff --git a/hchyun-ui/src/api/tool/regular.js b/hchyun-ui/src/api/tool/regular.js index ec08ffe..6774468 100644 --- a/hchyun-ui/src/api/tool/regular.js +++ b/hchyun-ui/src/api/tool/regular.js @@ -3,7 +3,7 @@ import request from '@/utils/request' // 查询校验规则列表 export function listRegular(query) { return request({ - url: '/system/regular/list', + url: '/tool/regular/list', method: 'get', params: query }) @@ -12,7 +12,7 @@ export function listRegular(query) { // 查询校验规则详细 export function getRegular(id) { return request({ - url: '/system/regular/' + id, + url: '/tool/regular/' + id, method: 'get' }) } @@ -20,7 +20,7 @@ export function getRegular(id) { // 新增校验规则 export function addRegular(data) { return request({ - url: '/system/regular', + url: '/tool/regular', method: 'post', data: data }) @@ -29,7 +29,7 @@ export function addRegular(data) { // 修改校验规则 export function updateRegular(data) { return request({ - url: '/system/regular', + url: '/tool/regular', method: 'put', data: data }) @@ -38,7 +38,7 @@ export function updateRegular(data) { // 删除校验规则 export function delRegular(id) { return request({ - url: '/system/regular/' + id, + url: '/tool/regular/' + id, method: 'delete' }) } @@ -50,4 +50,4 @@ export function exportRegular(query) { method: 'get', params: query }) -} \ No newline at end of file +} diff --git a/hchyun-ui/src/store/modules/user.js b/hchyun-ui/src/store/modules/user.js index 767d334..ba870b4 100644 --- a/hchyun-ui/src/store/modules/user.js +++ b/hchyun-ui/src/store/modules/user.js @@ -51,7 +51,8 @@ const user = { return new Promise((resolve, reject) => { getInfo(state.token).then(res => { const user = res.user - const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; + // const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : process.env.VUE_APP_BASE_API + user.avatar; + const avatar = user.avatar == "" ? require("@/assets/image/profile.jpg") : user.avatar; if (res.roles && res.roles.length > 0) { // 验证返回的roles是否是一个非空数组 commit('SET_ROLES', res.roles) commit('SET_PERMISSIONS', res.permissions) @@ -66,7 +67,7 @@ const user = { }) }) }, - + // 退出系统 LogOut({ commit, state }) { return new Promise((resolve, reject) => { diff --git a/hchyun-ui/src/utils/fileUtils.js b/hchyun-ui/src/utils/fileUtils.js index 89af810..33396d4 100644 --- a/hchyun-ui/src/utils/fileUtils.js +++ b/hchyun-ui/src/utils/fileUtils.js @@ -22,7 +22,7 @@ export function uploadFile(data) { } }).then(res => { if (res.data.code === 200) { - return res.data + return res.data.data } else { Message({ message: res.data.msg, diff --git a/hchyun-ui/src/views/system/user/profile/userAvatar.vue b/hchyun-ui/src/views/system/user/profile/userAvatar.vue index 37ae1dd..9606bc5 100644 --- a/hchyun-ui/src/views/system/user/profile/userAvatar.vue +++ b/hchyun-ui/src/views/system/user/profile/userAvatar.vue @@ -126,7 +126,9 @@ 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.imgUrl; + + this.options.img = response.imgUrl; store.commit('SET_AVATAR', this.options.img); this.msgSuccess("修改成功"); this.visible = false; @@ -139,4 +141,4 @@ export default { } } }; - \ No newline at end of file + diff --git a/hchyun-ui/src/views/test/downloadtest.vue b/hchyun-ui/src/views/test/downloadtest.vue index 8a6b367..09560c9 100644 --- a/hchyun-ui/src/views/test/downloadtest.vue +++ b/hchyun-ui/src/views/test/downloadtest.vue @@ -1,18 +1,18 @@