样式,排序,翻页保留查询条件,继续抽象

This commit is contained in:
Jerry Yan 2022-07-30 11:53:48 +08:00
parent b9a46390e0
commit 33af2c5713
9 changed files with 37 additions and 92 deletions

View File

@ -19,7 +19,7 @@ class CommentQueryController extends BaseController
} }
} }
} }
$comments = $query->paginate(10); $comments = $query->paginate(10)->withQueryString();
return view("index", [ return view("index", [
"keyword" => $keyword, "keyword" => $keyword,
"comments" => $comments, "comments" => $comments,

View File

@ -14,7 +14,7 @@ class DanmakuQueryController extends BaseController
$video_list = Videos::query() $video_list = Videos::query()
->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus") ->withCount("danmakus", "bilibili_danmakus", "ixigua_danmakus", "douyin_danmakus")
->orderByDesc("created_at") ->orderByDesc("created_at")
->paginate(10); ->paginate(10)->withQueryString();
return view("danmaku.index", [ return view("danmaku.index", [
"video_list" => $video_list, "video_list" => $video_list,
]); ]);
@ -35,7 +35,7 @@ class DanmakuQueryController extends BaseController
} }
} }
} }
$danmakus = $query->orderBy("created_at", "asc")->paginate(20); $danmakus = $query->orderBy("created_at", "asc")->paginate(20)->withQueryString();
return view("danmaku.search_index", [ return view("danmaku.search_index", [
"keyword" => $keyword, "keyword" => $keyword,
"video" => $video, "video" => $video,

View File

@ -12,7 +12,7 @@ class ProgramQueryController extends BaseController
$keyword = $request->get("keyword", ""); $keyword = $request->get("keyword", "");
$programs = Programs::query()->with(["appends", "video_pivots.video"]) $programs = Programs::query()->with(["appends", "video_pivots.video"])
->where("status", "=", 1)->limit(15)->orderByDesc("created_at") ->where("status", "=", 1)->limit(15)->orderByDesc("created_at")
->paginate(); ->paginate(10)->withQueryString();
return view("program.index", [ return view("program.index", [
"keyword" => $keyword, "keyword" => $keyword,
"programs"=>$programs, "programs"=>$programs,

View File

@ -15,7 +15,7 @@ class Programs extends Model
public function video_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany public function video_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany
{ {
return $this->hasMany(ProgramVideos::class, "program_id", "id")->orderBy("created_at"); return $this->hasMany(ProgramVideos::class, "program_id", "id")->orderByDesc("created_at");
} }
public function videos(): \Illuminate\Database\Eloquent\Relations\HasManyThrough public function videos(): \Illuminate\Database\Eloquent\Relations\HasManyThrough

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,4 @@
{ {
"/js/app.js": "/js/app.js?id=f775b77a8886d46e619d4d79272ec38d", "/js/app.js": "/js/app.js?id=f775b77a8886d46e619d4d79272ec38d",
"/css/app.css": "/css/app.css?id=3b9c308b6dc460a0dfe4535c4c94ab78" "/css/app.css": "/css/app.css?id=e45f0e1f4819e8fc855349a3302912d2"
} }

View File

@ -28,26 +28,24 @@
</td> </td>
<td>{{$video_pivot->created_at}}</td> <td>{{$video_pivot->created_at}}</td>
<td> <td>
<a class="underline block" target="_blank" <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->start_part" :time="$video_pivot->start_time">
href="https://www.bilibili.com/video/{{$video_pivot->video_bvid}}?p={{$video_pivot->start_part}}&t={{$video_pivot->start_sec}}" <div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div>
title="P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}" @if($video_pivot->start_image)
>P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</a> <img width="300" src="{{$video_pivot->start_image}}" alt="开始时的画面">
@if($video_pivot->start_image) @else
<img width="300" src="{{$video_pivot->start_image}}" alt="开始时的画面"> 节目开始位置
@else @endif
<div>暂无</div> </x-links.video_link>
@endif
</td> </td>
<td> <td>
<a class="underline" target="_blank" <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->stop_part" :time="$video_pivot->stop_time">
href="https://www.bilibili.com/video/{{$video_pivot->video_bvid}}?p={{$video_pivot->stop_part}}&t={{$video_pivot->stop_sec}}" <div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div>
title="P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}" @if($video_pivot->start_image)
>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</a> <img width="300" src="{{$video_pivot->stop_image}}" alt="结束时的画面">
@if($video_pivot->stop_image) @else
<img width="300" src="{{$video_pivot->stop_image}}" alt="结束时的画面"> 节目结束位置
@else @endif
<div>暂无</div> </x-links.video_link>
@endif
</td> </td>
<td> <td>
<a class="text-blue-600 underline" <a class="text-blue-600 underline"

View File

@ -25,19 +25,19 @@
<tbody> <tbody>
@foreach($programs as $program) @foreach($programs as $program)
<tr> <tr>
<td class="border align-top"> <td class="border align-top w-1/2 lg:w-1/4">
<a class="text-blue-600 lg:text-current underline lg:no-underline" href="/programs/{{ $program->id }}/video"> <a class="text-blue-600 lg:text-current underline lg:no-underline" href="/programs/{{ $program->id }}/video">
<span title="节目">{{$program->name}}</span> <span title="节目">{{$program->name}}</span>
<span title="难度">{{$program->difficulty}}</span> <span title="难度">{{$program->difficulty}}</span>
<span title="要求">{{$program->desc}}</span> <span title="要求">{{$program->desc}}</span>
</a> </a>
</td> </td>
<td class="border align-top"> <td class="border align-top w-1/2 lg:w-1/4">
@foreach($program->appends as $append) @foreach($program->appends as $append)
<x-append :append="$append"></x-append> <x-append :append="$append"></x-append>
@endforeach @endforeach
</td> </td>
<td class="border align-top hidden lg:table-cell"> <td class="border align-top hidden lg:table-cell lg:w-1/4">
@foreach($program->video_pivots as $video_pivot) @foreach($program->video_pivots as $video_pivot)
<x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->start_part" :time="$video_pivot->start_time"> <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->start_part" :time="$video_pivot->start_time">
<div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div> <div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div>
@ -49,7 +49,7 @@
</x-links.video_link> </x-links.video_link>
@endforeach @endforeach
</td> </td>
<td class="border align-top hidden lg:table-cell"> <td class="border align-top hidden lg:table-cell lg:w-1/4">
@foreach($program->video_pivots as $video_pivot) @foreach($program->video_pivots as $video_pivot)
<x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->stop_part" :time="$video_pivot->stop_time"> <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->stop_part" :time="$video_pivot->stop_time">
<div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div> <div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div>

View File

@ -15,57 +15,12 @@
</div> </div>
<div class="ml-2"> <div class="ml-2">
@foreach($program->appends as $append) @foreach($program->appends as $append)
@if($append->is_original) <x-append :append="$append"></x-append>
<div> @endforeach
@switch($append->platform_id) </div>
@case(1) <div>
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/bilibili.ico" alt="B站"> @foreach($videos as $video_pivot)
<a class="underline" href="https://space.bilibili.com/{{$append->from_mid}}" target="_blank">{{$append->from}}</a> <a class="text-blue-600" href="{{url("/danmakus/".$video_pivot->video_bvid)}}">查看弹幕</a>
@break
@case(2)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频">
<a class="underline" href="https://www.ixigua.com/home/{{$append->from_mid}}/" target="_blank">{{$append->from}}</a>
@break
@case(3)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音">
{{$append->from}}
@break
@default
{{$append->from}}
@break
@endswitch
老板点播
<span title="一分10块">{{$append->price}}</span>
@if($append->append)
<span>{{$append->append}}</span>
@endif
</div>
@else
<div>
@switch($append->platform_id)
@case(1)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/bilibili.ico" alt="B站">
<a class="underline" href="https://space.bilibili.com/{{$append->from_mid}}" target="_blank">{{$append->from}}</a>
@break
@case(2)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/ixigua.ico" alt="西瓜视频">
<a class="underline" href="https://www.ixigua.com/home/{{$append->from_mid}}/" target="_blank">{{$append->from}}</a>
@break
@case(3)
<img class="w-4 h-4 inline-block" src="https://cdn.jerryyan.net/luboimg/douyin.ico" alt="抖音">
{{$append->from}}
@break
@default
{{$append->from}}
@break
@endswitch
老板追加:{{$append->name}}
<span title="一分10块">{{$append->price}}</span>
@if($append->append)
<span>{{$append->append}}</span>
@endif
</div>
@endif
@endforeach @endforeach
</div> </div>
</div> </div>
@ -80,32 +35,24 @@
@foreach($videos as $video_pivot) @foreach($videos as $video_pivot)
<tr class="border"> <tr class="border">
<td class="border align-bottom"> <td class="border align-bottom">
<a class="block" <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->start_part" :time="$video_pivot->start_time">
target="_blank"
href="https://www.bilibili.com/video/{{$video_pivot->video_bvid}}?p={{$video_pivot->start_part}}&t={{$video_pivot->start_sec}}"
title="P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}"
>
<div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div> <div>{{$video_pivot->created_at}} P{{$video_pivot->start_part}}#{{$video_pivot->start_time}}</div>
@if($video_pivot->start_image) @if($video_pivot->start_image)
<img width="300" src="{{$video_pivot->start_image}}" alt="开始时的画面"> <img width="300" src="{{$video_pivot->start_image}}" alt="开始时的画面">
@else @else
节目开始位置 节目开始位置
@endif @endif
</a> </x-links.video_link>
</td> </td>
<td class="border align-bottom"> <td class="border align-bottom">
<a class="block" <x-links.video_link :bvid="$video_pivot->video_bvid" :part="$video_pivot->stop_part" :time="$video_pivot->stop_time">
target="_blank"
href="https://www.bilibili.com/video/{{$video_pivot->video_bvid}}?p={{$video_pivot->stop_part}}&t={{$video_pivot->stop_sec}}"
title="P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}"
>
<div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div> <div>P{{$video_pivot->stop_part}}#{{$video_pivot->stop_time}}</div>
@if($video_pivot->start_image) @if($video_pivot->start_image)
<img width="300" src="{{$video_pivot->stop_image}}" alt="结束时的画面"> <img width="300" src="{{$video_pivot->stop_image}}" alt="结束时的画面">
@else @else
节目结束位置 节目结束位置
@endif @endif
</a> </x-links.video_link>
</td> </td>
</tr> </tr>
@endforeach @endforeach