完善模板功能
This commit is contained in:
parent
98156991c1
commit
5dffe62adc
@ -6,6 +6,7 @@ Route::get('usercate', 'app\\admin\\controller\\System\\FileController@getUserCa
|
||||
Route::get('allfiles', 'app\\admin\\controller\\System\\FileController@getAllFiles');
|
||||
Route::get('catefiles/:id', 'app\\admin\\controller\\System\\FileController@getCateFiles');
|
||||
Route::post('uploadfile', 'app\\admin\\controller\\System\\FileController@uploadFile');
|
||||
Route::post('uploadfiles', 'app\\admin\\controller\\System\\FileController@uploadFile');
|
||||
Route::post('updatefile/:id', 'app\\admin\\controller\\System\\FileController@updateFile');
|
||||
Route::delete('deletefile/:id', 'app\\admin\\controller\\System\\FileController@deleteFile');
|
||||
Route::get('movefile/:id', 'app\\admin\\controller\\System\\FileController@moveFile');
|
||||
|
||||
60
app/index/controller/BannerController.php
Normal file
60
app/index/controller/BannerController.php
Normal file
@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\BaseController;
|
||||
use think\response\Json;
|
||||
use think\facade\Db;
|
||||
|
||||
/**
|
||||
* Banner 控制器
|
||||
*/
|
||||
class BannerController extends BaseController
|
||||
{
|
||||
/**
|
||||
* 获取 Banner 列表
|
||||
* @return Json
|
||||
*/
|
||||
public function getBanners(): Json
|
||||
{
|
||||
// 从 BaseController 获取当前租户ID
|
||||
$tid = $this->getTenantId();
|
||||
|
||||
if (empty($tid)) {
|
||||
return json([
|
||||
'code' => 400,
|
||||
'msg' => '无法识别租户信息',
|
||||
'list' => [],
|
||||
]);
|
||||
}
|
||||
|
||||
// 查询该租户下的 Banner
|
||||
$banners = Db::name('mete_apps_cms_banner')
|
||||
->where('tid', $tid)
|
||||
->whereNull('delete_time')
|
||||
->order('sort', 'asc')
|
||||
->order('id', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
// 处理图片路径
|
||||
foreach ($banners as &$banner) {
|
||||
if (!empty($banner['image'])) {
|
||||
// 如果图片路径已经是完整 URL,直接返回
|
||||
if (!preg_match('/^https?:\/\//', $banner['image'])) {
|
||||
// 拼接完整 URL
|
||||
$banner['image'] = $this->request->scheme() . '://' . $this->request->host() .
|
||||
(strpos($banner['image'], '/') === 0 ? '' : '/') . $banner['image'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return json([
|
||||
'code' => 200,
|
||||
'msg' => 'success',
|
||||
'list' => $banners,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,9 @@ Route::get('footerdata', 'app\index\controller\Index@getFooterData');
|
||||
// --- 文章列表路由 ---
|
||||
Route::get('getCenterNews', 'app\index\controller\Article\NewsCenterController@getCenterNews');
|
||||
|
||||
// --- Banner 路由 ---
|
||||
Route::get('getBanners', 'app\index\controller\BannerController@getBanners');
|
||||
|
||||
// --- 文章互动路由 ---
|
||||
Route::post('articleViews/:id', 'app\index\controller\Article\ArticleController@articleViews');
|
||||
Route::post('articleLikes/:id', 'app\index\controller\Article\ArticleController@articleLikes');
|
||||
|
||||
@ -658,7 +658,7 @@ p {
|
||||
.hero-section-wrapper-5 .hero-style-5 {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: 270px 0 140px;
|
||||
padding: 100px 0 100px;
|
||||
}
|
||||
|
||||
@media only screen and (min-width: 1200px) and (max-width: 1399px) {
|
||||
@ -758,12 +758,15 @@ p {
|
||||
}
|
||||
|
||||
.hero-section-wrapper-5 .hero-style-5 .hero-image {
|
||||
margin-bottom: 100px;
|
||||
/* margin-bottom: 100px; */
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.hero-section-wrapper-5 .hero-style-5 .hero-image img {
|
||||
width: 100%;
|
||||
max-height:450px;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.hero-section-wrapper-5 .hero-style-5 .shapes .shape {
|
||||
@ -964,7 +967,6 @@ p {
|
||||
ABOUT-4 CSS
|
||||
================================ */
|
||||
.about-style-4 {
|
||||
background: #F3F3F3;
|
||||
padding: 100px 0 50px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
|
||||
@ -13,6 +13,8 @@
|
||||
<link rel="stylesheet" href="assets/css/animate.css" />
|
||||
<link rel="stylesheet" href="assets/css/lindy-uikit.css" />
|
||||
<link rel="stylesheet" href="assets/css/all.min.css" />
|
||||
<!-- Swiper CSS -->
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.css" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@ -82,23 +84,14 @@
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
<div class="hero-section hero-style-5 img-bg" style="background-image: url('assets/img/hero/hero-5/hero-bg.svg')">
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-6">
|
||||
<div class="hero-content-wrapper">
|
||||
<h2 class="mb-30 wow fadeInUp" data-wow-delay=".2s">You're Using Free Lite Version</h2>
|
||||
<p class="mb-30 wow fadeInUp" data-wow-delay=".4s">Please purchase full version of the template to get all sections and permission to use with commercial projects.</p>
|
||||
<a href="#0" class="button button-lg radius-50 wow fadeInUp" data-wow-delay=".6s">Get Started <i class="lni lni-chevron-right"></i> </a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-6 align-self-end">
|
||||
<div class="hero-image wow fadeInUp" data-wow-delay=".5s">
|
||||
<img src="assets/img/hero/hero-5/hero-img.svg" alt="">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Banner 轮播图 -->
|
||||
<div class="swiper banner-swiper">
|
||||
<div class="swiper-wrapper" id="banner-container">
|
||||
<!-- Banner 将通过 JavaScript 动态加载 -->
|
||||
</div>
|
||||
<div class="swiper-pagination"></div>
|
||||
<div class="swiper-button-next"></div>
|
||||
<div class="swiper-button-prev"></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="feature" class="feature-section feature-style-5">
|
||||
@ -217,8 +210,8 @@
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-xxl-5 col-xl-5 col-lg-7 col-md-10">
|
||||
<div class="section-title text-center mb-50">
|
||||
<h3 class="mb-15">Get in touch</h3>
|
||||
<p>Stop wasting time and money designing and managing a website that doesn’t get results. Happiness guaranteed!</p>
|
||||
<h3 class="mb-15">联系我们</h3>
|
||||
<p>如果您有任何需求,欢迎联系我们!</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -229,37 +222,37 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="single-input">
|
||||
<input type="text" id="name" name="name" class="form-input" placeholder="Name">
|
||||
<input type="text" id="name" name="name" class="form-input" placeholder="姓名">
|
||||
<i class="lni lni-user"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="single-input">
|
||||
<input type="email" id="email" name="email" class="form-input" placeholder="Email">
|
||||
<input type="email" id="email" name="email" class="form-input" placeholder="邮箱">
|
||||
<i class="lni lni-envelope"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="single-input">
|
||||
<input type="text" id="number" name="number" class="form-input" placeholder="Number">
|
||||
<input type="text" id="number" name="number" class="form-input" placeholder="手机号">
|
||||
<i class="lni lni-phone"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="single-input">
|
||||
<input type="text" id="subject" name="subject" class="form-input" placeholder="Subject">
|
||||
<input type="text" id="subject" name="subject" class="form-input" placeholder="您的标题">
|
||||
<i class="lni lni-text-format"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="single-input">
|
||||
<textarea name="message" id="message" class="form-input" placeholder="Message" rows="6"></textarea>
|
||||
<textarea name="message" id="message" class="form-input" placeholder="您的需求" rows="6"></textarea>
|
||||
<i class="lni lni-comments-alt"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<div class="form-button">
|
||||
<button type="submit" class="button"> <i class="lni lni-telegram-original"></i> Submit</button>
|
||||
<button type="submit" class="button"> <i class="lni lni-telegram-original"></i> 提交</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -277,8 +270,7 @@
|
||||
<i class="lni lni-phone"></i>
|
||||
</div>
|
||||
<div class="text">
|
||||
<p>0045939863784</p>
|
||||
<p>+004389478327</p>
|
||||
<p>+86 19895983967</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -288,8 +280,8 @@
|
||||
<i class="lni lni-envelope"></i>
|
||||
</div>
|
||||
<div class="text">
|
||||
<p>yourmail@gmail.com</p>
|
||||
<p>admin@yourwebsite.com</p>
|
||||
<p>lygyunze@gmail.com</p>
|
||||
<p>357099073@qq.com</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -299,7 +291,7 @@
|
||||
<i class="lni lni-map-marker"></i>
|
||||
</div>
|
||||
<div class="text">
|
||||
<p>John's House, 13/5 Road, Sidny United State Of America</p>
|
||||
<p>江苏省连云港市海州区润潮国际大厦</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -393,12 +385,87 @@
|
||||
<script src="assets/js/wow.min.js"></script>
|
||||
<script src="assets/js/main.js"></script>
|
||||
<script src="assets/js/all.min.js"></script>
|
||||
<!-- Swiper JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/swiper@11/swiper-bundle.min.js"></script>
|
||||
|
||||
<!-- 加载新闻数据 -->
|
||||
<script>
|
||||
// API 接口地址配置
|
||||
const API_BASE_URL = 'https://api.yunzer.cn';
|
||||
|
||||
// 加载 Banner 轮播图
|
||||
function loadBanners() {
|
||||
const bannerContainer = document.getElementById('banner-container');
|
||||
if (!bannerContainer) return;
|
||||
|
||||
fetch(API_BASE_URL + '/getBanners')
|
||||
.then(res => res.json())
|
||||
.then(result => {
|
||||
if (result.code !== 200 || !result.list || result.list.length === 0) {
|
||||
// 没有 Banner 时显示默认内容
|
||||
bannerContainer.innerHTML = '<div class="swiper-slide"><div class="hero-section hero-style-5 img-bg" style="background-image: url(\'assets/img/hero/hero-5/hero-bg.svg\')"><div class="container"><div class="row"><div class="col-lg-6"><div class="hero-content-wrapper"><h2 class="mb-30">欢迎来到我们的网站</h2><p class="mb-30">精彩从这里开始</p></div></div><div class="col-lg-6 align-self-end"><div class="hero-image"><img src="assets/img/hero/hero-5/hero-img.svg" alt=""></div></div></div></div></div></div>';
|
||||
initSwiper();
|
||||
return;
|
||||
}
|
||||
|
||||
let html = '';
|
||||
result.list.forEach((item) => {
|
||||
const title = item.title || '';
|
||||
const desc = item.desc || '';
|
||||
const imageUrl = item.image || '';
|
||||
const url = item.url || '#';
|
||||
|
||||
html += '<div class="swiper-slide">' +
|
||||
'<div class="hero-section hero-style-5 img-bg" style="background-image: url(\'assets/img/hero/hero-5/hero-bg.svg\')">' +
|
||||
'<div class="container">' +
|
||||
'<div class="row">' +
|
||||
'<div class="col-lg-6">' +
|
||||
'<div class="hero-content-wrapper">' +
|
||||
'<h2 class="mb-30 wow fadeInUp" data-wow-delay=".2s">' + title + '</h2>' +
|
||||
'<p class="mb-30 wow fadeInUp" data-wow-delay=".4s">' + desc + '</p>' +
|
||||
(url !== '#' ? '<a href="' + url + '" class="button button-lg radius-50 wow fadeInUp" data-wow-delay=".6s">了解更多 <i class="lni lni-chevron-right"></i></a>' : '') +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="col-lg-6 align-self-end">' +
|
||||
'<div class="hero-image wow fadeInUp" data-wow-delay=".5s">' +
|
||||
'<img src="' + imageUrl + '" alt="' + title + '">' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'</div>';
|
||||
});
|
||||
|
||||
bannerContainer.innerHTML = html;
|
||||
initSwiper();
|
||||
})
|
||||
.catch(err => {
|
||||
console.error('加载 Banner 失败:', err);
|
||||
bannerContainer.innerHTML = '<div class="swiper-slide"><div class="hero-section hero-style-5 img-bg" style="background-image: url(\'assets/img/hero/hero-5/hero-bg.svg\')"><div class="container"><div class="row"><div class="col-lg-6"><div class="hero-content-wrapper"><h2 class="mb-30">欢迎来到我们的网站</h2><p class="mb-30">精彩从这里开始</p></div></div><div class="col-lg-6 align-self-end"><div class="hero-image"><img src="assets/img/hero/hero-5/hero-img.svg" alt=""></div></div></div></div></div></div>';
|
||||
initSwiper();
|
||||
});
|
||||
}
|
||||
|
||||
// 初始化 Swiper
|
||||
function initSwiper() {
|
||||
new Swiper('.banner-swiper', {
|
||||
loop: true,
|
||||
autoplay: {
|
||||
delay: 5000,
|
||||
disableOnInteraction: false,
|
||||
},
|
||||
pagination: {
|
||||
el: '.swiper-pagination',
|
||||
clickable: true,
|
||||
},
|
||||
navigation: {
|
||||
nextEl: '.swiper-button-next',
|
||||
prevEl: '.swiper-button-prev',
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// 去除 HTML 标签,提取纯文本
|
||||
function stripHtml(html) {
|
||||
if (!html) return '';
|
||||
@ -423,6 +490,10 @@
|
||||
|
||||
// 页面加载完成后执行
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// 加载 Banner 轮播图
|
||||
loadBanners();
|
||||
|
||||
// 加载新闻数据
|
||||
const container = document.getElementById('news-container');
|
||||
if (!container) return;
|
||||
|
||||
@ -474,8 +545,64 @@
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- Banner 轮播图样式 -->
|
||||
<style>
|
||||
.banner-swiper {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-slide {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.banner-swiper .hero-section {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-pagination {
|
||||
bottom: 20px;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-pagination-bullet {
|
||||
background: #333;
|
||||
opacity: 0.3;
|
||||
width: 10px;
|
||||
height: 10px;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-pagination-bullet-active {
|
||||
opacity: 1;
|
||||
background: #5864FF;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-button-next,
|
||||
.banner-swiper .swiper-button-prev {
|
||||
color: #5864FF;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: rgba(255, 255, 255, 0.8);
|
||||
border-radius: 50%;
|
||||
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-button-next:after,
|
||||
.banner-swiper .swiper-button-prev:after {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.banner-swiper .swiper-button-next:hover,
|
||||
.banner-swiper .swiper-button-prev:hover {
|
||||
background: #fff;
|
||||
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- 新闻卡片样式 -->
|
||||
<style>
|
||||
.feature-section {
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.news-card {
|
||||
background: #fff;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user