Browse Source

站点配置

moshaorui 4 months ago
parent
commit
615aebafce

+ 27 - 19
app/Admin/Controllers/DistAdminDistributorController.php

@@ -84,7 +84,7 @@ class DistAdminDistributorController extends AdminController
     {
         return Show::make($id, DistAdminDistributor::with(['appearance']), function (Show $show) {
             $show->field('id');
-            $show->field('company_name',);
+            $show->field('company_name');
             $show->field('company_address');
             $show->field('site_name');
             $show->field('domain_type',admin_trans_label('domain'))->as(function ($domainType) {
@@ -110,6 +110,9 @@ class DistAdminDistributorController extends AdminController
             $show->field('enabled')->using(admin_trans_array(config('dictionary.enabled')));
             $show->field('created_at');
             $show->field('updated_at');
+            $show->field('seo_title');
+            $show->field('seo_keywords');
+            $show->field('seo_description');
             // 按钮
             $show->disableDeleteButton();
         });
@@ -123,35 +126,40 @@ class DistAdminDistributorController extends AdminController
     protected function form()
     {
         return Form::make(new DistAdminDistributor(), function (Form $form) {
-            $form->display('id');
-            $form->text('company_name', )->required();
-            $form->text('company_address',);
-            $form->text('site_name')->required();
+            $form->text('company_name')->width(9,3)->required();
+            $form->text('company_address',)->width(9,3);
+            $form->text('site_name')->width(9,3)->required();
 
             $form->radio('domain_type')
+                ->width(9,3)
                 ->when(0, function (Form $form) {
-                    $form->text('secondary_domain')->help('Please enter the domain name, such as demo.'.env('TOP_DOMAIN'));
+                    $form->text('secondary_domain')->width(9,3)->help('Please enter the domain name, such as demo.'.env('TOP_DOMAIN'));
                 })
                 ->when(1, function (Form $form) {
-                    $form->text('custom_domain')->help('Please enter the domain name, such as www.example.com,and bind the domain name to the IP address '.env('DIST_SITE_IP'));
+                    $form->text('custom_domain')->width(9,3)->help('Please enter the domain name, such as www.example.com,and bind the domain name to the IP address '.env('DIST_SITE_IP'));
                 })
                 ->default(0)
                 ->options([0=>'second-level domain',1=>'custom domain'])
                 ->required();
 
 
-            $form->select('appearance_id',admin_trans_field('appearance'))->options(DistAppearance::selectOptions())->required();
-            $form->text('country')->required();
-            $form->text('contact_number');
-            $form->text('service_hotline');
-            $form->text('whats_app');
-            $form->text('facebook');
-            $form->text('instagram');
-            $form->text('youtube');
-            $form->text('linkedin');
-            $form->text('tiktok');
-            $form->textarea('remark');
-            $form->switch('enabled')->default(1);
+            $form->select('appearance_id',admin_trans_field('appearance'))->width(9,3)->options(DistAppearance::selectOptions())->required();
+            $form->text('country')->width(9,3)->required();
+            $form->text('contact_number')->width(9,3);
+            $form->text('service_hotline')->width(9,3);
+            $form->text('whats_app')->width(9,3);
+            $form->text('facebook')->width(9,3);
+            $form->text('instagram')->width(9,3);
+            $form->text('youtube')->width(9,3);
+            $form->text('linkedin')->width(9,3);
+            $form->text('tiktok')->width(9,3);
+            $form->textarea('remark')->width(9,3);
+            $form->switch('enabled')->width(9,3)->default(1);
+            $form->text('seo_title')->width(9,3)->required();
+            $form->text('seo_keywords')->width(9,3);
+            $form->textarea('seo_description')->width(9,3);
+
+
             //保存前回调
             $form->saving(function (Form $form) {
                 if (!$form->isCreating()) {

+ 31 - 15
app/Distributor/Controllers/SettingsController.php

@@ -15,7 +15,7 @@ class SettingsController extends Controller
 
     public function index(Content $content)
     {
-        return $content->title(admin_trans( 'admin.domain'))
+        return $content->title(admin_trans( 'admin.settings'))
             ->body(
 <<<HTML
 <div class="card">{$this->form()->render()}</div>
@@ -25,21 +25,34 @@ HTML
 
     protected function form()
     {
-        //查分销商信息
         $distInfo = DistAdminDistributor::getInfo();
-        $secondaryDomain = $distInfo->secondary_domain ? $distInfo->secondary_domain : '';
-        $customDomain = $distInfo->custom_domain ? $distInfo->custom_domain : '';
         $form = new Form();
-        $form->radio('domain_type')
-            ->when(0, function (Form $form) use ($secondaryDomain) {
-                $form->text('secondary_domain')->width(4,2)->value($secondaryDomain)->readOnly();
-            })
-            ->when(1, function (Form $form) use ($customDomain){
-                $form->text('custom_domain')->width(4,2)->value($customDomain)->required()->help('Please enter the domain name, such as www.example.com,and bind the domain name to the IP address '.env('DIST_SITE_IP'));
-            })
-            ->options([0=>admin_trans_field('secondary_domain'),1=>admin_trans_field('custom_domain')])
-            ->value($distInfo->domain_type)
-            ->required();
+        $form->tab('domain', function (Form $form) use ($distInfo) {
+            //查分销商信息
+            $secondaryDomain = $distInfo->secondary_domain ? $distInfo->secondary_domain : '';
+            $customDomain = $distInfo->custom_domain ? $distInfo->custom_domain : '';
+            $form->radio('domain_type')
+                ->when(0, function (Form $form) use ($secondaryDomain) {
+                    $form->text('secondary_domain')->width(4,2)->value($secondaryDomain)->readOnly();
+                })
+                ->when(1, function (Form $form) use ($customDomain){
+                    $form->text('custom_domain')->width(4,2)->value($customDomain)->required()->help('Please enter the domain name, such as www.example.com,and bind the domain name to the IP address '.env('DIST_SITE_IP'));
+                })
+                ->options([0=>admin_trans_field('secondary_domain'),1=>admin_trans_field('custom_domain')])
+                ->value($distInfo->domain_type)
+                ->required();
+        });
+        $form->tab('site', function (Form $form)   use ($distInfo) {
+            $form->text('site_name')->value($distInfo->site_name)->required();
+            $form->text('company_name')->value($distInfo->company_name)->required();
+            $form->text('company_address')->value($distInfo->company_address);
+            $form->text('contact_number')->value($distInfo->contact_number);
+            $form->text('service_hotline')->value($distInfo->service_hotline);
+            $form->text('whats_app')->value($distInfo->whats_app);
+            $form->text('seo_title')->value($distInfo->seo_title)->required();
+            $form->text('seo_keywords')->value($distInfo->seo_keywords);
+            $form->textarea('seo_description')->value($distInfo->seo_description);
+        });
         return $form;
     }
 
@@ -61,8 +74,11 @@ HTML
                 return $form->response()->error('Error in domain format');
             }
         }
-
         DistAdminDistributor::updateDomain($domainType,$customDomain);
+
+        //站点配置
+        DistAdminDistributor::updateInfo($request->all());
+
         return $form->response()->success('Success');
     }
 

+ 2 - 2
app/Distributor/Controllers/SiteMenuController.php

@@ -98,10 +98,10 @@ class SiteMenuController extends AdminDistController
             //标题
             $form->text('title')->required();
             //类型
-            $form->select('menu_type')->options(config('dictionary.menu_type'))->required()
+            $form->select('menu_type')->options(admin_trans_array(config('dictionary.menu_type')))->required()
                 ->when(1, function (Form $form) use ($menuConfig,$thisObject) {
                     //选择产品
-                    $form->select('collections_type')->options(config('dictionary.collections_type'))
+                    $form->select('collections_type')->options(admin_trans_array(config('dictionary.collections_type')))
                         ->value($thisObject->getArrayValue('collections_type',$menuConfig))
                         ->when(0, function (Form $form) use ($menuConfig,$thisObject) {
                             $form->select('product_category')->options(DistProductCategory::selectOptions())->value($thisObject->getArrayValue('product_category',$menuConfig));

+ 16 - 0
app/Distributor/Repositories/DistAdminDistributor.php

@@ -39,6 +39,22 @@ class DistAdminDistributor extends EloquentRepository
         $row->save();
     }
 
+    public static function updateInfo($info)
+    {
+        $id = getDistributorId();
+        $row = Model::find($id);
+        $row->site_name = $info['site_name'];
+        $row->company_name = $info['company_name'];
+        $row->company_address = $info['company_address'];
+        $row->contact_number = $info['contact_number'];
+        $row->service_hotline = $info['service_hotline'];
+        $row->whats_app = $info['whats_app'];
+        $row->seo_title = $info['seo_title'];//seo_title
+        $row->seo_keywords = $info['seo_keywords'];//seo_keywords
+        $row->seo_description = $info['seo_description'];//seo_description
+        $row->save();
+    }
+
     /*
      * 分销商切换主题
      */

+ 7 - 7
config/dictionary.php

@@ -37,15 +37,15 @@ return [
     ],
     //菜单类型
     'menu_type' => [
-        '0' => 'Home page',
-        '1' => 'Collections',
-        '2' => 'Products',
-        '3' => 'Pages',
-        '4' => 'Url',
+        '0' => 'home_page',
+        '1' => 'collections',
+        '2' => 'products',
+        '3' => 'pages',
+        '4' => 'url',
     ],
     'collections_type' => [
-        '0' => 'Product Category',
-        '1' => 'Posts Tag',
+        '0' => 'product_category',
+        '1' => 'pages_tag',
     ],
     //文章状态
     'pages_status' => [

+ 5 - 0
lang/en/admin.php

@@ -240,4 +240,9 @@ return [
     'appearance' => 'Appearance',
     'distro_management' => 'Distro Management',
     'users_management'  => 'Users Management',
+    'domain'  => 'Domain',
+    'top_menu'  => 'Top Menu',
+    'footer_menu'  => 'Footer Menu',
+    'pages'  => 'Pages',
+    'pages_tag'  => 'Pages Tag',
 ];

+ 23 - 0
lang/en/global.php

@@ -104,6 +104,29 @@ return [
         'settings'              => 'Settings',
         'inquiry_management'    => 'Inquiry Management',
         'enable'                => 'Enable',
+        'parent_id'             => 'Parent Id',
+        'select_product'        => 'Select Product',
+        'select_pages'          => 'Select Pages',
+        'select_category'       => 'Select Category',
+        'publish'              => 'Publish',
+        'tags'                  => 'Tags',
+        'url_and_handle'        => 'url and handle',
+        'url_repeated'          => 'url repeated',
+        'visible'               => 'Visible',
+        'hidden'                => 'Hidden',
+        'draft'                 => 'Draft',
+        'published'             => 'Published',
+        'video_player'          => 'Video Player',
+        'new'                  => 'New',
+        'processing'           => 'Processing',
+        'processed'            => 'Processed',
+        'home_page'            => 'Home Page',
+        'collections'          => 'Collections',
+        'products'             => 'Products',
+        'pages'                => 'Pages',
+        'url'                  => 'Url',
+        'product_category'      => 'Product Category',
+        'pages_tag'             => 'Pages Tag',
     ],
     'options' => [
         //

+ 7 - 0
lang/zh_CN/global.php

@@ -133,6 +133,13 @@ return [
         'new'                  => '等待处理',
         'processing'           => '处理中',
         'processed'            => '已处理',
+        'home_page'            => '首页',
+        'collections'          => '集合',
+        'products'             => '产品',
+        'pages'                => '文章',
+        'url'                  => '外部连接',
+        'product_category'      => '产品分类',
+        'pages_tag'             => '文章标签',
     ],
     'options' => [
         //