Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
techbook
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
front-end-dev
techbook
Commits
9f615480
Commit
9f615480
authored
Feb 25, 2020
by
zhangyanni
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
fb8b4ed6
edf1940c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
0 deletions
+77
-0
proactivity.vue
src/views/publishactivity/proactivity.vue
+0
-0
upimg.vue
src/views/publishactivity/upimg.vue
+77
-0
No files found.
src/views/publishactivity/proactivity.vue
View file @
9f615480
This diff is collapsed.
Click to expand it.
src/views/publishactivity/upimg.vue
0 → 100644
View file @
9f615480
<
template
>
<div>
<el-upload
:class=
"
{hide:imagesIf}"
class="uploadImgCircle imgwidth"
name="fileUpload"
list-type="picture-card"
:action=uploadHostHeader
:multiple="false"
:limit="1"
:file-list="fileList"
:on-success="uploadComplete"
:before-upload="handleBeforeFile"
:on-remove="handleRemove"
>
<i
class=
"iconfont icon-jiahao"
></i>
<p
class=
"uploadImgTitle"
>
{{
$t
(
"personalAuth.businessCardimg"
)
}}
</p>
</el-upload>
</div>
</
template
>
<
script
>
export
default
{
name
:
"upimg"
,
props
:[
'upmax'
],
data
(){
return
{
fileList
:[],
//上传存放路径
dialogImageUrl
:
""
,
//上传存放图片
imagesIf
:
false
,
//禁止上传
uploadHostHeader
:
'/base/upload/uploadPicture'
,
//图片上传地址
}
},
methods
:{
//附件上传之前判断文件格式
handleBeforeFile
(
file
)
{
var
nameArr
=
file
.
name
.
split
(
'.'
);
const
isPng
=
nameArr
[
nameArr
.
length
-
1
]
===
'png'
;
const
isJpg
=
nameArr
[
nameArr
.
length
-
1
]
===
'jpg'
;
const
isPNG
=
nameArr
[
nameArr
.
length
-
1
]
===
'PNG'
;
const
isJPG
=
nameArr
[
nameArr
.
length
-
1
]
===
'JPG'
;
const
isLt2M
=
file
.
size
/
1024
/
1024
<=
this
.
upmax
;
if
(
!
isPNG
&&
!
isJPG
&&
!
isPng
&&
!
isJpg
)
{
this
.
$message
.
error
(
this
.
$t
(
'releasejson.compantype'
));
}
else
if
(
!
isLt2M
){
if
(
this
.
upmax
==
5
){
this
.
$message
.
error
(
'上传图片大小不能超过 5MB'
)
}
else
{
this
.
$message
.
error
(
this
.
$t
(
'releasejson.compansize'
));
}
}
return
(
isPNG
||
isJPG
||
isPng
||
isJpg
)
&&
isLt2M
;
},
//删除上传文件
handleRemove
(){
this
.
fileList
=
[];
this
.
imagesIf
=
false
;
this
.
$emit
(
'dataEvent'
,
''
);
// this.formData.companyLogoUrl = '';
},
//上传文件成功回调
uploadComplete
(
res
,
file
){
this
.
$emit
(
'dataEvent'
,
res
.
result
.
fileUpload
);
// this.formData.companyLogoUrl = res.result.fileUpload;
this
.
imagesIf
=
true
;
// this.$refs.formimg.clearValidate();
},
},
}
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
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