From 5a6d74a517666316f9fbf622e397f670adecc5a8 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 12:42:33 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Console/Link.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Console/Link.php b/app/Http/Controllers/Console/Link.php index e5d066e..6ba351e 100644 --- a/app/Http/Controllers/Console/Link.php +++ b/app/Http/Controllers/Console/Link.php @@ -29,6 +29,7 @@ public function __construct() protected function ViewList(Request $request): Factory|View|Application|RedirectResponse { + $this->data['request'] = $request; $dataMarge = [ 'blogFriendsTotal' => DB::table('blog_link') ->whereNotIn('blog_link.blogLocation', [0]) @@ -59,11 +60,10 @@ protected function ViewList(Request $request): Factory|View|Application|Redirect 'unactive' => 'px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', ]; $this->data['blogCount'] = ceil($this->data['blogCount']/10); + if ($this->data['request']->page > $this->data['blogCount']-1) return Response::redirectTo(route('console.friends-link.list')); } else { $this->data['blog'] = DB::select("SELECT * FROM xf_index.blog_link WHERE blogName LIKE '%$request->search%' OR blogUrl LIKE '%$request->search%' ORDER BY id"); } - $this->data['request'] = $request; - if ($this->data['request']->page > $this->data['blogCount']-1) return Response::redirectTo(route('console.friends-link.list')); $this->data = array_merge($this->data, $dataMarge); return view('console.friends-link.list', $this->data); } -- 2.43.0 From 9df6d9b75bb3a615f7a6d3d3236d19793d6a3f89 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 13:12:32 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E7=BC=96=E8=BE=91=E5=99=A8=EF=BC=8C?= =?UTF-8?q?=E8=B7=AF=E7=94=B1=E8=A1=A8=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Console/Link.php | 42 +++++++++++++++++---------- routes/web.php | 7 ++++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/app/Http/Controllers/Console/Link.php b/app/Http/Controllers/Console/Link.php index 6ba351e..24f0eeb 100644 --- a/app/Http/Controllers/Console/Link.php +++ b/app/Http/Controllers/Console/Link.php @@ -27,6 +27,19 @@ public function __construct() $this->data = $data->data; } + public function ViewEdit(Request $request, $userId): Application|Factory|View|RedirectResponse + { + // 查找友链 + $resultBlog = DB::table('blog_link') + ->find($userId); + $this->data['blog'] = [ + $resultBlog, + ]; + // 没有查询到执行删除 + if ($this->data['blog'][0] == null) return Response::redirectTo(route('console.friends-link.list')); + return view('console.friends-link.edit', $this->data); + } + protected function ViewList(Request $request): Factory|View|Application|RedirectResponse { $this->data['request'] = $request; @@ -45,22 +58,22 @@ protected function ViewList(Request $request): Factory|View|Application|Redirect // 获取数据库信息 if (empty($request->page)) $request->page = 0; $this->data['blog'] = DB::table('blog_link') - ->whereNotIn('blogLocation',[0]) + ->whereNotIn('blogLocation', [0]) ->orderBy('id') - ->offset($request->page*10) + ->offset($request->page * 10) ->limit(10) ->get() ->toArray(); $this->data['blogCount'] = DB::table('blog_link') - ->whereNotIn('blogLocation',[0]) + ->whereNotIn('blogLocation', [0]) ->orderBy('id') ->count(); $this->data['webClass'] = [ 'active' => 'px-3 py-2 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white', 'unactive' => 'px-3 py-2 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white', ]; - $this->data['blogCount'] = ceil($this->data['blogCount']/10); - if ($this->data['request']->page > $this->data['blogCount']-1) return Response::redirectTo(route('console.friends-link.list')); + $this->data['blogCount'] = ceil($this->data['blogCount'] / 10); + if ($this->data['request']->page > $this->data['blogCount'] - 1) return Response::redirectTo(route('console.friends-link.list')); } else { $this->data['blog'] = DB::select("SELECT * FROM xf_index.blog_link WHERE blogName LIKE '%$request->search%' OR blogUrl LIKE '%$request->search%' ORDER BY id"); } @@ -68,16 +81,13 @@ protected function ViewList(Request $request): Factory|View|Application|Redirect return view('console.friends-link.list', $this->data); } - protected function ViewCheck(Request $request): Factory|View|Application - { - return view('console.friends-link.check', $this->data); - } + protected function ViewCheck(Request $request): Factory|View|Application + { + return view('console.friends-link.check', $this->data); + } - protected function ViewEdit(Request $request) { - return view('console.friends-link.edit',$this->data); - } - - protected function ViewAdd(Request $request) { - return view('console.friends-link.add',$this->data); - } + protected function ViewAdd(Request $request): Factory|View|Application + { + return view('console.friends-link.add', $this->data); + } } diff --git a/routes/web.php b/routes/web.php index 45165d2..bf79f43 100644 --- a/routes/web.php +++ b/routes/web.php @@ -9,6 +9,7 @@ use App\Http\Controllers\Console\Link as ConsoleLink; use App\Http\Controllers\Function\Link as UserLink; use App\Http\Controllers\Index; +use Illuminate\Http\Request; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Response; use Illuminate\Support\Facades\Route; @@ -44,7 +45,11 @@ Route::redirect('list','list/1'); Route::get('list',[ConsoleLink::class,'ViewList'])->name('console.friends-link.list'); Route::get('check',[ConsoleLink::class,'ViewCheck'])->name('console.friends-link.check'); - Route::get('edit/{page}',[ConsoleLink::class,'ViewEdit'])->name('console.friends-link.edit'); + Route::get('edit/{userId}',function ($userId) { + $ConsoleLink = new ConsoleLink(); + $request = new Request(); + return $ConsoleLink->ViewEdit($request,$userId); + })->name('console.friends-link.edit'); Route::get('add',[ConsoleLink::class,'ViewAdd'])->name('console.friends-link.add'); }); }); -- 2.43.0 From 02f9675b00283f72959f63d0300af963fcb08204 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 15:21:19 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0icon?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/function/make-friend.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/function/make-friend.blade.php b/resources/views/function/make-friend.blade.php index 268fefa..4010ac6 100644 --- a/resources/views/function/make-friend.blade.php +++ b/resources/views/function/make-friend.blade.php @@ -29,7 +29,7 @@ class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translat
- +
-- 2.43.0 From 2516de70d6237205f5e6863eb9d2c7842498184c Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 16:30:49 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=8D=9A=E5=AE=A2=E9=A2=9C=E8=89=B2?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=BF=81=E7=A7=BB=E6=9E=84=E5=BB=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...3_06_16_075646_create_blog_color_table.php | 39 ++++++++++ ...3_06_16_075950_update_blog_color_table.php | 77 +++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 database/migrations/2023_06_16_075646_create_blog_color_table.php create mode 100644 database/migrations/2023_06_16_075950_update_blog_color_table.php diff --git a/database/migrations/2023_06_16_075646_create_blog_color_table.php b/database/migrations/2023_06_16_075646_create_blog_color_table.php new file mode 100644 index 0000000..ee730e8 --- /dev/null +++ b/database/migrations/2023_06_16_075646_create_blog_color_table.php @@ -0,0 +1,39 @@ +id(); + $table->boolean('onlyAdminUse')->default(0)->comment('只允许管理员使用'); + $table->string('colorLightType')->default('text-gray-500')->comment('颜色ID'); + $table->string('colorDarkType')->default('dark:text-gray-800')->comment('暗色颜色ID'); + $table->string('comment')->nullable()->comment('备注'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('blog_color'); + } +} diff --git a/database/migrations/2023_06_16_075950_update_blog_color_table.php b/database/migrations/2023_06_16_075950_update_blog_color_table.php new file mode 100644 index 0000000..0607c20 --- /dev/null +++ b/database/migrations/2023_06_16_075950_update_blog_color_table.php @@ -0,0 +1,77 @@ +insert([ + 'colorLightType' => 'text-gray-500', + 'colorDarkType' => 'dark:text-gray-800', + 'comment' => '灰色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-blue-500', + 'colorDarkType' => 'dark:text-blue-800', + 'comment' => '蓝色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-indigo-500', + 'colorDarkType' => 'dark:text-indigo-800', + 'comment' => '靛青色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-purple-500', + 'colorDarkType' => 'dark:text-purple-800', + 'comment' => '紫色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-pink-500', + 'colorDarkType' => 'dark:text-pink-800', + 'comment' => '粉色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-green-500', + 'colorDarkType' => 'dark:text-green-800', + 'comment' => '绿色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-yellow-500', + 'colorDarkType' => 'dark:text-yellow-800', + 'comment' => '蓝色' + ]); + DB::table('blog_color')->insert([ + 'colorLightType' => 'text-red-500', + 'colorDarkType' => 'dark:text-red-800', + 'comment' => '红色' + ]); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('blog_color', function (Blueprint $table) { + // + }); + } +} -- 2.43.0 From 91e23d0d5d2e3347d8983250ca46bb0cea4ccdda Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 17:18:40 +0800 Subject: [PATCH 5/7] edit.blade --- .../views/console/friends-link/edit.blade.php | 253 ++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 resources/views/console/friends-link/edit.blade.php diff --git a/resources/views/console/friends-link/edit.blade.php b/resources/views/console/friends-link/edit.blade.php new file mode 100644 index 0000000..071f348 --- /dev/null +++ b/resources/views/console/friends-link/edit.blade.php @@ -0,0 +1,253 @@ + + + + + + + + + @include('modules.head') + {!! $webHeader !!} + + + + + +@include('console.modules.aside') + +
+
+ @include('console.modules.personal') +
+
友链修改
+
+
+
+
+

当前友链

+

超级友链

+

待审友链

+
+
+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+
+
+
+ +
+
+ +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+
+ + +
+
+ +
+ +
+
+
+ + +
+
+ +
+ +
+
+
+
+ +
+
+ + +
+
+ +
+ +
+
+
+
+
+
+ + +
+
+ + + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+ + 参考样式 +
+
+
+ Bordered avatar +
+

{{ $blog[0]->blogName }}

+

{{ $blog[0]->blogDescription }}

+
+
+
+
+
+ Bordered avatar +
+

{{ $blog[0]->blogName }}

+

{{ $blog[0]->blogDescription }}

+
+
+
+
+
+
+
+
+
+ + + + + -- 2.43.0 From 1ca89a161d557958f5fe1adb08e4059394822e11 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 17:19:01 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E7=AE=80=E5=8D=95=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E5=8F=8A=E8=B7=AF=E7=94=B1=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Console/Link.php | 18 ++++++++++++++++++ routes/web.php | 2 ++ 2 files changed, 20 insertions(+) diff --git a/app/Http/Controllers/Console/Link.php b/app/Http/Controllers/Console/Link.php index 24f0eeb..4dd1149 100644 --- a/app/Http/Controllers/Console/Link.php +++ b/app/Http/Controllers/Console/Link.php @@ -35,6 +35,14 @@ public function ViewEdit(Request $request, $userId): Application|Factory|View|Re $this->data['blog'] = [ $resultBlog, ]; + $this->data['blogSort'] = DB::table('blog_sort') + ->orderBy('sort') + ->get() + ->toArray(); + $this->data['blogColor'] = DB::table('blog_color') + ->orderBy('id') + ->get() + ->toArray(); // 没有查询到执行删除 if ($this->data['blog'][0] == null) return Response::redirectTo(route('console.friends-link.list')); return view('console.friends-link.edit', $this->data); @@ -90,4 +98,14 @@ protected function ViewAdd(Request $request): Factory|View|Application { return view('console.friends-link.add', $this->data); } + + protected function ViewSort(): Factory|View|Application + { + return view('console.friends-link.sort',$this->data); + } + + protected function ViewColor(): Factory|View|Application + { + return view('concole.friends-link.color',$this->data); + } } diff --git a/routes/web.php b/routes/web.php index bf79f43..b65ee3c 100644 --- a/routes/web.php +++ b/routes/web.php @@ -51,6 +51,8 @@ return $ConsoleLink->ViewEdit($request,$userId); })->name('console.friends-link.edit'); Route::get('add',[ConsoleLink::class,'ViewAdd'])->name('console.friends-link.add'); + Route::get('sort',[ConsoleLink::class,'ViewSort'])->name('console.friends-link.sort'); + Route::get('color',[ConsoleLink::class,'ViewColor'])->name('console.friends-link.color'); }); }); -- 2.43.0 From 1164054628b4c277c2d1b908a0fa122525732503 Mon Sep 17 00:00:00 2001 From: XiaoLFeng Date: Fri, 16 Jun 2023 17:19:11 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=BC=8F=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/views/function/link.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/function/link.blade.php b/resources/views/function/link.blade.php index 44076e1..5031dca 100644 --- a/resources/views/function/link.blade.php +++ b/resources/views/function/link.blade.php @@ -30,7 +30,7 @@ class="relative left-[calc(50%-11rem)] aspect-[1155/678] w-[36.125rem] -translat @if($valueLink->blogLocation == $valueSort->id)
+ class="flex p-2 hover:bg-gray-100 bg-white border border-grey-200 rounded-lg shadow-lg sm:p-4 dark:bg-gray-800 dark:hover:bg-gray-700 dark:border-gray-700 grid-cols-2 m-1">