更新前端文件
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2006~2018 http://thinkphp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: liu21st <liu21st@gmail.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
// 生成应用公共文件
|
||||
'__file__' => ['common.php'],
|
||||
'__dir__' => ['controller', 'model', 'view', 'validate'],
|
||||
'controller' => ['Index', 'admin/Config', 'admin/Menu', 'admin/Member', 'admin/Content', 'admin/Action', 'admin/Ad', 'admin/Attribute', 'admin/Category', 'admin/Channel', 'admin/Client', 'admin/Database', 'admin/Model', 'admin/Link', 'admin/Seo', 'admin/Addons', 'admin/Form', 'admin/Group'],
|
||||
'model' => ['Member', 'Config', 'Content', 'Channel', 'Client', 'Model', 'Link', 'Ad', 'AdPlace'],
|
||||
'view' => ['admin/index/index', 'admin/config/group', 'admin/member/index', 'admin/content/index', 'admin/category/index'],
|
||||
];
|
||||
@@ -9,7 +9,7 @@
|
||||
namespace app\controller;
|
||||
|
||||
use app\BaseController;
|
||||
use think\facade\Config;
|
||||
use think\facade\Cache;
|
||||
|
||||
/**
|
||||
* @title 后端公共模块
|
||||
@@ -22,13 +22,13 @@ class Admin extends BaseController {
|
||||
'\app\middleware\Admin'
|
||||
];
|
||||
|
||||
protected $data = ['meta' => ['title'=>''], 'data' => [], 'code' => 0, 'msg' => ''];
|
||||
protected $data = ['data' => [], 'code' => 0, 'msg' => ''];
|
||||
|
||||
protected function initialize(){
|
||||
$config = Config::get('system');
|
||||
$config = Cache::get('system_config');
|
||||
if (!$config) {
|
||||
$config = (new \app\model\Config())->lists();
|
||||
Config::set($config, 'system');
|
||||
Cache::set('system_config', $config);
|
||||
}
|
||||
$this->data['config'] = $config;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,5 @@ class Action extends Admin{
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,4 +18,11 @@ class Addons extends Admin{
|
||||
public function index(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 钩子列表
|
||||
*/
|
||||
public function hooks(){
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,73 @@
|
||||
namespace app\controller\admin;
|
||||
|
||||
use app\controller\Admin;
|
||||
use think\facade\Db;
|
||||
|
||||
use app\model\Client as ClientModel;
|
||||
|
||||
class Client extends Admin{
|
||||
|
||||
/**
|
||||
* @title 系统首页
|
||||
*/
|
||||
public function index(){
|
||||
public function index(ClientModel $client){
|
||||
$res = $client->paginate(25, false, array(
|
||||
'query' => $this->request->param()
|
||||
));
|
||||
|
||||
$data = $res->toArray();
|
||||
$data['page'] = $res->render();
|
||||
$this->data = $data;
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 添加客户端
|
||||
*/
|
||||
public function add(ClientModel $client){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->param();
|
||||
$result = $client->validate(true)->save($data);
|
||||
if (false !== $result) {
|
||||
return $this->success('成功添加', url('client/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info['appid'] = rand_string(10, 1); //八位数字appid
|
||||
$info['appsecret'] = rand_string(32); //32位数字加字母秘钥
|
||||
$data = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 编辑客户端
|
||||
*/
|
||||
public function edit(ClientModel $client){
|
||||
if ($this->request->isPost()) {
|
||||
$data = $this->request->param();
|
||||
$result = $client->validate(true)->save($data, array('id'=>$request->param('id')));
|
||||
if (false !== $result) {
|
||||
return $this->success('修改添加', url('client/index'));
|
||||
}else{
|
||||
return $this->error($this->model->getError());
|
||||
}
|
||||
}else{
|
||||
$info = $client->where('id', $this->request->param('id'))->find();
|
||||
$data = array(
|
||||
'info' => $info
|
||||
);
|
||||
return $this->data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @title 删除客户端
|
||||
*/
|
||||
public function del(ClientModel $client){
|
||||
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -8,5 +8,5 @@ return [
|
||||
// Session初始化
|
||||
\think\middleware\SessionInit::class,
|
||||
// 页面Trace调试
|
||||
// \think\middleware\TraceDebug::class,
|
||||
\think\middleware\TraceDebug::class,
|
||||
];
|
||||
|
||||
@@ -26,6 +26,7 @@ class Admin {
|
||||
}
|
||||
|
||||
if ($request->isAjax()) {
|
||||
unset($this->data['config']);
|
||||
return json($this->data);
|
||||
} else {
|
||||
return $response->data($this->fetch());
|
||||
@@ -46,7 +47,8 @@ class Admin {
|
||||
'__public__' => '/static/admin',
|
||||
),
|
||||
);
|
||||
|
||||
return View::config($config)->assign($this->data)->fetch($template);
|
||||
$data = isset($this->data['data']) ? $this->data['data'] : [];
|
||||
$data['config'] = isset($this->data['config']) ? $this->data['config'] : $data;
|
||||
return View::config($config)->assign($data)->fetch($template);
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class AdminAuth {
|
||||
* @title 显示菜单
|
||||
*/
|
||||
protected function getMenu($request) {
|
||||
$current_controller = str_replace('.', '/', strtolower($request->controller()));
|
||||
$current_controller = '/' . str_replace('.', '/', strtolower($request->controller()));
|
||||
$current_url = $current_controller . '/' . strtolower($request->action());
|
||||
$menu = Cache::get('menu');
|
||||
if (!$menu) {
|
||||
@@ -50,7 +50,7 @@ class AdminAuth {
|
||||
}
|
||||
$current_pid = 0;
|
||||
foreach ($menu as $key => $value) {
|
||||
if (strpos($value['url'], $current_controller) !== false) {
|
||||
if (strpos($value['url'], $current_controller.'/') !== false) {
|
||||
if ($value['pid'] == 0) {
|
||||
$current_pid = $value['id'];
|
||||
} else {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{extend name="admin/base"/}
|
||||
@@ -0,0 +1 @@
|
||||
{extend name="admin/base"/}
|
||||
@@ -0,0 +1 @@
|
||||
{extend name="admin/base"/}
|
||||
@@ -13,7 +13,7 @@
|
||||
</meta>
|
||||
</head>
|
||||
<body>
|
||||
<div id="theme-wrapper">
|
||||
<div id="theme-wrapper" class="vue-main">
|
||||
<header class="navbar" id="header-navbar">
|
||||
<div class="container">
|
||||
<div class="navbar-header">
|
||||
@@ -75,7 +75,7 @@
|
||||
<ul class="nav navbar-nav">
|
||||
{volist name="headerMenu" id="item"}
|
||||
<li class="{if isset($item['active']) && $item['active']}active{/if}">
|
||||
<a href="/{$item['url']}">
|
||||
<a href="{:url($item['url'])}">
|
||||
<i class="fa fa-{$item['icon']}"></i>
|
||||
<span>{$item['title']}</span>
|
||||
</a>
|
||||
@@ -135,7 +135,7 @@
|
||||
{volist name="asideMenu" id="menu"}
|
||||
<li class="nav-header hidden-sm hidden-xs">{$key}</li>
|
||||
{volist name="menu" id="item"}
|
||||
<li {if $item['active']}class="active"{/if}><a href="/{$item['url']}"><i class="fa fa-{$item['icon']}"></i><span>{$item['title']}</span></a></li>
|
||||
<li {if $item['active']}class="active"{/if}><a href="{:url($item['url'])}"><i class="fa fa-{$item['icon']}"></i><span>{$item['title']}</span></a></li>
|
||||
{/volist}
|
||||
{/volist}
|
||||
</ul>
|
||||
@@ -168,19 +168,19 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
{block name="body"}
|
||||
<div class="main-box clearfix">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>新功能</h2>
|
||||
<h2>{$meta|default='新功能'}</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{block name="toolbar"}{/block}
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
{block name="body"}{/block}
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -199,7 +199,8 @@
|
||||
<script src="__static__/libs/nanoscroller/jquery.nanoscroller.min.js"></script>
|
||||
<script type="text/javascript" src="__static__/js/jquery.slimscroll.min.js"></script>
|
||||
<script src="__js__/app.js"></script>
|
||||
<script type="text/javascript" src="__static__/js/require.js" data-main="__static__/admin/js/main"></script>
|
||||
<script type="text/javascript" src="/static/js/vue.js"></script>
|
||||
<script type="text/javascript" src="/static/js/axios.min.js"></script>
|
||||
{block name="script"}{/block}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +1,37 @@
|
||||
{extend name="admin/base"/}
|
||||
{extend name="admin/base"/}
|
||||
{block name="body"}
|
||||
|
||||
<div class="table-responsive clearfix">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>名称</th>
|
||||
<th>APPID</th>
|
||||
<th>APPSECRET</th>
|
||||
<th>创建时间</th>
|
||||
<th>更新时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{volist name="data" id="item"}
|
||||
<tr>
|
||||
<td>{$item['id']}</td>
|
||||
<td>{$item['title']}</td>
|
||||
<td>{$item['appid']}</td>
|
||||
<td>{$item['appsecret']}</td>
|
||||
<td>{$item['create_time']}</td>
|
||||
<td>{$item['update_time']}</td>
|
||||
<td>
|
||||
<a href="{:url('/admin/client/edit?id='.$item['id'])}">编辑</a>
|
||||
<a href="{:url('/admin/client/del?id='.$item['id'])}" class="ajax-post confirm">删除</a>
|
||||
</td>
|
||||
</tr>
|
||||
{/volist}
|
||||
</tbody>
|
||||
</table>
|
||||
{$page}
|
||||
</div>
|
||||
|
||||
{/block}
|
||||
@@ -1,23 +1,15 @@
|
||||
{extend name="admin/base"/}
|
||||
{block name="toolbar"}
|
||||
<a href="{:url('Config/index')}" class="btn btn-primary">
|
||||
<i class="fa fa-list"></i>
|
||||
配置列表
|
||||
</a>
|
||||
<a href="{:url('Config/add')}" class="btn btn-danger">
|
||||
<i class="fa fa-list"></i>
|
||||
添加配置
|
||||
</a>
|
||||
{/block}
|
||||
{block name="body"}
|
||||
|
||||
<div class="main-box clearfix vue-main">
|
||||
<header class="main-box-header clearfix">
|
||||
<div class="pull-left">
|
||||
<h2>配置管理</h2>
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
<a href="{:url('Config/index')}" class="btn btn-primary">
|
||||
<i class="fa fa-list"></i>
|
||||
配置列表
|
||||
</a>
|
||||
<a href="{:url('Config/add')}" class="btn btn-danger">
|
||||
<i class="fa fa-list"></i>
|
||||
添加配置
|
||||
</a>
|
||||
</div>
|
||||
</header>
|
||||
<div class="main-box-body clearfix">
|
||||
<div class="tabs-wrapper">
|
||||
<ul class="nav nav-tabs">
|
||||
{volist name="config['config_group_list']" id="item"}
|
||||
@@ -80,16 +72,19 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript">
|
||||
require(['vue', 'jquery'], function(Vue, $){
|
||||
new Vue({
|
||||
el:".vue-main",
|
||||
data:{}
|
||||
})
|
||||
var vm = new Vue({
|
||||
el:".vue-main",
|
||||
data:{},
|
||||
created(){
|
||||
$.ajax({
|
||||
success: function(res){
|
||||
console.log(res)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{extend name="admin/base"/}
|
||||
@@ -0,0 +1 @@
|
||||
{extend name="admin/base"/}
|
||||
Reference in New Issue
Block a user