Compare commits
6 Commits
4035fe4751
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
| db1ad0f88a | |||
| 4d34d76c4f | |||
| 276d901875 | |||
| c9bc2022e6 | |||
| 8311181967 | |||
| 99d49ee8a2 |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -9,8 +9,8 @@ Thumbs.db
|
|||||||
.env.prod
|
.env.prod
|
||||||
.htaccess
|
.htaccess
|
||||||
.user.ini
|
.user.ini
|
||||||
404.html
|
/404.html
|
||||||
index.html
|
/index.html
|
||||||
|
|
||||||
public/dist*
|
public/dist*
|
||||||
public/opendoc
|
public/opendoc
|
||||||
|
|||||||
@@ -32,7 +32,8 @@ class ProductCategoryModel extends ProductCategoryBaseModel
|
|||||||
// 所属产品目录分类id查询
|
// 所属产品目录分类id查询
|
||||||
public function scopeTcoId($query, $value)
|
public function scopeTcoId($query, $value)
|
||||||
{
|
{
|
||||||
$query->where('related_tco_category', '=', $value);
|
// $query->where('related_tco_category', '=', $value);
|
||||||
|
$query->whereRaw('FIND_IN_SET(:ref_id, related_tco_category)', ['ref_id' => $value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class ProductCategoryValidate extends Validate
|
|||||||
'name' => 'require|max:64',
|
'name' => 'require|max:64',
|
||||||
'icon' => 'max:125',
|
'icon' => 'max:125',
|
||||||
'desc' => 'max:255',
|
'desc' => 'max:255',
|
||||||
'related_tco_category' => 'integer',
|
'related_tco_category' => 'string|checkRelatedTcoCategory',
|
||||||
'sort' => 'integer',
|
'sort' => 'integer',
|
||||||
'level' => 'integer',
|
'level' => 'integer',
|
||||||
'is_show' => 'in:0,1',
|
'is_show' => 'in:0,1',
|
||||||
@@ -51,7 +51,8 @@ class ProductCategoryValidate extends Validate
|
|||||||
'name.max' => '名称最多不能超过64个字符',
|
'name.max' => '名称最多不能超过64个字符',
|
||||||
'icon.max' => '图标最多不能超过125个字符',
|
'icon.max' => '图标最多不能超过125个字符',
|
||||||
'desc.max' => '描述最多不能超过255个字符',
|
'desc.max' => '描述最多不能超过255个字符',
|
||||||
'related_tco_category.integer' => '关联TCO分类格式错误',
|
'related_tco_category.string' => '关联TCO分类格式错误',
|
||||||
|
'related_tco_category.checkRelatedTcoCategory' => '该TCO分类已绑定',
|
||||||
'sort.integer' => '排序格式错误',
|
'sort.integer' => '排序格式错误',
|
||||||
'level.integer' => '级别格式错误',
|
'level.integer' => '级别格式错误',
|
||||||
'is_show.in' => '是否显示格式错误',
|
'is_show.in' => '是否显示格式错误',
|
||||||
@@ -84,4 +85,32 @@ class ProductCategoryValidate extends Validate
|
|||||||
{
|
{
|
||||||
return $this->remove('id', 'require|integer')->remove('pid', 'different|checkPidNotBeChildren');
|
return $this->remove('id', 'require|integer')->remove('pid', 'different|checkPidNotBeChildren');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 验证related_tco_category
|
||||||
|
protected function checkRelatedTcoCategory($value, $rule, $data = [])
|
||||||
|
{
|
||||||
|
if (empty($value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
$val = ProductCategoryModel::where(function($query) use($value) {
|
||||||
|
$arr = explode(",", $value);
|
||||||
|
foreach ($arr as $v) {
|
||||||
|
$query->whereFindInSet('related_tco_category', $v, 'OR');
|
||||||
|
}
|
||||||
|
})->column('id');
|
||||||
|
if (!empty($val)) {
|
||||||
|
$size = count($val);
|
||||||
|
// 如果存在超过一个,直接验证失败
|
||||||
|
if ($size > 1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// 如果存在一个,并存在的id不为自身,验证失败(考虑更新场景查到自身情况)
|
||||||
|
if ($size == 1 && $val[0] != $data['id']) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
20
app/index/controller/TopicLaptop.php
Normal file
20
app/index/controller/TopicLaptop.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
declare (strict_types = 1);
|
||||||
|
|
||||||
|
namespace app\index\controller;
|
||||||
|
|
||||||
|
use think\facade\View;
|
||||||
|
use think\Request;
|
||||||
|
|
||||||
|
class TopicLaptop extends Common
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 专题 - 笔记本电脑首页
|
||||||
|
*/
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
return View::fetch('index');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,43 +12,6 @@ use think\Request;
|
|||||||
*/
|
*/
|
||||||
class TopicPowerProdline extends Common
|
class TopicPowerProdline extends Common
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* 重写控制器初始化
|
|
||||||
*/
|
|
||||||
public function initialize()
|
|
||||||
{
|
|
||||||
// 获取国家/语言列表
|
|
||||||
$languages = $this->getLanguages();
|
|
||||||
// 输出国家/语言列表
|
|
||||||
if (get_platform() == 'mobile') {
|
|
||||||
View::assign('header_languages', $languages);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取当前语言
|
|
||||||
$current_language = $this->getCurrentLanguage($languages);
|
|
||||||
if (!empty($current_language)) {
|
|
||||||
$this->lang_id = $current_language['id'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取产品分类
|
|
||||||
$categorys = $this->getProductCategory($this->lang_id);
|
|
||||||
// 输出产品分类
|
|
||||||
View::assign('header_categorys', $categorys);
|
|
||||||
|
|
||||||
// 获取系统配置
|
|
||||||
$configs = $this->getSysConfig($this->lang_id, ['basic', 'contact', 'media']);
|
|
||||||
$this->basic_config = $configs['basic'];
|
|
||||||
// 输出系统配置
|
|
||||||
View::assign('basic_config', $configs['basic']);
|
|
||||||
View::assign('contact_config', $configs['contact']);
|
|
||||||
View::assign('media_config', $configs['media']);
|
|
||||||
|
|
||||||
// 获取底部导航
|
|
||||||
$footer_navigation = $this->getNavigation('NAV_67f60be43df8d', $this->lang_id);
|
|
||||||
// 输出底部导航
|
|
||||||
View::assign('footer_navigation', $footer_navigation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 专题 - 电力品线首页
|
* 专题 - 电力品线首页
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -107,10 +107,16 @@ Route::group('topic', function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 专题 - 电力品线
|
// 专题 - 电力品线
|
||||||
Route::group("power_prodline", function() {
|
Route::group('power_prodline', function() {
|
||||||
// 专题 - 电力品线首页
|
// 专题 - 电力品线首页
|
||||||
Route::get('index', 'TopicPowerProdline/index');
|
Route::get('index', 'TopicPowerProdline/index');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 专题 - 笔记本电脑
|
||||||
|
Route::group('laptop', function() {
|
||||||
|
// 专题 - 笔记本电脑首页
|
||||||
|
Route::get('index', 'TopicLaptop/index');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// 数据迁移
|
// 数据迁移
|
||||||
|
|||||||
13
app/index/view/mobile/topic_laptop/index.html
Normal file
13
app/index/view/mobile/topic_laptop/index.html
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
{block name="style"}
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
{block name="header"}
|
||||||
|
<!-- 重置header头为空 -->
|
||||||
|
{/block}
|
||||||
|
{block name="main"}
|
||||||
|
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
|
||||||
|
{/block}
|
||||||
@@ -125,6 +125,43 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(function() {
|
||||||
|
$('.header-PC #header .navItem>a').each(function(idx, item) {
|
||||||
|
var _item = $(item);
|
||||||
|
_item.removeClass('active');
|
||||||
|
if (_item.attr('href') && compareUrls(location.href, _item.get(0).href)) {
|
||||||
|
_item.addClass('active').siblings();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 比较两个URL是否相等(支持只有path的情况,并处理有无.html后缀的情况)
|
||||||
|
function compareUrls(url1, url2) {
|
||||||
|
// 如果输入的是相对路径,添加当前域名
|
||||||
|
if (!url1.startsWith('http')) {
|
||||||
|
url1 = window.location.origin + (url1.startsWith('/') ? '' : '/') + url1;
|
||||||
|
}
|
||||||
|
if (!url2.startsWith('http')) {
|
||||||
|
url2 = window.location.origin + (url2.startsWith('/') ? '' : '/') + url2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将两个URL转换为URL对象
|
||||||
|
const urlObj1 = new URL(url1);
|
||||||
|
const urlObj2 = new URL(url2);
|
||||||
|
|
||||||
|
// 获取路径名并移除末尾的斜杠
|
||||||
|
let path1 = urlObj1.pathname.replace(/\/$/, '');
|
||||||
|
let path2 = urlObj2.pathname.replace(/\/$/, '');
|
||||||
|
|
||||||
|
// 移除.html后缀
|
||||||
|
path1 = path1.replace(/\.html$/, '');
|
||||||
|
path2 = path2.replace(/\.html$/, '');
|
||||||
|
|
||||||
|
// 比较处理后的路径
|
||||||
|
return path1 === path2;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
// 搜索历史记录处理
|
// 搜索历史记录处理
|
||||||
|
|||||||
52
app/index/view/pc/topic_laptop/index.html
Normal file
52
app/index/view/pc/topic_laptop/index.html
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
{extend name="public/base" /}
|
||||||
|
{block name="style"}
|
||||||
|
<link rel="stylesheet" href="__CSS__/topic_laptop/swiper.css">
|
||||||
|
{/block}
|
||||||
|
{block name="main"}
|
||||||
|
<!-- 轮播核心容器 -->
|
||||||
|
<img src="./img/banner1.png" alt="测试" href="https://www.baidu.com" style="width: 200px;height:200px">
|
||||||
|
<div class="swiper-container auto-swiper-container">
|
||||||
|
<div class="swiper-wrapper">
|
||||||
|
<a class="swiper-slide auto-swiper-slide">
|
||||||
|
<img src="./img/banner1.png" alt="测试" href="https://www.baidu.com">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/block}
|
||||||
|
{block name="script"}
|
||||||
|
<script type="text/javascript">
|
||||||
|
//轮播图
|
||||||
|
let swiper=null;
|
||||||
|
window.onload = function ()
|
||||||
|
{
|
||||||
|
if (typeof Swiper === 'undefined') {
|
||||||
|
console.error('Swiper加载失败,请刷新页面重试');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
swiper = new Swiper('.auto-swiper-container', {
|
||||||
|
autoplay: {
|
||||||
|
delay: 3000, // 调整为3秒切换,更友好
|
||||||
|
disableOnInteraction: false,
|
||||||
|
},
|
||||||
|
loop: false,
|
||||||
|
slidesPerView: 1,
|
||||||
|
spaceBetween: 0,
|
||||||
|
pagination: false,
|
||||||
|
navigation: false,
|
||||||
|
scrollbar: false,
|
||||||
|
on: {
|
||||||
|
resize: function ()
|
||||||
|
{
|
||||||
|
this.update();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
window.addEventListener('resize', function ()
|
||||||
|
{
|
||||||
|
swiper.update();
|
||||||
|
});
|
||||||
|
// 初始化时触发滚动事件,确保状态正确
|
||||||
|
window.dispatchEvent(new Event('scroll'));
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
{/block}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
{extend name="public/nas_base" /}
|
{extend name="public/base" /}
|
||||||
{block name="style"}
|
{block name="style"}
|
||||||
<link rel="stylesheet" href="__CSS__/topic_power_prodline/index.css">
|
<link rel="stylesheet" href="__CSS__/topic_power_prodline/index.css">
|
||||||
<link rel="stylesheet" href="__CSS__/topic_power_prodline/swiper.css">
|
<link rel="stylesheet" href="__CSS__/topic_power_prodline/swiper.css">
|
||||||
@@ -10,15 +10,7 @@
|
|||||||
<link rel="stylesheet" href="__CSS__/topic_power_prodline/product_card.css">
|
<link rel="stylesheet" href="__CSS__/topic_power_prodline/product_card.css">
|
||||||
<link rel="stylesheet" href="__CSS__/topic_power_prodline/footer.css">
|
<link rel="stylesheet" href="__CSS__/topic_power_prodline/footer.css">
|
||||||
{/block}
|
{/block}
|
||||||
{block name="header"}
|
|
||||||
<!-- 重置header头为空 -->
|
|
||||||
{/block}
|
|
||||||
{block name="main"}
|
{block name="main"}
|
||||||
<a class="header" href="/">
|
|
||||||
<div class="header-img">
|
|
||||||
<img src="__IMAGES__/logo.png" alt="">
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<!-- 轮播核心容器 -->
|
<!-- 轮播核心容器 -->
|
||||||
<div class="swiper-container auto-swiper-container" >
|
<div class="swiper-container auto-swiper-container" >
|
||||||
{notempty name="data.focus_image"}
|
{notempty name="data.focus_image"}
|
||||||
|
|||||||
@@ -177,6 +177,7 @@
|
|||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
.header-PC #header .nav2 .navItem > a.active,
|
||||||
.header-PC #header .nav2 .navItem .navItemConten1 li a:hover {
|
.header-PC #header .nav2 .navItem .navItemConten1 li a:hover {
|
||||||
color: #004bfa;
|
color: #004bfa;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user