修改样式及配置

This commit is contained in:
Anyon 2022-04-21 14:48:58 +08:00
parent e613af8853
commit 6fec22723b
3 changed files with 23 additions and 19 deletions

View File

@ -43,22 +43,28 @@ class Login extends Controller
if (AdminService::instance()->isLogin()) {
$this->redirect(sysuri('admin/index/index'));
} else {
$this->title = '系统登录';
// 登录验证码
$this->captchaType = 'LoginCaptcha';
$this->captchaToken = CodeExtend::uniqidDate(18);
$this->developMode = SystemService::instance()->checkRunMode();
// 当前运行模式
$system = SystemService::instance();
$this->developMode = $system->checkRunMode();
// 后台背景处理
$images = str2arr(sysconf('login_image') ?: '', '|') ?: ['/static/theme/img/login/bg1.jpg', '/static/theme/img/login/bg2.jpg'];
$images = str2arr(sysconf('login_image') ?: '', '|') ?: [
$system->paths('/static/theme/img/login/bg1.jpg')['__ROOT__'],
$system->paths('/static/theme/img/login/bg2.jpg')['__ROOT__'],
];
$this->loginStyle = sprintf('style="background-image:url(%s)" data-bg-transition="%s"', $images[0], join(',', $images));
// 刷新当前后台域名
// 记录后台域名
$host = "{$this->request->scheme()}://{$this->request->host()}";
if ($host !== sysconf('base.site_host')) sysconf('base.site_host', $host);
// 标记登录验证令牌
if (!$this->app->session->get('LoginInputSessionError')) {
$this->app->session->set($this->captchaType, $this->captchaToken);
}
// 加载显示登录模板
$this->title = '系统登录';
$this->fetch();
}
} else {

View File

@ -1,11 +1,17 @@
{extend name="index/index"}
{block name='style'}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<script>if (location.href.indexOf('#') > -1) location.replace(location.href.split('#')[0])</script>
<link rel="stylesheet" href="__ROOT__/static/theme/css/login.css">
{/block}
{block name="body"}
<div class="login-container" {$loginStyle|RAW}>
<div class="login-container" {$loginStyle|raw}>
<div class="header notselect layui-hide-xs">
<a href="{:url('@')}" class="title">{:sysconf('app_name')}<span>{:sysconf('app_version')}</span></a>
{notempty name='developMode'}
<a class="pull-right layui-anim layui-anim-fadein" href='https://gitee.com/zoujingli/ThinkAdmin'>
<a class="pull-right layui-anim layui-anim-fadein" target="_blank" href='https://gitee.com/zoujingli/ThinkAdmin'>
<img src='https://gitee.com/zoujingli/ThinkAdmin/widgets/widget_1.svg' alt='Fork me on Gitee'>
</a>
{/notempty}
@ -46,12 +52,6 @@
</div>
{/block}
{block name='style'}
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<script>if (location.href.indexOf('#') > -1) location.replace(location.href.split('#')[0])</script>
<link rel="stylesheet" href="__ROOT__/static/theme/css/login.css">
{/block}
{block name='script'}
<script src="__ROOT__/static/login.js"></script>
{/block}

View File

@ -14,6 +14,8 @@
// | github 代码仓库https://github.com/zoujingli/ThinkAdmin
// +----------------------------------------------------------------------
use think\admin\service\SystemService;
return [
// 模板引擎类型使用 Think
'type' => 'Think',
@ -40,9 +42,5 @@ return [
// 标签默认过滤输出方法
'default_filter' => 'htmlentities=###,ENT_QUOTES',
// 定义模板替换字符串
'tpl_replace_string' => [
'__APP__' => rtrim(url('@')->build(), '\\/'),
'__ROOT__' => rtrim(dirname(request()->basefile()), '\\/'),
'__FULL__' => rtrim(dirname(request()->basefile(true)), '\\/'),
],
'tpl_replace_string' => SystemService::instance()->paths(),
];