Browse Source

1.菜单加上图片
2.轮播把截图去掉

moshaorui 4 weeks ago
parent
commit
5c5af804f4

+ 1 - 2
app/Distributor/Controllers/SiteBannerController.php

@@ -66,8 +66,7 @@ class SiteBannerController extends AdminDistController
         return Form::make(new SiteBanner(), function (Form $form) {
             $form->text('title')->required();
             $form->text('subtitle');
-            $form->cutImage("image_url", admin_trans_label('images'))
-                ->aspectRatio(1920/600)// 设置裁剪框比例
+            $form->image("image_url", admin_trans_label('images'))
                 ->retainable()//禁止删OSS图
                 ->autoUpload()
                 ->uniqueName()

+ 8 - 0
app/Distributor/Controllers/SiteMenuController.php

@@ -98,6 +98,14 @@ class SiteMenuController extends AdminDistController
                 }))->required();
             //标题
             $form->text('title')->required();
+            //图片
+            $form->image("image_url", admin_trans_label('images'))
+                ->retainable()//禁止删OSS图
+                ->autoUpload()
+                ->uniqueName()
+                ->accept(config('distributor.upload.oss_image.accept'))
+                ->maxSize(config('distributor.upload.oss_image.max_size'))
+                ->dir(config("distributor.upload.directory.image").'/menu/'.date("Ymd"));
             //类型
             $form->select('menu_type')->options(admin_trans_array(config('dictionary.menu_type')))->required()
                 ->when(1, function (Form $form) use ($menuConfig,$thisObject) {

+ 31 - 0
database/migrations/2025_03_05_023833_update_site_menu.php

@@ -0,0 +1,31 @@
+<?php
+
+use Illuminate\Database\Migrations\Migration;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Support\Facades\Schema;
+
+return new class extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        //菜单增加图片字段
+        Schema::table('site_menu', function (Blueprint $table) {
+            $table->string('image_url', 255)->nullable()->comment('菜单图片');
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        //
+    }
+};