first commit
This commit is contained in:
221
views/layouts/main.php
Normal file
221
views/layouts/main.php
Normal file
@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var string $content */
|
||||
|
||||
use app\assets\AppAsset;
|
||||
use app\widgets\Alert;
|
||||
use yii\bootstrap5\Breadcrumbs;
|
||||
use yii\bootstrap5\Html;
|
||||
use yii\bootstrap5\Nav;
|
||||
use yii\bootstrap5\NavBar;
|
||||
|
||||
AppAsset::register($this);
|
||||
|
||||
$this->registerCsrfMetaTags();
|
||||
$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset');
|
||||
$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
|
||||
$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']);
|
||||
$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']);
|
||||
$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii::getAlias('@web/images/logo.png')]);
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>" class="h-100">
|
||||
<head>
|
||||
<script>if (window !== top) top.location.replace(location.href);</script>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<!-- <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>-->
|
||||
<!-- <link rel="stylesheet" href="../../../assets/module/admin.css?v=317">-->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
<style>
|
||||
body {
|
||||
background-image: url("/images/bg-login.jpg");
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
body:before {
|
||||
content: "";
|
||||
background-color: rgba(0, 0, 0, .2);
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.login-wrapper {
|
||||
max-width: 420px;
|
||||
padding: 20px;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form {
|
||||
padding: 25px 30px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 3px 6px -1px rgba(0, 0, 0, 0.19);
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > h2 {
|
||||
color: #333;
|
||||
font-size: 18px;
|
||||
text-align: center;
|
||||
margin-bottom: 25px;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item {
|
||||
margin-bottom: 25px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item > .layui-input {
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
border-radius: 2px !important;
|
||||
}
|
||||
|
||||
.login-wrapper .layui-input-icon-group > .layui-input {
|
||||
padding-left: 46px;
|
||||
}
|
||||
|
||||
.login-wrapper .layui-input-icon-group > .layui-icon {
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
line-height: 46px;
|
||||
font-size: 20px;
|
||||
color: #909399;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item.login-captcha-group {
|
||||
padding-right: 135px;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item.login-captcha-group > .login-captcha {
|
||||
height: 46px;
|
||||
width: 120px;
|
||||
cursor: pointer;
|
||||
box-sizing: border-box;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 2px !important;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item > .layui-form-checkbox {
|
||||
margin: 0 !important;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item > .layui-form-checkbox > .layui-icon {
|
||||
width: 15px !important;
|
||||
height: 15px !important;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form .layui-btn-fluid {
|
||||
height: 48px;
|
||||
line-height: 48px;
|
||||
font-size: 16px;
|
||||
border-radius: 2px !important;
|
||||
}
|
||||
|
||||
.login-wrapper > .layui-form > .layui-form-item.login-oauth-group > a > .layui-icon {
|
||||
font-size: 26px;
|
||||
}
|
||||
|
||||
.login-copyright {
|
||||
color: #eee;
|
||||
padding-bottom: 20px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
@media screen and (min-height: 550px) {
|
||||
.login-wrapper {
|
||||
margin: -250px auto 0;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 0;
|
||||
right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.login-copyright {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.layui-btn {
|
||||
background-color: #5FB878;
|
||||
border-color: #5FB878;
|
||||
}
|
||||
|
||||
.layui-link {
|
||||
color: #5FB878 !important;
|
||||
}
|
||||
|
||||
.p{
|
||||
text-align: center;
|
||||
margin-bottom: 25px;
|
||||
font-weight: 300;
|
||||
color: #999;
|
||||
font-size: 17px ;
|
||||
}
|
||||
.h2{
|
||||
margin-bottom: 10px !important;
|
||||
font-weight: 500;
|
||||
font-size: 30px !important;
|
||||
color: #000;
|
||||
}
|
||||
</style>
|
||||
<body class="d-flex flex-column h-100 theme-colorful">
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<?= $content ?>
|
||||
|
||||
<footer id="footer" class="mt-auto py-3 bg-light">
|
||||
<div class="container">
|
||||
<div class="row text-muted">
|
||||
<!-- <div class="col-md-6 text-center text-md-start">© My Company --><?//= date('Y') ?><!--</div>-->
|
||||
<div class="col-md-6 text-center text-md-end"><?= "copyright © " . date('Y') . " rights reserved." ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
<?php $this->registerJsFile('@web/libs/layui/layui.js') ?>
|
||||
<?php $this->registerJsFile('@web/js/common.js') ?>
|
||||
<!-- js部分 -->
|
||||
<!--<script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>-->
|
||||
<!--<script type="text/javascript" src="../../../assets/js/common.js?v=317"></script>-->
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
|
||||
83
views/layouts/main_bak.php
Normal file
83
views/layouts/main_bak.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var string $content */
|
||||
|
||||
use app\assets\AppAsset;
|
||||
use app\widgets\Alert;
|
||||
use yii\bootstrap5\Breadcrumbs;
|
||||
use yii\bootstrap5\Html;
|
||||
use yii\bootstrap5\Nav;
|
||||
use yii\bootstrap5\NavBar;
|
||||
|
||||
AppAsset::register($this);
|
||||
|
||||
$this->registerCsrfMetaTags();
|
||||
$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset');
|
||||
$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
|
||||
$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']);
|
||||
$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']);
|
||||
$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii::getAlias('@web/favicon.ico')]);
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>" class="h-100">
|
||||
<head>
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
<body class="d-flex flex-column h-100">
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<header id="header">
|
||||
<?php
|
||||
NavBar::begin([
|
||||
'brandLabel' => Yii::$app->name,
|
||||
'brandUrl' => Yii::$app->homeUrl,
|
||||
'options' => ['class' => 'navbar-expand-md navbar-dark bg-dark fixed-top']
|
||||
]);
|
||||
echo Nav::widget([
|
||||
'options' => ['class' => 'navbar-nav'],
|
||||
'items' => [
|
||||
['label' => 'Home', 'url' => ['/site/index']],
|
||||
['label' => 'About', 'url' => ['/site/about']],
|
||||
['label' => 'Contact', 'url' => ['/site/contact']],
|
||||
Yii::$app->user->isGuest
|
||||
? ['label' => 'Login', 'url' => ['/site/login']]
|
||||
: '<li class="nav-item">'
|
||||
. Html::beginForm(['/site/logout'])
|
||||
. Html::submitButton(
|
||||
'Logout (' . Yii::$app->user->identity->username . ')',
|
||||
['class' => 'nav-link btn btn-link logout']
|
||||
)
|
||||
. Html::endForm()
|
||||
. '</li>'
|
||||
]
|
||||
]);
|
||||
NavBar::end();
|
||||
?>
|
||||
</header>
|
||||
|
||||
<main id="main" class="flex-shrink-0" role="main">
|
||||
<div class="container">
|
||||
<?php if (!empty($this->params['breadcrumbs'])): ?>
|
||||
<?= Breadcrumbs::widget(['links' => $this->params['breadcrumbs']]) ?>
|
||||
<?php endif ?>
|
||||
<?= Alert::widget() ?>
|
||||
<?= $content ?>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<footer id="footer" class="mt-auto py-3 bg-light">
|
||||
<div class="container">
|
||||
<div class="row text-muted">
|
||||
<div class="col-md-6 text-center text-md-start">© My Company <?= date('Y') ?></div>
|
||||
<div class="col-md-6 text-center text-md-end"><?= Yii::powered() ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
85
views/layouts/main_index.php
Normal file
85
views/layouts/main_index.php
Normal file
@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/** @var yii\web\View $this */
|
||||
/** @var string $content */
|
||||
|
||||
use app\assets\AppAsset;
|
||||
use app\widgets\Alert;
|
||||
use yii\bootstrap5\Breadcrumbs;
|
||||
use yii\bootstrap5\Html;
|
||||
use yii\bootstrap5\Nav;
|
||||
use yii\bootstrap5\NavBar;
|
||||
|
||||
AppAsset::register($this);
|
||||
|
||||
$this->registerCsrfMetaTags();
|
||||
$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset');
|
||||
$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
|
||||
$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']);
|
||||
$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']);
|
||||
$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii::getAlias('@web/images/logo.png')]);
|
||||
$this->registerJsFile('@web/js/layui.js', ['position' => \yii\web\View::POS_HEAD]);
|
||||
$this->registerJsFile('@web/libs/layui/lay/modules/jquery.js', ['position' => \yii\web\View::POS_HEAD]);
|
||||
$this->registerJsFile('@web/js/common.js', ['position' => \yii\web\View::POS_HEAD]);
|
||||
?>
|
||||
<?php $this->beginPage() ?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="<?= Yii::$app->language ?>" class="h-100">
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title><?= Html::encode($this->title) ?></title>
|
||||
<!-- <script src="//unpkg.com/layui@2.13.3/dist/layui.js"></script>-->
|
||||
<!-- <link rel="stylesheet" href="../../../assets/libs/layui/css/layui.css"/>-->
|
||||
<!-- <link rel="stylesheet" href="../../../assets/module/admin.css?v=317">-->
|
||||
<!--[if lt IE 9]>
|
||||
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
|
||||
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
|
||||
<![endif]-->
|
||||
<?php $this->head() ?>
|
||||
</head>
|
||||
|
||||
<body class="layui-layout-body">
|
||||
<?php $this->beginBody() ?>
|
||||
|
||||
<?= $content ?>
|
||||
|
||||
<?php $this->endBody() ?>
|
||||
<!-- js部分 -->
|
||||
<!--<script type="text/javascript" src="../../../assets/libs/layui/layui.js"></script>-->
|
||||
<!--<script type="text/javascript" src="../../../assets/js/common.js?v=317"></script>-->
|
||||
<script>
|
||||
layui.use(['layer', 'form','admin'], function () {
|
||||
var $ = layui.jquery;
|
||||
var layer = layui.layer;
|
||||
var form = layui.form;
|
||||
var admin = layui.admin;
|
||||
/* 表单提交 */
|
||||
form.on('submit(loginSubmit)', function (obj) {
|
||||
admin.showLoading('body',1, '.7');
|
||||
$.post('',obj.field ,function (res) {
|
||||
if(res.code == 666){
|
||||
layer.msg(res.msg, {icon: 1, time: 1500}, function () {
|
||||
location.replace('/')
|
||||
});
|
||||
}else {
|
||||
layer.msg(res.msg, {icon: 2, time: 1500});
|
||||
$('img.login-captcha').prop('src',$('img.login-captcha').attr('src')+ '?t=' + (new Date).getTime());
|
||||
}
|
||||
admin.removeLoading( 'body',true, true);
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
/* 图形验证码 */
|
||||
$('img.login-captcha').click(function () {
|
||||
this.src = this.src + '?t=' + (new Date).getTime();
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
<?php $this->endPage() ?>
|
||||
|
||||
Reference in New Issue
Block a user