Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pet-finance-web
Project
Project
Details
Activity
Releases
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
刘怀志
pet-finance-web
Commits
b8f538a9
Commit
b8f538a9
authored
Aug 09, 2023
by
刘怀志
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
上传图片功能修改
parent
20b37ad5
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
243 additions
and
27 deletions
+243
-27
config.js
src/api/system/config.js
+8
-0
index.vue
src/components/ImageUpload/index.vue
+158
-27
index.vue
src/components/imageCropper/index.vue
+77
-0
No files found.
src/api/system/config.js
View file @
b8f538a9
...
...
@@ -58,3 +58,11 @@ export function refreshCache() {
method
:
'delete'
})
}
export
function
uploadCommon
(
data
)
{
return
request
({
headers
:
{
'Content-Type'
:
'multipart/form-data'
},
url
:
'/common/upload'
,
method
:
'post'
,
data
})
}
src/components/ImageUpload/index.vue
View file @
b8f538a9
This diff is collapsed.
Click to expand it.
src/components/imageCropper/index.vue
0 → 100644
View file @
b8f538a9
<
template
>
<div
class=
"image-cropper-modal"
>
<el-dialog
:visible=
"visible"
:append-to-body=
"true"
:close-on-click-modal=
"false"
title=
"裁剪图片"
width=
"700px"
class=
"image-cropper-dialog"
@
close=
"visible = false"
>
<vue-cropper
ref=
"imageCropper"
:img=
"url"
:auto-crop-width=
"autoCropWidth"
:auto-crop-height=
"autoCropHeight"
:auto-crop=
"true"
:fixed=
"false"
:fixed-number=
"[1, 1]"
:fixed-box=
"true"
:output-size=
"1"
output-type=
"png"
/>
<template
#
footer
>
<span
class=
"dialog-footer"
>
<el-button
class=
"common-btn cancel"
@
click=
"onCancel"
>
取 消
</el-button>
<el-button
class=
"common-btn confirm"
type=
"primary"
@
click=
"onConfirm"
>
确 定
</el-button>
</span>
</
template
>
</el-dialog>
</div>
</template>
<
script
>
import
{
VueCropper
}
from
'vue-cropper'
export
default
{
name
:
'ImageCropperModal'
,
components
:
{
VueCropper
},
props
:
{
visible
:
{
type
:
Boolean
,
default
:
false
},
url
:
{
type
:
String
,
default
:
''
},
autoCropWidth
:
{
type
:
String
,
default
:
`
${
100
*
4
}
`
},
autoCropHeight
:
{
type
:
String
,
default
:
`
${
100
*
4
}
`
}
},
methods
:
{
onCancel
()
{
this
.
$emit
(
'cancel'
)
},
onConfirm
()
{
this
.
$refs
.
imageCropper
.
getCropBlob
((
blob
)
=>
{
this
.
$emit
(
'confirm'
,
blob
)
})
}
}
}
</
script
>
<
style
lang=
"scss"
scoped
>
.image-cropper-dialog
{
.vue-cropper
{
height
:
500px
;
}
}
</
style
>
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