202508271602
加入包廂代碼
This commit is contained in:
parent
01ff6d46db
commit
f070df7d03
@ -7,18 +7,31 @@ use App\Livewire\Actions\Logout;
|
||||
|
||||
class Navigation extends Component
|
||||
{
|
||||
// 菜單列表
|
||||
public array $menus = [
|
||||
private array $commonMenus = [
|
||||
['name' => '首頁', 'route' => 'welcome'],
|
||||
['name' => '新歌快報', 'route' => 'new-songs'],
|
||||
['name' => '熱門排行', 'route' => 'top-ranking'],
|
||||
['name' => '歌名查詢', 'route' => 'search-song'],
|
||||
];
|
||||
private array $roomMenus = [
|
||||
['name' => '已點歌曲', 'route' => 'clicked-song'],
|
||||
['name' => '聲音控制', 'route' => 'sound-control'],
|
||||
['name' => '社群媒體', 'route' => 'social-media'],
|
||||
['name' => '真情告白', 'route' => 'love-message'],
|
||||
['name' => '心情貼圖', 'route' => 'mood-stickers'],
|
||||
];
|
||||
public array $menus = [];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// 先放共用的
|
||||
$this->menus = $this->commonMenus;
|
||||
|
||||
// 如果有 room_code,再合併
|
||||
if (session()->has('room_code')) {
|
||||
$this->menus = array_merge($this->menus, $this->roomMenus);
|
||||
}
|
||||
}
|
||||
|
||||
public function logout(Logout $logout)
|
||||
{
|
||||
|
25
app/Livewire/Pages/Home.php
Normal file
25
app/Livewire/Pages/Home.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Livewire\Pages;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Home extends Component
|
||||
{
|
||||
public $roomCode;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
// 先從 URL 取得 room_code,再存進 session
|
||||
session()->forget('room_code');
|
||||
$this->roomCode = request()->query('room_code', session('room_code', null));
|
||||
if ($this->roomCode) {
|
||||
session(['room_code' => $this->roomCode]);
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.pages.home');
|
||||
}
|
||||
}
|
15
resources/views/livewire/pages/home.blade.php
Normal file
15
resources/views/livewire/pages/home.blade.php
Normal file
@ -0,0 +1,15 @@
|
||||
<div class="py-12 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
||||
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-新歌快報.png') }}" href="{{ route('new-songs') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-熱門排行.png') }}" href="{{ route('top-ranking') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-歌名查詢.png') }}" href="{{ route('search-song') }}" />
|
||||
@if($roomCode)
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-已點歌曲.png') }}" onclick="orderSongAndNavigate()" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-聲音控制.png') }}" href="{{ route('sound-control') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-社群媒體.png') }}" href="{{ route('social-media') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-真情告白.png') }}" href="{{ route('love-message') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-心情貼圖.png') }}" href="{{ route('mood-stickers') }}" />
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
@ -6,16 +6,5 @@
|
||||
</div>
|
||||
</x-slot>
|
||||
|
||||
<div class="py-12 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
|
||||
<div class="grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-6">
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-新歌快報.png') }}" href="{{ route('new-songs') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-熱門排行.png') }}" href="{{ route('top-ranking') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-歌名查詢.png') }}" href="{{ route('search-song') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-已點歌曲.png') }}" onclick="orderSongAndNavigate()" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-聲音控制.png') }}" href="{{ route('sound-control') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-社群媒體.png') }}" href="{{ route('social-media') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-真情告白.png') }}" href="{{ route('love-message') }}" />
|
||||
<x-button.flat-card image="{{ asset('手機點歌/首頁-心情貼圖.png') }}" href="{{ route('mood-stickers') }}" />
|
||||
</div>
|
||||
</div>
|
||||
<livewire:pages.home />
|
||||
</x-app-layout>
|
Loading…
x
Reference in New Issue
Block a user