Compare commits

...

3 Commits

Author SHA1 Message Date
Anyon
cfc5071a8c Update Plugs.php 2022-07-11 14:12:01 +08:00
Anyon
9422674a2b 修改插件 2022-07-11 14:02:53 +08:00
Anyon
af4a1748c4 修改环境变更 2022-07-11 13:51:29 +08:00
3 changed files with 23 additions and 6 deletions

View File

@ -38,6 +38,27 @@ class Plugs extends Controller
$this->fetch(realpath(__DIR__ . '/../../view/api/icon.html'));
}
/**
* 前端脚本变量
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function script(): \think\Response
{
$debug = $this->app->isDebug() ? 'true' : 'false';
$editor = sysconf("base.editor") ?: "ckeditor4";
$taRoot = sysuri("admin/index/index", [], false);
return response(join("\n", [
"window.taDebug = {$debug};",
"window.taAdmin = '{$taRoot}';",
"window.taEditor = '{$editor}';",
]))->header([
'Content-Type' => 'application/x-javascript'
]);
}
/**
* 优化数据库
* @login true

View File

@ -16,11 +16,7 @@
<link rel="stylesheet" href="__ROOT__/static/extra/style.css?at={:date('md')}">
{block name="style"}{/block}
<script src="__ROOT__/static/plugs/jquery/pace.min.js"></script>
<script>
window.taDebug = '{:intval($app->isDebug())}' > 0;
window.taEditor = '{:sysconf("base.editor")?:"ckeditor4"}';
window.tapiRoot = '{:sysuri("admin/index/index",[],false)}';
</script>
<script src="{:url('admin/api.plugs/script',[],false,false)}"></script>
</head>
<body class="layui-layout-body layui-layout-theme-{$theme|default='default'}">

View File

@ -40,7 +40,7 @@ if (typeof Array.prototype.forEach !== 'function') {
var srcs = document.scripts[document.scripts.length - 1].src.split('/');
window.appRoot = srcs.slice(0, -2).join('/') + '/';
window.baseRoot = srcs.slice(0, -1).join('/') + '/';
window.tapiRoot = window.tapiRoot || window.appRoot + "admin";
window.tapiRoot = window.taAdmin || window.appRoot + "admin";
/*! 挂载 layui & jquery 对象 */
layui.config({base: baseRoot + 'plugs/layui_exts/'});