diff --git a/beike/Admin/Services/FileManagerService.php b/beike/Admin/Services/FileManagerService.php index 3ca6290b..ec9f59e8 100644 --- a/beike/Admin/Services/FileManagerService.php +++ b/beike/Admin/Services/FileManagerService.php @@ -211,7 +211,7 @@ class FileManagerService private function handleImage($filePath, $baseName): array { return [ - 'path' => $filePath, + 'path' => '/catalog' . $filePath, 'name' => $baseName, 'url' => image_resize("catalog{$filePath}"), 'origin_url' => image_origin("catalog{$filePath}"), diff --git a/beike/Models/Product.php b/beike/Models/Product.php index 62fa5188..9ad930aa 100644 --- a/beike/Models/Product.php +++ b/beike/Models/Product.php @@ -11,9 +11,6 @@ class Product extends Base use SoftDeletes; protected $fillable = ['images', 'video', 'position', 'active', 'variables']; - protected $attributes = [ - 'image' => '' - ]; protected $casts = [ 'active' => 'boolean', 'variables' => 'array', diff --git a/public/build/beike/admin/css/app.css b/public/build/beike/admin/css/app.css index c7186da1..9e11cdeb 100644 --- a/public/build/beike/admin/css/app.css +++ b/public/build/beike/admin/css/app.css @@ -264,9 +264,11 @@ body { background-position: center center; } +.border-dashed { + border-style: dashed !important; +} + .set-product-img { - width: 80px; - height: 80px; background-color: #f8f8f8; border: 1px dashed #e2e2e2; display: flex; diff --git a/public/build/beike/admin/css/bootstrap.css b/public/build/beike/admin/css/bootstrap.css index 769c31b5..60b1e2fd 100644 --- a/public/build/beike/admin/css/bootstrap.css +++ b/public/build/beike/admin/css/bootstrap.css @@ -12301,7 +12301,7 @@ textarea.form-control-lg { align-items: center; justify-content: space-between; padding: 1rem 1rem; - border-bottom: 1px solid #f3f3f3; + border-bottom: 1px solid #e2e2e2; border-top-left-radius: calc(0.3rem - 1px); border-top-right-radius: calc(0.3rem - 1px); } @@ -12328,7 +12328,7 @@ textarea.form-control-lg { align-items: center; justify-content: flex-end; padding: 0.75rem; - border-top: 1px solid #f3f3f3; + border-top: 1px solid #e2e2e2; border-bottom-right-radius: calc(0.3rem - 1px); border-bottom-left-radius: calc(0.3rem - 1px); } @@ -13586,7 +13586,7 @@ textarea.form-control-lg { } .border { - border: 1px solid #f3f3f3 !important; + border: 1px solid #e2e2e2 !important; } .border-0 { @@ -13594,7 +13594,7 @@ textarea.form-control-lg { } .border-top { - border-top: 1px solid #f3f3f3 !important; + border-top: 1px solid #e2e2e2 !important; } .border-top-0 { @@ -13602,7 +13602,7 @@ textarea.form-control-lg { } .border-end { - border-right: 1px solid #f3f3f3 !important; + border-right: 1px solid #e2e2e2 !important; } .border-end-0 { @@ -13610,7 +13610,7 @@ textarea.form-control-lg { } .border-bottom { - border-bottom: 1px solid #f3f3f3 !important; + border-bottom: 1px solid #e2e2e2 !important; } .border-bottom-0 { @@ -13618,7 +13618,7 @@ textarea.form-control-lg { } .border-start { - border-left: 1px solid #f3f3f3 !important; + border-left: 1px solid #e2e2e2 !important; } .border-start-0 { diff --git a/resources/beike/admin/css/_global.scss b/resources/beike/admin/css/_global.scss index 61d94408..171a0163 100644 --- a/resources/beike/admin/css/_global.scss +++ b/resources/beike/admin/css/_global.scss @@ -85,9 +85,11 @@ body { } } +.border-dashed { + border-style: dashed !important; +} + .set-product-img { - width: 80px; - height: 80px; background-color: #f8f8f8; border: 1px dashed #e2e2e2; display: flex; diff --git a/resources/beike/admin/css/bootstrap/bootstrap.scss b/resources/beike/admin/css/bootstrap/bootstrap.scss index 3c1307bf..9e5d65a7 100644 --- a/resources/beike/admin/css/bootstrap/bootstrap.scss +++ b/resources/beike/admin/css/bootstrap/bootstrap.scss @@ -21,7 +21,7 @@ $form-floating-padding-y: .9rem; $form-floating-height: 50px; $btn-focus-width: 0; $table-border-color: #e9ecef; -$border-color: #f3f3f3; +$border-color: #e2e2e2; $input-border-color: #e2e2e2; @import './bootstrap-icons'; diff --git a/resources/beike/admin/views/pages/products/form/form.blade.php b/resources/beike/admin/views/pages/products/form/form.blade.php index 7e7cc440..513191e0 100644 --- a/resources/beike/admin/views/pages/products/form/form.blade.php +++ b/resources/beike/admin/views/pages/products/form/form.blade.php @@ -24,6 +24,29 @@ {{-- --}} + +
+
+ + +
+
+
+
第一张图片将作为商品主图,支持同时上传多张图片,多张图片之间可随意调整位置;
+
开启多规格并且多规格配置了图片时,这里的图片将作为多规格的公用图片,展示在其后面
+
+ + {{--
+ @if ($product->image) +
+ +
+ @else + + @endif +
+ + --}} @@ -54,53 +77,55 @@
-
-
-
- @{{ variant.name[current_language_code] }} - 编辑 - 移除 + +
+
+
+ @{{ variant.name[current_language_code] }} + 编辑 + 移除 +
+
+ 添加规格图片 + Add value +
-
- 添加规格图片 - Add value -
-
- -
- {{--
--}} - {{-- --}} - {{-- --}} - {{-- --}} - {{--
--}} + +
+ {{--
--}} + {{-- --}} + {{-- --}} + {{-- --}} + {{--
--}} -
-
- +
+
+ +
+
+ + +
+
+ @{{ value.name[current_language_code] }}
- - -
-
- @{{ value.name[current_language_code] }} -
-
- -
-
请添加 Value
+ +
+
请添加 Value
+
-
+
Add variant
@@ -111,7 +136,7 @@ @{{ variant.name[current_language_code] || 'No name' }} - image + image model sku price @@ -128,13 +153,22 @@ -
+
+
+ + +
+
+
+ + {{--
+ placeholder="image"> --}} --}} - -
- @if ($product->image) -
- -
- @else - - @endif -
- - {{-- 第一张图片将作为商品主图,支持同时上传多张图片,多张图片之间可随意调整位置; --}} -
+ @@ -239,7 +261,7 @@ return image; } - return '{{ asset('catalog') }}' + image; + return '{{ asset('/') }}' + image; }; var app = new Vue({ @@ -248,6 +270,7 @@ current_language_code: '{{ current_language_code() }}', isMove: false, form: { + images: @json($product->images ?? []), model: @json($product->skus[0]['model'] ?? ''), price: @json($product->skus[0]['price'] ?? ''), quantity: @json($product->skus[0]['quantity'] ?? ''), @@ -313,16 +336,33 @@ } }, methods: { - // addVariant() { - // this.source.variables.push({ - // name: '', - // values: [] - // }); - // }, - - // datadragEnd(e) { - // console.log(e); - // }, + addProductImages(skuIndex) { + const self = this; + layer.open({ + type: 2, + title: '图片管理器', + shadeClose: false, + skin: 'file-manager-box', + scrollbar: false, + shade: 0.4, + area: ['1060px', '680px'], + content: `${document.querySelector('base').href}/file_manager`, + success: function(layerInstance, index) { + var iframeWindow = window[layerInstance.find("iframe")[0]["name"]]; + iframeWindow.callback = (images) => { + if (!isNaN(skuIndex)) { + if (self.form.skus[skuIndex].images === null) { + self.form.skus[skuIndex].images = images.map(e => e.path) + } else { + self.form.skus[skuIndex].images.push(...images.map(e => e.path)) + } + return; + } + self.form.images.push(...images.map(e => e.path)) + } + } + }); + }, dialogVariablesFormSubmit(form) { const name = JSON.parse(JSON.stringify(this.dialogVariables.form.name)); @@ -437,7 +477,7 @@ product_sku_id: 0, position: i, variants: combo, - image: '', + images: [], model: '', sku: '', price: null,