diff --git a/beike/Admin/Providers/AdminServiceProvider.php b/beike/Admin/Providers/AdminServiceProvider.php index 6da9e1a6..5ec9f1ed 100644 --- a/beike/Admin/Providers/AdminServiceProvider.php +++ b/beike/Admin/Providers/AdminServiceProvider.php @@ -10,6 +10,7 @@ use Illuminate\Support\ServiceProvider; use Beike\Admin\View\Components\Filter; use Beike\Admin\View\Components\Header; use Beike\Admin\View\Components\Sidebar; +use Beike\Admin\View\Components\Form\Image; use Beike\Admin\View\Components\Form\Input; use Beike\Console\Commands\MakeRootAdminUser; use Beike\Admin\View\Components\Form\InputLocale; @@ -45,6 +46,7 @@ class AdminServiceProvider extends ServiceProvider 'form-input-locale' => InputLocale::class, 'form-switch' => SwitchRadio::class, 'form-input' => Input::class, + 'form-image' => Image::class, ]); $this->registerGuard(); diff --git a/beike/Admin/View/Components/Form/Image.php b/beike/Admin/View/Components/Form/Image.php new file mode 100644 index 00000000..122a4eda --- /dev/null +++ b/beike/Admin/View/Components/Form/Image.php @@ -0,0 +1,24 @@ +name = $name; + $this->image = $image ?? ''; + $this->value = $value ?? ''; + } + + public function render() + { + return view('admin::components.form.image'); + } +} diff --git a/beike/Admin/View/Components/Sidebar.php b/beike/Admin/View/Components/Sidebar.php index 0a8c0866..898395f7 100644 --- a/beike/Admin/View/Components/Sidebar.php +++ b/beike/Admin/View/Components/Sidebar.php @@ -33,9 +33,10 @@ class Sidebar extends Component $routeNameWithPrefix = request()->route()->getName(); $routeName = str_replace($adminName . '.', '', $routeNameWithPrefix); - if (Str::startsWith($routeName, ['products.', 'categories.'])) { + if (Str::startsWith($routeName, ['products.', 'categories.', 'brands.'])) { $this->addLink('商品分类', admin_route('categories.index'), 'fa fa-tachometer-alt', $this->equalRoute('categories.index')); $this->addLink('商品列表', admin_route('products.index'), 'fa fa-tachometer-alt', $this->equalRoute('products.index')); + $this->addLink('品牌管理', admin_route('brands.index'), 'fa fa-tachometer-alt', $this->equalRoute('brands.index')); $this->addLink('回收站', admin_route('products.index', ['trashed' => 1]), 'fa fa-tachometer-alt', false); } diff --git a/public/build/beike/admin/css/app.css b/public/build/beike/admin/css/app.css index 8cd27124..f5ea2af3 100644 --- a/public/build/beike/admin/css/app.css +++ b/public/build/beike/admin/css/app.css @@ -272,6 +272,7 @@ body { background-color: #f8f8f8; border: 1px dashed #e2e2e2; display: flex; + cursor: pointer; align-items: center; justify-content: center; transition: all 0.2s ease; diff --git a/resources/beike/admin/css/_global.scss b/resources/beike/admin/css/_global.scss index 171a0163..9a05955e 100644 --- a/resources/beike/admin/css/_global.scss +++ b/resources/beike/admin/css/_global.scss @@ -93,6 +93,7 @@ body { background-color: #f8f8f8; border: 1px dashed #e2e2e2; display: flex; + cursor: pointer; align-items: center; // flex-start | center justify-content: center; // flex-end | center | space-between transition: all .2s ease; diff --git a/resources/beike/admin/views/components/form/image.blade.php b/resources/beike/admin/views/components/form/image.blade.php new file mode 100644 index 00000000..db9921ca --- /dev/null +++ b/resources/beike/admin/views/components/form/image.blade.php @@ -0,0 +1,10 @@ +
+
+ @if ($image) + + @else + + @endif +
+
+ \ No newline at end of file diff --git a/resources/beike/admin/views/pages/brands/index.blade.php b/resources/beike/admin/views/pages/brands/index.blade.php index 67b8f23e..3b519a7b 100644 --- a/resources/beike/admin/views/pages/brands/index.blade.php +++ b/resources/beike/admin/views/pages/brands/index.blade.php @@ -3,10 +3,10 @@ @section('title', '品牌管理') @section('content') -
+
-
- 创建 +
+
@@ -20,21 +20,146 @@ - @foreach ($brands as $brand) - - - - - - - - - @endforeach + + + + + + + +
{{ $brand['id'] }}{{ $brand['name'] }}{{ $brand['logo'] }}{{ $brand['sort_order'] }}{{ $brand['status'] }} - 编辑 -
@{{ brand.id }}@{{ brand.name }}@{{ brand.logo }}@{{ brand.sort_order }}@{{ brand.status }} + + +
+ + {{-- {{ $brands->links('admin::vendor/pagination/bootstrap-4') }} --}}
+ + + + + + + + + + + + + + + + + + + + + + 保存 + 取消 + + +
@endsection + + +@push('footer') + @include('admin::shared.vue-image') + +@endpush diff --git a/resources/beike/admin/views/pages/customer_groups/index.blade.php b/resources/beike/admin/views/pages/customer_groups/index.blade.php index 9416156b..dac04de3 100644 --- a/resources/beike/admin/views/pages/customer_groups/index.blade.php +++ b/resources/beike/admin/views/pages/customer_groups/index.blade.php @@ -136,6 +136,7 @@ checkedCustomersCreate(type, index) { this.dialog.show = true this.dialog.type = type + this.dialog.index = index if (type == 'edit') { let group = this.customer_groups[index]; @@ -174,7 +175,11 @@ $http[type](url, this.dialog.form).then((res) => { this.$message.success(res.message); - this.customer_groups.push(res.data) + if (type == 'add') { + this.customer_groups.push(res.data) + } else { + this.customer_groups[this.dialog.index] = res.data + } this.dialog.show = false }) }); diff --git a/resources/beike/admin/views/shared/vue-image.blade.php b/resources/beike/admin/views/shared/vue-image.blade.php new file mode 100644 index 00000000..8999f07c --- /dev/null +++ b/resources/beike/admin/views/shared/vue-image.blade.php @@ -0,0 +1,55 @@ + + +