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