This commit is contained in:
walkor 2022-12-08 20:24:57 +08:00
parent a8abbb32de
commit de64561b47
8 changed files with 38 additions and 27 deletions

View File

@ -92,12 +92,12 @@ class ConfigController extends Base
$data[$section]['preload'] = !empty($items['preload']); $data[$section]['preload'] = !empty($items['preload']);
$data[$section]['session'] = !empty($items['session']); $data[$section]['session'] = !empty($items['session']);
$data[$section]['max'] = Util::filterNum($items['max'] ?? '30'); $data[$section]['max'] = Util::filterNum($items['max'] ?? '30');
$data[$section]['index']['id'] = Util::filterNum($items['index']['id'] ?? '10'); $data[$section]['index']['id'] = Util::filterNum($items['index']['id'] ?? '0');
$data[$section]['index']['href'] = Util::filterUrlPath($items['index']['href'] ?? ''); $data[$section]['index']['href'] = Util::filterUrlPath($items['index']['href'] ?? '');
$data[$section]['index']['title'] = htmlspecialchars($items['index']['title'] ?? '首页'); $data[$section]['index']['title'] = htmlspecialchars($items['index']['title'] ?? '首页');
break; break;
case 'theme': case 'theme':
$data[$section]['defaultColor'] = Util::filterNum($items['defaultColor'] ?? '1'); $data[$section]['defaultColor'] = Util::filterNum($items['defaultColor'] ?? '2');
$data[$section]['defaultMenu'] = $items['defaultMenu'] ?? '' == 'dark-theme' ? 'dark-theme' : 'light-theme'; $data[$section]['defaultMenu'] = $items['defaultMenu'] ?? '' == 'dark-theme' ? 'dark-theme' : 'light-theme';
$data[$section]['defaultHeader'] = $items['defaultHeader'] ?? '' == 'dark-theme' ? 'dark-theme' : 'light-theme'; $data[$section]['defaultHeader'] = $items['defaultHeader'] ?? '' == 'dark-theme' ? 'dark-theme' : 'light-theme';
$data[$section]['allowCustom'] = !empty($items['allowCustom']); $data[$section]['allowCustom'] = !empty($items['allowCustom']);

View File

