新增前端站点
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
// 这是系统自动生成的公共文件
|
||||
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
/**
|
||||
* 前台系统-基础控制器
|
||||
*/
|
||||
namespace app\index\controller;
|
||||
use app\AppApi;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Cookie;
|
||||
use think\facade\Config;
|
||||
|
||||
use think\exception\HttpResponseException;
|
||||
use think\facade\Request;
|
||||
|
||||
class Base
|
||||
{
|
||||
public $config = [];
|
||||
public $userId = null;
|
||||
public $user = [];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
date_default_timezone_set('PRC');
|
||||
# 获取配置
|
||||
$this->config = Db::table('yz_admin_config')->select()->toArray();
|
||||
// 将配置数据转换为键值对形式
|
||||
$configData = [];
|
||||
foreach ($this->config as $item) {
|
||||
// 使用正确的字段名 config_name 和 config_value
|
||||
if (isset($item['config_name']) && isset($item['config_value'])) {
|
||||
$configData[$item['config_name']] = $item['config_value'];
|
||||
}
|
||||
}
|
||||
$this->config = $configData;
|
||||
|
||||
# 获取用户信息
|
||||
$this->userId = Cookie::get('user_id');
|
||||
if (!empty($this->userId)) {
|
||||
$this->user = Db::table('yz_users')->where('uid', $this->userId)->find();
|
||||
}
|
||||
|
||||
View::assign([
|
||||
'user' => $this->user,
|
||||
'config' => $this->config
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回json对象
|
||||
*/
|
||||
protected function returnCode($code, $data = [], $count = 10)
|
||||
{
|
||||
header('Content-type:application/json');
|
||||
if ($code == 0) {
|
||||
$arr = array(
|
||||
'code' => $code,
|
||||
'msg' => '成功',
|
||||
'count' => $count,
|
||||
'data' => $data
|
||||
);
|
||||
} else if ($code >= 1 && $code <= 100) {
|
||||
$arr = array(
|
||||
'code' => $code,
|
||||
'msg' => $data
|
||||
);
|
||||
} else {
|
||||
$appapi = new AppApi();
|
||||
$arr = array(
|
||||
'code' => $code,
|
||||
'msg' => $appapi::errorTip($code)
|
||||
);
|
||||
}
|
||||
echo json_encode($arr);
|
||||
if ($code != 0) {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作成功跳转的快捷方法
|
||||
* @access protected
|
||||
* @param mixed $msg 提示信息
|
||||
* @return void
|
||||
*/
|
||||
protected function success($msg = '')
|
||||
{
|
||||
$result = [
|
||||
'code' => 1,
|
||||
'msg' => $msg
|
||||
];
|
||||
|
||||
$type = $this->getResponseType();
|
||||
if ($type == 'html') {
|
||||
$response = view(Config::get('app.dispatch_success_tmpl'), $result);
|
||||
} else if ($type == 'json') {
|
||||
$response = json($result);
|
||||
}
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作错误跳转的快捷方法
|
||||
* @access protected
|
||||
* @param mixed $msg 提示信息
|
||||
* @return void
|
||||
*/
|
||||
protected function error($msg = '')
|
||||
{
|
||||
$result = [
|
||||
'code' => 0,
|
||||
'msg' => $msg
|
||||
];
|
||||
$response = view(Config::get('app.dispatch_error_tmpl'), $result);
|
||||
throw new HttpResponseException($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前的response 输出类型
|
||||
* @access protected
|
||||
* @return string
|
||||
*/
|
||||
protected function getResponseType()
|
||||
{
|
||||
return Request::isJson() || Request::isAjax() ? 'json' : 'html';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台管理系统-首页
|
||||
*/
|
||||
namespace app\index\controller;
|
||||
use app\index\controller\Base;
|
||||
use think\facade\Db;
|
||||
use think\facade\View;
|
||||
use think\facade\Env;
|
||||
use think\facade\Config;
|
||||
|
||||
class Index extends Base
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的event定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
// 这是系统自动生成的middleware定义文件
|
||||
return [
|
||||
|
||||
];
|
||||
@@ -0,0 +1,83 @@
|
||||
<footer class="footer">
|
||||
<div class="container">
|
||||
<div class="footer-content">
|
||||
<div class="footer-logo">
|
||||
<h3>{$config['admin_name']}</h3>
|
||||
</div>
|
||||
<div class="footer-links">
|
||||
<ul>
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/about">关于我们</a></li>
|
||||
<li><a href="/contact">联系我们</a></li>
|
||||
<li><a href="/service">服务条款</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="footer-contact">
|
||||
<p>电话:{$config['phone'] ?? '暂无'}</p>
|
||||
<p>邮箱:{$config['email'] ?? 'admin@example.com'}</p>
|
||||
<p>地址:{$config['address'] ?? '暂无地址信息'}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer-bottom">
|
||||
<p>版权所有 © {date('Y')} {$config['admin_name']} - 保留所有权利</p>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<style>
|
||||
.footer {
|
||||
background-color: #333;
|
||||
color: #fff;
|
||||
padding: 30px 0;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 15px;
|
||||
}
|
||||
.footer-content {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.footer-logo h3 {
|
||||
margin: 0;
|
||||
font-size: 24px;
|
||||
color: #fff;
|
||||
}
|
||||
.footer-links ul {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
.footer-links li {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.footer-links a {
|
||||
color: #ccc;
|
||||
text-decoration: none;
|
||||
transition: color 0.3s;
|
||||
}
|
||||
.footer-links a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
.footer-contact p {
|
||||
margin: 5px 0;
|
||||
color: #ccc;
|
||||
}
|
||||
.footer-bottom {
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #444;
|
||||
}
|
||||
@media (max-width: 768px) {
|
||||
.footer-content {
|
||||
flex-direction: column;
|
||||
}
|
||||
.footer-logo, .footer-links, .footer-contact {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,22 @@
|
||||
<header class="site-header">
|
||||
<div class="logo">
|
||||
<a href="/">网站名称</a>
|
||||
</div>
|
||||
<nav class="main-nav">
|
||||
<ul>
|
||||
<li><a href="/">首页</a></li>
|
||||
<li><a href="/about">关于我们</a></li>
|
||||
<li><a href="/services">服务</a></li>
|
||||
<li><a href="/contact">联系我们</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<div class="user-actions">
|
||||
<?php if(isset($_SESSION['user_id'])): ?>
|
||||
<a href="/user/profile">个人中心</a>
|
||||
<a href="/user/logout">退出登录</a>
|
||||
<?php else: ?>
|
||||
<a href="/user/login">登录</a>
|
||||
<a href="/user/register">注册</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</header>
|
||||
@@ -0,0 +1,410 @@
|
||||
<main class="main-content">
|
||||
<div class="container">
|
||||
<section class="hero-section">
|
||||
<div class="hero-content">
|
||||
<h1>欢迎来到我们的网站</h1>
|
||||
<p>我们提供专业的服务和优质的产品</p>
|
||||
<a href="#" class="btn btn-primary">了解更多</a>
|
||||
</div>
|
||||
<div class="hero-image">
|
||||
<img src="__STATIC__/images/hero.jpg" alt="欢迎图片">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="features-section">
|
||||
<h2 class="section-title">我们的特色</h2>
|
||||
<div class="features-grid">
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="layui-icon layui-icon-star"></i>
|
||||
</div>
|
||||
<h3>高品质服务</h3>
|
||||
<p>我们致力于提供最优质的服务,满足客户的各种需求。</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="layui-icon layui-icon-diamond"></i>
|
||||
</div>
|
||||
<h3>专业团队</h3>
|
||||
<p>我们拥有经验丰富的专业团队,为您提供最佳解决方案。</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<div class="feature-icon">
|
||||
<i class="layui-icon layui-icon-heart"></i>
|
||||
</div>
|
||||
<h3>客户至上</h3>
|
||||
<p>以客户需求为中心,提供个性化的服务和支持。</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="about-section">
|
||||
<div class="about-content">
|
||||
<h2 class="section-title">关于我们</h2>
|
||||
<p>我们是一家专注于提供高质量服务的公司,成立于2010年。多年来,我们不断创新和发展,已经成为行业内的领先企业。</p>
|
||||
<p>我们的使命是通过卓越的产品和服务,帮助客户实现他们的目标和愿景。</p>
|
||||
<a href="#" class="btn btn-secondary">查看更多</a>
|
||||
</div>
|
||||
<div class="about-image">
|
||||
<img src="__STATIC__/images/about.jpg" alt="关于我们">
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="products-section">
|
||||
<h2 class="section-title">热门产品</h2>
|
||||
<div class="products-grid">
|
||||
<div class="product-card">
|
||||
<img src="__STATIC__/images/product1.jpg" alt="产品1">
|
||||
<h3>产品一</h3>
|
||||
<p>产品描述信息,介绍产品的特点和优势。</p>
|
||||
<a href="#" class="btn btn-small">查看详情</a>
|
||||
</div>
|
||||
<div class="product-card">
|
||||
<img src="__STATIC__/images/product2.jpg" alt="产品2">
|
||||
<h3>产品二</h3>
|
||||
<p>产品描述信息,介绍产品的特点和优势。</p>
|
||||
<a href="#" class="btn btn-small">查看详情</a>
|
||||
</div>
|
||||
<div class="product-card">
|
||||
<img src="__STATIC__/images/product3.jpg" alt="产品3">
|
||||
<h3>产品三</h3>
|
||||
<p>产品描述信息,介绍产品的特点和优势。</p>
|
||||
<a href="#" class="btn btn-small">查看详情</a>
|
||||
</div>
|
||||
<div class="product-card">
|
||||
<img src="__STATIC__/images/product4.jpg" alt="产品4">
|
||||
<h3>产品四</h3>
|
||||
<p>产品描述信息,介绍产品的特点和优势。</p>
|
||||
<a href="#" class="btn btn-small">查看详情</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="contact-section">
|
||||
<h2 class="section-title">联系我们</h2>
|
||||
<div class="contact-container">
|
||||
<div class="contact-info">
|
||||
<div class="contact-item">
|
||||
<i class="layui-icon layui-icon-location"></i>
|
||||
<p>地址:中国上海市浦东新区张江高科技园区</p>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<i class="layui-icon layui-icon-cellphone"></i>
|
||||
<p>电话:400-123-4567</p>
|
||||
</div>
|
||||
<div class="contact-item">
|
||||
<i class="layui-icon layui-icon-email"></i>
|
||||
<p>邮箱:info@example.com</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="contact-form">
|
||||
<form action="#" method="post">
|
||||
<div class="form-group">
|
||||
<input type="text" name="name" placeholder="您的姓名">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="email" name="email" placeholder="您的邮箱">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<textarea name="message" placeholder="您的留言"></textarea>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">提交</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<style>
|
||||
.main-content {
|
||||
padding: 50px 0;
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.section-title {
|
||||
text-align: center;
|
||||
margin-bottom: 40px;
|
||||
font-size: 32px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
/* 英雄区域样式 */
|
||||
.hero-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.hero-content {
|
||||
flex: 1;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.hero-content h1 {
|
||||
font-size: 48px;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.hero-content p {
|
||||
font-size: 18px;
|
||||
margin-bottom: 30px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.hero-image {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.hero-image img {
|
||||
max-width: 100%;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
/* 按钮样式 */
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 12px 30px;
|
||||
border-radius: 5px;
|
||||
text-decoration: none;
|
||||
font-weight: bold;
|
||||
transition: all 0.3s ease;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background-color: #3492ED;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background-color: #2a7fd9;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background-color: #6c757d;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background-color: #5a6268;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
padding: 8px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* 特色部分样式 */
|
||||
.features-section {
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
gap: 30px;
|
||||
}
|
||||
|
||||
.feature-card {
|
||||
background-color: white;
|
||||
padding: 30px;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
|
||||
text-align: center;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.feature-card:hover {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
.feature-icon {
|
||||
font-size: 48px;
|
||||
color: #3492ED;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.feature-card h3 {
|
||||
margin-bottom: 15px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.feature-card p {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
/* 关于我们部分样式 */
|
||||
.about-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.about-content {
|
||||
flex: 1;
|
||||
padding-right: 50px;
|
||||
}
|
||||
|
||||
.about-content h2 {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.about-content p {
|
||||
margin-bottom: 20px;
|
||||
color: #666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
|
||||
.about-image {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.about-image img {
|
||||
max-width: 100%;
|
||||
border-radius: 10px;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.1);
|
||||
}
|
||||
|
||||
/* 产品部分样式 */
|
||||
.products-section {
|
||||
margin-bottom: 80px;
|
||||
}
|
||||
|
||||
.products-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.product-card {
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.product-card:hover {
|
||||
transform: translateY(-10px);
|
||||
}
|
||||
|
||||
.product-card img {
|
||||
width: 100%;
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.product-card h3 {
|
||||
padding: 15px 15px 5px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.product-card p {
|
||||
padding: 0 15px 15px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.product-card .btn {
|
||||
margin: 0 15px 15px;
|
||||
}
|
||||
|
||||
/* 联系我们部分样式 */
|
||||
.contact-section {
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
|
||||
.contact-container {
|
||||
display: flex;
|
||||
background-color: white;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.05);
|
||||
}
|
||||
|
||||
.contact-info {
|
||||
flex: 1;
|
||||
padding: 40px;
|
||||
background-color: #3492ED;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.contact-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.contact-item i {
|
||||
font-size: 24px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
|
||||
.contact-form {
|
||||
flex: 2;
|
||||
padding: 40px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group input,
|
||||
.form-group textarea {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 5px;
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
.form-group textarea {
|
||||
height: 150px;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/* 响应式设计 */
|
||||
@media (max-width: 992px) {
|
||||
.hero-section,
|
||||
.about-section {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.hero-content,
|
||||
.about-content {
|
||||
padding-right: 0;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.features-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.products-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
}
|
||||
|
||||
.contact-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 576px) {
|
||||
.features-grid,
|
||||
.products-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.hero-content h1 {
|
||||
font-size: 36px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{$config['admin_name']}</title>
|
||||
<link rel="stylesheet" href="__CSS__/style.css">
|
||||
</head>
|
||||
<body>
|
||||
{include file="component/header" /}
|
||||
{include file="component/main" /}
|
||||
{include file="component/footer" /}
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user