refactor: 附件/视频搜索
This commit is contained in:
@@ -21,6 +21,7 @@ class Attachment extends Common
|
||||
{
|
||||
$param = request()->param([
|
||||
'id',
|
||||
'keyword',
|
||||
'page/d' => 1,
|
||||
'size/d' => 12,
|
||||
]);
|
||||
@@ -47,6 +48,7 @@ class Attachment extends Common
|
||||
'support_platform',
|
||||
'attach',
|
||||
])
|
||||
->withSearch(['name'], ['name' => $param['keyword']??null])
|
||||
->language($this->lang_id)
|
||||
->category($param['id']??null)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
@@ -70,6 +72,7 @@ class Attachment extends Common
|
||||
{
|
||||
$param = request()->param([
|
||||
'id',
|
||||
'keyword',
|
||||
'page/d' => 1,
|
||||
'size/d' => 12
|
||||
]);
|
||||
@@ -106,6 +109,7 @@ class Attachment extends Common
|
||||
'video',
|
||||
'link'
|
||||
])
|
||||
->withSearch(['name'], ['name' => $param['keyword']??null])
|
||||
->language($this->lang_id)
|
||||
->category($param['id']??null)
|
||||
->order(['sort' => 'asc', 'id' => 'desc'])
|
||||
|
||||
@@ -33,9 +33,10 @@ return [
|
||||
'detail_recommend' => 'Recommended for you',
|
||||
],
|
||||
'attachment' => [
|
||||
'software_drives' => 'Software and Drivers',
|
||||
'video' => 'Videos',
|
||||
'support_model' => 'Supported Models',
|
||||
'support_platform' => 'Supported Systems',
|
||||
'software_drives' => 'Software and Drivers',
|
||||
'video' => 'Videos',
|
||||
'support_model' => 'Supported Models',
|
||||
'support_platform' => 'Supported Systems',
|
||||
'search_placeholder' => 'Search model',
|
||||
]
|
||||
];
|
||||
@@ -33,9 +33,10 @@ return [
|
||||
'detail_recommend' => '你可能还喜欢',
|
||||
],
|
||||
'attachment' => [
|
||||
'software_drives' => '软件和驱动程序',
|
||||
'video' => '视频',
|
||||
'support_model' => '支持型号',
|
||||
'support_platform' => '支持系统',
|
||||
'software_drives' => '软件和驱动程序',
|
||||
'video' => '视频',
|
||||
'support_model' => '支持型号',
|
||||
'support_platform' => '支持系统',
|
||||
'search_placeholder' => '搜索型号',
|
||||
]
|
||||
];
|
||||
@@ -22,6 +22,15 @@ class AttachmentModel extends AttachmentBaseModel
|
||||
// 设置JSON数据返回数组
|
||||
protected $jsonAssoc = true;
|
||||
|
||||
// 附件名称搜索器
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('name', 'like', "%{$value}%");
|
||||
}
|
||||
|
||||
// 所属语言范围查询
|
||||
public function scopeLanguage($query, $language)
|
||||
{
|
||||
|
||||
@@ -18,6 +18,15 @@ class VideoModel extends VideoBaseModel
|
||||
// 软删除字段
|
||||
protected $deleteTime = 'deleted_at';
|
||||
|
||||
// 视频名称搜索器
|
||||
public function searchNameAttr($query, $value, $data)
|
||||
{
|
||||
if (is_null($value)) {
|
||||
return;
|
||||
}
|
||||
$query->where('name', 'like', "%{$value}%");
|
||||
}
|
||||
|
||||
// 所属语言范围查询
|
||||
public function scopeLanguage($query, $language)
|
||||
{
|
||||
|
||||
@@ -12,12 +12,13 @@
|
||||
</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" />
|
||||
<form action="{:url('attachment/index')}" method="get">
|
||||
<div class="search_all">
|
||||
<input type="hidden" name="id" value="{$Request.get.id}" />
|
||||
<input type="text" name="keyword" placeholder="{:lang('attachment.search_placeholder')}" />
|
||||
<button class="searchbtn" type="submit"><img src="__IMAGES__/search_blue.png" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- tab切换 -->
|
||||
<div class="tab">
|
||||
{notempty name="categorys"}
|
||||
@@ -36,8 +37,8 @@
|
||||
<a href="{:url('attachment/video')}"><div class="tabit">{:lang('attachment.video')}</div></a>
|
||||
</div>
|
||||
<!-- 切换的内容 -->
|
||||
{notempty name="attachements"}
|
||||
<div class="softlist">
|
||||
{notempty name="attachements"}
|
||||
{volist name="attachements" id="att"}
|
||||
<div class="softit">
|
||||
<div class="left_img">
|
||||
@@ -62,8 +63,10 @@
|
||||
</div>
|
||||
{/volist}
|
||||
<div>{$page|raw}</div>
|
||||
{else/}
|
||||
<div class="softit">查询无结果!</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -12,12 +12,12 @@
|
||||
</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" />
|
||||
<form action="{:url('attachment/video')}" method="get">
|
||||
<div class="search_all">
|
||||
<input type="text" name="keyword" placeholder="{:lang('attachment.search_placeholder')}" />
|
||||
<button class="searchbtn" type="submit"><img src="__IMAGES__/search_blue.png" /></button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- tab切换 -->
|
||||
<div class="tab">
|
||||
{notempty name="attachment_categorys"}
|
||||
@@ -45,9 +45,9 @@
|
||||
</div>
|
||||
{/notempty}
|
||||
<!-- 视频内容 -->
|
||||
{notempty name="videos"}
|
||||
<div class="bdconten">
|
||||
<ul >
|
||||
{notempty name="videos"}
|
||||
<dl class="video_hotul">
|
||||
{volist name="videos" id="vo"}
|
||||
<dd>
|
||||
@@ -65,9 +65,11 @@
|
||||
<div class="clear"></div>
|
||||
</dl>
|
||||
<div>{$page|raw}</div>
|
||||
{else/}
|
||||
<dl class="video-empty">查询无结果!</dl>
|
||||
{/notempty}
|
||||
</ul>
|
||||
</div>
|
||||
{/notempty}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -65,6 +65,8 @@
|
||||
top: 50%;
|
||||
margin-top: -0.75rem;
|
||||
right: 6rem;
|
||||
border: 0;
|
||||
background-color: transparent;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .search_all .searchbtn img {
|
||||
width: 100%;
|
||||
@@ -259,3 +261,6 @@
|
||||
margin-top: 16px;
|
||||
line-height: 20px;
|
||||
}
|
||||
.orico_Page_download .downloadMain .contact_c .video-empty {
|
||||
padding-bottom: 3rem;
|
||||
}
|
||||
|
||||
BIN
public/static/index/images/search_blue.png
Executable file
BIN
public/static/index/images/search_blue.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 571 B |
Reference in New Issue
Block a user