moshaorui 1 month ago
parent
commit
3bca2154cb

+ 15 - 1
app/Admin/Controllers/SiteAlbumController.php

@@ -136,6 +136,8 @@ JS
                 $dataImages = array_slice($images, 0, 1);
                 return CommonHelper::displayImage($dataImages,80);
             });
+            $grid->column('title',admin_trans_label('product_name'));
+            //$grid->column('title_en');
             $grid->column('model');
             $grid->column('folder_id',admin_trans_label('folder'))
                 ->display(function ($folder_id) {
@@ -147,6 +149,15 @@ JS
                 0 => 'danger',
                 1 => 'success',
             ]);
+            $grid->column('status')->display(function ($status) {
+                $updated_at = $this->updated_at->format('Y-m-d H:i:s');
+                //三个月前显示待更新
+                if (time() - strtotime($updated_at) > 90 * 24 * 3600) {
+                    return '<span class="label label-warning" style="background:#dda451">待更新</span>';
+                } else {
+                    return '<span class="label label-success" style="background:#21b978">正常</span>';
+                }
+            });
             $grid->column('missing_content')->display(function ($missing_content) {
                 $missing_content = [];
                 if ($this->cover == '[]') {$missing_content[] = '主图';}
@@ -236,6 +247,8 @@ JS
                     $folderId = array_key_first($selectOptions);
                 }
                 $form->select('folder_id')->options($selectOptions)->default($folderId)->required();
+                $form->text('title',admin_trans_label('product_name'))->required();
+                $form->text('title_en',admin_trans_label('product_name_en'))->required();
                 $form->text('model')->required();
                 $form->table('parameters',admin_trans_label('attribute_name'), function (Form\NestedForm $table) {
                     $table->text('key')->required();
@@ -360,6 +373,7 @@ JS
             })->tab(admin_trans_label('pdf'), function (Form $form) {
                  $form->hasMany('pdf', function ($form) {
                      $form->text('pdf_title')->required();
+                     $form->text('pdf_title_en')->required();
                      $form->tradFile('pdf_src')
                          ->retainable()//禁止删OSS图
                          ->removable() // 可移除图片
@@ -380,7 +394,7 @@ JS
                          $data = [];
                          foreach ($input as $value) {
                              if ($value['_remove_'] != 1){
-                                 $data[] = ['pdf_title'=>$value['pdf_title'],'pdf_src'=>$value['pdf_src']];
+                                 $data[] = ['pdf_title'=>$value['pdf_title'],'pdf_title_en' => $value['pdf_title_en'],'pdf_src'=>$value['pdf_src']];
                              }
                          }
                          return json_encode($data);

+ 12 - 6
app/Admin/Controllers/SiteAlbumFolderController.php

@@ -35,13 +35,19 @@ class SiteAlbumFolderController extends AdminController
             $grid->column('id')->sortable();
             $grid->column('title')->display(function ($title) {
                 $level = $this->level; // 获取当前行的 level 字段值
-                $prefix = str_repeat('&nbsp; ', $level * 2). ' <i class="fa fa-angle-right"></i>&nbsp; '; // 生成 level * 3 个加号
+                $has_children = $this->has_children; // 获取当前行的 has_children 字段值
+                if ($has_children) {
+                    $prefix = str_repeat('&nbsp; ', $level * 2). ' <i class="fa fa-angle-right"></i>&nbsp; '; // 生成 level * 3 个加号
+                } else {
+                    $prefix = str_repeat('&nbsp; ', $level * 2). ' &nbsp; '; // 生成 level * 3 个加号
+                }
+
                 return $prefix . ' ' . html_entity_decode($title); // 拼接加号和名称
             });
             $grid->column('cover') ->display(function ($images) {
                 return CommonHelper::displayImage([$images],80);
             });
-            $grid->column('folder_type')->using(admin_trans_array(config('dictionary.folder_type')))->label([0 => 'primary', 1 => 'success',]);
+            //$grid->column('folder_type')->using(admin_trans_array(config('dictionary.folder_type')))->label([0 => 'primary', 1 => 'success',]);
             $grid->column('parent_id');
             $grid->column('order')->sortable();
             $grid->column('enabled')->switch();
@@ -67,7 +73,7 @@ class SiteAlbumFolderController extends AdminController
                 ->options(SiteAlbumFolder::selectMainOptions())
                 ->saving(function ($v) {
                     return (int) $v;
-                });
+                })->default(0);
             $form->text('title')->required();
             $form->image('cover')
                 ->retainable()//禁止删OSS图
@@ -77,9 +83,9 @@ class SiteAlbumFolderController extends AdminController
                 ->maxSize(config('admin.upload.oss_image.max_size'))
                 ->dir(config("admin.upload.directory.image").'/uploads/'.date("Ymd"))
                 ->required();
-            $form->radio('folder_type')
-                ->options(admin_trans_array(config('dictionary.folder_type')))
-                ->default(0)->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',

+ 69 - 0
app/Admin/Controllers/SiteUserController.php

@@ -0,0 +1,69 @@
+<?php
+
+namespace App\Admin\Controllers;
+
+use App\Admin\Repositories\SiteUser;
+use Dcat\Admin\Form;
+use Dcat\Admin\Grid;
+use Dcat\Admin\Show;
+use Dcat\Admin\Http\Controllers\AdminController;
+use Dcat\Admin\Layout\Content;
+use Dcat\Admin\Admin;
+
+class SiteUserController extends AdminController
+{
+    /**
+     * page index
+     */
+    public function index(Content $content)
+    {
+        return $content
+            ->header('列表')
+            ->description('全部')
+            ->breadcrumb(['text'=>'列表','url'=>''])
+            ->body($this->grid());
+    }
+
+    /**
+     * Make a grid builder.
+     *
+     * @return Grid
+     */
+    protected function grid()
+    {
+        return Grid::make(new SiteUser(), function (Grid $grid) {
+            $grid->column('id')->sortable();
+            $grid->column('username');
+            $grid->column('nick_name');
+            $grid->column('created_at');
+            $grid->column('updated_at')->sortable();
+
+            $grid->filter(function (Grid\Filter $filter) {
+                $filter->equal('id');
+            });
+            $grid->model()->orderBy('id', 'desc');
+            $grid->disableViewButton();
+        });
+    }
+
+
+
+    /**
+     * Make a form builder.
+     *
+     * @return Form
+     */
+    protected function form()
+    {
+        return Form::make(new SiteUser(), function (Form $form) {
+            $form->text('username')->required();
+            $form->text('nick_name')->required();
+            $form->password('password')->required();
+            $form->saving(function (Form $form) {
+                if ($form->password) {
+                    $form->password = bcrypt($form->password);
+                }
+            });
+        });
+    }
+}

+ 2 - 0
app/Admin/Repositories/SiteAlbumFolder.php

@@ -31,6 +31,7 @@ class SiteAlbumFolder extends EloquentRepository
         // 转换成一维数组
         $data=flattenTree($data);
 
+
         return $model->makePaginator(
             count($data), // 传入总记录数
             $data // 传入数据二维数组
@@ -52,6 +53,7 @@ class SiteAlbumFolder extends EloquentRepository
                 unset($selectOptions[$key]);
             }
         }
+
         return $selectOptions;
     }
 

+ 16 - 0
app/Admin/Repositories/SiteUser.php

@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Admin\Repositories;
+
+use App\Models\SiteUser as Model;
+use Dcat\Admin\Repositories\EloquentRepository;
+
+class SiteUser extends EloquentRepository
+{
+    /**
+     * Model.
+     *
+     * @var string
+     */
+    protected $eloquentClass = Model::class;
+}

+ 2 - 0
app/Admin/routes.php

@@ -27,6 +27,8 @@ Route::group([
     $router->resource('site-album', 'SiteAlbumController');
     //相册日志
     $router->get('site-album-log', 'SiteAlbumLogController@index');
+    //相删用户
+    $router->resource('site-users', 'SiteUserController');
 });
 
 // 定义RPC服务

+ 14 - 0
app/Models/SiteUser.php

@@ -0,0 +1,14 @@
+<?php
+
+namespace App\Models;
+
+use Dcat\Admin\Traits\HasDateTimeFormatter;
+
+use Illuminate\Database\Eloquent\Model;
+
+class SiteUser extends Model
+{
+	use HasDateTimeFormatter;
+    protected $table = 'site_users';
+    
+}

+ 2 - 0
app/helpers.php

@@ -174,8 +174,10 @@ if (!function_exists('flattenTree')) {
             // 复制节点数据,但不包括子节点,并添加 level 字段
             $flattenedNode = array_diff_key($node, ['children' => null]);
             $flattenedNode['level'] = $level;
+            $flattenedNode['has_children'] = isset($node['children']) && is_array($node['children']);
             $result[] = $flattenedNode;
 
+
             // 如果有子节点,递归处理子节点,并将 level 增加 1
             if (isset($node['children']) && is_array($node['children'])) {
                 flattenTree($node['children'], $result, $level + 1);

+ 1 - 1
config/app.php

@@ -83,7 +83,7 @@ return [
     |
     */
 
-    'locale' => 'en',
+    'locale' => 'zh_CN',
 
     /*
     |--------------------------------------------------------------------------

+ 16 - 4
dcat_admin_ide_helper.php

@@ -63,10 +63,13 @@ namespace Dcat\Admin {
      * @property Grid\Column|Collection en_detail
      * @property Grid\Column|Collection cn_detail
      * @property Grid\Column|Collection enabled
+     * @property Grid\Column|Collection title_en
      * @property Grid\Column|Collection folder_type
      * @property Grid\Column|Collection show_tabs
-     * @property Grid\Column|Collection nick_name
+     * @property Grid\Column|Collection user_name
      * @property Grid\Column|Collection action
+     * @property Grid\Column|Collection content_id
+     * @property Grid\Column|Collection nick_name
      *
      * @method Grid\Column|Collection id(string $label = null)
      * @method Grid\Column|Collection name(string $label = null)
@@ -120,10 +123,13 @@ namespace Dcat\Admin {
      * @method Grid\Column|Collection en_detail(string $label = null)
      * @method Grid\Column|Collection cn_detail(string $label = null)
      * @method Grid\Column|Collection enabled(string $label = null)
+     * @method Grid\Column|Collection title_en(string $label = null)
      * @method Grid\Column|Collection folder_type(string $label = null)
      * @method Grid\Column|Collection show_tabs(string $label = null)
-     * @method Grid\Column|Collection nick_name(string $label = null)
+     * @method Grid\Column|Collection user_name(string $label = null)
      * @method Grid\Column|Collection action(string $label = null)
+     * @method Grid\Column|Collection content_id(string $label = null)
+     * @method Grid\Column|Collection nick_name(string $label = null)
      */
     class Grid {}
 
@@ -182,10 +188,13 @@ namespace Dcat\Admin {
      * @property Show\Field|Collection en_detail
      * @property Show\Field|Collection cn_detail
      * @property Show\Field|Collection enabled
+     * @property Show\Field|Collection title_en
      * @property Show\Field|Collection folder_type
      * @property Show\Field|Collection show_tabs
-     * @property Show\Field|Collection nick_name
+     * @property Show\Field|Collection user_name
      * @property Show\Field|Collection action
+     * @property Show\Field|Collection content_id
+     * @property Show\Field|Collection nick_name
      *
      * @method Show\Field|Collection id(string $label = null)
      * @method Show\Field|Collection name(string $label = null)
@@ -239,10 +248,13 @@ namespace Dcat\Admin {
      * @method Show\Field|Collection en_detail(string $label = null)
      * @method Show\Field|Collection cn_detail(string $label = null)
      * @method Show\Field|Collection enabled(string $label = null)
+     * @method Show\Field|Collection title_en(string $label = null)
      * @method Show\Field|Collection folder_type(string $label = null)
      * @method Show\Field|Collection show_tabs(string $label = null)
-     * @method Show\Field|Collection nick_name(string $label = null)
+     * @method Show\Field|Collection user_name(string $label = null)
      * @method Show\Field|Collection action(string $label = null)
+     * @method Show\Field|Collection content_id(string $label = null)
+     * @method Show\Field|Collection nick_name(string $label = null)
      */
     class Show {}
 

+ 4 - 0
lang/zh_CN/global.php

@@ -118,6 +118,8 @@ return [
         'missing_content'       => '缺少内容',
         'nick_name'             => '昵称',
         'action'                => '操作',
+        'title_en'              => '标题(英文)',
+        'pdf_title_en'          => 'PDF标题(英文)',
     ],
     'labels' => [
         'list'         => '列表',
@@ -229,6 +231,8 @@ return [
         'image_preview'         => '图片预览',
         'video_cover'           => '视频封面',
         'folder'                => '文件夹名称',
+        'product_name'          => '名称',
+        'product_name_en'       => '名称(英文)',
     ],
     'options' => [
         //

+ 1 - 0
lang/zh_CN/menu.php

@@ -58,5 +58,6 @@ return [
         'folder' => '文件夹',
         'album' => '相册内容',
         'album_log' => '相册日志',
+        'site_user' => '相册用户',
     ],
 ];

+ 35 - 20
resources/views/admin/pages/login.blade.php

@@ -19,6 +19,18 @@
     .form-group .control-label {
         text-align: left;
     }
+    .justify-content-between {
+        margin-top: 1rem;
+    }
+    #captcha {
+        width: 185px;
+        float: left;
+    }
+    .captcha-img {
+        float: right;
+        width: 110px;
+        height: 34px;
+    }
 </style>
 
 <div class="login-page bg-40">
@@ -100,6 +112,7 @@
                             placeholder="{{ trans('admin.captcha') }}"
                             required
                         >
+                        <img src="/prime-control/captcha?{{ time() }}" alt="captcha" class="captcha-img" onclick="this.src='/prime-control/captcha?'+Math.random()">
 
                         <div class="form-control-position">
                             <i class="feather icon-image"></i>
@@ -114,39 +127,41 @@
                                 @endforeach
                             </span>
                         @endif
-                        <img src="/prime-control/captcha?{{ time() }}" alt="captcha" class="captcha-img" onclick="this.src='/prime-control/captcha?'+Math.random()">
+
                     </fieldset>
 
+
+
+{{--                    <div class="form-group d-flex justify-content-between align-items-center">--}}
+{{--                        <div class="text-left">--}}
+{{--                            <a class="lang-item" href="javascript:void(0);" data-lang="en">English</a>--}}
+{{--                           / <a class="lang-item" href="javascript:void(0);" data-lang="zh_CN">中文</a>--}}
+{{--                        </div>--}}
+{{--                    </div>--}}
+
+                    <button type="submit" class="btn btn-primary float-letf login-btn">
+                        {{ __('admin.login') }}
+                        <i class="feather icon-arrow-right"></i>
+                    </button>
+
                     <div class="form-group d-flex justify-content-between align-items-center">
                         <div class="text-left">
                             @if(config('admin.auth.remember'))
-                            <fieldset class="checkbox">
-                                <div class="vs-checkbox-con vs-checkbox-primary">
-                                    <input id="remember" name="remember"  value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
-                                    <span class="vs-checkbox">
+                                <fieldset class="checkbox">
+                                    <div class="vs-checkbox-con vs-checkbox-primary">
+                                        <input id="remember" name="remember"  value="1" type="checkbox" {{ old('remember') ? 'checked' : '' }}>
+                                        <span class="vs-checkbox">
                                                         <span class="vs-checkbox--check">
                                                           <i class="vs-icon feather icon-check"></i>
                                                         </span>
                                                     </span>
-                                    <span> {{ trans('admin.remember_me') }}</span>
-                                </div>
-                            </fieldset>
+                                        <span> {{ trans('admin.remember_me') }}</span>
+                                    </div>
+                                </fieldset>
                             @endif
                         </div>
                     </div>
-                    <div class="form-group d-flex justify-content-between align-items-center">
-                        <div class="text-left">
-                            <a class="lang-item" href="javascript:void(0);" data-lang="en">English</a>
-                           / <a class="lang-item" href="javascript:void(0);" data-lang="zh_CN">中文</a>
-                        </div>
-                    </div>
-
-                    <button type="submit" class="btn btn-primary float-right login-btn">
 
-                        {{ __('admin.login') }}
-                        &nbsp;
-                        <i class="feather icon-arrow-right"></i>
-                    </button>
                 </form>
 
             </div>

+ 3 - 3
resources/views/admin/partials/navbar.blade.php

@@ -49,9 +49,9 @@
                     @endif
                     -->
 
-                    <i class="fa fa-language f16"></i>
-                    <a class="lang-item " href="javascript:void(0);" data-lang="en">English</a>
-                    <a class="lang-item " href="javascript:void(0);" data-lang="zh_CN">中文</a>
+{{--                    <i class="fa fa-language f16"></i>--}}
+{{--                    <a class="lang-item " href="javascript:void(0);" data-lang="en">English</a>--}}
+{{--                    <a class="lang-item " href="javascript:void(0);" data-lang="zh_CN">中文</a>--}}
 
                     <ul class="nav navbar-nav">
                         {{--User Account Menu--}}