Commit c3f6e5f3 authored by xieyishang's avatar xieyishang

addxx

parent ee61c34b
<?php
namespace app\admin\controller;
use app\common\controller\Backend;
use app\common\model\News as NewsModel;
use fast\Tree;
use think\Db;
/**
* 分类管理
*
* @icon fa fa-list
* @remark 用于管理网站的所有分类,分类可进行无限级分类,分类类型请在常规管理->系统配置->字典配置中添加
*/
class News extends Backend
{
/**
* @var \app\common\model\News
*/
protected $model = null;
protected $Newslist = [];
protected $noNeedRight = ['selectpage'];
// public function _initialize()
// {
// parent::_initialize();
// $this->model = model('app\common\model\News');
// $tree = Tree::instance();
// $tree->init(collection($this->model->order('weigh desc,id desc')->select())->toArray(), 'pid');
// $this->Newslist = $tree->getTreeList($tree->getTreeArray(0), 'name');
// $Newsdata = [0 => ['type' => 'all', 'name' => __('None')]];
// foreach ($this->Newslist as $k => $v) {
// $Newsdata[$v['id']] = $v;
// }
// $typeList = NewsModel::getTypeList();
// $this->view->assign("flagList", $this->model->getFlagList());
// $this->view->assign("typeList", $typeList);
// // $this->view->assign("parentList", $Newsdata);
// $this->assignconfig('typeList', $typeList);
// }
/**
* 查看文章列表
*/
public function index()
{
//设置过滤方法
$this->request->filter(['strip_tags']);
if ($this->request->isAjax()) {
if ($this->request->request('keyField')) {
return $this->selectpage();
}
$offset = $this->request->request('offset');
$limit = $this->request->request('limit');
// var_dump($offset,$limit);die;
$field = ['news_id','news_img','news_title','secondary_title','news_comtent','news_view','news_sort', 'FROM_UNIXTIME(news_createtime,"%Y-%m-%d %H-%m %s") as news_createtime'];
$list = Db::name('news')->field($field)->limit($offset,$limit )->select();
$result['total'] = Db::name('news')->count();
$result['rows'] = $list;
return json($result);
}
return $this->view->fetch();
}
}
<div class="panel panel-default panel-intro">
{:build_heading()}
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
{:build_toolbar('refresh,add,delete')}
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="{:$auth->check('news/edit')}"
data-operate-del="{:$auth->check('news/del')}"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
var Controller = {
index: function () {
// 初始化表格参数配置
Table.api.init({
extend: {
index_url: 'news/index',
// add_url: 'news/add',
// edit_url: 'news/edit',
// del_url: 'news/del',
// multi_url: 'news/multi',
// dragsort_url: 'ajax/weigh',
table: 'news',
}
});
var table = $("#table");
var tableOptions = {
url: $.fn.bootstrapTable.defaults.extend.index_url,
pk: 'id',
sortName: 'weigh',
pagination: true,
commonSearch: false,
search: false,
columns: [
[
{checkbox: true},
{field: 'news_id', title: '文章id'},
// {field: 'news_img', title: '图片', operate: false,},
{field: 'news_title', title: '文章标题', align: 'left'},
{field: 'secondary_title', title: '副标题'},
{field: 'news_createtime', title: '添加时间'},
{field: 'news_view', title: '浏览量'},
{field: 'news_sort', title: '排序'}
]
]
};
// 初始化表格
table.bootstrapTable(tableOptions);
// 为表格绑定事件
Table.api.bindevent(table);
//绑定TAB事件
$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
// var options = table.bootstrapTable(tableOptions);
var typeStr = $(this).attr("href").replace('#', '');
var options = table.bootstrapTable('getOptions');
options.pageNumber = 1;
options.queryParams = function (params) {
// params.filter = JSON.stringify({type: typeStr});
params.type = typeStr;
return params;
};
table.bootstrapTable('refresh', {});
return false;
});
//必须默认触发shown.bs.tab事件
// $('ul.nav-tabs li.active a[data-toggle="tab"]').trigger("shown.bs.tab");
},
add: function () {
Controller.api.bindevent();
setTimeout(function () {
$("#c-type").trigger("change");
}, 100);
},
edit: function () {
Controller.api.bindevent();
},
api: {
bindevent: function () {
$(document).on("change", "#c-type", function () {
$("#c-pid option[data-type='all']").prop("selected", true);
$("#c-pid option").removeClass("hide");
$("#c-pid option[data-type!='" + $(this).val() + "'][data-type!='all']").addClass("hide");
$("#c-pid").data("selectpicker") && $("#c-pid").selectpicker("refresh");
});
Form.api.bindevent($("form[role=form]"));
}
}
};
return Controller;
});
......@@ -43,3 +43,15 @@
---------------------------------------------------------------
[ 2021-03-09T10:35:47+08:00 ] 127.0.0.1 GET www.fa.com/srMLgYvykH.php/leaving?addtabs=1
[ error ] [0]语法解析错误: syntax error, unexpected 'page' (T_STRING), expecting ')'
---------------------------------------------------------------
[ 2021-03-09T11:18:32+08:00 ] 127.0.0.1 GET www.fa.com/srMLgYvykH.php/news/index?sort=weigh&order=desc&offset=0&limit=10&_=1615259912262
[ error ] [10501]SQLSTATE[42S22]: Column not found: 1054 Unknown column 'phone' in 'field list'
---------------------------------------------------------------
[ 2021-03-09T11:18:37+08:00 ] 127.0.0.1 GET www.fa.com/srMLgYvykH.php/news/index?sort=weigh&order=desc&offset=0&limit=10&_=1615259917577
[ error ] [10501]SQLSTATE[42S22]: Column not found: 1054 Unknown column 'phone' in 'field list'
---------------------------------------------------------------
[ 2021-03-09T11:18:37+08:00 ] 127.0.0.1 GET www.fa.com/srMLgYvykH.php/news/index?sort=weigh&order=desc&offset=0&limit=10&_=1615259917578
[ error ] [10501]SQLSTATE[42S22]: Column not found: 1054 Unknown column 'phone' in 'field list'
---------------------------------------------------------------
[ 2021-03-09T11:32:21+08:00 ] 127.0.0.1 GET www.fa.com/srMLgYvykH.php/news/index?sort=weigh&order=desc&offset=0&limit=10&_=1615260741080
[ error ] [10501]SQLSTATE[42S22]: Column not found: 1054 Unknown column 'phone' in 'field list'
<?php if (!defined('THINK_PATH')) exit(); /*a:4:{s:79:"D:\phpstudy_pro\WWW\www.fa.com\public/../application/admin\view\news\index.html";i:1615259786;s:73:"D:\phpstudy_pro\WWW\www.fa.com\application\admin\view\layout\default.html";i:1611580233;s:70:"D:\phpstudy_pro\WWW\www.fa.com\application\admin\view\common\meta.html";i:1611580233;s:72:"D:\phpstudy_pro\WWW\www.fa.com\application\admin\view\common\script.html";i:1611580233;}*/ ?>
<!DOCTYPE html>
<html lang="<?php echo $config['language']; ?>">
<head>
<meta charset="utf-8">
<title><?php echo (isset($title) && ($title !== '')?$title:''); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
<meta name="renderer" content="webkit">
<meta name="referrer" content="never">
<link rel="shortcut icon" href="/assets/img/favicon.ico" />
<!-- Loading Bootstrap -->
<link href="/assets/css/backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">
<?php if(\think\Config::get('fastadmin.adminskin')): ?>
<link href="/assets/css/skins/<?php echo \think\Config::get('fastadmin.adminskin'); ?>.css?v=<?php echo \think\Config::get('site.version'); ?>" rel="stylesheet">
<?php endif; ?>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements. All other JS at the end of file. -->
<!--[if lt IE 9]>
<script src="/assets/js/html5shiv.js"></script>
<script src="/assets/js/respond.min.js"></script>
<![endif]-->
<script type="text/javascript">
var require = {
config: <?php echo json_encode($config); ?>
};
</script>
</head>
<body class="inside-header inside-aside <?php echo defined('IS_DIALOG') && IS_DIALOG ? 'is-dialog' : ''; ?>">
<div id="main" role="main">
<div class="tab-content tab-addtabs">
<div id="content">
<div class="row">
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<section class="content-header hide">
<h1>
<?php echo __('Dashboard'); ?>
<small><?php echo __('Control panel'); ?></small>
</h1>
</section>
<?php if(!IS_DIALOG && !\think\Config::get('fastadmin.multiplenav') && \think\Config::get('fastadmin.breadcrumb')): ?>
<!-- RIBBON -->
<div id="ribbon">
<ol class="breadcrumb pull-left">
<?php if($auth->check('dashboard')): ?>
<li><a href="dashboard" class="addtabsit"><i class="fa fa-dashboard"></i> <?php echo __('Dashboard'); ?></a></li>
<?php endif; ?>
</ol>
<ol class="breadcrumb pull-right">
<?php foreach($breadcrumb as $vo): ?>
<li><a href="javascript:;" data-url="<?php echo $vo['url']; ?>"><?php echo $vo['title']; ?></a></li>
<?php endforeach; ?>
</ol>
</div>
<!-- END RIBBON -->
<?php endif; ?>
<div class="content">
<div class="panel panel-default panel-intro">
<?php echo build_heading(); ?>
<div class="panel-body">
<div id="myTabContent" class="tab-content">
<div class="tab-pane fade active in" id="one">
<div class="widget-body no-padding">
<div id="toolbar" class="toolbar">
<?php echo build_toolbar('refresh,add,delete'); ?>
</div>
<table id="table" class="table table-striped table-bordered table-hover"
data-operate-edit="<?php echo $auth->check('news/edit'); ?>"
data-operate-del="<?php echo $auth->check('news/del'); ?>"
width="100%">
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="/assets/js/require<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js" data-main="/assets/js/require-backend<?php echo \think\Config::get('app_debug')?'':'.min'; ?>.js?v=<?php echo htmlentities($site['version']); ?>"></script>
</body>
</html>
This diff is collapsed.
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