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
a9afe8e3
Commit
a9afe8e3
authored
Jan 11, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页弹窗
parent
4122181b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
119 additions
and
6 deletions
+119
-6
Banner.php
application/api/controller/Banner.php
+1
-1
Banner.php
application/index/controller/Banner.php
+37
-1
advertising.html
application/index/view/banner/advertising.html
+64
-0
banner.html
application/index/view/banner/banner.html
+1
-0
BannerModel.php
application/model/BannerModel.php
+3
-0
route.php
application/route.php
+2
-0
banner.js
public/resource/js/banner.js
+11
-4
No files found.
application/api/controller/Banner.php
View file @
a9afe8e3
...
@@ -31,7 +31,7 @@ class Banner extends Basic
...
@@ -31,7 +31,7 @@ class Banner extends Basic
*/
*/
public
function
getBannerList
()
public
function
getBannerList
()
{
{
$field
=
"id,title,CONCAT('"
.
CK_IMG_URL
.
"' , pic_path) as pic_path, url, sort,is_show,create_time,update_time"
;
$field
=
"id,title,CONCAT('"
.
CK_IMG_URL
.
"' , pic_path) as pic_path, url,
type,
sort,is_show,create_time,update_time"
;
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$result
=
$this
->
bannerModel
$result
=
$this
->
bannerModel
->
getBannerList
(
1
,
15
,
"sort desc"
,
$field
,
$params
);
->
getBannerList
(
1
,
15
,
"sort desc"
,
$field
,
$params
);
...
...
application/index/controller/Banner.php
View file @
a9afe8e3
...
@@ -32,10 +32,43 @@ class Banner extends Basic
...
@@ -32,10 +32,43 @@ class Banner extends Basic
return
view
(
"banner/banner"
);
return
view
(
"banner/banner"
);
}
}
/**
* 查询banner列表
* @return \think\Response
*/
public
function
advertising
()
{
return
view
(
"banner/advertising"
);
}
/**
* 首页banner
* @return \think\Response
*/
public
function
getBannerList
()
public
function
getBannerList
()
{
{
$field
=
"id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"
;
$field
=
"id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"
;
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$params
[
'type'
]
=
array
(
"eq"
,
0
);
$pageNo
=
empty
(
$_POST
[
'pageNo'
])
?
1
:
$_POST
[
'pageNo'
];
$pageSize
=
empty
(
$_POST
[
'pageSize'
])
?
15
:
$_POST
[
'pageSize'
];
$result
[
"list"
]
=
$this
->
bannerModel
->
getBannerList
(
$pageNo
,
$pageSize
,
"sort desc"
,
$field
,
$params
);
$result
[
"total"
]
=
$this
->
bannerModel
->
getBannerTotal
(
$params
);
return
$this
->
response
(
"200"
,
"request success"
,
$result
);
}
/**
* 首页弹框
* @return \think\Response
*/
public
function
getPopList
()
{
$field
=
"id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time"
;
$params
[
'is_show'
]
=
array
(
"eq"
,
0
);
$params
[
'type'
]
=
array
(
"eq"
,
1
);
$pageNo
=
empty
(
$_POST
[
'pageNo'
])
?
1
:
$_POST
[
'pageNo'
];
$pageNo
=
empty
(
$_POST
[
'pageNo'
])
?
1
:
$_POST
[
'pageNo'
];
$pageSize
=
empty
(
$_POST
[
'pageSize'
])
?
15
:
$_POST
[
'pageSize'
];
$pageSize
=
empty
(
$_POST
[
'pageSize'
])
?
15
:
$_POST
[
'pageSize'
];
$result
[
"list"
]
=
$this
->
bannerModel
$result
[
"list"
]
=
$this
->
bannerModel
...
@@ -65,6 +98,9 @@ class Banner extends Basic
...
@@ -65,6 +98,9 @@ class Banner extends Basic
if
(
isset
(
$_POST
[
"url"
]))
{
if
(
isset
(
$_POST
[
"url"
]))
{
$params
[
"url"
]
=
$_POST
[
"url"
];
$params
[
"url"
]
=
$_POST
[
"url"
];
}
}
if
(
isset
(
$_POST
[
"type"
]))
{
$params
[
"type"
]
=
$_POST
[
"type"
];
}
if
(
isset
(
$_POST
[
"cover_image"
]))
{
if
(
isset
(
$_POST
[
"cover_image"
]))
{
$params
[
"cover_image"
]
=
$_POST
[
"cover_image"
];
$params
[
"cover_image"
]
=
$_POST
[
"cover_image"
];
}
}
...
@@ -75,7 +111,7 @@ class Banner extends Basic
...
@@ -75,7 +111,7 @@ class Banner extends Basic
$params
[
"is_show"
]
=
$_POST
[
"is_show"
];
$params
[
"is_show"
]
=
$_POST
[
"is_show"
];
}
}
if
(
empty
(
$params
[
"title"
])
||
empty
(
$params
[
"url"
])
||
empty
(
$params
[
"cover_image"
])
||
empty
(
$params
[
"sort"
]))
{
if
(
empty
(
$params
[
"title"
])
||
empty
(
$params
[
"
type"
])
||
empty
(
$params
[
"
url"
])
||
empty
(
$params
[
"cover_image"
])
||
empty
(
$params
[
"sort"
]))
{
return
$this
->
response
(
"101"
,
"请提交正确的请求参数"
);
return
$this
->
response
(
"101"
,
"请提交正确的请求参数"
);
}
}
if
(
isset
(
$params
[
'id'
]))
{
if
(
isset
(
$params
[
'id'
]))
{
...
...
application/index/view/banner/advertising.html
0 → 100644
View file @
a9afe8e3
{layout name="global/frame_tpl" /}
<input
type=
"hidden"
class=
"page-load"
id=
"banner"
/>
<!--导航star-->
<!-- Sidebar -->
<!-- /#sidebar-wrapper -->
<!-- Page Content -->
<div
id=
"page-content-wrapper"
>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-lg-10 col-lg-offset-0"
>
<div
class=
"panel panel-default"
>
<div
class=
"panel-heading breadcrumb"
>
<li><a
href=
"#"
>
首页弹框广告
</a></li>
<li
class=
"active"
>
新增广告
</li>
<div
class=
"pull-right"
>
<ul
class=
"bread_btn"
>
<li>
<a
href=
"#modal-add-do"
data-toggle=
"modal"
id=
"add_banner"
class=
"btn btn-default"
><i
class=
"icon-plus"
></i>
新增广告
</a>
</li>
</ul>
</div>
</div>
<div
class=
"panel-body"
>
<div
class=
"table-responsive"
>
<table
class=
"table table-striped table-bordered table-hover"
>
<thead>
<tr>
<th>
标题
</th>
<th>
图片
</th>
<th>
链接
</th>
<th>
排序
</th>
<th>
点击
</th>
<th>
修改人
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody
id=
"banner_list"
>
</tbody>
</table>
<!-- /#page-content-wrapper -->
<div
style=
"float:right"
id=
"pagediv"
>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
value=
"1"
id=
"type"
/>
</div>
</div>
</div>
</div>
application/index/view/banner/banner.html
View file @
a9afe8e3
...
@@ -52,6 +52,7 @@
...
@@ -52,6 +52,7 @@
</div>
</div>
</div>
</div>
</div>
</div>
<input
type=
"hidden"
value=
"0"
id=
"type"
/>
</div>
</div>
</div>
</div>
...
...
application/model/BannerModel.php
View file @
a9afe8e3
...
@@ -45,6 +45,9 @@ class BannerModel extends Model
...
@@ -45,6 +45,9 @@ class BannerModel extends Model
if
(
isset
(
$param
[
'url'
]))
{
if
(
isset
(
$param
[
'url'
]))
{
$arr
[
"url"
]
=
$param
[
'url'
];
$arr
[
"url"
]
=
$param
[
'url'
];
}
}
if
(
isset
(
$param
[
'type'
]))
{
$arr
[
"type"
]
=
$param
[
'type'
];
}
if
(
isset
(
$param
[
'sort'
]))
{
if
(
isset
(
$param
[
'sort'
]))
{
$arr
[
"sort"
]
=
$param
[
'sort'
];
$arr
[
"sort"
]
=
$param
[
'sort'
];
}
}
...
...
application/route.php
View file @
a9afe8e3
...
@@ -36,7 +36,9 @@ Route::group('index', [
...
@@ -36,7 +36,9 @@ Route::group('index', [
//banner模块
//banner模块
'banner'
=>
[
'index/banner/index'
,
[
'method'
=>
'get'
]
],
'banner'
=>
[
'index/banner/index'
,
[
'method'
=>
'get'
]
],
'advertising'
=>
[
'index/banner/advertising'
,
[
'method'
=>
'get'
]
],
'bannerList'
=>
[
'index/banner/getBannerList'
,
[
'method'
=>
'post'
]
],
'bannerList'
=>
[
'index/banner/getBannerList'
,
[
'method'
=>
'post'
]
],
'getPopList'
=>
[
'index/banner/getPopList'
,
[
'method'
=>
'post'
]
],
'addOrSave'
=>
[
'index/banner/addOrSave'
,
[
'method'
=>
'post'
]
],
'addOrSave'
=>
[
'index/banner/addOrSave'
,
[
'method'
=>
'post'
]
],
'upIsShow'
=>
[
'index/banner/upIsShow'
,
[
'method'
=>
'post'
]
],
'upIsShow'
=>
[
'index/banner/upIsShow'
,
[
'method'
=>
'post'
]
],
...
...
public/resource/js/banner.js
View file @
a9afe8e3
/**
/**
* Created by zw on 2017/12/15.
* Created by zw on 2017/12/15.
*/
*/
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'blow-up'
],
function
(
doT
,
template
)
{
define
([
'doT'
,
'text!temp/banner_template_tpl.html'
,
'ckfinder'
,
'ckfinderStart'
,
'css!style/home.css'
,
'blow-up'
],
function
(
doT
,
template
)
{
var
banner
=
{
var
banner
=
{
pageNo
:
1
,
/*第几页*/
pageNo
:
1
,
/*第几页*/
pageSize
:
15
,
/*每页显示多少条*/
pageSize
:
15
,
/*每页显示多少条*/
...
@@ -34,6 +34,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -34,6 +34,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
params
.
url
=
$
(
"#url"
).
val
();
params
.
url
=
$
(
"#url"
).
val
();
params
.
cover_image
=
$
(
"#cover_image"
).
val
();
params
.
cover_image
=
$
(
"#cover_image"
).
val
();
params
.
sort
=
$
(
"#sort"
).
val
();
params
.
sort
=
$
(
"#sort"
).
val
();
params
.
type
=
$
(
"#type"
).
val
();
if
(
!
params
.
title
||
params
.
title
==
null
)
{
if
(
!
params
.
title
||
params
.
title
==
null
)
{
alert
(
"banner名称不能为空"
);
alert
(
"banner名称不能为空"
);
...
@@ -89,9 +90,15 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -89,9 +90,15 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
var
params
=
{};
var
params
=
{};
params
.
pageNo
=
banner
.
pageNo
;
params
.
pageNo
=
banner
.
pageNo
;
params
.
pageSize
=
banner
.
pageSize
;
params
.
pageSize
=
banner
.
pageSize
;
var
url
=
''
;
var
requestPath
=
window
.
location
.
pathname
;
if
(
requestPath
.
indexOf
(
"advertising"
)
>
0
){
url
=
'/admin.php/index/getPopList'
;
}
else
{
url
=
'/admin.php/index/bannerList'
;
}
$
.
ajax
({
$
.
ajax
({
url
:
'/admin.php/index/bannerList'
,
url
:
url
,
type
:
'POST'
,
type
:
'POST'
,
async
:
true
,
async
:
true
,
data
:
params
,
data
:
params
,
...
@@ -110,7 +117,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
...
@@ -110,7 +117,7 @@ define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart
banner
.
getBannerList
(
el
.
num
.
current
);
banner
.
getBannerList
(
el
.
num
.
current
);
}
}
});
});
$
(
'.J_preview'
).
preview
();
$
(
'.J_preview'
).
preview
();
}
}
});
});
...
...
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