新增前端站点

This commit is contained in:
云泽网 2025-04-30 18:07:45 +08:00
parent b568aad8cc
commit 3a2c9281c1
21 changed files with 1268 additions and 52 deletions

View File

@ -49,52 +49,6 @@ class Base{
$controller = request()->controller();
$action = request()->action();
$key = $controller.'/'.$action;
// // 演示站专用
// if(Request::isPost()){
// if(
// $key == 'Yunzer/configvalue' ||
// $key == 'Yunzer/configadd' ||
// $key == 'Yunzer/configedit' ||
// $key == 'Yunzer/configdel' ||
// $key == 'Yunzer/menuadd' ||
// $key == 'Yunzer/menuedit' ||
// $key == 'Yunzer/menudel' ||
// $key == 'Yunzer/buttonadd' ||
// $key == 'Yunzer/buttonedit' ||
// $key == 'Yunzer/buttondel' ||
// $key == 'Yunzeradmin/groupadd' ||
// $key == 'Yunzeradmin/groupedit' ||
// $key == 'Yunzeradmin/groupdel' ||
// $key == 'Yunzeradmin/useradd' ||
// $key == 'Yunzeradmin/useredit' ||
// $key == 'Yunzeradmin/userdel' ||
// $key == 'Yunzeradmin/admininfo' ||
// $key == 'Yunzeradmin/test_add' ||
// $key == 'Yunzeradmin/test_edit' ||
// $key == 'Yunzeradmin/test_static_add' ||
// $key == 'Yunzeradmin/test_static_edit' ||
// $key == 'Index/upload_img' ||
// $key == 'Index/upload_img_s' ||
// $key == 'Index/upload_imgs_kin'
// ){
// $this->returnCode(1,'演示站,不能操作');
// }
// }
// // 演示站专用
// if($key == 'Index/index' || $key == 'Index/welcome'){
// }else{
// $aMenu = Db::table('yz_admin_sys_menu')->where('src',$key)->find();
// if(empty($aMenu)){
// $this->error('对不起,您访问的功能不存在');
// }
// $rights = json_decode($group['rights']);
// if(!in_array($aMenu['smid'],$rights)){
// $this->error('对不起,您没有权限');
// }
// }
View::assign([
'aUser' => $this->aUser,
'config' => $this->config

View File

@ -34,6 +34,11 @@
</li>
</ul>
<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
<li class="layui-nav-item layui-hide-xs" lay-unselect title="前端站点" onclick="gotoFront()">
<a href="javascript:;" layadmin-event="gotoFront">
<i class="layui-icon layui-icon-website"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect title="全屏" onclick="fullScreen()">
<a href="javascript:;" layadmin-event="fullscreen">
<i class="layui-icon layui-icon-screen-full"></i>
@ -167,6 +172,11 @@
}, 'json');
});
}
//跳转前端站点
function gotoFront(){
window.open("//{$config['admin_domain']}", "_blank");
}
</script>
</body>

View File

@ -1 +0,0 @@

2
app/index/common.php Normal file
View File

@ -0,0 +1,2 @@
<?php
// 这是系统自动生成的公共文件

View File

@ -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';
}
}

View File

@ -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');
}
}

5
app/index/event.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的event定义文件
return [
];

5
app/index/middleware.php Normal file
View File

@ -0,0 +1,5 @@
<?php
// 这是系统自动生成的middleware定义文件
return [
];

View File

