Browse Source

Merge branch 'master' of igamebox/mtb_dcatadmin_plus into stable

moshaorui 3 tháng trước cách đây
mục cha
commit
8ccdc054b7

+ 1 - 0
app/Admin/Controllers/DistSiteController.php

@@ -156,6 +156,7 @@ class DistSiteController extends AdminController
                 $form->text('company_name')->width(9,3);
                 $form->text('company_address',)->width(9,3);
                 $form->text('service_hotline')->width(9,3);
+                $form->text('dist_email',admin_trans_label('email'))->width(9,3);
                 $form->text('whats_app')->width(9,3);
                 $form->text('facebook')->width(9,3);
                 $form->text('instagram')->width(9,3);

+ 11 - 0
app/Admin/Repositories/BaseProductImage.php

@@ -57,15 +57,26 @@ class BaseProductImage extends EloquentRepository
             }
         }
         // 处理条件2:如果数据在 base_product_image 中无,但在 $images 有
+        $i = 1;
         foreach ($images as $image) {
             $found = $existingImages->firstWhere('image_url', $image);
             if (!$found) {
                 $result[] = [
                     'id' => 0,
                     'image_url' => $image,
+                    'order' => $i,
                 ];
             }
+            //更新库中排序
+            foreach ($existingImages as $existingImage) {
+                if ($existingImage->image_url == $image) {
+                    $existingImage->order = $i;
+                    $existingImage->save();
+                }
+            }
+            $i++;
         }
+
         return $result;
     }
 

+ 1 - 0
app/Distributor/Controllers/SettingsController.php

@@ -98,6 +98,7 @@ class SettingsController extends Controller
             $form->text('company_name')->value($distInfo->company_name);
             $form->text('company_address')->value($distInfo->company_address);
             $form->text('service_hotline')->value($distInfo->service_hotline);
+            $form->text('dist_email',admin_trans_label('email'))->value($distInfo->dist_email);
             $form->text('whats_app')->value($distInfo->whats_app);
             $form->text('facebook')->value($distInfo->facebook);
             $form->text('instagram')->value($distInfo->instagram);

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

@@ -76,6 +76,7 @@ class DistAdminDistributor extends EloquentRepository
         $row->company_name = $info['company_name'];
         $row->company_address = $info['company_address'];
         $row->service_hotline = $info['service_hotline'];
+        $row->dist_email = $info['dist_email'];
         $row->whats_app = $info['whats_app'];
         $row->facebook = $info['facebook'];
         $row->instagram = $info['instagram'];

+ 10 - 0
app/Distributor/Repositories/DistProductImage.php

@@ -31,14 +31,24 @@ class DistProductImage extends EloquentRepository
             }
         }
         // 处理条件2:如果数据在 base_product_image 中无,但在 $images 有
+        $i = 1;
         foreach ($images as $image) {
             $found = $existingImages->firstWhere('image_url', $image);
             if (!$found) {
                 $result[] = [
                     'id' => 0,
                     'image_url' => $image,
+                    'order' => $i,
                 ];
             }
+            //更新库中排序
+            foreach ($existingImages as $existingImage) {
+                if ($existingImage->image_url == $image) {
+                    $existingImage->order = $i;
+                    $existingImage->save();
+                }
+            }
+            $i++;
         }
         return $result;
     }

+ 1 - 1
app/Models/BaseProduct.php

@@ -37,7 +37,7 @@ class BaseProduct extends Model
     // 一对多关联
     public function images()
     {
-        return $this->hasMany(BaseProductImage::class, 'product_id','id');
+        return $this->hasMany(BaseProductImage::class, 'product_id','id')->orderBy('order', 'asc')->orderBy('id', 'asc');
     }
 
 }

+ 3 - 1
app/Models/BaseProductImage.php

@@ -16,7 +16,9 @@ class BaseProductImage extends Model
     ];
     protected $fillable = [
         'image_url',
-        'product_id'];
+        'product_id',
+        'order',
+    ];
 
     // 反向关联,属于某个产品
     public function product()

+ 1 - 1
app/Models/DistProduct.php

@@ -56,7 +56,7 @@ class DistProduct extends Model
     // 一对多关联
     public function images()
     {
-        return $this->hasMany(DistProductImage::class, 'product_id');
+        return $this->hasMany(DistProductImage::class, 'product_id')->orderBy('order', 'asc')->orderBy('id', 'asc');
     }
 
 }

+ 5 - 0
public/vendor/grapes/grapes.init.js

@@ -409,6 +409,11 @@ editor.on('load', () => {
     //----------
     layer.close(loadIndex);
 
+    $('body').css({
+        visibility: 'visible',
+        opacity: 1
+    });
+
 });
 
 //保存模版内容

+ 6 - 0
public/vendor/grapes/style.css

@@ -2,6 +2,12 @@ body, html {
     height: 100%;
     margin: 0;
 }
+body {
+    visibility: hidden;
+    opacity: 0;
+    transition: opacity 0.3s ease, visibility 0.3s ease;
+}
+
 .gjs-mdl-dialog {
     background-color: white;
     color: #333;

+ 1 - 1
resources/views/distributor/pages-custom/visual-editor.blade.php

@@ -7,7 +7,7 @@
     <meta name="csrf-token" content="{{ csrf_token() }}">
     <link rel="stylesheet" href="/vendor/grapes/grapes.min.css" rel="stylesheet">
     <link href="/vendor/grapes/layui/css/layui.css" rel="stylesheet">
-    <link rel="stylesheet" href="/vendor/grapes/style.css" rel="stylesheet">
+    <link rel="stylesheet" href="/vendor/grapes/style.css?v=2024122801" rel="stylesheet">
     <script src="/vendor/grapes/grapes.min.js"></script>
     <script src="/vendor/grapes/jquery.min.js"></script>
     <script src="/vendor/grapes/layui/layui.js"></script>