[更新]修改系统参数配置表单

This commit is contained in:
Anyon 2019-09-30 14:52:51 +08:00
parent d9f21d2dab
commit 56a9dc9156
4 changed files with 144 additions and 72 deletions

View File

@ -62,21 +62,29 @@ class Config extends Controller
* 系统参数配置
* @auth true
* @menu true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function info()
{
$this->title = '系统参数配置';
$this->fetch();
}
/**
* 修改系统能数配置
* @auth true
* @throws \think\Exception
* @throws \think\exception\PDOException
*/
public function config()
{
$this->applyCsrfToken();
if (Request::isGet()) {
$this->title = '系统参数配置';
$this->fetch();
} else {
foreach (Request::post() as $key => $value) {
sysconf($key, $value);
}
$this->success('系统参数配置成功!');
$this->fetch('system-config');
}
foreach (Request::post() as $key => $value) {
sysconf($key, $value);
}
$this->success('系统参数配置成功!');
}
/**

View File

@ -11,67 +11,75 @@
{/foreach}
</div>
<form onsubmit="return false" data-auto="true" action="{:url()}" method="post" class="think-box-shadow padding-40 padding-bottom-10">
<div class="layui-row layui-col-space30">
<div class="layui-col-md6">
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">程序名称</span>
<span class="color-desc margin-left-5">Name</span>
<input name="app_name" required placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input">
</label>
<p class="help-block">程序名称,在后台左上角标题处理显示</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">程序版本</span>
<span class="color-desc margin-left-5">Version</span>
<input name="app_version" placeholder="请输入程序版本" value="{:sysconf('app_version')}" class="layui-input">
</label>
<p class="help-block">程序版本,在后台左上角标题处理显示</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站名称</span>
<span class="color-desc margin-left-5">Website</span>
<input name="site_name" required placeholder="请输入网站名称" value="{:sysconf('site_name')}" class="layui-input">
</label>
<p class="help-block">网站名称,将在浏览器的标签上显示名称</p>
</div>
</div>
<div class="layui-col-md6">
<div class="layui-form-item">
<span class="color-green font-w7">浏览器图标</span>
<span class="color-desc margin-left-5">Browser</span>
<div class="relative block">
<img alt="icon" data-tips-image style="height:auto;max-height:32px;min-width:32px" src="{:sysconf('site_icon')}"/>
<input type="hidden" name="site_icon" onchange="$(this).prev('img').attr('src', this.value)" value="{:sysconf('site_icon')}" class="layui-input">
<a class="margin-left-10" data-file="btn" data-type="ico,png" data-field="site_icon">上传图片</a>
<p class="help-block">建议上传 ICO 图标的尺寸为 128x128 <a href="http://www.favicon-icon-generator.com" target="_blank">ICON在线制作</a></p>
</div>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站备案号</span>
<span class="color-desc margin-left-5">Miitbeian</span>
<input name="miitbeian" placeholder="请输入网站备案号" value="{:sysconf('miitbeian')}" class="layui-input">
</label>
<p class="help-block">网站备案号,可以在<a target="_blank" href="http://beian.miit.gov.cn">备案管理中心</a>查询获取,将在登录页面下面显示</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站版权信息</span>
<span class="color-desc margin-left-5">Copyright</span>
<input name="site_copy" required placeholder="请输入版权信息" value="{:sysconf('site_copy')}" class="layui-input">
</label>
<p class="help-block">网站版权信息,在后台登录页面显示版本信息并链接到备案到信息备案管理系统</p>
</div>
</div>
</div>
<div class="hr-line-dashed"></div>
<div class="layui-form-item text-center">
<button class="layui-btn" type="submit">保存配置</button>
</div>
</form>
{if auth('config')}
<div class="think-box-shadow margin-bottom-15">
<span class="color-green font-w7">系统配置参数:</span>
<a class="layui-btn layui-btn-sm layui-btn-primary" data-modal="{:url('config')}">修改系统配置</a>
</div>
{/if}
<div class="think-box-shadow padding-40">
<div class="layui-form-item">
<div class="absolute" style="width:100px;overflow:hidden">
<span class="color-green font-w7">网站图标</span>
<img alt="icon" data-tips-image style="height:auto;max-height:55px;min-width:55px" src="{:sysconf('site_icon')}"/>
</div>
<div style="padding-left:80px">
<span class="color-green font-w7">网站名称 Website</span>
<label class="relative block">
<input readonly value="{:sysconf('site_name')}" class="layui-input layui-bg-gray">
<a data-copy="{:sysconf('site_name')}" class="fa fa-copy right-btn"></a>
</label>
<p class="help-block">网站名称及网站图标,将显示在浏览器的标签上</p>
</div>
</div>
<div class="layui-form-item">
<span class="color-green font-w7">管理程序名称 Name</span>
<label class="relative block">
<input readonly placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input layui-bg-gray">
<a data-copy="{:sysconf('app_name')}" class="fa fa-copy right-btn"></a>
</label>
<p class="help-block">管理程序名称,将显示在后台左上角标题</p>
</div>
<div class="layui-form-item">
<span class="color-green font-w7">管理程序版本 Version</span>
<label class="relative block">
<input readonly value="{:sysconf('app_version')}" class="layui-input layui-bg-gray">
<a data-copy="{:sysconf('app_version')}" class="fa fa-copy right-btn"></a>
</label>
<p class="help-block">管理程序版本,将显示在后台左上角标题</p>
</div>
<div class="layui-form-item">
<span class="color-green font-w7">网站备案号 Miitbeian</span>
<label class="relative block">
<input readonly value="{:sysconf('miitbeian')}" class="layui-input layui-bg-gray">
<a data-copy="{:sysconf('miitbeian')}" class="fa fa-copy right-btn"></a>
</label>
<p class="help-block">网站备案号,可以在<a target="_blank" href="http://beian.miit.gov.cn">备案管理中心</a>查询获取,将显示在登录页面下面</p>
</div>
<div class="layui-form-item">
<span class="color-green font-w7">网站版权信息 Copyright</span>
<label class="relative block">
<input readonly value="{:sysconf('site_copy')}" class="layui-input layui-bg-gray">
<a data-copy="{:sysconf('site_copy')}" class="fa fa-copy right-btn"></a>
</label>
<p class="help-block">网站版权信息,在后台登录页面显示版本信息并链接到备案到信息备案管理系统</p>
</div>
</div>
{/block}
{block name='style'}
<style>
.right-btn {
top: 0;
right: 0;
width: 38px;
height: 38px;
display: inline-block;
position: absolute;
text-align: center;
line-height: 38px;
}
</style>
{/block}

View File

@ -1,7 +1,7 @@
<form onsubmit="return false;" data-auto="true" action="{:url()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body">
<div class="color-text margin-left-40 margin-bottom-20 layui-code" style="border-left-width:1px">
<p class="font-w7">文件将存储在本地服务器,需确保服务器的 public/upload 目录有写入权限,有足够的存储空间!</p>
<p>文件将存储在本地服务器,需确保服务器的 public/upload 目录有写入权限,有足够的存储空间!</p>
</div>
<div class="layui-form-item">
<label class="layui-form-label">AllowExts<br><span class="nowrap color-desc">允许类型</span></label>

View File

@ -0,0 +1,56 @@
<form onsubmit="return false" data-auto="true" action="{:url()}" method="post" class='layui-form layui-card' autocomplete="off">
<div class="layui-card-body padding-left-40">
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站名称 Website</span>
<input name="site_name" required placeholder="请输入网站名称" value="{:sysconf('site_name')}" class="layui-input">
</label>
<p class="help-block">网站名称,将在浏览器的标签上显示名称</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">管理程序名称 Name</span>
<input name="app_name" required placeholder="请输入程序名称" value="{:sysconf('app_name')}" class="layui-input">
</label>
<p class="help-block">管理程序名称,在后台左上角标题处理显示</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">管理程序版本 Version</span>
<input name="app_version" placeholder="请输入程序版本" value="{:sysconf('app_version')}" class="layui-input">
</label>
<p class="help-block">管理程序版本,在后台左上角标题处理显示</p>
</div>
<div class="layui-form-item">
<span class="color-green font-w7">浏览器图标 Browser</span>
<div class="relative block">
<img alt="icon" data-tips-image style="height:auto;max-height:42px;min-width:42px" src="{:sysconf('site_icon')}"/>
<input type="hidden" name="site_icon" onchange="$(this).prev('img').attr('src', this.value)" value="{:sysconf('site_icon')}" class="layui-input">
<a class="margin-left-10" data-file="btn" data-type="ico,png" data-field="site_icon">上传图片</a>
<p class="help-block">建议上传 ICO 图标的尺寸为 128x128 <a href="http://www.favicon-icon-generator.com" target="_blank">ICON在线制作</a></p>
</div>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站备案号 Miitbeian</span>
<input name="miitbeian" required placeholder="请输入网站备案号" value="{:sysconf('miitbeian')}" class="layui-input">
</label>
<p class="help-block">网站备案号,可以在<a target="_blank" href="http://beian.miit.gov.cn">备案管理中心</a>查询获取,将在登录页面下面显示</p>
</div>
<div class="layui-form-item">
<label class="relative block">
<span class="color-green font-w7">网站版权信息 Copyright</span>
<input name="site_copy" required placeholder="请输入版权信息" value="{:sysconf('site_copy')}" class="layui-input">
</label>
<p class="help-block">网站版权信息,在后台登录页面显示版本信息并链接到备案到信息备案管理系统</p>
</div>
<div class="hr-line-dashed"></div>
<div class="layui-form-item text-center">
<button class="layui-btn" type="submit">保存配置</button>
<button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消修改吗?" data-close>取消修改</button>
</div>
</div>
</form>