FastMovieAI AI短剧创作平台 二开基线
- 源码: xhadmincn/FastMovieAI (Apache 2.0) - 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION - vendor/示例资源已gitignore
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
{
|
||||
"title": "示例",
|
||||
"icon": "Operation",
|
||||
"path": "/app/pluginExample/admin",
|
||||
"sort": 3999,
|
||||
"show": false,
|
||||
"children": [
|
||||
{
|
||||
"title": "大屏",
|
||||
"path": "/app/pluginExample/admin/Databoard/index",
|
||||
"show": false,
|
||||
"component": "databoard"
|
||||
},
|
||||
{
|
||||
"title": "表单",
|
||||
"path": "/app/pluginExample/admin/Form/index",
|
||||
"show": false,
|
||||
"component": "form"
|
||||
},
|
||||
{
|
||||
"title": "分组表单",
|
||||
"path": "/app/pluginExample/admin/GroupForm/index",
|
||||
"show": false,
|
||||
"component": "form"
|
||||
},
|
||||
{
|
||||
"title": "审核表单",
|
||||
"path": "/app/pluginExample/admin/Examine/index",
|
||||
"show": false,
|
||||
"component": "examine"
|
||||
},
|
||||
{
|
||||
"title": "表格",
|
||||
"path": "/app/pluginExample/admin/Table/index",
|
||||
"show": false,
|
||||
"component": "table"
|
||||
},
|
||||
{
|
||||
"title": "图片",
|
||||
"path": "/app/pluginExample/admin/Images/index",
|
||||
"component": "images"
|
||||
},
|
||||
{
|
||||
"title": "信息展示",
|
||||
"path": "/app/pluginExample/admin/Info/index",
|
||||
"show": false,
|
||||
"component": "info"
|
||||
},
|
||||
{
|
||||
"title": "配置",
|
||||
"path": "/app/pluginExample/admin/Settings/basic",
|
||||
"show": false,
|
||||
"component": "form"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\api;
|
||||
|
||||
use app\expose\api\Install as ApiInstall;
|
||||
|
||||
class Install
|
||||
{
|
||||
use ApiInstall;
|
||||
public function __construct()
|
||||
{
|
||||
$this->plugin='pluginExample';
|
||||
$this->path = __DIR__;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\DataboardBuilder;
|
||||
use app\expose\build\builder\databoardBuilder\component\Domain;
|
||||
use app\expose\build\builder\databoardBuilder\component\Echarts;
|
||||
use app\expose\build\builder\databoardBuilder\component\Statistic;
|
||||
use app\expose\enum\Action;
|
||||
use support\Request;
|
||||
|
||||
class DataboardController extends Basic
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$builder = new DataboardBuilder([
|
||||
'gutter' => 6
|
||||
]);
|
||||
$today=100;
|
||||
$yesterday=124;
|
||||
$statistic = new Statistic;
|
||||
$statistic->setLabel('今日新注册用户')
|
||||
->setUnit('人')
|
||||
->setData([
|
||||
'today' => $today,
|
||||
'yesterday' => $yesterday,
|
||||
'growth_rate' => $yesterday?round(($today-$yesterday)/$yesterday*100,2):0
|
||||
])
|
||||
->setClass('p-6');
|
||||
$builder->add($statistic, [
|
||||
'xs' => 24,
|
||||
'sm' => 12,
|
||||
'md' => 6,
|
||||
'lg' => 4,
|
||||
'class' => 'bg-white p-4 rounded-4 shadow-lighter'
|
||||
]);
|
||||
$statistic = new Statistic;
|
||||
$statistic->setLabel('快捷操作')
|
||||
->setFooterText('操作提示')
|
||||
->setData([
|
||||
'today' => 100,
|
||||
'yesterday' => 124,
|
||||
'growth_rate' => 100,
|
||||
'footer' => 100
|
||||
])
|
||||
->setAction([
|
||||
'model' => Action::REDIRECT['value'],
|
||||
'path' => '/app/pluginExample/admin/Table/index',
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'label' => '去操作',
|
||||
'props' => [
|
||||
'type' => 'success',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
])
|
||||
->setClass('p-6');
|
||||
$builder->add($statistic, [
|
||||
'xs' => 24,
|
||||
'sm' => 12,
|
||||
'md' => 12,
|
||||
'lg' => 6,
|
||||
'xl' => 4,
|
||||
'class' => 'bg-white p-4 rounded-4 shadow-lighter'
|
||||
]);
|
||||
$Domain = new Domain;
|
||||
$Domain->setLabel('复制链接')
|
||||
->setTips('GitHub')
|
||||
->setDomain('https://github.com/RenLoong/loong-admin.git');
|
||||
$Domain->setAgreement([
|
||||
'title' => 'LoongAdmin',
|
||||
'url' => 'https://github.com/RenLoong/loong-admin.git'
|
||||
]);
|
||||
$builder->add($Domain, [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
'class' => 'bg-white p-4 rounded-4 shadow-lighter'
|
||||
], [
|
||||
'xs' => 1,
|
||||
'sm' => 1,
|
||||
'md' => 1,
|
||||
'lg' => 1,
|
||||
'xl' => 2,
|
||||
]);
|
||||
$this->echarts($builder);
|
||||
return $this->resData($builder);
|
||||
}
|
||||
public function echarts(DataboardBuilder $builder)
|
||||
{
|
||||
$request=request();
|
||||
$echarts = new Echarts;
|
||||
$echarts->setClass('bg-white p-4 rounded-4 shadow-lighter vh-65');
|
||||
$EchartsData=$this->getEchartsData($request);
|
||||
$echarts->setData($EchartsData);
|
||||
$builder->add($echarts);
|
||||
}
|
||||
public function getEchartsData(Request $request)
|
||||
{
|
||||
$data=[
|
||||
'color' => ['#80FFA5', '#00DDFF', '#37A2FF', '#FF0087', '#FFBF00'],
|
||||
'title' => [
|
||||
'text' => '数据可视化'
|
||||
],
|
||||
'tooltip' => [
|
||||
'trigger' => 'axis',
|
||||
'axisPointer' => [
|
||||
'type' => 'cross',
|
||||
'label' => [
|
||||
'backgroundColor' => '#6a7985'
|
||||
]
|
||||
]
|
||||
],
|
||||
'legend' => [
|
||||
'data' => ["注册人数"]
|
||||
],
|
||||
'toolbox' => [
|
||||
'show' => false
|
||||
],
|
||||
'grid' => [
|
||||
'left' => '3%',
|
||||
'right' => '4%',
|
||||
'bottom' => '3%',
|
||||
'containLabel' => true
|
||||
],
|
||||
'xAxis' => [
|
||||
[
|
||||
'type' => 'category',
|
||||
'boundaryGap' => false,
|
||||
'data' => []
|
||||
]
|
||||
],
|
||||
'yAxis' => [
|
||||
[
|
||||
'type' => 'value'
|
||||
]
|
||||
],
|
||||
'series' => [
|
||||
[
|
||||
'name' => "注册人数",
|
||||
'type' => 'line',
|
||||
'smooth' => true,
|
||||
'data' => []
|
||||
]
|
||||
]
|
||||
];
|
||||
for($i=7;$i>0;$i--){
|
||||
$date=date('Y-m-d',strtotime("-$i day"));
|
||||
$data['xAxis'][0]['data'][]=$date;
|
||||
$Statistic=rand(100,1000);
|
||||
if($Statistic){
|
||||
$data['series'][0]['data'][]=$Statistic;
|
||||
}else{
|
||||
$data['series'][0]['data'][]=0;
|
||||
}
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\ExamineBuilder;
|
||||
use app\expose\build\builder\FormBuilder;
|
||||
use app\expose\enum\Examine;
|
||||
use app\expose\enum\State;
|
||||
use support\Request;
|
||||
|
||||
class ExamineController extends Basic
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$builder = new ExamineBuilder([
|
||||
'old'=>[
|
||||
'label'=>'原始数据',
|
||||
'type'=>'info'
|
||||
],
|
||||
'new'=>[
|
||||
'label'=>'更新数据',
|
||||
'type'=>'success'
|
||||
]
|
||||
]);
|
||||
$builder->add('text', 'Text', 'text', [
|
||||
'props' => [
|
||||
]
|
||||
]);
|
||||
$builder->add('avatar', 'Avatar', 'avatar', [
|
||||
'props' => [
|
||||
]
|
||||
]);
|
||||
$builder->add('tag', 'Tag', 'tag', [
|
||||
'props' => [
|
||||
],
|
||||
'options' => [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->add('text', 'Text', 'text', [
|
||||
'props' => [
|
||||
]
|
||||
]);
|
||||
$builder->add('text', 'Text', 'text', [
|
||||
'props' => [
|
||||
]
|
||||
]);
|
||||
$builder->add('text', 'Text', 'text', [
|
||||
'props' => [
|
||||
]
|
||||
]);
|
||||
$builder->setOldData([
|
||||
'text'=>'文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字',
|
||||
'avatar'=>'头像',
|
||||
'tag'=>'选项一'
|
||||
]);
|
||||
$builder->setNewData([
|
||||
'text'=>'文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字文字',
|
||||
'avatar'=>'头像',
|
||||
'tag'=>'选项一'
|
||||
]);
|
||||
$formBuilder=new FormBuilder();
|
||||
$formBuilder->add('examine', '审核状态', 'radio', '', [
|
||||
'required' => true,
|
||||
'options' => Examine::getOptions(),
|
||||
'subProps' => [
|
||||
'border' => true
|
||||
]
|
||||
]);
|
||||
$formBuilder->add('remarks', '驳回理由', 'marked-editor', '', [
|
||||
'where' => [
|
||||
['examine', '=', Examine::REJECT['value']]
|
||||
],
|
||||
'required' => true,
|
||||
'props'=>[
|
||||
'bundle'=>true
|
||||
]
|
||||
]);
|
||||
$builder->addForm($formBuilder);
|
||||
return $this->resData($builder);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\FormBuilder;
|
||||
use app\expose\enum\State;
|
||||
use support\Request;
|
||||
|
||||
class FormController extends Basic
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$builder = new FormBuilder();
|
||||
$builder->add('input', 'Input', 'input', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Input Placeholder',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$builder->add('select', 'Select', 'select', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Select Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二',
|
||||
'tips' => '选项二Tips'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->add('remote_select', 'Remote Select', 'select', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Remote Select Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('mention', 'Mention', 'mention', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Mention Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('autocomplete', 'Autocomplete', 'autocomplete', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Autocomplete Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('switch', '状态', 'switch', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'active-value' => State::YES['value'],
|
||||
'inactive-value' => State::NO['value']
|
||||
]
|
||||
]);
|
||||
$builder->add('bundle', '附件库', 'bundle', '', [
|
||||
'props' => [
|
||||
// 'accept' => 'image/*',
|
||||
'multiple' => 1
|
||||
]
|
||||
]);
|
||||
return $this->resData($builder);
|
||||
}
|
||||
public function remote_select(Request $request)
|
||||
{
|
||||
$keyword = $request->post('keyword');
|
||||
$form = $request->post('form');
|
||||
$options = [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二',
|
||||
'tips' => '选项二Tips'
|
||||
]
|
||||
];
|
||||
return $this->resData($options);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,184 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\FormBuilder;
|
||||
use app\expose\enum\State;
|
||||
use support\Request;
|
||||
|
||||
class GroupFormController extends Basic
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$builder = new FormBuilder(null,null,[
|
||||
'translations'=>true
|
||||
]);
|
||||
$builder->setTranslations();
|
||||
$builder->add('input', 'Input', 'input', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Input Placeholder',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$builder->add('select', 'Select', 'select', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Select Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二',
|
||||
'tips' => '选项二Tips'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->add('remote_select', 'Remote Select', 'select', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Remote Select Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('mention', 'Mention', 'mention', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Mention Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('autocomplete', 'Autocomplete', 'autocomplete', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'remote' => [
|
||||
'url' => '/app/pluginExample/admin/Form/remote_select'
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Autocomplete Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => []
|
||||
]);
|
||||
$builder->add('switch', '状态', 'switch', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'active-value' => State::YES['value'],
|
||||
'inactive-value' => State::NO['value']
|
||||
]
|
||||
]);
|
||||
$builder->add('bundle', '附件库', 'bundle', '', [
|
||||
'props' => [
|
||||
// 'accept' => 'image/*',
|
||||
'multiple' => 1
|
||||
]
|
||||
]);
|
||||
|
||||
$subBuilder = new FormBuilder('group1', 'Group1');
|
||||
$subBuilder->add('input', 'Input', 'input', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Input Placeholder',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$subBuilder->add('select', 'Select', 'select', '', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Select Placeholder',
|
||||
'clearable' => true
|
||||
],
|
||||
'options' => [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二',
|
||||
'tips' => '选项二Tips'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addGroupForm($subBuilder);
|
||||
return $this->resData($builder);
|
||||
}
|
||||
public function remote_select(Request $request)
|
||||
{
|
||||
$keyword = $request->post('keyword');
|
||||
$form = $request->post('form');
|
||||
$options = [
|
||||
[
|
||||
'label' => '选项一',
|
||||
'value' => '选项一'
|
||||
],
|
||||
[
|
||||
'label' => '选项二',
|
||||
'value' => '选项二',
|
||||
'tips' => '选项二Tips'
|
||||
]
|
||||
];
|
||||
return $this->resData($options);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\FormBuilder;
|
||||
use app\expose\build\builder\ImagesBuilder;
|
||||
use app\expose\enum\Action;
|
||||
use support\Request;
|
||||
|
||||
class ImagesController extends Basic
|
||||
{
|
||||
public function indexGetGrid(Request $request)
|
||||
{
|
||||
$builder = new ImagesBuilder();
|
||||
$builder->addAction('编辑', [
|
||||
'path' => '/app/pluginExample/admin/Form/index',
|
||||
'props' => [
|
||||
'type' => 'primary',
|
||||
'title' => '编辑《{nickname}》'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'primary',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addAction('删除', [
|
||||
'model' => Action::COMFIRM['value'],
|
||||
'path' => '/app/pluginExample/admin/Table/delete',
|
||||
'where' => [
|
||||
['is_system', '!=', 1]
|
||||
],
|
||||
'props' => [
|
||||
'type' => 'error',
|
||||
'message' => '确定要删除《{nickname}》吗?',
|
||||
'confirmButtonClass' => 'el-button--danger'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'danger',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addHeader();
|
||||
$builder->addHeaderAction('创建', [
|
||||
'path' => '/app/pluginExample/admin/Form/create',
|
||||
'props' => [
|
||||
'type' => 'success',
|
||||
'title' => '创建'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'success'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addFooter();
|
||||
$builder->addFooterAction('移动到', [
|
||||
'model' => Action::DIALOG['value'],
|
||||
'path' => 'Admin/moveRole',
|
||||
'props' => [
|
||||
'title' => '移动到',
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'primary'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$formBuilder = new FormBuilder(null, null, [
|
||||
'inline' => true
|
||||
]);
|
||||
$formBuilder->add('username', '账号', 'input', '', [
|
||||
'props' => [
|
||||
'placeholder' => '账号搜索',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$formBuilder->add('mobile', '手机号', 'input', '', [
|
||||
'props' => [
|
||||
'placeholder' => '手机号搜索',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$builder->addScreen($formBuilder);
|
||||
$builder = $builder->builder();
|
||||
return $this->resData($builder);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$limit = $request->input('limit', 10);
|
||||
$data = [
|
||||
'total' => 100,
|
||||
'data' => []
|
||||
];
|
||||
for ($i = 0; $i < $limit; $i++) {
|
||||
$data['data'][] = [
|
||||
'id' => $i,
|
||||
'title' => '图片' . $i,
|
||||
'url' => 'https://picsum.photos/1920/1080?random=' . $i,
|
||||
];
|
||||
}
|
||||
return $this->resData($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\InfoBuilder;
|
||||
use support\Request;
|
||||
|
||||
class InfoController extends Basic
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$builder = new InfoBuilder();
|
||||
$builder->add('input', 'Input', 'span', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Input Placeholder',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$subBuilder = new InfoBuilder('subInfo','Sub Info');
|
||||
$subBuilder->add('input', 'Input', 'span', [
|
||||
'col' => [
|
||||
'xs' => 24,
|
||||
'sm' => 24,
|
||||
'md' => 24,
|
||||
'lg' => 24,
|
||||
'xl' => 8,
|
||||
],
|
||||
'props' => [
|
||||
'placeholder' => 'Input Placeholder',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$builder->addGroupInfo($subBuilder);
|
||||
$builder->setData([
|
||||
'input' => 'Input Value',
|
||||
'subInfo' => [
|
||||
'input' => 'Sub Info Input Value'
|
||||
]
|
||||
]);
|
||||
return $this->resData($builder);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\trait\Config;
|
||||
use support\Request;
|
||||
|
||||
class SettingsController extends Basic
|
||||
{
|
||||
use Config;
|
||||
public function basic(Request $request)
|
||||
{
|
||||
return $this->builder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,269 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\pluginExample\app\admin\controller;
|
||||
|
||||
use app\Basic;
|
||||
use app\expose\build\builder\FormBuilder;
|
||||
use app\expose\build\builder\TableBuilder;
|
||||
use app\expose\enum\Action;
|
||||
use app\expose\enum\State;
|
||||
use app\expose\enum\Week;
|
||||
use support\Request;
|
||||
|
||||
class TableController extends Basic
|
||||
{
|
||||
public function indexGetTable(Request $request)
|
||||
{
|
||||
$builder = new TableBuilder();
|
||||
$builder->addAction('操作', [
|
||||
'width' => '200px',
|
||||
'fixed' => 'right'
|
||||
]);
|
||||
$builder->addTableAction('编辑', [
|
||||
'path' => '/app/pluginExample/admin/Form/index',
|
||||
'props' => [
|
||||
'type' => 'primary',
|
||||
'title' => '编辑《{nickname}》'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'primary',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addTableAction('删除', [
|
||||
'model' => Action::COMFIRM['value'],
|
||||
'path' => '/app/pluginExample/admin/Table/delete',
|
||||
'where' => [
|
||||
['is_system', '!=', 1]
|
||||
],
|
||||
'props' => [
|
||||
'type' => 'error',
|
||||
'message' => '确定要删除《{nickname}》吗?',
|
||||
'confirmButtonClass' => 'el-button--danger'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'danger',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->addHeader();
|
||||
$builder->addHeaderAction('创建', [
|
||||
'path' => '/app/pluginExample/admin/Form/create',
|
||||
'props' => [
|
||||
'type' => 'success',
|
||||
'title' => '创建'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'button',
|
||||
'props' => [
|
||||
'type' => 'success'
|
||||
]
|
||||
]
|
||||
]);
|
||||
$formBuilder = new FormBuilder(null,null,[
|
||||
'inline' => true
|
||||
]);
|
||||
$formBuilder->add('username', '账号', 'input', '', [
|
||||
'props' => [
|
||||
'placeholder' => '账号搜索',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$formBuilder->add('mobile', '手机号', 'input', '', [
|
||||
'props' => [
|
||||
'placeholder' => '手机号搜索',
|
||||
'clearable' => true
|
||||
]
|
||||
]);
|
||||
$builder->addScreen($formBuilder);
|
||||
$builder->add('id', 'ID', [
|
||||
'props' => [
|
||||
'width' => '80px'
|
||||
]
|
||||
]);
|
||||
$builder->add('userinfo', '用户', [
|
||||
'component' => [
|
||||
'name' => 'table-userinfo',
|
||||
'props' => [
|
||||
'nickname' => 'nickname',
|
||||
'avatar' => 'headimg',
|
||||
'info' => 'username',
|
||||
'nicknameTags' => [
|
||||
[
|
||||
'field' => 'new_text',
|
||||
'props' => [
|
||||
'type' => 'danger',
|
||||
'size' => 'small'
|
||||
]
|
||||
],
|
||||
[
|
||||
'field' => 'new_text1',
|
||||
'props' => [
|
||||
'type' => 'success',
|
||||
'size' => 'small'
|
||||
]
|
||||
]
|
||||
],
|
||||
'tags' => [
|
||||
[
|
||||
'field' => 'role_name',
|
||||
'props' => [
|
||||
'type' => 'success'
|
||||
]
|
||||
]
|
||||
],
|
||||
]
|
||||
],
|
||||
'props' => [
|
||||
'minWidth' => '300px'
|
||||
]
|
||||
]);
|
||||
$builder->add('contact', '联系方式', [
|
||||
'props' => [
|
||||
'width' => '280px'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'table-times',
|
||||
'props' => [
|
||||
'group' => [
|
||||
[
|
||||
'field' => 'mobile',
|
||||
'label' => '手机号'
|
||||
],
|
||||
[
|
||||
'field' => 'email',
|
||||
'label' => '邮箱'
|
||||
],
|
||||
[
|
||||
'field' => 'wx_openid',
|
||||
'label' => 'OpenID'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->add('allow_week', '工作日', [
|
||||
'component' => [
|
||||
'name' => 'tag',
|
||||
'options' => Week::getOptions()
|
||||
],
|
||||
'props' => [
|
||||
'width' => '240px'
|
||||
]
|
||||
]);
|
||||
$builder->add('allow_work', '工作时间', [
|
||||
'component' => [
|
||||
'name' => 'tag',
|
||||
'options' => [
|
||||
[
|
||||
'index' => 0,
|
||||
'props' => [
|
||||
'type' => 'success'
|
||||
]
|
||||
],
|
||||
[
|
||||
'index' => 1,
|
||||
'props' => [
|
||||
'type' => 'danger'
|
||||
]
|
||||
]
|
||||
]
|
||||
],
|
||||
'props' => [
|
||||
'width' => '200px'
|
||||
]
|
||||
]);
|
||||
$builder->add('online_time', '活动', [
|
||||
'props' => [
|
||||
'width' => '200px'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'table-times',
|
||||
'props' => [
|
||||
'group' => [
|
||||
[
|
||||
'field' => 'online_time',
|
||||
'label' => '在线'
|
||||
],
|
||||
[
|
||||
'field' => 'login_time',
|
||||
'label' => '登录'
|
||||
],
|
||||
[
|
||||
'component' => 'tag',
|
||||
'field' => 'login_ip',
|
||||
'label' => '登录IP',
|
||||
'props' => [
|
||||
'size' => 'small',
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder->add('state', '状态', [
|
||||
'component' => [
|
||||
'name' => 'switch',
|
||||
'api' => '/app/pluginExample/admin/Table/indexUpdateState',
|
||||
'props' => [
|
||||
'active-value' => State::YES['value'],
|
||||
'inactive-value' => State::NO['value']
|
||||
]
|
||||
],
|
||||
'props' => [
|
||||
'width' => '100px'
|
||||
]
|
||||
]);
|
||||
$builder->add('create_time', '时间', [
|
||||
'props' => [
|
||||
'width' => '200px'
|
||||
],
|
||||
'component' => [
|
||||
'name' => 'table-times',
|
||||
'props' => [
|
||||
'group' => [
|
||||
[
|
||||
'field' => 'create_time',
|
||||
'label' => '创建'
|
||||
],
|
||||
[
|
||||
'field' => 'update_time',
|
||||
'label' => '更新'
|
||||
]
|
||||
]
|
||||
]
|
||||
]
|
||||
]);
|
||||
$builder = $builder->builder();
|
||||
return $this->resData($builder);
|
||||
}
|
||||
public function index(Request $request)
|
||||
{
|
||||
$data=[
|
||||
'total'=>1,
|
||||
'data'=>[
|
||||
[
|
||||
'id' => 1,
|
||||
'contact' => '13800138000',
|
||||
'allow_week' => '周一',
|
||||
'allow_work' => ['9:00','18:00'],
|
||||
'online_time' => '2021-01-01 10:00:00',
|
||||
'state' => 1,
|
||||
'new_text' => '新',
|
||||
'new_text1' => 'T',
|
||||
'nickname' => '张三',
|
||||
'headimg' => '',
|
||||
'username' => 'admin',
|
||||
'role_name' => '管理员',
|
||||
]
|
||||
]
|
||||
];
|
||||
return $this->resData($data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Here is your custom functions.
|
||||
*/
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
use support\Request;
|
||||
|
||||
return [
|
||||
'debug' => true,
|
||||
'controller_suffix' => 'Controller',
|
||||
'controller_reuse' => false
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'files' => [
|
||||
base_path() . '/plugin/pluginExample/app/functions.php',
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return new Webman\Container;
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'' => app\exception\Handler::class,
|
||||
];
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'default' => [
|
||||
'handlers' => [
|
||||
[
|
||||
'class' => Monolog\Handler\RotatingFileHandler::class,
|
||||
'constructor' => [
|
||||
runtime_path() . '/logs/api.log',
|
||||
7,
|
||||
Monolog\Logger::DEBUG,
|
||||
],
|
||||
'formatter' => [
|
||||
'class' => Monolog\Formatter\LineFormatter::class,
|
||||
'constructor' => [null, 'Y-m-d H:i:s', true],
|
||||
],
|
||||
]
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'' => [
|
||||
app\middleware\Template::class,
|
||||
app\middleware\Platform::class
|
||||
],
|
||||
'admin' => [
|
||||
app\expose\middleware\AdminAuth::class
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,2 @@
|
||||
<?php
|
||||
return [];
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use app\expose\build\builder\ComponentBuilder;
|
||||
|
||||
$Component = new ComponentBuilder;
|
||||
return [
|
||||
[
|
||||
#配置项名称
|
||||
'title' => '配置项名称',
|
||||
#配置项字段
|
||||
'field' => 'web_name',
|
||||
#配置项值
|
||||
'value' => 'FastMovie',
|
||||
#配置项组件
|
||||
'component' => 'input',
|
||||
#配置项额外属性
|
||||
'extra' => [
|
||||
#是否必填
|
||||
'required' => true,
|
||||
#element-plus表单中的rules规则
|
||||
'rules' => [
|
||||
['type'=>'string','required'=>true,'message'=>'请输入配置项值']
|
||||
],
|
||||
#使用接口验证
|
||||
'rules_api' => [
|
||||
'url' => '/app/pluginExample/example/test'
|
||||
],
|
||||
#提示
|
||||
'prompt' => [
|
||||
$Component->add('text', ['default' => '提示信息'], ['type' => 'info', 'size' => 'small'])
|
||||
->builder()
|
||||
],
|
||||
#组件属性
|
||||
'props' => [
|
||||
'type' => 'text',
|
||||
'placeholder' => '请输入应用名称'
|
||||
]
|
||||
]
|
||||
]
|
||||
];
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Multilingual configuration
|
||||
*/
|
||||
return [
|
||||
// Default language
|
||||
'locale' => 'zh_CN',
|
||||
// Fallback language
|
||||
'fallback_locale' => ['zh_CN', 'en'],
|
||||
// Folder where language files are stored
|
||||
'path' => base_path() . '/plugin/pluginExample/resource/translations',
|
||||
];
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of webman.
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* For full copyright and license information, please see the MIT-LICENSE.txt
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @author walkor<walkor@workerman.net>
|
||||
* @copyright walkor<walkor@workerman.net>
|
||||
* @link http://www.workerman.net/
|
||||
* @license http://www.opensource.org/licenses/mit-license.php MIT License
|
||||
*/
|
||||
|
||||
use support\view\Raw;
|
||||
use support\view\Twig;
|
||||
use support\view\Blade;
|
||||
// use support\view\ThinkPHP;
|
||||
use support\ThinkPHP;
|
||||
|
||||
return [
|
||||
'handler' => ThinkPHP::class,
|
||||
];
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "interface-example",
|
||||
"title": "应用示例项目",
|
||||
"version": "0.0.1",
|
||||
"description": "应用市场",
|
||||
"author": {
|
||||
"name": "余心",
|
||||
"email": "unknown.renloong@gmail.com"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'form_basic_title'=>'Basic',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'success' => 'Success',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'form_basic_title'=>'基础信息',
|
||||
];
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'success' => '成功',
|
||||
];
|
||||
Reference in New Issue
Block a user