Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
任超
/
js.portalStaticPage
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
c2e47dbc
authored
2020-12-23 13:49:23 +0800
by
任超
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
style:图片上传
1 parent
9ecccd74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
10 deletions
staticCss/pageHome.css
staticCss/yysq.css
staticJs/onlineApply/houseFill.js
staticCss/pageHome.css
View file @
c2e47db
...
...
@@ -25,6 +25,7 @@ div.banner {
.banner
.swiper_img
{
width
:
100%
;
height
:
100%
;
}
.banner
.banner_title
{
...
...
staticCss/yysq.css
View file @
c2e47db
...
...
@@ -439,6 +439,10 @@ input[type='file'] {
.conImageUpdate
{
width
:
100%
;
min-height
:
290px
;
border
:
1px
solid
#DEDEDE
;
border-radius
:
5px
;
padding
:
10px
0
;
box-sizing
:
border-box
;
}
.itemImageUpdate
{
margin-right
:
15px
;
...
...
@@ -479,5 +483,6 @@ input[type='file'] {
margin-right
:
10px
;
height
:
240px
;
width
:
70px
;
line-height
:
240px
;
text-align
:
center
;
writing-mode
:
vertical-lr
;
}
\ No newline at end of file
...
...
staticJs/onlineApply/houseFill.js
View file @
c2e47db
...
...
@@ -319,15 +319,21 @@ function AddCLxxClick() {
$
(
this
).
next
().
click
();
//隐藏了input:file样式后,点击头像就可以本地上传
$
(
this
).
next
().
on
(
"change"
,
function
()
{
var
objUrl
=
getObjectURL
(
this
.
files
[
0
]);
//获取图片的路径,该路径不是图片在本地的路径
var
file
=
this
.
files
[
0
].
type
;
if
(
file
==
''
)
{
layer
.
msg
(
'请上传,jpg,png,jpeg,gif格式文件'
);
return
false
;
}
if
(
objUrl
)
{
let
bsm_slclmx
=
UploadPicture
(
this
.
files
[
0
],
$
(
this
).
parent
().
parent
().
prop
(
"id"
));
if
(
bsm_slclmx
==
""
)
{
let
imageData
=
UploadPicture
(
this
.
files
[
0
],
$
(
this
).
parent
().
parent
().
prop
(
"id"
));
console
.
log
(
999
,
imageData
)
if
(
imageData
.
bsm_slclmx
==
""
)
{
layer
.
msg
(
'图片上传失败,请稍后上传!'
);
}
else
{
layer
.
msg
(
'图片上传成功'
);
$
(
this
).
prev
().
attr
(
"src"
,
obj
Url
);
//将图片路径存入src中,显示出图片
$
(
this
).
parent
().
attr
(
"id"
,
bsm_slclmx
);
$
(
this
).
prev
().
attr
(
"src"
,
imageData
.
preView
Url
);
//将图片路径存入src中,显示出图片
$
(
this
).
parent
().
attr
(
"id"
,
imageData
.
bsm_slclmx
);
$
(
this
).
parent
().
find
(
'.mask'
).
show
();
}
}
...
...
@@ -336,6 +342,7 @@ function AddCLxxClick() {
//del
$
(
document
).
on
(
"click"
,
".delete"
,
function
(
e
)
{
let
imgObj
=
$
(
this
).
parent
().
parent
().
siblings
(
".pic"
);
let
mask
=
$
(
this
).
parent
().
parent
();
let
file
=
$
(
this
).
parent
().
parent
().
siblings
(
"input[type='file']"
);
let
slclmxObj
=
$
(
this
).
parent
().
parent
().
parent
();
layer
.
confirm
(
'此操作将删除图片是否继续'
,
{
...
...
@@ -352,13 +359,14 @@ function AddCLxxClick() {
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
)
{
layer
.
msg
(
result
.
message
);
mask
.
hide
();
imgObj
.
attr
(
"src"
,
"../../staticImages/update.png"
);
file
.
after
(
file
.
clone
().
val
(
""
));
file
.
remove
();
slclmxObj
.
attr
(
"id"
,
""
);
}
else
{
layer
.
msg
(
'删除失败!'
);
}
}
});
...
...
@@ -368,7 +376,9 @@ function AddCLxxClick() {
})
// 放大
$
(
document
).
on
(
"click"
,
".enlarge"
,
function
(
e
)
{
var
imgHtml
=
"<img src='../../staticImages/update.png' />"
;
let
src
=
$
(
this
).
parent
().
parent
().
siblings
(
".pic"
).
attr
(
'src'
)
console
.
log
(
$
(
this
).
parent
().
parent
().
siblings
(
".pic"
).
attr
(
'src'
))
var
imgHtml
=
"<img style='width:1000px;height:600px' src='"
+
src
+
"' />"
;
layer
.
open
({
type
:
1
,
title
:
false
,
...
...
@@ -383,7 +393,7 @@ function AddCLxxClick() {
// 图片上传
function
UploadPicture
(
flie
,
bsmCl
)
{
let
bsm_slclmx
=
""
;
let
imageData
;
let
formData
=
new
FormData
();
formData
.
append
(
'bsmCl'
,
bsmCl
);
formData
.
append
(
'files'
,
flie
);
...
...
@@ -399,11 +409,11 @@ function UploadPicture(flie, bsmCl) {
//数据,这里使用的是Json格式进行传输
success
:
function
(
result
)
{
//返回数据根据结果进行相应的处理
if
(
result
.
code
==
200
)
{
bsm_slclmx
=
result
.
data
[
0
].
bsmSlclmx
;
imageData
=
result
.
data
[
0
]
;
}
}
});
return
bsm_slclmx
;
return
imageData
;
}
...
...
Please
register
or
sign in
to post a comment