优化后台插件中心

This commit is contained in:
pushuo 2022-09-26 17:21:37 +08:00 committed by Edward Yang
parent d6263e6db6
commit 77f28a598e
7 changed files with 181 additions and 15 deletions

View File

@ -28,6 +28,11 @@ class MarketingController
$data = [
'plugins' => $plugins,
];
if ($request->expectsJson()) {
return json_success(trans('common.success'), $data);
}
return view('admin::pages.marketing.index', $data);
}

View File

@ -0,0 +1,36 @@
@charset "UTF-8";
/**
* @copyright 2022 beikeshop.com - All Rights Reserved.
* @link https://beikeshop.com
* @Author pu shuo <pushuo@guangda.work>
* @Date 2022-09-26 16:39:21
* @LastEditTime 2022-09-26 16:39:34
*/
body.page-marketing {
.col-xl-3 {
@media (min-width: 1200px) {
width: 20%;
}
}
.marketing-item {
box-shadow: none;
border: 1px solid #eee;
.plugin-img {
margin: -1rem -1rem 0 -1rem;
}
.plugin-name {
height: 40px;
overflow: hidden;
text-overflow:ellipsis;
// white-space: nowrap;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
}
}

View File

@ -23,6 +23,7 @@ $primary: #fd560f;
@import 'element-ui';
@import 'login';
@import 'page-product';
@import 'marketing';
@import 'autocomplete';
@import 'page-category';
@import './design/menu';

View File

@ -26,8 +26,6 @@
</head>
<body class="@yield('body-class')">
<!-- <div style="height: 80px; background: white;"></div> -->
<x-admin-header />
<div class="main-content">

View File

@ -2,11 +2,120 @@
@section('title', __('admin/marketing.marketing_list'))
@section('body-class', 'page-marketing')
@section('content')
@dump($plugins)
<div id="app" class="card h-min-600" v-cloak>
<div class="card-body">
<div class="bg-light p-4 mb-4">
<div class="row">
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('product.name') }}</label>
<input @keyup.enter="search" type="text" v-model="filter.name" class="form-control" placeholder="name">
</div>
{{-- <div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('product.sku') }}</label>
<input @keyup.enter="search" type="text" v-model="filter.sku" class="form-control" placeholder="sku">
</div>
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('product.model') }}</label>
<input @keyup.enter="search" type="text" v-model="filter.model" class="form-control" placeholder="model">
</div> --}}
{{--
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('product.category') }}</label>
<select v-model="filter.category_id" class="form-control">
<option value="">{{ __('common.all') }}</option>
@foreach ($categories as $_category)
<option :value="{{ $_category->id }}">{{ $_category->name }}</option>
@endforeach
</select>
</div> --}}
<div class="col-xxl-20 col-xl-3 col-lg-4 col-md-4 d-flex align-items-center mb-3">
<label class="filter-title">{{ __('common.status') }}</label>
<select v-model="filter.active" class="form-control">
<option value="">{{ __('common.all') }}</option>
<option value="1">{{ __('product.active') }}</option>
<option value="0">{{ __('product.inactive') }}</option>
</select>
</div>
</div>
<div class="row">
<label class="filter-title"></label>
<div class="col-auto">
<button type="button" @click="search" class="btn btn-outline-primary btn-sm">{{ __('common.filter') }}</button>
<button type="button" @click="resetSearch" class="btn btn-outline-secondary btn-sm">{{ __('common.reset') }}</button>
</div>
</div>
</div>
<div class="marketing-wrap">
<div class="row">
<div class="col-xl-3 col-md-4 col-6" v-for="plugin, index in plugins.data" :key="index">
<div class="card mb-4 marketing-item">
<div class="card-body">
<div class="plugin-img mb-3"><a href=""><img :src="plugin.icon_big" class="img-fluid"></a></div>
<div class="plugin-name fw-bold mb-2">@{{ plugin.name }}</div>
<div class="d-flex align-items-center justify-content-between">
<span class="text-success">免费</span>
<span class="text-secondary">下载数999</span>
</div>
</div>
</div>
</div>
</div>
</div>
<el-pagination v-if="plugins.data.length" layout="prev, pager, next" background :page-size="plugins.per_page" :current-page.sync="page"
:total="plugins.total"></el-pagination>
</div>
</div>
@endsection
@push('footer')
<script>
</script>
<script>
new Vue({
el: '#app',
data: {
plugins: @json($plugins ?? []),
page: 1,
filter: {
name: bk.getQueryString('name'),
category_id: bk.getQueryString('category_id'),
sku: bk.getQueryString('sku'),
model: bk.getQueryString('model'),
active: bk.getQueryString('active'),
},
},
watch: {
page: function() {
this.loadData();
},
},
methods: {
loadData() {
$http.get(`marketing?page=${this.page}`).then((res) => {
this.marketing = res.data.marketing;
})
},
search: function() {
this.page = 1;
this.loadData();
},
resetSearch() {
Object.keys(this.filter).forEach(key => this.filter[key] = '')
this.loadData();
},
}
})
</script>
@endpush

View File

@ -6,16 +6,19 @@
<div id="plugins-app" class="card" v-cloak>
<div class="card-body h-min-600">
<el-upload
class="upload-demo"
action=""
:limit="1"
:show-file-list="false"
:http-request="uploadFile"
accept=".zip"
>
<el-button size="small" type="primary">{{ __('admin/plugin.plugin_upload') }}</el-button>
</el-upload>
<div class="d-flex align-items-center justify-content-between">
<el-upload
class="upload-demo"
action=""
:limit="1"
:show-file-list="false"
:http-request="uploadFile"
accept=".zip"
>
<el-button size="small" type="primary">{{ __('admin/plugin.plugin_upload') }}</el-button>
</el-upload>
<a href="{{ admin_route('marketing.index') }}" class="btn btn-outline-info">插件中心</a>
</div>
<div class="mt-4" style="">
<table class="table">
<thead>

View File

@ -0,0 +1,14 @@
<?php
/**
* header.php
*
* @copyright 2022 beikeshop.com - All Rights Reserved
* @link https://beikeshop.com
* @author Edward Yang <yangjin@guangda.work>
* @created 2022-08-02 19:03:19
* @modified 2022-08-02 19:03:19
*/
return [
'marketing_list' => '插件中心',
];