李帅

1.重构一言表

......@@ -115,7 +115,6 @@ class VideoTempController extends AdminController
$form->hasMany('components','组件', function (Form\NestedForm $form) {
$form->select('name','组件名称')->options([
'one_poem_with_annotate' => '一言带注解组件',
'every_poem' => '每日一言组件',
'one_poem' => '一言组件',
'weather' => '天气组件',
'date' => '日期组件',
......@@ -123,22 +122,30 @@ class VideoTempController extends AdminController
]);
$form->select('position','组件位置')->options(VideoTemp::POSITION_OPTIONS);
$form->switch('fade', '淡入淡出')->help("开启淡入淡出会使背景色失效");
$form->number('text_bg_box', '背景厚度')->default(0)
->addElementClass('text_bg_box')->help('设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0');
$form->color('text_bg_color', '背景色')->default('#5c6bc6')->addElementClass('text_bg_color');
$form->selectTable('font_file','字体')
->title('字体选择')
->from(FontTable::make())
->model(Font::class,'file','name');
$form->number('font_size', '字号')->default(12)->min(12);
$form->color('text_color', '字体颜色')->default('#f5f5f5')->addElementClass('text_color');
$form->number('opacity', '透明度')->min(0)->max(100)
->addElementClass('opacity')->default(100)
->help('范围为0-100,100表示不透明,0表示完全透明');
$form->switch('fix_bounds', '避免剪切');
$form->radio('draw', '文字效果')
->options(['fade'=>'淡入淡出', 'fix'=>'固定显示'])->default('fade')
->when('fade',function (Form\NestedForm $form){
$form->selectTable('font_file','字体')
->title('字体选择')
->from(FontTable::make())
->model(Font::class,'file','name');
$form->number('font_size', '字号')->default(12)->min(12);
$form->color('text_color', '字体颜色')->default('#f5f5f5')->addElementClass('text_color');
})
->when('fix',function (Form\NestedForm $form){
$form->number('text_bg_box', '背景厚度')->default(0)
->addElementClass('text_bg_box')->help('设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0');
$form->color('text_bg_color', '背景色')->default('#5c6bc6')->addElementClass('text_bg_color');
$form->selectTable('font_file','字体')
->title('字体选择')
->from(FontTable::make())
->model(Font::class,'file','name');
$form->number('font_size', '字号')->default(12)->min(12);
$form->color('text_color', '字体颜色')->default('#f5f5f5')->addElementClass('text_color');
$form->number('opacity', '透明度')->min(0)->max(100)
->addElementClass('opacity')->default(100)
->help('范围为0-100,100表示不透明,0表示完全透明');
});
});
$form->hidden('state')->default(1)
......
This diff is collapsed. Click to expand it.
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class UpdateComponentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropColumns('components', ['fix_bounds']);
Schema::table('components', function (Blueprint $table) {
$table->string('draw')->after('position')->comment('文字效果');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('components', function (Blueprint $table) {
$table->string('fix_bounds')->after('opacity')->comment('超出避免剪切');
});
}
}