@ -23,7 +23,7 @@ class AccessControl implements MiddlewareInterface
$msg = ''; $msg = '';
if (!Auth::canAccess($controller, $action, $code, $msg)) { if (!Auth::canAccess($controller, $action, $code, $msg)) {
if ($request->expectsJson()) { if ($request->expectsJson()) {
$response = json(['code' => $code, 'msg' => $msg, 'type' => 'error']); $response = json(['code' => $code, 'msg' => $msg, 'data' => []]);
} else { } else {
if ($code === 401) { if ($code === 401) {
$response = response(<<<EOF $response = response(<<<EOF

View File

@ -31,12 +31,20 @@
</button> </button>
</div> </div>
</form> </form>
<script>
var color = localStorage.getItem("theme-color-color");
var second = localStorage.getItem("theme-color-second");
if (!color || !second) {
localStorage.setItem("theme-color-color", "#2d8cf0");
localStorage.setItem("theme-color-second", "#ecf5ff");
}
</script>
<!-- 资 源 引 入 --> <!-- 资 源 引 入 -->
<script src="/app/admin/component/layui/layui.js"></script> <script src="/app/admin/component/layui/layui.js"></script>
<script src="/app/admin/component/pear/pear.js"></script> <script src="/app/admin/component/pear/pear.js"></script>
<script src="/app/admin/admin/js/permission.js"></script>
<script> <script>
layui.use(['form', 'button', 'popup', 'layer'], function() { layui.use(['form', 'button', 'popup', 'layer', 'theme', 'admin'], function() {
var $ = layui.$, layer = layui.layer, form = layui.form; var $ = layui.$, layer = layui.layer, form = layui.form;
function switchCaptcha() { function switchCaptcha() {
$('.codeImage').attr("src", "/app/admin/account/captcha/login?v=" + new Date().getTime()); $('.codeImage').attr("src", "/app/admin/account/captcha/login?v=" + new Date().getTime());

View File

@ -45,7 +45,7 @@
<div class="layui-form-item"> <div class="layui-form-item">
<label class="layui-form-label">端口</label> <label class="layui-form-label">端口</label>
<div class="layui-input-block"> <div class="layui-input-block">
<input type="number" placeholder="请填写入数据库端口" class="layui-input" required value="3306" /> <input type="number" placeholder="请填写入数据库端口" name="port" class="layui-input" required value="3306" />
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
@ -115,9 +115,19 @@
</div> </div>
</div> </div>
<script>
var color = localStorage.getItem("theme-color-color");
var second = localStorage.getItem("theme-color-second");
if (!color || !second) {
localStorage.setItem("theme-color-color", "#2d8cf0");
localStorage.setItem("theme-color-second", "#ecf5ff");
}
</script>
<script src="/app/admin/component/layui/layui.js"></script> <script src="/app/admin/component/layui/layui.js"></script>
<script src="/app/admin/component/pear/pear.js"></script> <script src="/app/admin/component/pear/pear.js"></script>
<script src="/app/admin/admin/js/permission.js"></script>
<script> <script>
layui.use(["form", "step","code","element", "popup"], function() { layui.use(["form", "step","code","element", "popup"], function() {
var $ = layui.$, var $ = layui.$,

View File

@ -18,7 +18,9 @@ layui.$(function () {
layui.each(codes, function (k, code) { layui.each(codes, function (k, code) {
codes[k] = '*[permission^="'+code+'"]'; codes[k] = '*[permission^="'+code+'"]';
}); });
$("head").append("<style>"+codes.join(",")+"{display: initial}</style>"); if (codes.length) {
$("head").append("<style>" + codes.join(",") + "{display: initial}</style>");
}
} }
}); });
}); });

View File

@ -23,7 +23,6 @@ layui.define(["jquery","layer"], function (exports) {
} }
theme.colorSet = function(color, second) { theme.colorSet = function(color, second) {
var style = ''; var style = '';
style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a,.pear-nav-tree .layui-this a,.pear-nav-tree .layui-this{background-color: ' +color + '!important;}'; style += '.light-theme .pear-nav-tree .layui-this a:hover,.light-theme .pear-nav-tree .layui-this,.light-theme .pear-nav-tree .layui-this a,.pear-nav-tree .layui-this a,.pear-nav-tree .layui-this{background-color: ' +color + '!important;}';
style += '.pear-admin .layui-logo .title{color:' + color + '!important;}'; style += '.pear-admin .layui-logo .title{color:' + color + '!important;}';
@ -61,6 +60,7 @@ layui.define(["jquery","layer"], function (exports) {
style += 'xm-select .xm-body .xm-option .xm-option-icon{border-color:'+color+'!important;}';//变更 style += 'xm-select .xm-body .xm-option .xm-option-icon{border-color:'+color+'!important;}';//变更
style += 'xm-select > .xm-body .xm-option.selected.hide-icon{background-color:'+color+'!important;}';//变更 style += 'xm-select > .xm-body .xm-option.selected.hide-icon{background-color:'+color+'!important;}';//变更
style += 'xm-select > .xm-body .xm-toolbar .toolbar-tag:hover{color:'+color+'!important;}';//变更 style += 'xm-select > .xm-body .xm-toolbar .toolbar-tag:hover{color:'+color+'!important;}';//变更
style += '.layui-layer-dialog .layui-layer-content .layui-icon-ok{color:'+color+'!important;}';//变更
style += '.pear-this,.pear-text{color:' + color + '!important}'; style += '.pear-this,.pear-text{color:' + color + '!important}';
style += '.pear-back{background-color:'+ color +'!important}'; style += '.pear-back{background-color:'+ color +'!important}';
style += '.pear-collapsed-pe{background-color:'+color+'!important}' style += '.pear-collapsed-pe{background-color:'+color+'!important}'

View File

@ -26,7 +26,7 @@
} }
}, },
"theme": { "theme": {
"defaultColor": "1", "defaultColor": "2",
"defaultMenu": "light-theme", "defaultMenu": "light-theme",
"defaultHeader": "light-theme", "defaultHeader": "light-theme",
"allowCustom": true, "allowCustom": true,

File diff suppressed because one or more lines are too long