diff --git a/app/command/ScanDemo.php b/app/command/ScanDemo.php new file mode 100644 index 0000000..bf745af --- /dev/null +++ b/app/command/ScanDemo.php @@ -0,0 +1,58 @@ +setName('scan:demo') + ->setDescription('the scan:demo command'); + } + + protected function execute(Input $input, Output $output) + { + // 指令输出 + $output->writeln('scan:demo'); + + + $model_category = Category::where('title', '组件')->find(); + + $demo_pc_dir = App::getRootPath() . '/demo/pc'; + + $list_demo_file = scandir($demo_pc_dir); + + foreach ($list_demo_file as $file_name) { + $file_name = str_replace(['.html', '.', '..',], '', $file_name); + + if (empty($file_name)) { + continue; + } + + $model_post = Post::where('tpl_name', $file_name)->find(); + if (empty($model_post)) { + $output->writeln('新组件:' . $file_name); + $model_post = new Post(); + $model_post->type = 'default'; + $model_post->tpl_name = $file_name; + $model_post->title = Config::get("demo.{$file_name}.title", $file_name); + $model_post->desc = Config::get("demo.{$file_name}.desc", $file_name); + $model_post->category_id = $model_category['id']; + $model_post->save(); + } + } + } +} diff --git a/config/console.php b/config/console.php index ed5a791..8e555c3 100644 --- a/config/console.php +++ b/config/console.php @@ -4,11 +4,13 @@ // +---------------------------------------------------------------------- use app\command\make\View; +use app\command\ScanDemo; return [ // 指令定义 'commands' => [ 'app\command\ResetPassword', - View::class + View::class, + ScanDemo::class ], ]; diff --git a/database/seeds/InitPost.php b/database/seeds/InitPost.php index 4a6f74f..78ae8cf 100644 --- a/database/seeds/InitPost.php +++ b/database/seeds/InitPost.php @@ -38,8 +38,6 @@ class InitPost extends Seeder $list_demo_file = scandir($demo_pc_dir); - - foreach ($list_demo_file as $file_name) { $file_name = str_replace(['.html', '.', '..',], '', $file_name); @@ -50,6 +48,7 @@ class InitPost extends Seeder $model_post = Post::where('tpl_name', $file_name)->find(); if (empty($model_post)) { $model_post = new Post(); + $model_post->type = 'default'; $model_post->tpl_name = $file_name; $model_post->title = Config::get("demo.{$file_name}.title", $file_name); $model_post->desc = Config::get("demo.{$file_name}.desc", $file_name); diff --git a/demo/pc/descriptions.html b/demo/pc/descriptions.html index c3d6861..b1bbb5a 100644 --- a/demo/pc/descriptions.html +++ b/demo/pc/descriptions.html @@ -1,4 +1,4 @@ -{volist name="[''=>'基本','table'=>'表格']" id='vo'} +{volist name="[''=>'基本','table'=>'表格','border'=>'边框']" id='vo'}
diff --git a/source/scss/desciptions/_desciptions.scss b/source/scss/desciptions/_desciptions.scss index 532ba75..98d533f 100644 --- a/source/scss/desciptions/_desciptions.scss +++ b/source/scss/desciptions/_desciptions.scss @@ -1,20 +1,18 @@ .ul-descriptions { // TODO:使用grid实现布局 + display : grid; + grid-template-columns: calc(1 / 3 * 100%) calc(1 / 3 * 100%) calc(1 / 3 * 100%); - display : flex; - flex-wrap: wrap; - + $labelWidth: 90px; .item { - display : inline-flex; - width : 30%; - position: relative; - height : 40px; - + display : inline-flex; + position : relative; + min-height: 40px; .label { - width : calc(40% - 12px); + width : calc($labelWidth - 12px); padding-right : 12px; position : absolute; height : 100%; @@ -22,50 +20,146 @@ align-items : center; justify-content: flex-end; color : #333; + min-width : calc($labelWidth - 12px); + font-weight : 400; } .value { - position : absolute; - width : calc(60% - 0px); - margin-left : calc(40% + 0px); + width : calc(100% - $labelWidth - 12px); + margin-left : calc($labelWidth + 12px); display : flex; align-items : center; justify-content: left; - height : 100%; + height : auto; white-space : break-all; word-break : break-all; color : #666; } + + &.article { + grid-column-start: 1; + grid-column-end : 4; + + .label { + align-items: flex-start; + padding-top: 10px; + height : calc(100% - 10px) + } + + .value { + .article-item { + white-space: break-spaces; + padding : 5px; + } + } + } + + &.tag { + .value { + .tag-item { + padding : 3px 6px; + border-radius : 3px; + background-color: #6cf; + color : #fff; + margin-right : 5px; + font-size : 12px; + } + } + } + + &.poster { + grid-row: span 2; + + .value { + .poster-item { + max-width : 100%; + max-height: 80px; + margin : 5px; + } + } + } + + &.line { + grid-column-start: 1; + grid-column-end : 4; + } + + &.lines { + grid-column-start: 1; + grid-column-end : 4; + + .label { + align-items: flex-start; + padding-top: 10px; + height : calc(100% - 10px) + } + } + + &.short-line { + grid-column: span 2; + } + + &.box { + grid-row: span 2; + } } &.table { - margin-left: 1px; - margin-top : 1px; + $borderColor : #000; + border-style : solid; + border-color : $borderColor; + border-width : 1px; + margin-right : 1px; + margin-bottom: 1px; .item { - border : 1px solid #000; - margin-left: -1px; - margin-top : -1px; + + border-style : solid; + border-color : $borderColor; + border-width : 0px 1px 1px 0; + margin-bottom: -1px; + margin-right : -1px; .label { - position: relative; - - &::after { - content : ''; - position : absolute; - right : 0; - top : 0; - height : 100%; - width : 1px; - background-color: #000; - } + position : absolute; + border-right: 1px solid $borderColor; } + &.line { + border-right: 0; - .value { - width : calc(60% - 10px); - margin-left: calc(40% + 10px); } + } } + + &.border { + $borderColor : rgb(235, 238, 245); + border-style : solid; + border-color : $borderColor; + border-width : 1px; + margin-right : 1px; + margin-bottom: 0px; + + .item { + border-style : solid; + border-color : $borderColor; + border-width : 0px 1px 1px 0; + margin-bottom: 0px; + margin-right : -1px; + + .label { + position : absolute; + border-right : 1px solid $borderColor; + background-color: rgb(245, 247, 250); + } + + &.line { + border-right: 0; + + } + + } + } + } \ No newline at end of file