liutk 2026-02-21 20:00:42 +08:00
parent a4b4fa7aca
commit 64843b6805
6 changed files with 52 additions and 3 deletions

View File

@ -115,7 +115,7 @@ class Components extends BaseRenderer {
* 标签选择 * 标签选择
*/ */
public function keywordsTagControl($name = 'tags', $label= null, $pKey = null){ public function keywordsTagControl($name = 'tags', $label= null, $pKey = null){
return amisMake()->TagControl() return amis()->TagControl()
->name($name)->label($label ?? __('admin.components.tag')) ->name($name)->label($label ?? __('admin.components.tag'))
->maxTagLength(0) ->maxTagLength(0)
->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray()); ->options(Keyword::where('parent_key', $pKey)->pluck('name', 'id')->toArray());
@ -123,7 +123,7 @@ class Components extends BaseRenderer {
public function keywordsTag($label = null, $color = null){ public function keywordsTag($label = null, $color = null){
if($color){ if($color){
$tag = amisMake()->Tag()->label($label ?? __('admin.components.tag')) $tag = amis()->Tag()->label($label ?? __('admin.components.tag'))
->displayMode('rounded')->style([ ->displayMode('rounded')->style([
'color' => '#fff', 'color' => '#fff',
'backgroundColor' =>$color, 'backgroundColor' =>$color,

View File

@ -38,6 +38,7 @@ Route::group([
$router->resource('project_flows', \App\Admin\Controllers\ProjectFlowController::class); $router->resource('project_flows', \App\Admin\Controllers\ProjectFlowController::class);
$router->resource('project_photos', \App\Admin\Controllers\ProjectPhotoController::class); $router->resource('project_photos', \App\Admin\Controllers\ProjectPhotoController::class);
$router->resource('project_advances', \App\Admin\Controllers\ProjectAdvanceController::class); $router->resource('project_advances', \App\Admin\Controllers\ProjectAdvanceController::class);
$router->resource('case_studies', \App\Admin\Controllers\CaseStudyController::class);
//修改上传 //修改上传
$router->post('upload_file', [\App\Admin\Controllers\IndexController::class, 'uploadFile']); $router->post('upload_file', [\App\Admin\Controllers\IndexController::class, 'uploadFile']);

View File

@ -29,4 +29,49 @@ class ProjectArticleFilter extends ModelFilter
{ {
return $this->where('type', $type); return $this->where('type', $type);
} }
public function tIds($tIds){
$tIds = explode(',',$tIds);
return $this->where(function($q) use ($tIds) {
foreach ($tIds as $tId) {
$q->whereRaw("FIND_IN_SET('".$tId."',t_ids)");
}
});
}
public function publishedAt($publishedAt){
$publishedAt = explode(',',$publishedAt);
return $this->where(function($q) use ($publishedAt) {
$startAt = Arr::get($publishedAt, 0) ?? null;
$endAt = Arr::get($publishedAt, 1) ?? null;
if(!empty($startAt)){
$q->where('published_at', '>=', $startAt);
}
if(!empty($endAt)){
$q->where('published_at', '<=', $endAt);
}
});
}
public function createdAt($createdAt){
$createdAt = explode(',',$createdAt);
return $this->where(function($q) use ($createdAt) {
$startAt = Arr::get($createdAt, 0) ?? null;
$endAt = Arr::get($createdAt, 1) ?? null;
if(!empty($startAt)){
$q->where('created_at', '>=', $startAt);
}
if(!empty($endAt)){
$q->where('created_at', '<=', $endAt);
}
});
}
public function enable($enable){
return $this->where('is_enable', $enable);
}
public function recommend($recommend){
return $this->where('is_recommend', $recommend);
}
} }

View File

@ -18,6 +18,7 @@ class ProjectArticle extends Model
public const TYPE_FLOW = 2; //服务流程 public const TYPE_FLOW = 2; //服务流程
public const TYPE_PHOTO = 3; //相关图片 public const TYPE_PHOTO = 3; //相关图片
public const TYPE_ADVANCE = 4; //核心优势 public const TYPE_ADVANCE = 4; //核心优势
public const TYPE_CASE_STUDY = 5; //服务案例
protected function serializeDate(\DateTimeInterface $date) protected function serializeDate(\DateTimeInterface $date)
{ {

View File

@ -32,6 +32,8 @@ class ProjectArticleService extends BaseService
$query->where('type', ProjectArticle::TYPE_PHOTO); $query->where('type', ProjectArticle::TYPE_PHOTO);
}elseif(Str::contains($currentUrl, 'project_advances')){ }elseif(Str::contains($currentUrl, 'project_advances')){
$query->where('type', ProjectArticle::TYPE_ADVANCE); $query->where('type', ProjectArticle::TYPE_ADVANCE);
}elseif(Str::contains($currentUrl, 'case_studies')){
$query->where('type', ProjectArticle::TYPE_CASE_STUDY);
} }
return $query; return $query;
} }

View File

@ -29,7 +29,7 @@ class AdminMenuSeeder extends Seeder
['title'=> 'project_advances', 'icon'=>'', 'url'=>'/project_advances', 'order'=>5], ['title'=> 'project_advances', 'icon'=>'', 'url'=>'/project_advances', 'order'=>5],
] ]
], ],
['title'=>'case_studies', 'icon'=>'carbon:cloud-satellite-services','url'=>'/case_study_articles', 'order'=>3], ['title'=>'case_studies', 'icon'=>'carbon:cloud-satellite-services','url'=>'/case_studies', 'order'=>3],
['title' => 'web_content', 'icon' => 'ic:outline-collections-bookmark', 'url' => '/web_content', 'order'=>4, ['title' => 'web_content', 'icon' => 'ic:outline-collections-bookmark', 'url' => '/web_content', 'order'=>4,
'children' =>[ 'children' =>[
['title'=>'news', 'icon'=>'','url'=>'/articles', 'order'=>1], ['title'=>'news', 'icon'=>'','url'=>'/articles', 'order'=>1],