Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
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
e6a9dd0e
authored
Aug 28, 2023
by
xingyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 个人中心头像为空时不能修改
parent
e8dce93d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
src/components/Cropper/src/CropperAvatar.vue
+2
-0
src/views/Profile/components/UserAvatar.vue
+3
-5
No files found.
src/components/Cropper/src/CropperAvatar.vue
View file @
e6a9dd0e
<
template
>
<div
class=
"user-info-head"
@
click=
"open()"
>
<img
v-if=
"sourceValue"
:src=
"sourceValue"
alt=
"avatar"
class=
"img-circle img-lg"
/>
<img
v-if=
"!sourceValue"
:src=
"avatar"
alt=
"avatar"
class=
"img-circle img-lg"
/>
<el-button
v-if=
"showBtn"
:class=
"`$
{prefixCls}-upload-btn`" @click="open()">
{{
btnText
?
btnText
:
t
(
'cropper.selectImage'
)
}}
</el-button>
...
...
@@ -17,6 +18,7 @@ import { useDesign } from '@/hooks/web/useDesign'
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
useI18n
}
from
'vue-i18n'
import
CopperModal
from
'./CopperModal.vue'
import
avatar
from
'@/assets/imgs/avatar.jpg'
defineOptions
({
name
:
'CropperAvatar'
})
...
...
src/views/Profile/components/UserAvatar.vue
View file @
e6a9dd0e
...
...
@@ -4,7 +4,7 @@
ref=
"cropperRef"
:btnProps=
"
{ preIcon: 'ant-design:cloud-upload-outlined' }"
:showBtn="false"
:value="
avatar
"
:value="
img
"
width="120px"
@change="handelUpload"
/>
...
...
@@ -13,15 +13,13 @@
<
script
lang=
"ts"
setup
>
import
{
propTypes
}
from
'@/utils/propTypes'
import
{
uploadAvatar
}
from
'@/api/system/user/profile'
import
{
CropperAvatar
}
from
'@/components/Cropper'
defineOptions
({
name
:
'UserAvatar'
})
const
props
=
defineProps
({
defineProps
({
img
:
propTypes
.
string
.
def
(
''
)
})
const
avatar
=
computed
(()
=>
{
return
props
.
img
})
const
cropperRef
=
ref
()
const
handelUpload
=
async
({
data
})
=>
{
...
...
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