wip
This commit is contained in:
parent
a45a119db8
commit
e9b66f64e4
|
|
@ -25,7 +25,8 @@ class SettingController extends Controller
|
|||
public function index()
|
||||
{
|
||||
$settings = SystemSettingRepo::getList();
|
||||
dd($settings);
|
||||
|
||||
return view('admin::pages.setting', ['settings' => $settings]);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -47,5 +48,7 @@ class SettingController extends Controller
|
|||
];
|
||||
SettingRepo::createOrUpdate($data);
|
||||
}
|
||||
|
||||
return json_success("修改成功");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ class Header extends Component
|
|||
$this->addLink('商品管理', admin_route('products.index'), equal_route('admin.products.index'));
|
||||
$this->addLink('会员管理', admin_route('customers.index'), equal_route('admin.customers.index'));
|
||||
// $this->addLink('营销管理', admin_route('home.index'), equal_route('admin.promotions.index'));
|
||||
$this->addLink('插件管理', admin_route('plugins.index'), equal_route('admin.plugins.index'));
|
||||
$this->addLink('首页装修', admin_route('design.index'), equal_route('admin.design.index'));
|
||||
// $this->addLink('插件管理', admin_route('plugins.index'), equal_route('admin.plugins.index'));
|
||||
// $this->addLink('首页装修', admin_route('design.index'), equal_route('admin.design.index'));
|
||||
$this->addLink('系统设置', admin_route('settings.index'), equal_route('admin.settings.index'));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,35 +27,42 @@ class Sidebar extends Component
|
|||
public function render()
|
||||
{
|
||||
$routeName = request()->route()->getName();
|
||||
if (Str::startsWith($routeName, ['admin.products.', 'admin.categories.'])) {
|
||||
if (Str::startsWith($routeName, [admin_name() . '.products.', admin_name() . '.categories.'])) {
|
||||
$this->addLink('商品分类', admin_route('categories.index'), 'fa fa-tachometer-alt', false);
|
||||
$this->addLink('商品列表', admin_route('products.index'), 'fa fa-tachometer-alt', false);
|
||||
$this->addLink('回收站', admin_route('products.index', ['trashed' => 1]), 'fa fa-tachometer-alt', false);
|
||||
}
|
||||
|
||||
if (Str::startsWith($routeName, ['admin.plugins.'])) {
|
||||
$this->addLink('插件列表', admin_route('categories.index'), 'fa fa-tachometer-alt', $routeName == 'admin.plugins.index');
|
||||
// if (Str::startsWith($routeName, [admin_name() . '.plugins.'])) {
|
||||
// $this->addLink('插件列表', admin_route('categories.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.plugins.index');
|
||||
// }
|
||||
|
||||
if (Str::startsWith($routeName, [admin_name() . '.customers.', admin_name() . '.customer_groups.'])) {
|
||||
$this->addLink('会员管理', admin_route('customers.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.customers.index');
|
||||
$this->addLink('用户组', admin_route('customer_groups.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.customer_groups.index');
|
||||
}
|
||||
|
||||
if (Str::startsWith($routeName, ['admin.customers.', 'admin.customer_groups.'])) {
|
||||
$this->addLink('会员管理', admin_route('customers.index'), 'fa fa-tachometer-alt', $routeName == 'admin.customers.index');
|
||||
$this->addLink('用户组', admin_route('customer_groups.index'), 'fa fa-tachometer-alt', $routeName == 'admin.customer_groups.index');
|
||||
if (Str::startsWith($routeName, [admin_name() . '.orders.'])) {
|
||||
$this->addLink('订单列表', admin_route('orders.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.orders.index');
|
||||
}
|
||||
|
||||
if (Str::startsWith($routeName, ['admin.orders.'])) {
|
||||
$this->addLink('订单列表', admin_route('orders.index'), 'fa fa-tachometer-alt', $routeName == 'admin.orders.index');
|
||||
if (Str::startsWith($routeName, [admin_name() . '.settings.', admin_name() . '.plugins.'])) {
|
||||
$this->addLink('系统设置', admin_route('settings.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.settings.index');
|
||||
$this->addLink('插件列表', admin_route('plugins.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.plugins.index');
|
||||
$this->addLink('首页装修', admin_route('design.index'), 'fa fa-tachometer-alt', $routeName == admin_name() . '.design.index', true);
|
||||
}
|
||||
|
||||
return view('admin::components.sidebar');
|
||||
}
|
||||
|
||||
public function addLink($title, $url, $icon, $active)
|
||||
public function addLink($title, $url, $icon, $active, $new_window = false)
|
||||
{
|
||||
$this->links[] = [
|
||||
'title' => $title,
|
||||
'url' => $url,
|
||||
'icon' => $icon,
|
||||
'active' => $active
|
||||
'active' => $active,
|
||||
'new_window' => $new_window ?? false
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,6 +110,46 @@ body {
|
|||
width: calc(100% - 1000px);
|
||||
}
|
||||
|
||||
.h-min-100 {
|
||||
min-height: 100px;
|
||||
}
|
||||
|
||||
.h-min-200 {
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
.h-min-300 {
|
||||
min-height: 300px;
|
||||
}
|
||||
|
||||
.h-min-400 {
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.h-min-500 {
|
||||
min-height: 500px;
|
||||
}
|
||||
|
||||
.h-min-600 {
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
.h-min-700 {
|
||||
min-height: 700px;
|
||||
}
|
||||
|
||||
.h-min-800 {
|
||||
min-height: 800px;
|
||||
}
|
||||
|
||||
.h-min-900 {
|
||||
min-height: 900px;
|
||||
}
|
||||
|
||||
.h-min-1000 {
|
||||
min-height: 1000px;
|
||||
}
|
||||
|
||||
.font-size-12 {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@ body {
|
|||
}
|
||||
}
|
||||
|
||||
// 生成 100 200 300 ... 1000 的最小高度
|
||||
@for $i from 1 through 10 {
|
||||
.h-min-#{$i}00 {
|
||||
min-height: #{$i}00px;
|
||||
}
|
||||
}
|
||||
|
||||
.font-size-12 {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<ul class="list-unstyled navbar-nav">
|
||||
@foreach ($links as $link)
|
||||
<li class="nav-item {{ $link['active'] ? 'active' : '' }}">
|
||||
<a class="nav-link" href="{{ $link['url'] }}"><i class="iconfont"></i> {{ $link['title'] }}</a>
|
||||
<a target="{{ $link['new_window'] ? '_blank' : '_self' }}" class="nav-link" href="{{ $link['url'] }}"><i class="iconfont"></i> {{ $link['title'] }}</a>
|
||||
</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,128 @@
|
|||
@extends('admin::layouts.master')
|
||||
|
||||
@section('title', '插件编辑')
|
||||
|
||||
@push('header')
|
||||
<script src="{{ asset('vendor/tinymce/5.9.1/tinymce.min.js') }}"></script>
|
||||
{{-- <script src="{{ asset('vendor/tinymce-vue/tinymce-vue.min.js') }}"></script> --}}
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div id="plugins-app-form" class="card h-min-600">
|
||||
<div class="card-body pt-5">
|
||||
<el-form :model="form" :rules="rules" ref="form" label-width="110px">
|
||||
<div v-for="column, index in source.columns">
|
||||
<el-form-item :label="column.label" v-if="column.type == 'string'" class="form-max-w" :prop="column.required ? column.name : ''">
|
||||
<el-input v-model="form[column.name]" :placeholder="column.label"></el-input>
|
||||
<div class="text-muted font-size-12 lh-base" v-if="column.description">@{{ column.description }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="column.label" v-if="column.type == 'text'" style="max-width: 900px;" :prop="column.required ? column.name : ''">
|
||||
<textarea v-model="form[column.name]" :data-key="column.name" id="input-tinymce"></textarea>
|
||||
<div class="text-muted font-size-12 lh-base" v-if="column.description">@{{ column.description }}</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="column.label" v-if="column.type == 'select'" class="form-max-w">
|
||||
<el-select v-model="form[column.name]" placeholder="请选择" >
|
||||
<el-option v-for="option, o_i in column.options" :key="o_i" :label="option.label"
|
||||
:value="option.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<div class="text-muted font-size-12 lh-base" v-if="column.description">@{{ column.description }}</div>
|
||||
</el-form-item>
|
||||
<el-form-item :label="column.label" v-if="column.type == 'bool'">
|
||||
<el-switch v-model="form[column.name]" :active-value="1" :inactive-value="0"></el-switch>
|
||||
<div class="text-muted font-size-12 lh-base" v-if="column.description">@{{ column.description }}</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm('form')">提交</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('footer')
|
||||
<script>
|
||||
let app = new Vue({
|
||||
el: '#plugins-app-form',
|
||||
data: {
|
||||
customerTab: 'customer',
|
||||
form: {
|
||||
status: false
|
||||
},
|
||||
source: {
|
||||
columns: @json($settings)
|
||||
},
|
||||
|
||||
rules: {
|
||||
// name: [{required: true, message: '请输入用户名', trigger: 'blur'}, ],
|
||||
},
|
||||
},
|
||||
|
||||
// 在实例创建完成后被立即同步调用
|
||||
created () {
|
||||
},
|
||||
// 在挂载开始之前被调用:相关的 render 函数首次被调用
|
||||
beforeMount () {
|
||||
this.source.columns.forEach((e) => {
|
||||
this.$set(this.form, e.name, e.value)
|
||||
if (e.required) {
|
||||
this.rules[e.name] = [{required: true, message: `请输入${e.label}`, trigger: 'blur'}]
|
||||
}
|
||||
})
|
||||
},
|
||||
// 实例被挂载后调用
|
||||
mounted () {
|
||||
|
||||
},
|
||||
|
||||
methods: {
|
||||
submitForm(form) {
|
||||
this.$refs[form].validate((valid) => {
|
||||
if (!valid) {
|
||||
this.$message.error('请检查表单是否填写正确');
|
||||
return;
|
||||
}
|
||||
|
||||
$http.post('settings', this.form).then((res) => {
|
||||
this.$message.success(res.message);
|
||||
})
|
||||
});
|
||||
},
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
tinymce.init({
|
||||
selector: '#input-tinymce',
|
||||
language: "zh_CN",
|
||||
branding: false,
|
||||
height: 400,
|
||||
plugins: "link lists fullscreen table hr wordcount image imagetools code",
|
||||
menubar: "",
|
||||
toolbar: "undo redo | toolbarImageButton | bold italic underline strikethrough | forecolor backcolor | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | formatpainter removeformat | charmap emoticons | preview | template link anchor table toolbarImageUrlButton | fullscreen code",
|
||||
// contextmenu: "link image imagetools table",
|
||||
toolbar_items_size: 'small',
|
||||
image_caption: true,
|
||||
// imagetools_toolbar: 'imageoptions',
|
||||
toolbar_mode: 'wrap',
|
||||
font_formats:
|
||||
"微软雅黑='Microsoft YaHei';黑体=黑体;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Georgia=georgia,palatino;Helvetica=helvetica;Times New Roman=times new roman,times;Verdana=verdana,geneva",
|
||||
fontsize_formats: "10px 12px 14px 18px 24px 36px",
|
||||
relative_urls : true,
|
||||
setup:function(ed) {
|
||||
ed.on('change', function(e) {
|
||||
if (e.target.targetElm.dataset.key) {
|
||||
app.form[e.target.targetElm.dataset.key] = ed.getContent()
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue