소스 검색

1.修改上传路径
2.增加文字描述

moshaorui 1 개월 전
부모
커밋
ffb045c59b
5개의 변경된 파일46개의 추가작업 그리고 21개의 파일을 삭제
  1. 32 11
      app/Admin/Controllers/SiteAlbumController.php
  2. 2 10
      app/Admin/Controllers/SiteAlbumFolderController.php
  3. 10 0
      config/dictionary.php
  4. 1 0
      lang/en/global.php
  5. 1 0
      lang/zh_CN/global.php

+ 32 - 11
app/Admin/Controllers/SiteAlbumController.php

@@ -285,10 +285,12 @@ JS
                     ->limit(config('admin.upload.oss_image.limit'))
                     ->accept(config('admin.upload.oss_image.accept'))
                     ->maxSize(config('admin.upload.oss_image.max_size'))
-                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                     ->saving(function ($images) use ($form) {
                         return json_encode($images);
                     });
+            })->tab(admin_trans_label('text_detail'), function (Form $form) {
+                $form->editor('text_detail',admin_trans_label('text_detail'));
             })->tab(admin_trans_label('en_detail'), function (Form $form) {
                 $form->multipleImage('en_detail')
                     ->retainable()//禁止删OSS图
@@ -299,7 +301,7 @@ JS
                     ->limit(config('admin.upload.oss_image.limit'))
                     ->accept(config('admin.upload.oss_image.accept'))
                     ->maxSize(config('admin.upload.oss_image.max_size'))
-                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                     ->saving(function ($images) use ($form) {
                         return json_encode($images);
                     });
@@ -313,7 +315,7 @@ JS
                     ->limit(config('admin.upload.oss_image.limit'))
                     ->accept(config('admin.upload.oss_image.accept'))
                     ->maxSize(config('admin.upload.oss_image.max_size'))
-                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                     ->saving(function ($images) use ($form) {
                         return json_encode($images);
                     });
@@ -343,7 +345,7 @@ JS
                         ->downloadable()
                         ->accept(config('admin.upload.oss_video.accept'))
                         ->maxSize(config('admin.upload.oss_video.max_size'))
-                        ->dir(config("admin.upload.directory.video").'/uploads/'.date("Ymd"))
+                        ->dir(config("admin.upload.directory.video").'/uploads/'.date("Ym"))
                         ->chunkSize(1024)
                         ->required();
                 })->useTable()
@@ -368,7 +370,7 @@ JS
                     ->limit(config('admin.upload.oss_image.limit'))
                     ->accept(config('admin.upload.oss_image.accept'))
                     ->maxSize(config('admin.upload.oss_image.max_size'))
-                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                     ->saving(function ($images) use ($form) {
                         return json_encode($images);
                     });
@@ -382,7 +384,7 @@ JS
                     ->limit(config('admin.upload.oss_image.limit'))
                     ->accept(config('admin.upload.oss_image.accept'))
                     ->maxSize(config('admin.upload.oss_image.max_size'))
-                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                    ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                     ->saving(function ($images) use ($form) {
                         return json_encode($images);
                     });
@@ -398,7 +400,7 @@ JS
                          ->downloadable()
                          ->accept(config('admin.upload.oss_pdf.accept'))
                          ->maxSize(config('admin.upload.oss_pdf.max_size'))
-                         ->dir(config("admin.upload.directory.pdf").'/uploads/'.date("Ymd"))
+                         ->dir(config("admin.upload.directory.pdf").'/uploads/'.date("Ym"))
                          ->chunkSize(1024)
                          ->required();
                 })->useTable()
