Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
884251d2
authored
Oct 20, 2026
by
renyizhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改用户头像
parent
61c9d5e8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
src/api/system/user.js
+1
-1
src/views/system/user/profile/userAvatar.vue
+5
-2
No files found.
src/api/system/user.js
View file @
884251d2
...
@@ -131,7 +131,7 @@ export function updateUserPwdByCode(data) {
...
@@ -131,7 +131,7 @@ export function updateUserPwdByCode(data) {
// 用户头像上传
// 用户头像上传
export
function
uploadAvatar
(
data
)
{
export
function
uploadAvatar
(
data
)
{
return
request
({
return
request
({
url
:
'/
system/user/profile/
avatar'
,
url
:
'/
member/user/update-
avatar'
,
method
:
'post'
,
method
:
'post'
,
data
:
data
data
:
data
})
})
...
...
src/views/system/user/profile/userAvatar.vue
View file @
884251d2
...
@@ -125,9 +125,12 @@ function uploadImg() {
...
@@ -125,9 +125,12 @@ function uploadImg() {
let
formData
=
new
FormData
();
let
formData
=
new
FormData
();
formData
.
append
(
"avatarfile"
,
data
,
options
.
filename
);
formData
.
append
(
"avatarfile"
,
data
,
options
.
filename
);
uploadAvatar
(
formData
).
then
(
response
=>
{
uploadAvatar
(
formData
).
then
(
response
=>
{
// 后端 createFile 已返回完整 URL(如 http://127.0.0.1:48080/admin-api/infra/file/1/get/avatar/xxx.png),
// 直接使用,避免与 VITE_APP_BASE_API 重复拼接导致 URL 非法
const
avatarUrl
=
response
.
data
;
open
.
value
=
false
;
open
.
value
=
false
;
options
.
img
=
import
.
meta
.
env
.
VITE_APP_BASE_API
+
response
.
img
Url
;
options
.
img
=
avatar
Url
;
userStore
.
avatar
=
options
.
img
;
userStore
.
avatar
=
avatarUrl
;
proxy
.
$modal
.
msgSuccess
(
"修改成功"
);
proxy
.
$modal
.
msgSuccess
(
"修改成功"
);
visible
.
value
=
false
;
visible
.
value
=
false
;
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment