Commit 65f6e3fb authored by clone's avatar clone

banner pc后台

parent b0bfb948
......@@ -2,6 +2,7 @@
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\BannerModel;
use think\Controller;
......@@ -12,31 +13,31 @@ use think\Controller;
* Time : 15:12
* Intro:
*/
class banner
class Banner extends Basic
{
protected $bannerModel;
public function __construct()
{
// $this->bannerModel = new BannerModel();
}
public function index(){
echo 1111111111;exit;
$this->bannerModel = new BannerModel();
}
/**
* 查询banner列表
* @return \think\Response
*/
public function getBannerList()
public function index()
{
echo 111111111;exit;
return view("banner/banner");
/* $field = "id,title,pic_path,url,sort,is_show,create_time,update_time";
}
public function getBannerList(){
$field = "id,title,pic_path,url,sort,hits,is_show,up_user,create_time,update_time";
$params['is_show'] = array( "eq", 0 );
$result = $this->bannerModel
->getBannerList(1, 15, "sort desc", $field, $params);
return $this->response("200", "request success", $result);*/
return $this->response("200", "request success", $result);
}
......@@ -46,17 +47,17 @@ class banner
*/
public function addOrSave()
{
/* $params = array(
"id" => 2,
"is_show" => 0
);
$msg = isset($params['id']) ? "修改" : "新增";
$result = $this->bannerModel->addOrUpdate($params);
if ($result['code'] == 200) {
return $this->response("200", $msg . "成功", $result["msg"]);
} else {
return $this->response("101", $msg . $result["msg"]);
}*/
/* $params = array(
"id" => 2,
"is_show" => 0
);
$msg = isset($params['id']) ? "修改" : "新增";
$result = $this->bannerModel->addOrUpdate($params);
if ($result['code'] == 200) {
return $this->response("200", $msg . "成功", $result["msg"]);
} else {
return $this->response("101", $msg . $result["msg"]);
}*/
}
/**
......@@ -65,15 +66,15 @@ class banner
*/
public function upIsShow()
{
/* $params = array(
"id" => 1,
"is_show" => 1
);
$result = $this->bannerModel->upIsShow($params);
if ($result['code'] == 200) {
return $this->response("200", "update success", $result["msg"]);
} else {
return $this->response("101", "update error");
}*/
/* $params = array(
"id" => 1,
"is_show" => 1
);
$result = $this->bannerModel->upIsShow($params);
if ($result['code'] == 200) {
return $this->response("200", "update success", $result["msg"]);
} else {
return $this->response("101", "update error");
}*/
}
}
\ No newline at end of file
<?php
namespace app\index\extend;
/**
* Created by PhpStorm.
* User: zw
* Date: 2017/12/4
* Time: 9:35
* 基类
*/
use think\Controller;
use think\Request;
use think\Response;
class Basic extends Controller
{
/**
* 访问请求对象
* @var Request
*/
public $request;
public $params;
/**
* 基础接口SDK
* @param Request|null $request
*/
public function __construct(Request $request = null)
{
// CORS 跨域 Options 检测响应
$this->corsOptionsHandler();
// 输入对象
$this->request = is_null($request) ? Request::instance() : $request;
if (strtoupper($this->request->method()) === "GET") {
$this->params = $this->request->param();
} elseif (strtoupper($this->request->method()) === "POST") {
$this->params = $this->request->param() != null ? $this->request->param() : null;
}
}
/**
* 输出返回数据
* @param string $msg 提示消息内容
* @param string $code 业务状态码
* @param mixed $data 要返回的数据
* @param string $type 返回类型 JSON XML
* @return Response
*/
public function response($code = 'SUCCESS', $msg, $data = [], $type = 'json')
{
$result = [ 'code' => $code, 'msg' => $msg, 'data' => $data, 'type' => strtolower($type) ];
return Response::create($result, $type);
}
/**
* Cors Options 授权处理
*/
public static function corsOptionsHandler()
{
if (request()->isOptions()) {
header('Access-Control-Allow-Origin:*');
header('Access-Control-Allow-Headers:Accept,Referer,Host,Keep-Alive,User-Agent,X-Requested-With,Cache-Control,Content-Type,Cookie,token');
header('Access-Control-Allow-Credentials:true');
header('Access-Control-Allow-Methods:GET,POST,OPTIONS');
header('Access-Control-Max-Age:1728000');
header('Content-Type:text/plain charset=UTF-8');
header('Content-Length: 0', true);
header('status: 204');
header('HTTP/1.0 204 No Content');
exit;
}
}
/**
* Cors Request Header信息
* @return array
*/
public static function corsRequestHander()
{
return [
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Credentials' => true,
'Access-Control-Allow-Methods' => 'GET,POST,OPTIONS',
'Access-Defined-X-Support' => 'service@cuci.cc',
'Access-Defined-X-Servers' => 'Guangzhou Cuci Technology Co. Ltd',
];
}
}
......@@ -38,41 +38,8 @@
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>刘女士</td>
<td>
<img src="/adsimg/20171117215901.jpg" class="diagram-image">
</td>
<td>刘丹丹</td>
<td>张大大</td>
<td>Thornton</td>
<td>张大大</td>
<td>
<a class="btn1 btn-success " href="#modal-do" data-toggle="modal">
编辑
</a>
<a class="btn1 btn-danger " href="#modal-delete" data-toggle="modal" onclick="show_details(2244)">
删除
</a>
</td>
</tr>
<tr>
<td>李楠楠</td>
<td>Jac12413ob</td>
<td>Thornton</td>
<td>刘丹丹</td>
<td>张大大</td>
<td>Thornton</td>
<td>
<a class="btn1 btn-success " href="#modal-do" data-toggle="modal">
编辑
</a>
<a class="btn1 btn-danger" href="#modal-delete" data-toggle="modal" onclick="show_details(2244)">
删除
</a>
</td>
</tr>
<tbody id="banner_list">
</tbody>
</table>
......@@ -97,63 +64,6 @@
</div>
<!-- /#wrapper -->
<!-- /#编辑模态框 -->
<div class="modal fade" id="modal-do" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
&times;
</button>
<h4 class="modal-title" >
编辑
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" action="/agents/add_user" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" id="inputEmail3" placeholder="请输入标题">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" placeholder="请输入备注">
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">链接:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图片:</label>
<div class="col-sm-9">
<a class="file-input-wrapper btn"><input id="img" name="img" type="file"></a>
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary">
提交
</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal -->
</div>
<!-- /#删除模态框 -->
<div class="modal fade" id="modal-delete" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
......@@ -182,7 +92,7 @@
</div><!-- /.modal -->
</div>
<!-- /#新增广告模态框 -->
<!-- /#新增编辑广告模态框 -->
<div class="modal fade" id="modal-add-do" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
......@@ -194,46 +104,45 @@
新增广告
</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" action="/agents/add_user" method="post" onsubmit="return check()">
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" placeholder="请输入标题">
</div>
<div class="modal-body" style="height: 350px">
<div class="form-group">
<label class="col-sm-3 control-label">标题:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" placeholder="请输入标题">
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" placeholder="请输入备注">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" placeholder="请输入备注">
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">链接:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">链接:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图片:</label>
<div class="col-sm-9">
<a class="file-input-wrapper btn"><input id="img1" name="img" type="file"></a>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">图片:</label>
<div class="col-sm-9">
<input readonly="readonly" type="text" name="cover_image" id="cover_image" class="require"/>
<button class="button6 banner_img" type="button">选择图片</button>
<span class="tip">建议尺寸288x320</span>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
</div>
<div class="form-group" >
<label class="col-sm-3 control-label">排序:</label>
<div class="col-sm-9">
<input type="text" class="form-control btn6" name="title" autocomplete="off" >
</div>
</form>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭
</button>
<button type="button" class="btn btn-primary">
提交
<button type="button" class="btn btn-primary" id="save_banner">
确认
</button>
</div>
</div><!-- /.modal-content -->
......
......@@ -2,8 +2,8 @@
<html lang="en-us">
<head>
{include file="global/header_tpl" /}
<link rel="stylesheet" href="../../../../resource/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="../../../../resource/css/public.css" type="text/css" />
<link rel="stylesheet" href="/resource/css/bootstrap.css" type="text/css" />
<link rel="stylesheet" href="/resource/css/public.css" type="text/css" />
</head>
<body>
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="../../../../resource/css/bootstrap.css" type="text/css" />
<script src="../../../../resource/lib/js/jquery-2.0.3.min.js"></script>
<script src="../../../../resource/lib/js/bootstrap.min.js"></script>
</head>
<body style="height: 100%">
<!-- Large modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="user" />
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
...
</div>
</div>
</div>
<!-- Small modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>
<link rel="stylesheet" href="../../../../resource/css/bootstrap-combined.min.css" type="text/css" />
<link rel="stylesheet" href="../../../../resource/css/bootstrap-datetimepicker.min.css" type="text/css" />
<label>编辑:</label>
<?php
create_editor('describe');
?>
<input readonly="readonly" type="text" name="cover_image" id="cover_image" class="require"/>
<button class="button6 Bannertu" type="button">选择图片</button>
<span class="tip">建议尺寸288x320</span>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
...
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
Copy
Copy
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
<div id="datetimepicker" class="input-append date">
<input type="text"></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
\ No newline at end of file
{layout name="global/frame_tpl" /}
<input type="hidden" class="page-load" id="user" />
<link rel="stylesheet" href="../../../../resource/css/bootstrap-combined.min.css" type="text/css" />
<link rel="stylesheet" href="../../../../resource/css/bootstrap-datetimepicker.min.css" type="text/css" />
<label>编辑:</label>
<?php
create_editor('describe');
?>
<input readonly="readonly" type="text" name="cover_image" id="cover_image" class="require"/>
<button class="button6 Bannertu" type="button">选择图片</button>
<span class="tip">建议尺寸288x320</span>
Copy
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Star
</button>
<div id="datetimepicker" class="input-append date">
<input type="text"></input>
<span class="add-on">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="../../../../resource/css/bootstrap.css" type="text/css" />
<script src="../../../../resource/lib/js/jquery-2.0.3.min.js"></script>
<script src="../../../../resource/lib/js/bootstrap.min.js"></script>
</head>
<body style="height: 100%">
<!-- Large modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
...
</div>
</div>
</div>
<!-- Small modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-sm">Small modal</button>
<div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
<div class="modal-dialog modal-sm" role="document">
<div class="modal-content">
...
</div>
</div>
</div>
</body>
</html>
\ No newline at end of file
......@@ -49,12 +49,13 @@ Route::group('app', [
Route::group('index', [
/* 'member' => [ 'index/member.index/member', [ 'method' => 'get' ] ],
'member' => [ 'index/member.index/member', [ 'method' => 'get' ] ],
'preview_list' => [ 'index/member.index/preview_list', [ 'method' => 'get' ] ],
'consumer_list' => [ 'index/member.index/consumer_list', [ 'method' => 'get' ] ],
'diagram_list' => [ 'index/member.index/diagram_list', [ 'method' => 'get' ] ],
'entrust_list' => [ 'index/member.index/entrust_list', [ 'method' => 'get' ] ],*/
'entrust_list' => [ 'index/member.index/entrust_list', [ 'method' => 'get' ] ],
'banner' => [ 'index/banner/index', [ 'method' => 'get' ] ],
'bannerList' => [ 'index/banner/getBannerList', [ 'method' => 'post' ] ],
]);
......
body {
width: 1335px;
width: 1335px !important;
margin: 0;
margin: 0 auto;
background-color: #F2F2F2;
list-style:none
list-style:none;
padding-right:0px!important;
}
a:hover{
......
/**
* Created by zw on 2017/12/15.
*/
define (['doT', 'text!temp/banner_template_tpl.html', 'ckfinder', 'ckfinderStart', 'css!style/home.css', 'bootstrapJs'], function (doT, template) {
var banner = {
init: function () {
//初始化dot
$ ("body").append (template)
banner.event ()
banner.getBannerList ()
},
event: function () {
/*上传图片控件*/
$ (".banner_img").click (function () {
BrowseServer ('cover_image');
})
$ ("#save_banner").click (function () {
alert ("1111111");
})
},
/*获取banner list*/
getBannerList: function () {
$.ajax ({
url: '/index/bannerList',
type: 'POST',
async: true,
data: {id: 1},
dataType: 'json',
success: function (data) {
var temp = document.getElementById ('banner_list_tpl').innerHTML
var doTtmpl = doT.template (temp)
$ ("#banner_list").append (doTtmpl (data))
}
})
}
}
return banner
});
......@@ -7,24 +7,25 @@ define (['doT', 'text!temp/user_templete_tpl.html','ckfinder','ckfinderStart', '
user.getList ();
user.event ();
//时间控件初始化
$('#datetimepicker').datetimepicker({
/* $('#datetimepicker').datetimepicker({
format: 'yyyy-MM-dd',
language: 'zh-CN',
pickTime: false
}).on('changeDate',function(){
$(this).datetimepicker('hide');
});
});*/
},
event: function () {
$ (".Bannertu").click (function () {
alert(1111);
BrowseServer ('cover_image');
});
},
getList: function () {
var temp = document.getElementById ('user_index_tpl').innerHTML;
/* var temp = document.getElementById ('user_index_tpl').innerHTML;
var doTtmpl = doT.template (temp);
$ ("body").append (doTtmpl ());
$ ("body").append (doTtmpl ());*/
}
}
return user;
......
<script id="banner_list_tpl" type="text/template">
[% if(it.data.length > 0) { %]
[% for(var i = 0, len = it.data.length; i < len; i++){ %]
<tr>
<td>[%= it.data[i]["title"] %]</td>
<td>
<img src="[%= it.data[i]['pic_path'] %]" class="diagram-image">
</td>
<td>[%= it.data[i]["url"] %]</td>
<td>[%= it.data[i]["sort"] %]</td>
<td>[%= it.data[i]["hits"] %]</td>
<td>[%= it.data[i]["up_user"] %]</td>
<td>
<a class="btn1 btn-success " href="#modal-do" data-toggle="modal">
编辑
</a>
<a class="btn1 btn-danger " href="#modal-delete" data-toggle="modal">
删除
</a>
</td>
</tr>
[% } %]
[% }else{ %]
<tr>
<td colspan="7" style="text-align:center;"> 暂无数据</td>
</tr>
[% } %]
</script>
<script id="user_index_tpl" type="text/template">
<script id="banner_index_tpl" type="text/template">
this is template block
</script>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment