This commit is contained in:
pushuo 2022-06-29 20:59:36 +08:00
parent 911dbac5ca
commit 5d30cbbad9
4 changed files with 142 additions and 106 deletions

View File

@ -20,8 +20,7 @@ class PluginController extends Controller
*/
public function index()
{
$data = (new Manager)->getPlugins();
dd($data);
return view('admin::pages.plugins.index', []);
$data['plugins'] = (new Manager)->getPlugins();
return view('admin::pages.plugins.index', $data);
}
}

View File

@ -3,29 +3,92 @@
@section('title', '顾客管理')
@section('content')
<div id="customer-app" class="card">
<div class="card-header">
编辑顾客
</div>
<div id="customer-app-form" class="card">
<div class="card-body">
<form action="{{ admin_route($customer->id ? 'customers.update' : 'customers.store', $customer) }}"
method="POST">
@csrf
@method($customer->id ? 'PUT' : 'POST')
<input type="hidden" name="_redirect" value="{{ $_redirect }}">
<x-admin-form-switch title="状态" name="active" :value="old('active', $customer->active ?? 1)"/>
<x-admin::form.row>
<button type="submit" class="btn btn-primary">保存</button>
<a href="{{ $_redirect }}" class="btn btn-outline-secondary">返回</a>
</x-admin::form.row>
</form>
<el-form :model="form" :rules="rules" ref="form" label-width="100px" style="width: 460px;">
<div class="row">
<div class="col-12 col-md-6">
<h6 class="mb-4">用户信息</h6>
<el-form-item label="用户名" prop="name">
<el-input v-model="form.name"></el-input>
</el-form-item>
<el-form-item label="邮箱" prop="email">
<el-input v-model="form.email"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
<el-input v-model="form.password"></el-input>
</el-form-item>
<el-form-item label="用户组">
<el-select v-model="form.customer_group_id" placeholder="请选择">
<el-option
v-for="item in source.customer_group"
:key="item.value"
:label="item.name"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-switch v-model="form.status"></el-switch>
</el-form-item>
</div>
</div>
<el-form-item>
<el-button type="primary" @click="submitForm('form')">提交</el-button>
</el-form-item>
</el-form>
</div>
</div>
{{-- {{ admin_route($customer->id ? 'customers.update' : 'customers.store', $customer) }} --}}
@endsection
@push('footer')
<script>
new Vue({
el: '#customer-app-form',
data: {
form: {
id: '',
name: '',
email: '',
password: '',
customer_group_id: 1,
status: false,
address: [
{
name: '',
phone: '',
country_id: '',
city_id: '',
address_1: '',
address_2: '',
}
]
},
source: {
customer_group: [
{name: '超级vip', value: 1},
{name: '普通vip', value: 2},
{name: '青铜', value: 3},
],
},
rules: {
name: [
{ required: true, message: '请输入用户名', trigger: 'blur' },
],
}
},
methods: {
submitForm(form) {
this.$refs[form].validate((valid) => {
if (!valid) {
this.$message.error('请检查表单是否填写正确');
}
});
}
}
});
</script>
@endpush

View File

@ -2,57 +2,43 @@
@section('title', '顾客管理')
@push('header')
<style>
.el-tree-node__content {
height: 32px;
border-bottom: 1px solid #f9f9f9;
}
</style>
@endpush
@section('content')
<div id="customer-app" class="card">
<div class="card-body">
<a href="{{ admin_route('customers.create') }}" class="btn btn-primary">创建顾客</a>
<div class="mt-4" style="">
<el-tree :data="categories" default-expand-all :expand-on-click-node="false">
<div class="custom-tree-node" slot-scope="{ node, data }" style="flex:1;display:flex">
<span>@{{ data.id }}</span>
<span>@{{ data.email }}</span>
<span>@{{ data.avatar }}</span>
<span>@{{ data.from }}</span>
<div style="flex:1"></div>
<span class="mr-4">@{{ data.status ? '启用' : '禁用' }}</span>
<div>
<a :href="data.url_edit">编辑</a>
<a>删除</a>
</div>
</div>
</el-tree>
<div class="d-flex justify-content-between my-4">
<a href="{{ admin_route('customers.create') }}" class="btn btn-primary">创建顾客</a>
</div>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>邮箱</th>
<th>名称</th>
<th>注册来源</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
@foreach ($customers as $customer)
<tr v-for="customer, index in customers" :key="index">
<td>{{ $customer['id'] }}</td>
<td>{{ $customer['email'] }}</td>
<td>
<div class="d-flex align-items-center">
<img src="{{ $customer['avatar'] }}" class="img-fluid rounded-circle me-2" style="width: 40px;">
<div>{{ $customer['name'] }}</div>
</div>
</td>
<td>{{ $customer['from'] }}</td>
<td>{{ $customer['status'] }}</td>
<td>
<a class="btn btn-outline-secondary btn-sm" href="{{ admin_route('customers.edit', [$customer['id']]) }}">编辑</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
@endsection
@push('footer')
<script>
new Vue({
el: '#customer-app',
data: {
categories: @json($customers),
defaultProps: {
children: 'children',
label: 'name'
}
},
methods: {
handleNodeClick(data) {
console.log(data);
}
}
});
</script>
@endpush
@endsection

View File

@ -12,48 +12,36 @@
<tr>
<th>#</th>
<th>插件类型</th>
<th width="60%">插件描述</th>
<th width="55%">插件描述</th>
<th>状态</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Mark</td>
<td>
<div class="plugin-describe d-flex align-items-center">
<div class="me-2" style="width: 50px;"><img src="http://dummyimage.com/100x100" class="img-fluid"></div>
<div>
<h6>插件名称</h6>
<div class="">插件详细描述,插件详细描述,插件详细描述插件详细描述插件详细描述插件详细描述</div>
@foreach ($plugins as $plugin)
<tr>
<td>{{ $plugin->code }}</td>
<td>{{ $plugin->type }}</td>
<td>
<div class="plugin-describe d-flex align-items-center">
<div class="me-2" style="width: 50px;"><img src="{{ $plugin->icon }}" class="img-fluid"></div>
<div>
<h6>{{ $plugin->name }}</h6>
<div class="">{!! $plugin->description !!}</div>
</div>
</div>
</div>
</td>
<td>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="switch-1" checked>
<label class="form-check-label" for="switch-1"></label>
</div>
</td>
<td>
<button class="btn btn-outline-secondary btn-sm">编辑</button>
</td>
</tr>
<tr>
<td>1</td>
<td>Mark</td>
<td>Mark</td>
<td>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="switch-2">
<label class="form-check-label" for="switch-2" checked></label>
</div>
</td>
<td>
<button class="btn btn-outline-secondary btn-sm">编辑</button>
</td>
</tr>
</td>
<td>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="switch-1" {{ $plugin->enabled ? 'checked' : '' }}>
<label class="form-check-label" for="switch-1"></label>
</div>
</td>
<td>
<a class="btn btn-outline-secondary btn-sm" href="">编辑</a>
</td>
</tr>
@endforeach
</tbody>
</table>
</div>