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
4178f7cc
Commit
4178f7cc
authored
Aug 30, 2018
by
xinyuandu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增
parent
f284e951
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
253 additions
and
0 deletions
+253
-0
pictureShow.js
public/resource/js/pictureShow.js
+253
-0
No files found.
public/resource/js/pictureShow.js
0 → 100644
View file @
4178f7cc
/**
* Created by xinyuan.du time at 2018/8/30.
* author : xinyuan.du
* time : 2018/08/30
* about : 商铺图库
*/
define
([
'doT'
,
'text!temp/phonelist_template_tpl.html'
,
'css!style/home.css'
,
'ckfinder'
,
'ckfinderStart'
,
'pagination'
,
'bootstrapJs'
],
function
(
doT
,
template
)
{
picture
=
{
pageNo
:
1
,
/*第几页*/
pageSize
:
10
,
/*每页显示多少条*/
id
:
''
,
house_id
:
''
,
type
:
''
,
valueCurrent
:
''
,
ajaxObj
:
''
,
stopstatus
:
true
,
boxphoto
:
''
,
init
:
function
()
{
//初始化dot
$
(
"body"
).
append
(
template
);
picture
.
getList
();
picture
.
event
();
},
event
:
function
()
{
$
(
"#search"
).
click
(
function
()
{
picture
.
getList
(
1
);
});
$
(
"#reset"
).
click
(
function
()
{
//重置
document
.
getElementById
(
"form_search"
).
reset
();
});
$
(
'#add_picture'
).
click
(
function
(){
});
$
(
'#modal'
).
on
(
'show.bs.modal'
,
function
(){
picture
.
getYetai
();
});
$
(
'#modal'
).
on
(
'hide.bs.modal'
,
function
(){
$
(
'#yetai_id'
).
empty
();
});
$
(
document
).
on
(
'click'
,
'.yetai_checkbox'
,
function
(
e
){
if
(
$
(
this
).
hasClass
(
"isCheck"
)
){
$
(
this
).
css
(
"background-color"
,
"#FFFFFF"
);
$
(
this
).
removeClass
(
"isCheck"
);
}
else
{
$
(
this
).
css
(
"background-color"
,
"royalblue"
);
$
(
this
).
addClass
(
"isCheck"
);
}
console
.
log
(
$
(
this
).
html
())
});
$
(
'#save'
).
click
(
function
(){
var
aaa
=
''
;
$
(
'.yetai_checkbox'
).
each
(
function
(){
if
(
$
(
this
).
hasClass
(
"isCheck"
)
){
aaa
+=
$
(
this
).
html
()
+
","
;
}
});
console
.
log
(
aaa
.
substr
(
0
,
aaa
.
length
-
1
));
picture
.
savePicture
(
aaa
.
substr
(
0
,
aaa
.
length
-
1
));
});
$
(
'#modal'
).
find
(
'select#leased'
).
change
(
function
(){
if
(
$
(
'#modal'
).
find
(
'select#leased option:selected'
).
val
()
==
0
){
$
(
'.yetai-area'
).
hide
();
}
else
if
(
$
(
'#modal'
).
find
(
'select#leased option:selected'
).
val
()
==
1
){
$
(
'.yetai-area'
).
show
();
}
else
{
$
(
'.yetai-area'
).
show
();
}
});
//附件上传处理事件
$
(
"#file_input"
).
change
(
function
()
{
var
_this
=
$
(
this
),
_spFile
=
_this
.
data
(
'spfile'
),
_limitTop
=
_this
.
data
(
'limittop'
),
_fileNum
=
_this
.
parent
().
next
().
find
(
'.delet-pic-btn'
).
length
;
//根据删除按钮的个数,确定文件的个数
if
(
_limitTop
&&
(
_fileNum
<
_limitTop
))
{
var
formData
=
new
FormData
();
formData
.
append
(
'type'
,
'business_school_file'
);
formData
.
append
(
'image'
,
_this
[
0
].
files
[
0
]);
$
.
ajax
({
type
:
'post'
,
url
:
'/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
;
/*_this.parent().next().prepend('<li class="pdf-pre-li"><a data-filename="{3}" class="pdf-pre-a" href="javascript:;" title="保存之后才可以点击下载">{2}</a><a href="javascript:;" class="delet-pic-btn">删除</a></li>'.stringFormatObj({
'0': _url,
'1': decodeURI(_url.slice(_url.lastIndexOf('/') + 1)),
'2': dealFileName(decodeURI(_url.slice(_url.lastIndexOf('/') + 1))),//dealFileName不要忘记
'3': _data.data.img_path
}));*/
var
tag
=
''
;
tag
+=
'<div class="col-xs-3">'
;
tag
+=
' <img src="'
+
_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
)
}
else
{
alert
(
_data
.
msg
);
};
},
error
:
function
()
{
alert
(
'enter error'
);
},
complete
:
function
(
xhr
,
textStatus
)
{
if
(
textStatus
===
'timeout'
)
{
//处理超时的逻辑
alert
(
'请求超时,请重试'
);
};
}
});
}
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);
};*/
});
},
addDeleteNewsEvent
:
function
(
id
){
$
.
ajax
({
url
:
'/index/delNewsFile'
,
type
:
'POST'
,
async
:
true
,
data
:
{
'file_id'
:
id
},
dataType
:
'json'
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
)
{
alert
(
'文件删除成功'
);
}
}
});
},
getList
:
function
(
pageNo
)
{
picture
.
pageNo
=
pageNo
;
var
params
=
{};
params
.
pageNo
=
picture
.
pageNo
;
params
.
pageSize
=
picture
.
pageSize
;
params
.
type
=
$
(
'#shop_type option:selected'
).
val
();
params
.
yetai
=
$
(
'#yt_type option:selected'
).
val
();
$
.
ajax
({
url
:
'/index/bindPhoneList'
,
//获取列表
type
:
'GET'
,
async
:
true
,
data
:
params
,
dataType
:
'json'
,
success
:
function
(
data
)
{
var
temp
=
document
.
getElementById
(
'phonelist_list_tpl'
).
innerHTML
;
var
doTtmpl
=
doT
.
template
(
temp
);
$
(
"#phonelist_list"
).
html
(
doTtmpl
(
data
.
data
.
list
));
/*分页代码*/
add_page
(
data
.
data
.
total
,
pageNo
,
picture
.
pageSize
,
picture
.
getList
);
$
(
"#pagediv"
).
pagination
({
length
:
data
.
data
.
total
,
current
:
pageNo
,
every
:
phonelist
.
pageSize
,
onClick
:
function
(
el
)
{
phonelist
.
getList
(
el
.
num
.
current
);
}
});
}
});
},
savePicture
:
function
(
data_yetai
){
var
yetai
=
$
(
'#modal'
).
find
(
'select#leased option:selected'
).
val
()
==
0
?
''
:
data_yetai
;
var
params
=
{
'yetai'
:
yetai
,
'type'
:
$
(
'#modal'
).
find
(
'select#leased option:selected'
).
val
()
};
var
_fujianObj
=
$
(
'#img_area'
).
find
(
'div>a.delet-pic-btn'
);
//附件看的是删除按钮的个数
if
(
_fujianObj
.
length
>
0
){
//判断附件存在,同时,附件可能存在0到5个
for
(
var
i
=
0
;
i
<
_fujianObj
.
length
;
i
++
){
var
one_name
=
_fujianObj
[
i
].
getAttribute
(
'data-filename'
);
//附件取得是data-filename
params
[
'annex_file_name['
+
i
+
']'
]
=
one_name
;
}
}
$
.
ajax
({
url
:
'/api/filtrateCondition'
,
type
:
'GET'
,
async
:
true
,
data
:
params
,
dataType
:
'json'
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
&&
data
.
data
!=
null
)
{
alert
(
"图片上传成功"
);
}
}
});
},
getYetai
:
function
()
{
$
.
ajax
({
url
:
'/api/filtrateCondition'
,
type
:
'GET'
,
async
:
true
,
data
:
{
"pageSize"
:
1000
},
dataType
:
'json'
,
success
:
function
(
data
)
{
if
(
data
.
code
==
200
&&
data
.
data
!=
null
)
{
var
str_yetai
=
''
;
$
(
'#yetai_id'
).
empty
();
//业态筛选
$
.
each
(
data
.
data
.
yetai
,
function
(
i
,
item
)
{
if
(
item
!=
'全部'
){
str_yetai
+=
'<div class="col-xs-3" style="padding:0px;text-align:center;margin:8px 0px;"><div class="yetai_checkbox" style="width:80px;border:1px solid black ; background-color : #ffffff;" >'
+
item
+
'</div></div>'
;
}
});
$
(
'#yetai_id'
).
append
(
str_yetai
);
}
}
});
},
};
return
picture
;
});
\ 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