mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-06 01:52:48 +08:00
完成分类和文章的模板设置
This commit is contained in:
12
README.md
12
README.md
@@ -8,17 +8,11 @@
|
||||
|
||||
#### 介绍
|
||||
|
||||
基于thinkphp6的系统后台管理模板,实现了几个通用的功能,基于ThinkPHP6,Layui,Jquery,支持各类数据库.
|
||||
基于thinkphp6的系统后台管理模板.
|
||||
|
||||
本项目的定位是实现几个基本的功能,节约您的一些开发时间,没有过多的开发设计限制.
|
||||
基于ThinkPHP6,Layui,Jquery,支持各类数据库.
|
||||
|
||||
您可以使用本模板,节省这部分时间.
|
||||
|
||||
类似的功能还有服务器信息/系统配置等.
|
||||
|
||||
实现功能的同时没有制定更多的开发规则,您完全可以把本项目的代码修按照您的意愿改掉.
|
||||
|
||||
这不是一个页面齐全,功能丰富的后台,但如果你想自定义开发又想节约一些时间,那么本模板很适合你。
|
||||
已实现很好用的`上传文件管理`,`内容管理`,`导航轮播管理(支持小程序)`的后台功能.
|
||||
|
||||
#### 最新演示
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ class Nav extends Common
|
||||
public function index(Request $request)
|
||||
{
|
||||
//
|
||||
|
||||
$type = $request->param('type',1);
|
||||
|
||||
$list = ModelNav::order('sort asc')->order('id asc')->where('type',$type)->paginate();
|
||||
|
||||
@@ -33,6 +33,11 @@ class System extends Common
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
public function theme()
|
||||
{
|
||||
|
||||
return View::fetch();
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
|
||||
46
app/index/controller/BaseController.php
Normal file
46
app/index/controller/BaseController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\BaseController as AppBaseController;
|
||||
use think\facade\Config;
|
||||
use think\facade\View;
|
||||
use think\helper\Str;
|
||||
|
||||
class BaseController extends AppBaseController
|
||||
{
|
||||
|
||||
/**
|
||||
* 是否使用多模板
|
||||
* 仅当名称为空或者指定名称有效,
|
||||
* 使用跨应用,跨控制器,引用模板路径的写法时无效
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $isUseTpls = true;
|
||||
|
||||
public function assign($template,$value)
|
||||
{
|
||||
return View::assign($template,$value);
|
||||
}
|
||||
|
||||
public function fetch($template = '',$vars = [])
|
||||
{
|
||||
if($this->isUseTpls && strpos($template,'@') === false && stripos($template,'/') === false){
|
||||
|
||||
if($template === ''){
|
||||
$config_auto_rule = Config::get('view.auto_rule');
|
||||
if (2 == $config_auto_rule) {
|
||||
$template = $this->request->action(true);
|
||||
} elseif (3 == $config_auto_rule) {
|
||||
$template = $this->request->action();
|
||||
} else {
|
||||
$template = Str::snake($this->request->action());
|
||||
}
|
||||
}
|
||||
return View::fetch(get_system_config('index_tpl_name').$template,$vars);
|
||||
}else{
|
||||
return View::fetch($template,$vars);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace app\index\controller;
|
||||
use think\facade\View;
|
||||
use think\Request;
|
||||
|
||||
class Index
|
||||
class Index extends BaseController
|
||||
{
|
||||
/**
|
||||
* 显示资源列表
|
||||
@@ -15,7 +15,10 @@ class Index
|
||||
public function index()
|
||||
{
|
||||
//
|
||||
return View::fetch();
|
||||
|
||||
dump($this->request->action());
|
||||
|
||||
return $this->fetch('');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
10
composer.lock
generated
10
composer.lock
generated
@@ -8,16 +8,16 @@
|
||||
"packages": [
|
||||
{
|
||||
"name": "league/flysystem",
|
||||
"version": "1.0.66",
|
||||
"version": "1.0.67",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/thephpleague/flysystem.git",
|
||||
"reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21"
|
||||
"reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/021569195e15f8209b1c4bebb78bd66aa4f08c21",
|
||||
"reference": "021569195e15f8209b1c4bebb78bd66aa4f08c21",
|
||||
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/5b1f36c75c4bdde981294c2a0ebdb437ee6f275e",
|
||||
"reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e",
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
@@ -94,7 +94,7 @@
|
||||
"sftp",
|
||||
"storage"
|
||||
],
|
||||
"time": "2020-03-17T18:58:12+00:00"
|
||||
"time": "2020-04-16T13:21:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "league/flysystem-cached-adapter",
|
||||
|
||||
14
config/view_type.php
Normal file
14
config/view_type.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'category' => [
|
||||
'' => '普通',
|
||||
|
||||
'_product' => '产品',
|
||||
'_case' => '案例',
|
||||
'_about' => '关于',
|
||||
],
|
||||
'post' => [
|
||||
'' => '普通',
|
||||
]
|
||||
];
|
||||
@@ -39,6 +39,7 @@ class CreateTableNav extends Migrator
|
||||
$table->addColumn(ColumnFormat::timestamp('delete_time'));
|
||||
$table->addColumn(Column::make('type','integer')->setLimit(10)->setSigned(false)->setComment('类型,用于区分业务场景:1:PC导航,2:PC轮播图,3:PC友情链接'));
|
||||
$table->addColumn(Column::make('img','string')->setLimit(100)->setComment('图片'));
|
||||
$table->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述'));
|
||||
$table->addColumn(Column::make('target','string')->setLimit(10)->setSigned(false)->setComment('网页链接打开对象,_BLANK,_SELF,iframe_name'));
|
||||
$table->addColumn(Column::make('xcx_type','integer')->setLimit(10)->setComment('小程序打开方式,1:小程序导航页面,2:普通页面,3:web-view,4:其他小程序,5:电话'));
|
||||
$table->addColumn(Column::make('value','string')->setLimit(100)->setComment('对象值,有可能是网页链接,小程序导航页面路径,小程序普通页面路径,电话'));
|
||||
|
||||
@@ -48,6 +48,7 @@ class CreateTablePost extends Migrator
|
||||
$table->addColumn(ColumnFormat::integerTypeStatus('type')->setComment('类型,1:文章,有分类有标签,2:页面,无分类无标签'));
|
||||
$table->addColumn(Column::make('files','text')->setComment('附件'));
|
||||
$table->addColumn(Column::make('pictures','text')->setComment('相册'));
|
||||
$table->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称'));
|
||||
$table->addIndex('type');
|
||||
$table->addIndex('status');
|
||||
$table->addIndex('delete_time');
|
||||
|
||||
@@ -37,6 +37,9 @@ class CreateTableCategory extends Migrator
|
||||
->addColumn(ColumnFormat::timestamp('delete_time'))
|
||||
->addColumn(ColumnFormat::integer('pid')->setComment('上级id'))
|
||||
->addColumn(ColumnFormat::integer('level')->setDefault(1)->setComment('层级'))
|
||||
->addColumn(ColumnFormat::stringShort('tpl_name')->setComment('模板名称'))
|
||||
->addColumn(ColumnFormat::stringUrl('title_img')->setComment('附图'))
|
||||
->addColumn(ColumnFormat::stringLong('desc')->setComment('副标题描述'))
|
||||
->addIndex('pid')
|
||||
->create();
|
||||
}
|
||||
|
||||
@@ -48,14 +48,42 @@
|
||||
<select name="pid">
|
||||
<option value="0">--无上级分类--</option>
|
||||
{volist name='$list_category' id='category'}
|
||||
|
||||
|
||||
<option value="{$category.id}">{:str_repeat('|--',$category.level)}{$category.title}</option>
|
||||
{/volist}
|
||||
|
||||
</select>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">副标题/描述</div>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">附图</div>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" name="title_img">
|
||||
<div>
|
||||
<div class="layui-btn upload-title-img">上传</div>
|
||||
</div>
|
||||
<div>
|
||||
<img src="" class="title-img" style="display: none;max-width: 200px;max-height: 200px;;" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">模板</div>
|
||||
<div class="layui-input-block">
|
||||
<select name="tpl_name">
|
||||
{volist name=':config("view_type.category")' id='view_type' key="tpl_name"}
|
||||
<option value="{$tpl_name}">{$view_type}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button>
|
||||
</div>
|
||||
@@ -73,8 +101,27 @@
|
||||
|
||||
<script>
|
||||
|
||||
layui.use(['form'],function(){
|
||||
layui.use(['form', 'upload'], function () {
|
||||
var upload = layui.upload;
|
||||
|
||||
upload.render({
|
||||
elem: '.upload-title-img',
|
||||
url: '{:url("api/Files/save")}',
|
||||
data: {
|
||||
type: 4,
|
||||
dir: 'article'
|
||||
},
|
||||
accept: 'images',
|
||||
done: function (result) {
|
||||
if (result.code == 0) {
|
||||
layer.msg('上传成功');
|
||||
$('input[name="title_img"]').val(result.data.save_name)
|
||||
$('.title-img').attr('src', result.data.src).show();
|
||||
} else {
|
||||
layer.msg(result.msg)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
@@ -57,7 +57,34 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">副标题/描述</div>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">附图</div>
|
||||
<div class="layui-input-block">
|
||||
<input type="hidden" name="title_img">
|
||||
<div>
|
||||
<div class="layui-btn upload-title-img">上传</div>
|
||||
</div>
|
||||
<div>
|
||||
<img src="" class="title-img" style="display: none;max-width: 200px;max-height: 200px;;" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">模板</div>
|
||||
<div class="layui-input-block">
|
||||
<select name="tpl_name">
|
||||
{volist name=':config("view_type.category")' id='view_type' key="tpl_name"}
|
||||
<option value="{$tpl_name}">{$view_type}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">提交</button>
|
||||
</div>
|
||||
@@ -79,7 +106,8 @@
|
||||
var form = layui.form;
|
||||
|
||||
form.val('*',{
|
||||
pid:'{$category.pid}'
|
||||
pid:'{$category.pid}',
|
||||
tpl_name:'{$category->getData("tpl_name")}',
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<li class="layui-nav-item layui-nav-itemed left-nav-item" data-name="others">
|
||||
<a class="" href="{:url('admin/System/others')}">第三方管理</a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-nav-itemed left-nav-item" data-name="theme">
|
||||
<a class="" href="{:url('admin/System/theme')}">主题管理</a>
|
||||
</li>
|
||||
<li class="layui-nav-item layui-nav-itemed left-nav-item" data-name="agreement">
|
||||
<a class="" href="{:url('admin/System/agreement')}">用户协议管理</a>
|
||||
</li>
|
||||
|
||||
@@ -48,6 +48,12 @@
|
||||
<input type="text" name="title" required lay-verify="required" value="" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">副标题/描述</div>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $Request.param.show_img == 1 }
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -47,6 +47,12 @@
|
||||
class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">副标题/描述</div>
|
||||
<div class="layui-input-block">
|
||||
<textarea name="desc" class="layui-textarea">{$nav.desc}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{if $Request.param.show_img == 1 }
|
||||
<div class="layui-form-item">
|
||||
|
||||
@@ -213,7 +213,16 @@
|
||||
<div class="layui-form-mid layui-word-aux">越大越靠前</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">模板</div>
|
||||
<div class="layui-input-block">
|
||||
<select name="tpl_name">
|
||||
{volist name=':config("view_type.post")' id='tpl_name' key="tpl_fix"}
|
||||
<option value="{$tpl_fix}">{$tpl_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
@@ -217,7 +217,16 @@
|
||||
<div class="layui-form-mid layui-word-aux">越大越靠前</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">模板</div>
|
||||
<div class="layui-input-block">
|
||||
<select name="tpl_name">
|
||||
{volist name=':config("view_type.post")' id='tpl_name' key="tpl_fix"}
|
||||
<option value="{$tpl_fix}">{$tpl_name}</option>
|
||||
{/volist}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
@@ -338,6 +347,7 @@
|
||||
status: '{$post->getData("status")}',
|
||||
is_top: '{$post->getData("is_top")}',
|
||||
jump_to_url_status: '{$post->getData("jump_to_url_status")}',
|
||||
tpl_name: '{$post->getData("tpl_name")}',
|
||||
})
|
||||
|
||||
form.on('submit(save)', function (data) {
|
||||
@@ -350,7 +360,7 @@
|
||||
console.log(formData);
|
||||
|
||||
$.post('{:url("update")}', formData, function (result) {
|
||||
|
||||
|
||||
layer.msg('添加成功')
|
||||
setTimeout(() => {
|
||||
location.href = result.data.jump_to_url
|
||||
@@ -417,7 +427,7 @@
|
||||
|
||||
function loadCategory() {
|
||||
$.get('{:url("Category/index")}', function (result) {
|
||||
|
||||
|
||||
result.data.forEach(category => {
|
||||
var prefix = '';
|
||||
for (let prefixLevelIndex = 0; prefixLevelIndex < category.level; prefixLevelIndex++) {
|
||||
@@ -430,10 +440,10 @@
|
||||
domCategory.find('input').attr('title', prefix + category.title)
|
||||
|
||||
if (categoryList.indexOf(category.id) >= 0) {
|
||||
|
||||
|
||||
domCategory.find('input').attr('checked', 'checked')
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
domCategory.appendTo('.category-list')
|
||||
|
||||
|
||||
80
view/admin/system/theme.html
Normal file
80
view/admin/system/theme.html
Normal file
@@ -0,0 +1,80 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<meta http-equiv="X-UA-Compatible" content="ie=edge">
|
||||
<title>系统管理</title>
|
||||
{include file="common/_require"}
|
||||
|
||||
<script>
|
||||
var currentHeaderNavItem = 'System';
|
||||
var currentLeftNavItem = 'theme';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body class="layui-layout-body">
|
||||
|
||||
<div class="layui-layout layui-layout-admin">
|
||||
{include file="common/_header"}
|
||||
|
||||
{include file="common/left_system"}
|
||||
|
||||
<div class="layui-body">
|
||||
|
||||
<div style="padding:15px">
|
||||
<div class="main-header">
|
||||
<span class="layui-breadcrumb">
|
||||
<a>首页</a>
|
||||
<a><cite>系统设置</cite></a>
|
||||
</span>
|
||||
</div>
|
||||
<div class="main-container">
|
||||
<div class="layui-col-md6">
|
||||
<fieldset class="layui-elem-field">
|
||||
<legend>系统管理</legend>
|
||||
<div class="layui-field-box">
|
||||
<form class="layui-form layui-form-pane" action="{:url('admin/System/update')}" method="post" lay-filter="*">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-form-label">选择主题</div>
|
||||
<div class="layui-input-block">
|
||||
<div>
|
||||
<input type="radio" name="index_tpl_name" value="" title="无">
|
||||
</div>
|
||||
<div>
|
||||
<input type="radio" name="index_tpl_name" value="easy_blue_" title="官网主题简约蓝">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<button class="layui-btn layui-btn-fluid" submit lay-submit lay-filter="site-info">保存</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{include file="common/_footer"}
|
||||
|
||||
<script>
|
||||
layui.use(['layer','form'],function(){
|
||||
|
||||
var form = layui.form;
|
||||
|
||||
form.val('*',{
|
||||
index_tpl_name:'{:get_system_config("index_tpl_name")}'
|
||||
})
|
||||
|
||||
})
|
||||
</script>
|
||||
</div>`
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user