Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
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
hujun
tl_estate
Commits
d361cee4
Commit
d361cee4
authored
Feb 15, 2019
by
duxinyuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改图片上传方式和内容,修改人:杜欣源
parent
cfeccaf1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
12 deletions
+99
-12
banner.js
public/resource/js/banner.js
+79
-5
banner_template_tpl.html
public/resource/template/banner_template_tpl.html
+20
-7
No files found.
public/resource/js/banner.js
View file @
d361cee4
...
@@ -6,6 +6,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -6,6 +6,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
pageNo
:
1
,
/*第几页*/
pageNo
:
1
,
/*第几页*/
pageSize
:
5
,
/*每页显示多少条*/
pageSize
:
5
,
/*每页显示多少条*/
datas
:
""
,
datas
:
""
,
imageName
:
""
,
init
:
function
()
{
init
:
function
()
{
//初始化dot
//初始化dot
$
(
"body"
).
append
(
template
);
$
(
"body"
).
append
(
template
);
...
@@ -13,10 +14,44 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -13,10 +14,44 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
banner
.
getBannerList
(
1
);
banner
.
getBannerList
(
1
);
},
},
event
:
function
()
{
event
:
function
()
{
var
that
=
this
;
/*上传图片控件*/
/*上传图片控件*/
$
(
".banner_img"
).
click
(
function
()
{
// $ (".banner_img").click (function () {
BrowseServer
(
'cover_image'
);
// BrowseServer ('cover_image');
});
// });
alert
(
"ggog"
)
//附件上传处理事件
$
(
"#cover_image"
).
change
(
function
()
{
var
_this
=
$
(
this
),
_spFile
=
_this
.
data
(
'spfile'
),
_limitTop
=
_this
.
data
(
'limittop'
),
_fileNum
=
_this
.
parent
().
next
().
find
(
'.delet-pic-btn'
).
length
;
//根据删除按钮的个数,确定文件的个数
console
.
log
(
"123123"
)
if
(
_limitTop
&&
(
_fileNum
<
_limitTop
))
{
console
.
log
(
"啊发撒"
)
banner
.
uploadImg
(
_this
);
}
else
{
alert
(
'上传上限为 '
+
_limitTop
);
return
false
;
};
});
//图片,附件上传删除键事件
$
(
document
).
on
(
'click'
,
'.delet-pic-btn'
,
function
(
e
)
{
var
_this
=
$
(
this
);
e
.
preventDefault
();
e
.
stopPropagation
();
$
(
this
).
parent
().
parent
().
remove
();
/*if(confirm('确定删除该图片吗?')) {
var _imgId = _this.parent().attr('data-imgid');
var file_id = $(this).parent('li').attr('id') - 0 ;
_this.parent().remove();
user.addDeleteNewsEvent(file_id);
};*/
});
$
(
"#add_banner"
).
on
(
"click"
,
function
()
{
$
(
"#add_banner"
).
on
(
"click"
,
function
()
{
$
(
"#editor_modal_title"
).
html
(
"添加广告"
);
$
(
"#editor_modal_title"
).
html
(
"添加广告"
);
...
@@ -32,7 +67,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -32,7 +67,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
params
.
title
=
$
(
"#title"
).
val
();
params
.
title
=
$
(
"#title"
).
val
();
params
.
url
=
$
(
"#url"
).
val
();
params
.
url
=
$
(
"#url"
).
val
();
params
.
cover_image
=
$
(
"#cover_image"
).
val
();
params
.
cover_image
=
banner
.
imageName
;
//
$ ("#cover_image").val ();
params
.
sort
=
$
(
"#sort"
).
val
();
params
.
sort
=
$
(
"#sort"
).
val
();
var
banner_type
=
$
(
"input[name=banner_type]:checked"
).
val
();
var
banner_type
=
$
(
"input[name=banner_type]:checked"
).
val
();
...
@@ -187,7 +222,46 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -187,7 +222,46 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
}
}
});
});
}
},
//上传图片
uploadImg
:
function
(
_this
){
var
formData
=
new
FormData
();
formData
.
append
(
'type'
,
'shop_image_depot'
);
formData
.
append
(
'image'
,
_this
[
0
].
files
[
0
]);
$
.
ajax
({
type
:
'post'
,
url
:
'http://images.tonglianjituan.com/index/uploadImg'
,
data
:
formData
,
dataType
:
'json'
,
contentType
:
false
,
cache
:
false
,
processData
:
false
,
beforeSend
:
function
()
{},
success
:
function
(
_data
)
{
if
(
_data
.
code
==
200
)
{
var
_url
=
_data
.
data
.
internet_img_name
;
var
tag
=
''
;
tag
+=
'<div class="col-xs-3 pictures" id='
+
_data
.
data
.
img_path
+
'>'
;
tag
+=
' <img src="http://images.tonglianjituan.com/'
+
_url
+
'" class="" id="" width="90%">'
;
tag
+=
' <div style="text-align:center" id="'
+
_data
.
data
.
img_path
+
'"><a href="javascript:;" class="delet-pic-btn">删除</a></div>'
;
tag
+=
'</div>'
;
$
(
'.img_area'
).
append
(
tag
)
;
banner
.
imageName
=
_data
.
data
.
img_path
;
}
else
{
alert
(
_data
.
msg
);
};
},
error
:
function
()
{
alert
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
alert
(
'请求超时,请重试'
);
};
}
});
},
};
};
return
banner
return
banner
});
});
public/resource/template/banner_template_tpl.html
View file @
d361cee4
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
<
td
>
[
%=
it
[
item
][
"title"
]
%
]
<
/td
>
<
td
>
[
%=
it
[
item
][
"title"
]
%
]
<
/td
>
<
td
>
<
td
>
<
input
type
=
"hidden"
value
=
'[%= it[item]["pic_path"] %]'
>
<
input
type
=
"hidden"
value
=
'[%= it[item]["pic_path"] %]'
>
<
img
src
=
'
/resource/lib/Attachments
/[%= it[item]["pic_path"] %]'
class
=
"diagram-image J_preview"
<
img
src
=
'
http://images.tonglianjituan.com/static/shop_image_depot
/[%= it[item]["pic_path"] %]'
class
=
"diagram-image J_preview"
data
-
bimg
=
'
/resource/lib/Attachments
/[%= it[item]["pic_path"] %]'
>
data
-
bimg
=
'
http://images.tonglianjituan.com/static/shop_image_depot
/[%= it[item]["pic_path"] %]'
>
<
/td
>
<
/td
>
<
td
>
<
td
>
...
@@ -115,13 +115,26 @@
...
@@ -115,13 +115,26 @@
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
图片:
</label>
<label
class=
"col-sm-3 control-label"
>
图片:
</label>
<div
class=
"col-sm-9"
>
<!--<div class="col-sm-9">
<input
readonly=
"readonly"
type=
"text"
name=
"cover_image"
class=
"form-control"
<input class="btn btn-default" type="file" id="file_input" data-limittop="10" /> <!-- 修改上传文件的最大数字-->
style=
"width: 150px !important;display: inline-block"
<!--<button class="btn btn-default">选择图片</button>
id=
"cover_image"
class=
"require"
placeholder=
"请选择图片"
/>
<input readonly="readonly" type="file" name="cover_image" class="btn btn-default"
id="cover_image" data-limittop="1"/>
<button class="banner_img btn btn-default" type="button">选择图片</button>
<button class="banner_img btn btn-default" type="button">选择图片</button>
<span class="tip">建议尺寸288x320</span>
<span class="tip">建议尺寸288x320</span>
</div>
</div>-->
<div
class=
"col-xs-9 p-a-0"
>
<div
class=
"file-upload-area p-a-0 "
>
<ul
class=
"img-pre-ul"
id=
"fujian_ul"
></ul>
<div
class=
"btn-area"
>
<input
class=
"btn btn-default"
type=
"file"
id=
"cover_image"
name=
"cover_image"
data-limittop=
"1"
/>
<!--修改上传文件的最大数字-->
<button
class=
"btn btn-default"
>
选择图片
</button>
</div>
<div
class=
"col-xs-12 img_area p-t-10"
>
</div>
</div>
</div>
</div>
</div>
<div
class=
"form-group"
>
<div
class=
"form-group"
>
<label
class=
"col-sm-3 control-label"
>
排序:
</label>
<label
class=
"col-sm-3 control-label"
>
排序:
</label>
...
...
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