@ -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>版权所有 &copy; {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>

View File

@ -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>

View File

@ -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>

View File

@ -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>

View File

@ -24,7 +24,7 @@
"topthink/framework": "^6.1.0",
"topthink/think-orm": "^2.0",
"topthink/think-filesystem": "^1.0",
"topthink/think-multi-app": "^1.0",
"topthink/think-multi-app": "^1.1",
"topthink/think-view": "^1.0",
"topthink/think-captcha": "^3.0",
"phpoffice/phpspreadsheet": "^1.25"

2
composer.lock generated
View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "8970cf0ed350dfcc74fde0c4e3fee12f",
"content-hash": "7c23a0e75a1b3f811f5e1afc64aff308",
"packages": [
{
"name": "composer/pcre",

View File

@ -11,7 +11,7 @@ return [
// 是否启用路由
'with_route' => true,
// 默认应用
'default_app' => 'admin',
'default_app' => 'index',
// 默认时区
'default_timezone' => 'Asia/Shanghai',

View File

@ -22,4 +22,13 @@ return [
'taglib_begin' => '{',
// 标签库标签结束标记
'taglib_end' => '}',
//定义JS CSS路径
'tpl_replace_string' => [
'__STATIC__' => '/static',
'__ADMIN__' => '/static/admin',
'__CSS__' => '/static/css',
'__JS__' => '/static/js',
],
// 是否开启模板编译缓存,设为false则每次都会重新编译
'tpl_cache' => false,
];

View File

@ -0,0 +1,8 @@
location ~* (runtime|application)/{
return 403;
}
location / {
if (!-e $request_filename){
rewrite ^(.*)$ /index.php?s=$1 last; break;
}
}

View File

@ -13,7 +13,16 @@
if (is_file($_SERVER["DOCUMENT_ROOT"] . $_SERVER["SCRIPT_NAME"])) {
return false;
} else {
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
// 检查是否访问后台路径
if (isset($_SERVER['REQUEST_URI']) && preg_match('#^/admin(/.*)?$#', $_SERVER['REQUEST_URI'])) {
// 将请求重定向到后台入口
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
$_SERVER["PATH_INFO"] = '/admin' . (isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : '');
$_SERVER["REQUEST_URI"] = '/index.php/admin' . (isset($_SERVER["PATH_INFO"]) ? $_SERVER["PATH_INFO"] : '');
} else {
// 前端入口
$_SERVER["SCRIPT_FILENAME"] = __DIR__ . '/index.php';
}
require __DIR__ . "/index.php";
}

View File

View File

@ -1,4 +1,4 @@
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\index.php";i:1745570174;}*/ ?>
<?php /*a:1:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\admin\view\index\index.php";i:1746003853;}*/ ?>
<!DOCTYPE html>
<html>
@ -35,6 +35,11 @@
</li>
</ul>
<ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">
<li class="layui-nav-item layui-hide-xs" lay-unselect title="前端站点" onclick="gotoFront()">
<a href="javascript:;" layadmin-event="gotoFront">
<i class="layui-icon layui-icon-website"></i>
</a>
</li>
<li class="layui-nav-item layui-hide-xs" lay-unselect title="全屏" onclick="fullScreen()">
<a href="javascript:;" layadmin-event="fullscreen">
<i class="layui-icon layui-icon-screen-full"></i>
@ -168,6 +173,11 @@
}, 'json');
});
}
//跳转前端站点
function gotoFront(){
window.open("//<?php echo htmlentities((string) $config['admin_domain']); ?>", "_blank");
}
</script>
</body>

View File

@ -0,0 +1,531 @@
<?php /*a:4:{s:59:"E:\Demos\DemoOwns\PHP\yunzer\app\index\view\index\index.php";i:1746007477;s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\index\view\component\header.php";i:1746004822;s:62:"E:\Demos\DemoOwns\PHP\yunzer\app\index\view\component\main.php";i:1746007578;s:64:"E:\Demos\DemoOwns\PHP\yunzer\app\index\view\component\footer.php";i:1746007524;}*/ ?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo htmlentities((string) $config['admin_name']); ?></title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<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>
<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>
<footer class="footer">
<div class="container">
<div class="footer-content">
<div class="footer-logo">
<h3><?php echo htmlentities((string) $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>电话:<?php echo isset($config['phone']) ? htmlentities((string) $config['phone']) : '暂无'; ?></p>
<p>邮箱:<?php echo isset($config['email']) ? htmlentities((string) $config['email']) : 'admin@example.com'; ?></p>
<p>地址:<?php echo isset($config['address']) ? htmlentities((string) $config['address']) : '暂无地址信息'; ?></p>
</div>
</div>
<div class="footer-bottom">
<p>版权所有 &copy; {date('Y')} <?php echo htmlentities((string) $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>
</body>
</html>