@@ -442,7 +444,7 @@ JS
     {
         $disk = $this->disk('oss');
         $newName = uniqueCode("video_cover_").$imgType;
-        $dir = config("admin.upload.directory.image").'/uploads/'.date("Ymd").'/'.$newName;
+        $dir = config("admin.upload.directory.image").'/uploads/'.date("Ym").'/'.$newName;
         $contents = file_get_contents($file);
         if (!$contents) {
             return ['status'=>false,'msg'=>'图片上传失败,请检查PHP配置'];
@@ -453,6 +455,13 @@ JS
 
     private function formAddJS() {
         $folderTabs = SiteAlbumFolder::getAllFolderTabs();
+        $album_tabs = config('dictionary.album_tabs');
+
+        foreach ($folderTabs as $key => $value) {
+            foreach ($value as $k => $v) {
+                $folderTabs[$key][$k] = admin_trans_label($album_tabs[$v]);
+            }
+        }
         $folderTabs = json_encode($folderTabs);
         //以下JS作用:1.点击列表时,把folder_id参数传递给表单 2.切换文件夹时,显示隐藏相应的tab
         Admin::script(
@@ -490,7 +499,8 @@ function showHideTabs(fid) {
         const folderIdValue = fid;
         // 获取当前 folderIdValue 对应的标签索引
         const tabIndexes = folderTabs[folderIdValue];
-        //console.log(tabIndexes);
+
+        console.log(tabIndexes);
 
         if (tabIndexes) {
             // 处理上方的 <li>,限定在 .nav-tabs 内
@@ -500,8 +510,19 @@ function showHideTabs(fid) {
                 }
             });
 
-            tabIndexes.forEach(function(index) {
-                $('.nav-tabs .nav-item:eq(' + (Number(index) + 1) + ')').show(); // 使用字符串拼接
+
+
+            $('.nav-tabs .nav-item').each(function() {
+                const navItem = $(this);
+                const navLink = navItem.find('.nav-link');
+
+                // 获取清理后的导航文本(包含处理空格和特殊字符)
+                const tabText = navLink.clone().children().remove().end().text().trim();
+
+                // 逻辑判断与显示控制
+                if (tabIndexes.includes(tabText)) {
+                    navItem.show(); // 显式设置显示
+                }
             });
 
         }

+ 2 - 10
app/Admin/Controllers/SiteAlbumFolderController.php

@@ -82,20 +82,12 @@ class SiteAlbumFolderController extends AdminController
                 ->uniqueName()
                 ->accept(config('admin.upload.oss_image.accept'))
                 ->maxSize(config('admin.upload.oss_image.max_size'))
-                ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
+                ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ym"))
                 ->required();
 //            $form->radio('folder_type')
 //                ->options(admin_trans_array(config('dictionary.folder_type')))
 //                ->default(0)->required();
-            $form->listbox('show_tabs')->options(admin_trans_array([
-                '0' => 'cover',
-                '1' => 'en_detail',
-                '2' => 'cn_detail',
-                '3' => 'video',
-                '4' => 'poster',
-                '5' => 'cert',
-                '6' => 'pdf',
-            ]))->default([0, 1, 2, 3, 4, 5, 6])->saving(function ($v) { return json_encode($v); });
+            $form->listbox('show_tabs')->options(admin_trans_array(config('dictionary.album_tabs')))->default([0, 1, 2, 3, 4, 5, 6, 7])->saving(function ($v) { return json_encode($v); });
             $form->number('order')
                 ->default(0)
                 ->rules('numeric');

+ 10 - 0
config/dictionary.php

@@ -43,4 +43,14 @@ return [
     ],
 
 
+    'album_tabs'=>[
+        '0' => 'cover',
+        '1' => 'en_detail',
+        '2' => 'cn_detail',
+        '3' => 'video',
+        '4' => 'poster',
+        '5' => 'cert',
+        '6' => 'pdf',
+        '7' => 'text_detail',
+    ],
 ];

+ 1 - 0
lang/en/global.php

@@ -221,6 +221,7 @@ return [
         'image_preview'         => 'Image Preview',
         'video_cover'           => 'Video Cover',
         'folder'                => 'Folder',
+        'text_detail'           => 'Text Detail',
     ],
     'options' => [
         //

+ 1 - 0
lang/zh_CN/global.php

@@ -233,6 +233,7 @@ return [
         'folder'                => '文件夹名称',
         'product_name'          => '名称',
         'product_name_en'       => '名称(英文)',
+        'text_detail'           => '文字详情',
     ],
     'options' => [
         //