Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sts网站
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
sts网站
Commits
42bb8f64
Commit
42bb8f64
authored
Nov 29, 2023
by
RuoYi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化头像上传参数新增文件名称
parent
72e4cd9f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
userAvatar.vue
ruoyi-ui/src/views/system/user/profile/userAvatar.vue
+9
-7
No files found.
ruoyi-ui/src/views/system/user/profile/userAvatar.vue
View file @
42bb8f64
...
...
@@ -70,12 +70,13 @@ export default {
// 弹出层标题
title
:
"修改头像"
,
options
:
{
img
:
store
.
getters
.
avatar
,
//裁剪图片的地址
autoCrop
:
true
,
// 是否默认生成截图框
autoCropWidth
:
200
,
// 默认生成截图框宽度
autoCropHeight
:
200
,
// 默认生成截图框高度
fixedBox
:
true
,
// 固定截图框大小 不允许改变
outputType
:
"png"
// 默认生成截图为PNG格式
img
:
store
.
getters
.
avatar
,
//裁剪图片的地址
autoCrop
:
true
,
// 是否默认生成截图框
autoCropWidth
:
200
,
// 默认生成截图框宽度
autoCropHeight
:
200
,
// 默认生成截图框高度
fixedBox
:
true
,
// 固定截图框大小 不允许改变
outputType
:
"png"
,
// 默认生成截图为PNG格式
filename
:
'avatar'
// 文件名称
},
previews
:
{},
resizeHandler
:
null
...
...
@@ -125,6 +126,7 @@ export default {
reader
.
readAsDataURL
(
file
);
reader
.
onload
=
()
=>
{
this
.
options
.
img
=
reader
.
result
;
this
.
options
.
filename
=
file
.
name
;
};
}
},
...
...
@@ -132,7 +134,7 @@ export default {
uploadImg
()
{
this
.
$refs
.
cropper
.
getCropBlob
(
data
=>
{
let
formData
=
new
FormData
();
formData
.
append
(
"avatarfile"
,
data
);
formData
.
append
(
"avatarfile"
,
data
,
this
.
options
.
filename
);
uploadAvatar
(
formData
).
then
(
response
=>
{
this
.
open
=
false
;
this
.
options
.
img
=
process
.
env
.
VUE_APP_BASE_API
+
response
.
imgUrl
;
...
...
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