李帅

1.重构一言表

...@@ -115,7 +115,6 @@ class VideoTempController extends AdminController ...@@ -115,7 +115,6 @@ class VideoTempController extends AdminController
115 $form->hasMany('components','组件', function (Form\NestedForm $form) { 115 $form->hasMany('components','组件', function (Form\NestedForm $form) {
116 $form->select('name','组件名称')->options([ 116 $form->select('name','组件名称')->options([
117 'one_poem_with_annotate' => '一言带注解组件', 117 'one_poem_with_annotate' => '一言带注解组件',
118 - 'every_poem' => '每日一言组件',
119 'one_poem' => '一言组件', 118 'one_poem' => '一言组件',
120 'weather' => '天气组件', 119 'weather' => '天气组件',
121 'date' => '日期组件', 120 'date' => '日期组件',
...@@ -123,8 +122,17 @@ class VideoTempController extends AdminController ...@@ -123,8 +122,17 @@ class VideoTempController extends AdminController
123 ]); 122 ]);
124 $form->select('position','组件位置')->options(VideoTemp::POSITION_OPTIONS); 123 $form->select('position','组件位置')->options(VideoTemp::POSITION_OPTIONS);
125 124
126 - $form->switch('fade', '淡入淡出')->help("开启淡入淡出会使背景色失效"); 125 + $form->radio('draw', '文字效果')
127 - 126 + ->options(['fade'=>'淡入淡出', 'fix'=>'固定显示'])->default('fade')
127 + ->when('fade',function (Form\NestedForm $form){
128 + $form->selectTable('font_file','字体')
129 + ->title('字体选择')
130 + ->from(FontTable::make())
131 + ->model(Font::class,'file','name');
132 + $form->number('font_size', '字号')->default(12)->min(12);
133 + $form->color('text_color', '字体颜色')->default('#f5f5f5')->addElementClass('text_color');
134 + })
135 + ->when('fix',function (Form\NestedForm $form){
128 $form->number('text_bg_box', '背景厚度')->default(0) 136 $form->number('text_bg_box', '背景厚度')->default(0)
129 ->addElementClass('text_bg_box')->help('设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0'); 137 ->addElementClass('text_bg_box')->help('设置背景块边缘厚度(用于在背景块边缘用背景色填充一圈),默认为0');
130 $form->color('text_bg_color', '背景色')->default('#5c6bc6')->addElementClass('text_bg_color'); 138 $form->color('text_bg_color', '背景色')->default('#5c6bc6')->addElementClass('text_bg_color');
...@@ -137,8 +145,7 @@ class VideoTempController extends AdminController ...@@ -137,8 +145,7 @@ class VideoTempController extends AdminController
137 $form->number('opacity', '透明度')->min(0)->max(100) 145 $form->number('opacity', '透明度')->min(0)->max(100)
138 ->addElementClass('opacity')->default(100) 146 ->addElementClass('opacity')->default(100)
139 ->help('范围为0-100,100表示不透明,0表示完全透明'); 147 ->help('范围为0-100,100表示不透明,0表示完全透明');
140 - $form->switch('fix_bounds', '避免剪切'); 148 + });
141 -
142 }); 149 });
143 150
144 $form->hidden('state')->default(1) 151 $form->hidden('state')->default(1)
......
This diff is collapsed. Click to expand it.
1 +<?php
2 +
3 +use Illuminate\Database\Migrations\Migration;
4 +use Illuminate\Database\Schema\Blueprint;
5 +use Illuminate\Support\Facades\Schema;
6 +
7 +class UpdateComponentsTable extends Migration
8 +{
9 + /**
10 + * Run the migrations.
11 + *
12 + * @return void
13 + */
14 + public function up()
15 + {
16 + Schema::dropColumns('components', ['fix_bounds']);
17 +
18 + Schema::table('components', function (Blueprint $table) {
19 + $table->string('draw')->after('position')->comment('文字效果');
20 + });
21 + }
22 +
23 + /**
24 + * Reverse the migrations.
25 + *
26 + * @return void
27 + */
28 + public function down()
29 + {
30 + Schema::table('components', function (Blueprint $table) {
31 + $table->string('fix_bounds')->after('opacity')->comment('超出避免剪切');
32 + });
33 + }
34 +}