Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
W
WebPublic
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
前端开发小组
WebPublic
Commits
fccb60ca
提交
fccb60ca
authored
3 年前
作者:
钟是志
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
上级
f9cd0322
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
26 行删除
+38
-26
UploadCom.js
one_stop_public/libs/UploadCom.js
+14
-4
UploadComDiyForQnZy.js
one_stop_public/libs/UploadComDiyForQnZy.js
+24
-22
没有找到文件。
one_stop_public/libs/UploadCom.js
浏览文件 @
fccb60ca
...
...
@@ -5,6 +5,17 @@ import config from "@/webPublic/one_stop_public/config";
import
styles
from
"./style.less"
;
import
UploadComDiyForQnZy
from
"@/webPublic/one_stop_public/libs/UploadComDiyForQnZy"
;
export
function
checkIsImage
(
path
){
if
(
!
path
){
return
false
;
}
let
p
=
path
.
toLowerCase
();
let
find
=
[
'.jpg'
,
'.png'
,
'.jpeg'
,
'.bmp'
,
'.gif'
].
find
((
x
)
=>
{
return
path
.
indexOf
(
x
)
>
-
1
;
});
return
!!
find
;
}
export
default
function
index
(
props
)
{
if
(
window
.
location
.
href
.
indexOf
(
"jy/geren/subsidy"
)
>
-
1
)
{
...
...
@@ -79,7 +90,6 @@ class UploadCom extends React.Component {
showUploadList
:
false
,
onChange
:
this
.
changeUrl
};
console
.
log
(
"---------asdasd-------"
,
this
.
props
,
this
.
state
);
return
(
<
div
>
{
" "
}
...
...
@@ -93,7 +103,7 @@ class UploadCom extends React.Component {
<
/Upload
>
<
ul
style
=
{{
paddingLeft
:
8
,
display
:
"flex"
}}
>
{(
files
||
[]).
map
((
f
)
=>
{
if
(
(
f
.
path
&&
f
.
path
.
indexOf
(
".png"
)
!==
-
1
)
||
f
.
path
.
indexOf
(
".jpg"
)
!==
-
1
)
{
if
(
f
.
path
&&
checkIsImage
(
f
.
path
)
)
{
return
(
<
li
key
=
{
f
.
path
}
className
=
{
styles
.
preview_img
}
>
<
div
className
=
{
styles
.
preview_div
}
>
...
...
@@ -144,9 +154,9 @@ class UploadCom extends React.Component {
visible
=
{
previewVisible
}
footer
=
{
null
}
onCancel
=
{()
=>
this
.
setState
({
previewVisible
:
false
})}
width
=
{
1200
}
width
=
{
'90vw'
}
>
<
img
alt
=
"example"
style
=
{{
minWidth
:
"100%"
,
}}
src
=
{
previewImage
}
/
>
<
img
alt
=
"example"
style
=
{{
width
:
"100%"
,
height
:
'auto'
}}
src
=
{
previewImage
}
/
>
<
/Modal
>
<
/div
>
);
...
...
This diff is collapsed.
Click to expand it.
one_stop_public/libs/UploadComDiyForQnZy.js
浏览文件 @
fccb60ca
...
...
@@ -3,6 +3,7 @@ import { Button, Icon, message, Modal, Upload } from "antd";
import
{
queryApiActionPath
}
from
"../utils/queryConfig"
;
import
config
from
"@/webPublic/one_stop_public/config"
;
import
styles
from
"./style.less"
;
import
{
checkIsImage
}
from
"./UploadCom"
;
// 为黔南职院单独写的 上传组件 用于 bug 20576 个人就业信息/求职创业补贴申报,201801010006 119242 上传图片加限制,跟签约派遣上传图片加限制一样
...
...
@@ -14,14 +15,16 @@ export default class UploadComDiyForQnZy extends React.Component {
this
.
state
=
{
files
:
value
.
files
,
previewVisible
:
false
,
previewImage
:
''
,
previewImage
:
""
};
}
//图片上传之前进行判断
beforeUpload
=
(
file
)
=>
{
const
isSize
=
this
.
isSize
(
file
);
return
isSize
;
return
this
.
isSize
(
file
).
then
((
res
)
=>
{
message
.
info
(
"正在上传中,请等待"
);
return
true
;
});
};
//检测尺寸
...
...
@@ -36,14 +39,13 @@ export default class UploadComDiyForQnZy extends React.Component {
valid
?
resolve
()
:
reject
();
};
img
.
src
=
_URL
.
createObjectURL
(
file
);
}).
then
(
()
=>
{
}).
then
(()
=>
{
return
file
;
},
()
=>
{
message
.
error
(
file
.
name
+
'图片尺寸不符合要求,需要上传高清图像 1080像素及以上,请修改后重新上传!'
);
message
.
error
(
file
.
name
+
"图片尺寸不符合要求,需要上传高清图像 1080像素及以上,请修改后重新上传!"
);
return
Promise
.
reject
();
}
,
}
);
};
...
...
@@ -57,22 +59,22 @@ export default class UploadComDiyForQnZy extends React.Component {
componentWillReceiveProps
(
nextProps
)
{
// Should be a controlled component.
if
(
'value'
in
nextProps
)
{
if
(
"value"
in
nextProps
)
{
const
value
=
nextProps
.
value
;
this
.
setState
(
value
);
}
}
changeUrl
=
(
info
)
=>
{
if
(
info
.
file
.
status
===
'done'
)
{
if
(
info
.
file
.
status
===
"done"
)
{
message
.
success
(
`
${
info
.
file
.
name
}
上传成功`
);
const
files
=
this
.
state
.
files
;
files
.
push
({
path
:
info
.
file
.
response
,
name
:
info
.
file
.
name
});
if
(
!
(
'value'
in
this
.
props
))
{
if
(
!
(
"value"
in
this
.
props
))
{
this
.
setState
({
files
});
}
this
.
triggerChange
({
files
});
}
else
if
(
info
.
file
.
status
===
'error'
)
{
}
else
if
(
info
.
file
.
status
===
"error"
)
{
message
.
error
(
`
${
info
.
file
.
name
}
上传失败`
);
}
};
...
...
@@ -84,7 +86,7 @@ export default class UploadComDiyForQnZy extends React.Component {
break
;
}
}
if
(
!
(
'value'
in
this
.
props
))
{
if
(
!
(
"value"
in
this
.
props
))
{
this
.
setState
({
files
});
}
this
.
triggerChange
({
files
});
...
...
@@ -94,25 +96,24 @@ export default class UploadComDiyForQnZy extends React.Component {
const
{
files
,
previewVisible
,
previewImage
}
=
this
.
state
;
const
{
isMultiple
,
accept
,
btnName
,
disabled
}
=
this
.
props
;
const
props
=
{
name
:
'file'
,
name
:
"file"
,
multiple
:
isMultiple
,
accept
:
accept
,
action
:
config
.
uploadUrl
,
showUploadList
:
false
,
onChange
:
this
.
changeUrl
,
beforeUpload
:
this
.
beforeUpload
,
beforeUpload
:
this
.
beforeUpload
};
console
.
log
(
'---------asdasd-------'
,
this
.
props
,
this
.
state
);
return
(
<
div
>
{
' '
}
{
" "
}
<
Upload
{...
props
}
disabled
=
{
disabled
}
>
{
!
disabled
&&
(
<>
<
Button
>
<
Icon
type
=
"upload"
/>
{
btnName
?
btnName
:
'上传附件'
}
{
btnName
?
btnName
:
"上传附件"
}
<
/Button
>
<
div
>
(注:必须上传高清扫描件
,
图像高至少是
1080
px
,宽至少是
1080
px
)
...
...
@@ -120,9 +121,9 @@ export default class UploadComDiyForQnZy extends React.Component {
<
/
>
)}
<
/Upload
>
<
ul
style
=
{{
paddingLeft
:
8
,
display
:
'flex'
}}
>
<
ul
style
=
{{
paddingLeft
:
8
,
display
:
"flex"
}}
>
{(
files
||
[]).
map
((
f
)
=>
{
if
((
f
.
path
&&
f
.
path
.
indexOf
(
'.png'
)
!==
-
1
)
||
f
.
path
.
indexOf
(
'.jpg'
)
!==
-
1
)
{
if
(
f
.
path
&&
checkIsImage
(
f
.
path
)
)
{
return
(
<
li
key
=
{
f
.
path
}
className
=
{
styles
.
preview_img
}
>
<
div
className
=
{
styles
.
preview_div
}
>
...
...
@@ -137,7 +138,7 @@ export default class UploadComDiyForQnZy extends React.Component {
// window.open(queryApiActionPath() + f.path);
this
.
setState
({
previewVisible
:
true
,
previewImage
:
queryApiActionPath
()
+
f
.
path
,
previewImage
:
queryApiActionPath
()
+
f
.
path
});
}}
>
<
Icon
type
=
"eye"
className
=
{
styles
.
icon_eye
}
/
>
...
...
@@ -157,7 +158,7 @@ export default class UploadComDiyForQnZy extends React.Component {
<
li
key
=
{
f
.
path
}
>
<
a
target
=
"_blank"
key
=
{
f
.
path
}
href
=
{
queryApiActionPath
()
+
f
.
path
}
>
{
f
.
name
}
<
/a>{' '
}
<
/a>{" "
}
{
!
disabled
&&
(
<
Icon
style
=
{{
marginLeft
:
10
}}
...
...
@@ -172,8 +173,9 @@ export default class UploadComDiyForQnZy extends React.Component {
<
Modal
visible
=
{
previewVisible
}
footer
=
{
null
}
width
=
{
'90vw'
}
onCancel
=
{()
=>
this
.
setState
({
previewVisible
:
false
})}
>
<
img
alt
=
"example"
style
=
{{
width
:
'100%'
}}
src
=
{
previewImage
}
/
>
<
img
alt
=
"example"
style
=
{{
width
:
"100%"
}}
src
=
{
previewImage
}
/
>
<
/Modal
>
<
/div
>
);
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论