refactor: 附件
This commit is contained in:
@@ -4,6 +4,7 @@ declare (strict_types = 1);
|
||||
namespace app\index\controller;
|
||||
|
||||
use app\index\model\AttachmentCategoryModel;
|
||||
use app\index\model\AttachmentModel;
|
||||
use think\facade\View;
|
||||
|
||||
/**
|
||||
@@ -11,13 +12,66 @@ use think\facade\View;
|
||||
*/
|
||||
class Attachment extends Common
|
||||
{
|
||||
// 分页列表
|
||||
/**
|
||||
* 分页列表
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
// 获取分类
|
||||
$category = AttachmentCategoryModel::language($this->lang_id)->select();
|
||||
View::assign('category', $category);
|
||||
$param = request()->param([
|
||||
'id',
|
||||
'page/d' => 1,
|
||||
'size/d' => 12,
|
||||
]);
|
||||
|
||||
// 获取附件分类
|
||||
$categorys = AttachmentCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent(0)
|
||||
->isShow(true)
|
||||
->select();
|
||||
View::assign('categorys', $categorys);
|
||||
|
||||
// 获取附件
|
||||
$attachements = AttachmentModel::field([
|
||||
'id',
|
||||
'name',
|
||||
'desc',
|
||||
'image',
|
||||
'applicable_to',
|
||||
'support_platform',
|
||||
'attach',
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->category($param['id']??null)
|
||||
->paginate([
|
||||
'list_rows' => $param['size'],
|
||||
'page' => $param['page'],
|
||||
]);
|
||||
View::assign('attachements', $attachements);
|
||||
View::assign('page', $attachements->render());
|
||||
|
||||
return View::fetch('index');
|
||||
}
|
||||
|
||||
/**
|
||||
* 视频
|
||||
*/
|
||||
public function video()
|
||||
{
|
||||
// 获取附件分类
|
||||
$categorys = AttachmentCategoryModel::field([
|
||||
'id',
|
||||
'name'
|
||||
])
|
||||
->language($this->lang_id)
|
||||
->parent(0)
|
||||
->isShow(true)
|
||||
->select();
|
||||
View::assign('categorys', $categorys);
|
||||
|
||||
return View::fetch('video');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ return [
|
||||
'detail_recommend' => 'Recommended for you',
|
||||
],
|
||||
'attachment' => [
|
||||
'software_drives' => 'Software and Drivers',
|
||||
'software_download' => 'Software Drives',
|
||||
'manual_download' => 'Manual',
|
||||
'video' => 'Videos'
|
||||
'software_drives' => 'Software and Drivers',
|
||||
'video' => 'Videos',
|
||||
'support_model' => 'Supported Models',
|
||||
'support_platform' => 'Supported Systems',
|
||||
]
|
||||
];
|
||||
@@ -33,9 +33,9 @@ return [
|
||||
'detail_recommend' => '你可能还喜欢',
|
||||
],
|
||||
'attachment' => [
|
||||
'software_drives' => '软件和驱动程序',
|
||||
'software_download' => '软件下载',
|
||||
'manual_download' => '手册',
|
||||
'video' => '视频'
|
||||
'software_drives' => '软件和驱动程序',
|
||||
'video' => '视频',
|
||||
'support_model' => '支持型号',
|
||||
'support_platform' => '支持系统',
|
||||
]
|
||||
];
|
||||
@@ -22,4 +22,16 @@ class AttachmentCategoryModel extends AttachmentCategoryBaseModel
|
||||
{
|
||||
return $query->where('language_id', '=', $language);
|
||||
}
|
||||
|
||||
// 上级id范围查询
|
||||
public function scopeParent($query, $pid)
|
||||
{
|
||||
return $query->where('pid', '=', $pid);
|
||||
}
|
||||
|
||||
// 是否显示状态范围查询
|
||||
public function scopeIsShow($query, bool $is_show)
|
||||
{
|
||||
return $query->where('is_show', '=', (int)$is_show);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,4 +16,24 @@ class AttachmentModel extends AttachmentBaseModel
|
||||
use SoftDelete;
|
||||
// 软删除时间字段名
|
||||
protected $deleteTime = 'deleted_at';
|
||||
|
||||
// 设置JSON字段
|
||||
protected $json = ['attach'];
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
// 所属语言范围查询
|
||||
public function scopeLanguage($query, $language)
|
||||
{
|
||||
$query->where('language_id', '=', $language);
|
||||
}
|
||||
|
||||
// 所属分类范围查询
|
||||
public function scopeCategory($query, $category)
|
||||
{
|
||||
if (is_null($category)) {
|
||||
return;
|
||||
}
|
||||
$query->where('category_id', '=', $category);
|
||||
}
|
||||
}
|
||||
|
||||
14
app/index/model/VideoCategoryModel.php
Normal file
14
app/index/model/VideoCategoryModel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class VideoCategoryModel extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
14
app/index/model/VideoModel.php
Normal file
14
app/index/model/VideoModel.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class VideoModel extends Model
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -36,7 +36,10 @@ Route::group('article', function() {
|
||||
|
||||
// 附件下载
|
||||
Route::group('attachment', function() {
|
||||
// 软件驱动/手册
|
||||
Route::get('index', 'Attachment/index');
|
||||
// 视频
|
||||
Route::get('video', 'Attachment/video');
|
||||
});
|
||||
|
||||
// 问答中心
|
||||
|
||||
@@ -20,147 +20,51 @@
|
||||
</div>
|
||||
<!-- tab切换 -->
|
||||
<div class="tab">
|
||||
<div class="tabit on">{:lang('attachment.software_download')}</div>
|
||||
<div class="tabit">{:lang('attachment.manual_download')}</div>
|
||||
<div class="tabit">{:lang('attachment.video')}</div>
|
||||
{notempty name="categorys"}
|
||||
{volist name="categorys" id="ca"}
|
||||
<a href="{:url('attachment/index', ['id' => $ca.id])}">
|
||||
{if condition="(!$Request.has.id && $key == 0) || $Request.get.id == $ca.id"}
|
||||
<div class="tabit on">
|
||||
{else/}
|
||||
<div class="tabit">
|
||||
{/if}
|
||||
{$ca.name}
|
||||
</div>
|
||||
</a>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
<a href="{:url('attachment/video')}"><div class="tabit">{:lang('attachment.video')}</div></a>
|
||||
</div>
|
||||
<!-- 切换的内容 -->
|
||||
{notempty name="attachements"}
|
||||
<div class="softlist">
|
||||
{volist name="attachements" id="att"}
|
||||
<div class="softit">
|
||||
<div class="left_img"><img src="downloadImg/10G.jpg" alt=""></div>
|
||||
<div class="left_img">
|
||||
<img src="{$att.image}" alt="">
|
||||
</div>
|
||||
<div>
|
||||
<p class="title">Driver for USB-C 10Gb Ethernet Adapter</p>
|
||||
<p class="sub_title">Supported Models: </p>
|
||||
<p class="des">ORICO-REA-10</p>
|
||||
<p class="sub_title">Supported Systems: </p>
|
||||
<p class="des">Windows 10-11, Linux</p>
|
||||
<p class="title">{$att.name}</p>
|
||||
<p class="sub_title">{:lang('attachment.support_model')}: </p>
|
||||
<p class="des">{$att.applicable_to}</p>
|
||||
<p class="sub_title">{:lang('attachment.support_platform')}: </p>
|
||||
<p class="des">{$att.support_platform}</p>
|
||||
<p>
|
||||
<a href="/uploads/download/2024/Linux-Driver.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Linux</span></a>
|
||||
<a href="/uploads/download/2024/Windows 10-11.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Windows 10-11</span></a>
|
||||
{notempty name="att.attach"}
|
||||
{volist name="att.attach" id="ch"}
|
||||
<a href="{$ch.file_path}" data-cod="dl" data-id="{$att.id}" target="_blank">
|
||||
<span class="l_button">{$ch.btn_name}</span>
|
||||
</a>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="softit">
|
||||
<div class="left_img"><img src="downloadImg/10G.jpg" alt=""></div>
|
||||
<div>
|
||||
<p class="title">Driver for USB-C 10Gb Ethernet Adapter</p>
|
||||
<p class="sub_title">Supported Models: </p>
|
||||
<p class="des">ORICO-REA-10</p>
|
||||
<p class="sub_title">Supported Systems: </p>
|
||||
<p class="des">Windows 10-11, Linux</p>
|
||||
<p>
|
||||
<a href="/uploads/download/2024/Linux-Driver.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Linux</span></a>
|
||||
<a href="/uploads/download/2024/Windows 10-11.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Windows 10-11</span></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="softit">
|
||||
<div class="left_img"><img src="downloadImg/10G.jpg" alt=""></div>
|
||||
<div>
|
||||
<p class="title">Driver for USB-C 10Gb Ethernet Adapter</p>
|
||||
<p class="sub_title">Supported Models: </p>
|
||||
<p class="des">ORICO-REA-10</p>
|
||||
<p class="sub_title">Supported Systems: </p>
|
||||
<p class="des">Windows 10-11, Linux</p>
|
||||
<p>
|
||||
<a href="/uploads/download/2024/Linux-Driver.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Linux</span></a>
|
||||
<a href="/uploads/download/2024/Windows 10-11.zip" data-cod="dl" data-id="332"
|
||||
target="_blank"><span class="l_button">Windows 10-11</span></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="Page">
|
||||
<span class="p_page">
|
||||
<a class="a_prev"></a>
|
||||
<em class="num">
|
||||
<a class="a_cur">1</a>
|
||||
<a>2</a>
|
||||
<a>3</a>
|
||||
<a>4</a>
|
||||
</em>
|
||||
<a class="a_next"></a>
|
||||
</span>
|
||||
</div>
|
||||
{/volist}
|
||||
<div>{$page|raw}</div>
|
||||
</div>
|
||||
<!-- VIDEO 切换 -->
|
||||
<div class="vidotabs" style="display: none;">
|
||||
<div class="hd">
|
||||
<ul>
|
||||
<li class="vli von">Data Storage</li>
|
||||
<li class="vli">Power Transmission</li>
|
||||
<li class="vli">Smart Life</li>
|
||||
<li class="vli">Accessories</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 视频内容 -->
|
||||
<div class="bdconten">
|
||||
<ul >
|
||||
<dl class="video_hotul">
|
||||
<dd>
|
||||
<div class="hot1">
|
||||
<video preload="none" controls="controls">
|
||||
<source src="/uploads/uk/video/entertainment/RP1 .mp4" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<div class="htit">
|
||||
<div class="htit1">ORICO RP1 Headphones</div>
|
||||
<div class="htit2"> ORICO RP1 in-ear music headphones, skin-friendly and
|
||||
comfortable for long time wearing; black, white, red and blue, four
|
||||
colors for you to choose. ORICO 2169U3 full mesh 2.5 inch hard drive
|
||||
enclosure, all-round heat-dissipation; compatible with SATA HDD below
|
||||
9.5mm. </div>
|
||||
</div>
|
||||
</dd>
|
||||
<dd>
|
||||
<div class="hot1">
|
||||
<video preload="none" controls="controls">
|
||||
<source src="/uploads/uk/video/entertainment/BS16.mp4" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<div class="htit">
|
||||
<div class="htit1">ORICO BS16 Bluetooth Speaker</div>
|
||||
<div class="htit2"> ORICO BS16 unique and delicate pocket Bluetooth speaker,
|
||||
bring you beautiful music; smaller size, unprecedented endurance. ORICO
|
||||
2169U3 full mesh 2.5 inch hard drive enclosure, all-round
|
||||
heat-dissipation; compatible with SATA HDD below 9.5mm. </div>
|
||||
</div>
|
||||
</dd>
|
||||
<div class="clear"></div>
|
||||
</dl>
|
||||
<div id="page39">
|
||||
<!-- 分页 s -->
|
||||
<!-- 分页 e -->
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 如果切换的是 Videos-->
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
{block name="script"}
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
// 为所有具有 tabitme 类的元素添加点击事件
|
||||
$('.tabit').click(function() {
|
||||
// 移除所有 tabitme 元素的 on 类
|
||||
$('.tabit').removeClass('on');
|
||||
// 为当前点击的元素添加 on 类
|
||||
$(this).addClass('on');
|
||||
});
|
||||
// 为所有具有 tabitme 类的元素添加点击事件
|
||||
$('.vli').click(function() {
|
||||
// 移除所有 tabitme 元素的 on 类
|
||||
$('.vli').removeClass('von');
|
||||
// 为当前点击的元素添加 on 类
|
||||
$(this).addClass('von');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{/block}
|
||||
90
app/index/view/attachment/video.html
Normal file
90
app/index/view/attachment/video.html
Normal file
@@ -0,0 +1,90 @@
|
||||
{extend name="public/base" /}
|
||||
{block name="style"}
|
||||
<link rel="stylesheet" href="__CSS__/download.css" />
|
||||
{/block}
|
||||
{block name="main"}
|
||||
<div class="orico_Page_download">
|
||||
<!-- 内容 -->
|
||||
<div class="downloadMain">
|
||||
<div class="topimg">
|
||||
<img src="__IMAGES__/banner_01.png" />
|
||||
<div class="banner_title">{:lang('attachment.software_drives')}</div>
|
||||
</div>
|
||||
<div class="contact_c">
|
||||
<!-- 搜索 -->
|
||||
<div class="search_all">
|
||||
<input type="text" name="textfield" placeholder="Search model" id="search_software">
|
||||
<div class="searchbtn" id="search-btn">
|
||||
<img src="downloadImg/search.png" />
|
||||
</div>
|
||||
</div>
|
||||
<!-- tab切换 -->
|
||||
<div class="tab">
|
||||
{notempty name="categorys"}
|
||||
{volist name="categorys" id="ca"}
|
||||
<a href="{:url('attachment/index', ['id' => $ca.id])}">
|
||||
<div class="tabit">
|
||||
{$ca.name}
|
||||
</div>
|
||||
</a>
|
||||
{/volist}
|
||||
{/notempty}
|
||||
<div class="tabit on">{:lang('attachment.video')}</div>
|
||||
</div>
|
||||
<!-- VIDEO 切换 -->
|
||||
<div class="vidotabs">
|
||||
<div class="hd">
|
||||
<ul>
|
||||
<li class="vli von">Data Storage</li>
|
||||
<li class="vli">Power Transmission</li>
|
||||
<li class="vli">Smart Life</li>
|
||||
<li class="vli">Accessories</li>
|
||||
</ul>
|
||||
</div>
|
||||
<!-- 视频内容 -->
|
||||
<div class="bdconten">
|
||||
<ul >
|
||||
<dl class="video_hotul">
|
||||
<dd>
|
||||
<div class="hot1">
|
||||
<video preload="none" controls="controls">
|
||||
<source src="/uploads/uk/video/entertainment/RP1 .mp4" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<div class="htit">
|
||||
<div class="htit1">ORICO RP1 Headphones</div>
|
||||
<div class="htit2"> ORICO RP1 in-ear music headphones, skin-friendly and
|
||||
comfortable for long time wearing; black, white, red and blue, four
|
||||
colors for you to choose. ORICO 2169U3 full mesh 2.5 inch hard drive
|
||||
enclosure, all-round heat-dissipation; compatible with SATA HDD below
|
||||
9.5mm. </div>
|
||||
</div>
|
||||
</dd>
|
||||
<dd>
|
||||
<div class="hot1">
|
||||
<video preload="none" controls="controls">
|
||||
<source src="/uploads/uk/video/entertainment/BS16.mp4" type="video/mp4">
|
||||
</video>
|
||||
</div>
|
||||
<div class="htit">
|
||||
<div class="htit1">ORICO BS16 Bluetooth Speaker</div>
|
||||
<div class="htit2"> ORICO BS16 unique and delicate pocket Bluetooth speaker,
|
||||
bring you beautiful music; smaller size, unprecedented endurance. ORICO
|
||||
2169U3 full mesh 2.5 inch hard drive enclosure, all-round
|
||||
heat-dissipation; compatible with SATA HDD below 9.5mm. </div>
|
||||
</div>
|
||||
</dd>
|
||||
<div class="clear"></div>
|
||||
</dl>
|
||||
<div id="page39">
|
||||
<!-- 分页 s -->
|
||||
<!-- 分页 e -->
|
||||
</div>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- 如果切换的是 Videos-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
@@ -156,52 +156,27 @@
|
||||
background-color: rgba(0, 75, 250, 0.05);
|
||||
cursor: pointer;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page {
|
||||
.orico_Page_download .downloadMain .contact_c .pagination {
|
||||
zoom: 1;
|
||||
text-align: center;
|
||||
color: #555;
|
||||
clear: both;
|
||||
padding-bottom: 2rem;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page span {
|
||||
.orico_Page_download .downloadMain .contact_c .pagination span {
|
||||
padding: 0px 0px;
|
||||
display: inline-block;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .a_prev,
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .a_next {
|
||||
display: inline-block;
|
||||
width: 10px;
|
||||
height: 21px;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .a_prev {
|
||||
background: url(../downloadImg/pfl.png) no-repeat;
|
||||
margin-right: 10px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .a_next {
|
||||
background: url(../downloadImg/prh.png) no-repeat;
|
||||
margin-left: 10px;
|
||||
padding: 0 10px;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .num a {
|
||||
.orico_Page_download .downloadMain .contact_c .pagination li {
|
||||
display: inline-block;
|
||||
width: 34px;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
font-size: 16px;
|
||||
color: #444;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .num a.a_cur,
|
||||
.orico_Page_download .downloadMain .contact_c .softlist .Page .p_page .num a:hover {
|
||||
background: #444;
|
||||
color: #fff;
|
||||
.orico_Page_download .downloadMain .contact_c .pagination li.active {
|
||||
background-color: #444444;
|
||||
color: #ffffff;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .vidotabs {
|
||||
margin-top: 32px;
|
||||
@@ -278,6 +253,7 @@
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-line-clamp: 2;
|
||||
line-clamp: 2;
|
||||
overflow: hidden;
|
||||
font-size: 14px;
|
||||
margin-top: 16px;
|
||||
|
||||
Reference in New Issue
Block a user