李帅

init

......@@ -10,6 +10,7 @@ use Dcat\Admin\Http\Controllers\AdminController;
class PoetryController extends AdminController
{
protected $title = '诗词';
/**
* Make a grid builder.
*
......@@ -28,7 +29,7 @@ class PoetryController extends AdminController
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
$filter->panel();
});
});
}
......
......@@ -10,6 +10,7 @@ use Dcat\Admin\Http\Controllers\AdminController;
class VerseController extends AdminController
{
protected $title = '诗节';
/**
* Make a grid builder.
*
......@@ -29,7 +30,7 @@ class VerseController extends AdminController
$grid->filter(function (Grid\Filter $filter) {
$filter->equal('id');
$filter->panel();
});
});
}
......
<?php
namespace App\Admin\Controllers;
use App\Admin\Repositories\VideoTemp;
use Dcat\Admin\Form;
use Dcat\Admin\Grid;
use Dcat\Admin\Show;
use Dcat\Admin\Http\Controllers\AdminController;
class VideoTempController extends AdminController
{
protected $title = '视频模板';
/**
* Make a grid builder.
*
* @return Grid
*/
protected function grid()
{
return Grid::make(new VideoTemp(), function (Grid $grid) {
// 设置自定义视图
$grid->view('admin.grid.custom');
$grid->setActionClass(Grid\Displayers\Actions::class);
// $grid->column('id',__('ID'))->sortable();
// $grid->column('title');
// $grid->column('type');
// $grid->column('bg_type');
// $grid->column('bg_url');
// $grid->column('bg_music');
// $grid->column('state');
// $grid->column('sn');
// $grid->column('top');
// $grid->column('left');
// $grid->column('font_size');
// $grid->column('created_at');
// $grid->column('updated_at')->sortable();
//
// $grid->filter(function (Grid\Filter $filter) {
// $filter->equal('id');
//
// });
});
}
/**
* Make a show builder.
*
* @param mixed $id
*
* @return Show
*/
protected function detail($id)
{
return Show::make($id, new VideoTemp(), function (Show $show) {
$show->field('id');
$show->field('title');
$show->field('type');
$show->field('bg_type');
$show->field('bg_url');
$show->field('bg_music');
$show->field('state');
$show->field('sn');
$show->field('top');
$show->field('left');
$show->field('font_size');
$show->field('created_at');
$show->field('updated_at');
});
}
/**
* Make a form builder.
*
* @return Form
*/
protected function form()
{
return Form::make(new VideoTemp(), function (Form $form) {
$form->display('id');
$form->block(8, function (Form\BlockForm $form) {
// 设置标题
$form->title('基本设置');
// 显示底部提交按钮
$form->showFooter();
// 设置字段宽度
$form->width(8, 3);
$form->column(12, function (Form\BlockForm $form) {
$form->text('title');
$form->radio('type')->options(['视频', '图文音频'])->default(0);
$form->radio('bg_type')
->options([1=>'视频', 2=>'图片'])
->when(1,function (Form\BlockForm $form){
$form->file('bg_url')
->accept('mp4')
->autoUpload()
->uniqueName()
->addElementClass('bg_url');
})
->when(2,function (Form\BlockForm $form){
$form->multipleImage('bg_url')
->limit(5)
->uniqueName()
->addElementClass('multi_bg_url');
})
->default(1);
$form->radio('bg_music')
->options(['无', '有'])
->when(1,function (Form\BlockForm $form){
$form->text('bgm_url');
})
->default(0);
$form->number('top');
$form->number('left');
$form->number('font_size');
$form->number('sn');
$form->radio('state')->options(['不显示', '显示'])->default(0);
});
});
$form->block(4, function (Form\BlockForm $form) {
$form->html(view('admin.form.phone'));
});
$form->display('created_at');
$form->display('updated_at');
});
}
}
......@@ -24,9 +24,16 @@ Route::group([
/** 众妙*/
$router->resource('/package', 'PackPoemController');
/** 视频模板*/
$router->resource('/template', 'VideoTempController');
$router->group(['prefix'=>'/tool'],function (Router $router){
/** 每日一言*/
$router->resource('/tool/every-poem', 'EverydayPoemController');
/** 推荐*/
// $router->resource('/tool/recommend','');
});
});
......
<?php
namespace App\Models;
use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Model;
class VideoTemp extends Model
{
use HasDateTimeFormatter;
protected $table = 'video_temp';
}
......@@ -17,9 +17,10 @@ class CreateImmerseTable extends Migration
$table->increments('id');
$table->unsignedBigInteger('user_id')->index()->comment('用户id');
$table->string('title')->default('')->comment('标题');
$table->text('content')->default('-')->comment('内容');
$table->unsignedTinyInteger('type')->comment('图文=1,视频=2');
$table->unsignedBigInteger('display_id')->comment('图文或视频id');
$table->text('content')->comment('内容');
$table->unsignedTinyInteger('type')->comment('音频图文=1,视频=2');
$table->unsignedBigInteger('duration')->comment('时长');
$table->unsignedBigInteger('size')->comment('大小');
$table->integer('praise')->comment('点赞量');
$table->integer('view')->comment('播放量');
$table->integer('collect')->comment('收藏量');
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateVideoTempTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('video_temp', function (Blueprint $table) {
$table->increments('id');
$table->string('title')->default('')->comment('模板标题');
$table->unsignedTinyInteger('type')->index()->comment('1=audio,2=video');
$table->unsignedTinyInteger('bg_type')->comment('1=image,2=video');
$table->string('bg_url')->nullable()->comment('背景动画化地址');
$table->unsignedTinyInteger('bg_music')->comment('0=没有,1=有');
$table->string('bgm_url')->nullable()->comment('背景音乐地址');
$table->unsignedTinyInteger('sn')->default('99')->comment('序号');
$table->unsignedSmallInteger('top')->default('0')->comment('距离容器上边距');
$table->unsignedSmallInteger('left')->default('0')->comment('距离容器左边距');
$table->unsignedTinyInteger('font_size')->default('12')->comment('字号');
$table->unsignedTinyInteger('state')->nullable()->comment('0=不显示,1=显示');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('video_temp');
}
}
<?php
/**
* A helper file for Dcat Admin, to provide autocomplete information to your IDE
*
* This file should not be included in your code, only analyzed by your IDE!
*
* @author jqh <841324345@qq.com>
*/
namespace Dcat\Admin {
use Illuminate\Support\Collection;
/**
* @property Grid\Column|Collection id
* @property Grid\Column|Collection name
* @property Grid\Column|Collection type
* @property Grid\Column|Collection version
* @property Grid\Column|Collection detail
* @property Grid\Column|Collection created_at
* @property Grid\Column|Collection updated_at
* @property Grid\Column|Collection is_enabled
* @property Grid\Column|Collection parent_id
* @property Grid\Column|Collection order
* @property Grid\Column|Collection icon
* @property Grid\Column|Collection uri
* @property Grid\Column|Collection extension
* @property Grid\Column|Collection permission_id
* @property Grid\Column|Collection menu_id
* @property Grid\Column|Collection slug
* @property Grid\Column|Collection http_method
* @property Grid\Column|Collection http_path
* @property Grid\Column|Collection role_id
* @property Grid\Column|Collection user_id
* @property Grid\Column|Collection value
* @property Grid\Column|Collection username
* @property Grid\Column|Collection password
* @property Grid\Column|Collection avatar
* @property Grid\Column|Collection remember_token
* @property Grid\Column|Collection uuid
* @property Grid\Column|Collection connection
* @property Grid\Column|Collection queue
* @property Grid\Column|Collection payload
* @property Grid\Column|Collection exception
* @property Grid\Column|Collection failed_at
* @property Grid\Column|Collection email
* @property Grid\Column|Collection token
* @property Grid\Column|Collection tokenable_type
* @property Grid\Column|Collection tokenable_id
* @property Grid\Column|Collection abilities
* @property Grid\Column|Collection last_used_at
* @property Grid\Column|Collection poetry_id
* @property Grid\Column|Collection tag_id
* @property Grid\Column|Collection email_verified_at
*
* @method Grid\Column|Collection id(string $label = null)
* @method Grid\Column|Collection name(string $label = null)
* @method Grid\Column|Collection type(string $label = null)
* @method Grid\Column|Collection version(string $label = null)
* @method Grid\Column|Collection detail(string $label = null)
* @method Grid\Column|Collection created_at(string $label = null)
* @method Grid\Column|Collection updated_at(string $label = null)
* @method Grid\Column|Collection is_enabled(string $label = null)
* @method Grid\Column|Collection parent_id(string $label = null)
* @method Grid\Column|Collection order(string $label = null)
* @method Grid\Column|Collection icon(string $label = null)
* @method Grid\Column|Collection uri(string $label = null)
* @method Grid\Column|Collection extension(string $label = null)
* @method Grid\Column|Collection permission_id(string $label = null)
* @method Grid\Column|Collection menu_id(string $label = null)
* @method Grid\Column|Collection slug(string $label = null)
* @method Grid\Column|Collection http_method(string $label = null)
* @method Grid\Column|Collection http_path(string $label = null)
* @method Grid\Column|Collection role_id(string $label = null)
* @method Grid\Column|Collection user_id(string $label = null)
* @method Grid\Column|Collection value(string $label = null)
* @method Grid\Column|Collection username(string $label = null)
* @method Grid\Column|Collection password(string $label = null)
* @method Grid\Column|Collection avatar(string $label = null)
* @method Grid\Column|Collection remember_token(string $label = null)
* @method Grid\Column|Collection uuid(string $label = null)
* @method Grid\Column|Collection connection(string $label = null)
* @method Grid\Column|Collection queue(string $label = null)
* @method Grid\Column|Collection payload(string $label = null)
* @method Grid\Column|Collection exception(string $label = null)
* @method Grid\Column|Collection failed_at(string $label = null)
* @method Grid\Column|Collection email(string $label = null)
* @method Grid\Column|Collection token(string $label = null)
* @method Grid\Column|Collection tokenable_type(string $label = null)
* @method Grid\Column|Collection tokenable_id(string $label = null)
* @method Grid\Column|Collection abilities(string $label = null)
* @method Grid\Column|Collection last_used_at(string $label = null)
* @method Grid\Column|Collection poetry_id(string $label = null)
* @method Grid\Column|Collection tag_id(string $label = null)
* @method Grid\Column|Collection email_verified_at(string $label = null)
*/
class Grid {}
class MiniGrid extends Grid {}
/**
* @property Show\Field|Collection id
* @property Show\Field|Collection name
* @property Show\Field|Collection type
* @property Show\Field|Collection version
* @property Show\Field|Collection detail
* @property Show\Field|Collection created_at
* @property Show\Field|Collection updated_at
* @property Show\Field|Collection is_enabled
* @property Show\Field|Collection parent_id
* @property Show\Field|Collection order
* @property Show\Field|Collection icon
* @property Show\Field|Collection uri
* @property Show\Field|Collection extension
* @property Show\Field|Collection permission_id
* @property Show\Field|Collection menu_id
* @property Show\Field|Collection slug
* @property Show\Field|Collection http_method
* @property Show\Field|Collection http_path
* @property Show\Field|Collection role_id
* @property Show\Field|Collection user_id
* @property Show\Field|Collection value
* @property Show\Field|Collection username
* @property Show\Field|Collection password
* @property Show\Field|Collection avatar
* @property Show\Field|Collection remember_token
* @property Show\Field|Collection uuid
* @property Show\Field|Collection connection
* @property Show\Field|Collection queue
* @property Show\Field|Collection payload
* @property Show\Field|Collection exception
* @property Show\Field|Collection failed_at
* @property Show\Field|Collection email
* @property Show\Field|Collection token
* @property Show\Field|Collection tokenable_type
* @property Show\Field|Collection tokenable_id
* @property Show\Field|Collection abilities
* @property Show\Field|Collection last_used_at
* @property Show\Field|Collection poetry_id
* @property Show\Field|Collection tag_id
* @property Show\Field|Collection email_verified_at
*
* @method Show\Field|Collection id(string $label = null)
* @method Show\Field|Collection name(string $label = null)
* @method Show\Field|Collection type(string $label = null)
* @method Show\Field|Collection version(string $label = null)
* @method Show\Field|Collection detail(string $label = null)
* @method Show\Field|Collection created_at(string $label = null)
* @method Show\Field|Collection updated_at(string $label = null)
* @method Show\Field|Collection is_enabled(string $label = null)
* @method Show\Field|Collection parent_id(string $label = null)
* @method Show\Field|Collection order(string $label = null)
* @method Show\Field|Collection icon(string $label = null)
* @method Show\Field|Collection uri(string $label = null)
* @method Show\Field|Collection extension(string $label = null)
* @method Show\Field|Collection permission_id(string $label = null)
* @method Show\Field|Collection menu_id(string $label = null)
* @method Show\Field|Collection slug(string $label = null)
* @method Show\Field|Collection http_method(string $label = null)
* @method Show\Field|Collection http_path(string $label = null)
* @method Show\Field|Collection role_id(string $label = null)
* @method Show\Field|Collection user_id(string $label = null)
* @method Show\Field|Collection value(string $label = null)
* @method Show\Field|Collection username(string $label = null)
* @method Show\Field|Collection password(string $label = null)
* @method Show\Field|Collection avatar(string $label = null)
* @method Show\Field|Collection remember_token(string $label = null)
* @method Show\Field|Collection uuid(string $label = null)
* @method Show\Field|Collection connection(string $label = null)
* @method Show\Field|Collection queue(string $label = null)
* @method Show\Field|Collection payload(string $label = null)
* @method Show\Field|Collection exception(string $label = null)
* @method Show\Field|Collection failed_at(string $label = null)
* @method Show\Field|Collection email(string $label = null)
* @method Show\Field|Collection token(string $label = null)
* @method Show\Field|Collection tokenable_type(string $label = null)
* @method Show\Field|Collection tokenable_id(string $label = null)
* @method Show\Field|Collection abilities(string $label = null)
* @method Show\Field|Collection last_used_at(string $label = null)
* @method Show\Field|Collection poetry_id(string $label = null)
* @method Show\Field|Collection tag_id(string $label = null)
* @method Show\Field|Collection email_verified_at(string $label = null)
*/
class Show {}
/**
*/
class Form {}
}
namespace Dcat\Admin\Grid {
/**
*/
class Column {}
/**
*/
class Filter {}
}
namespace Dcat\Admin\Show {
/**
*/
class Field {}
}
<?php
return [
'labels' => [
'VideoTemp' => 'VideoTemp',
'video-temp' => 'VideoTemp',
],
'fields' => [
'title' => '模板标题',
'type' => '类型',
'bg_type' => '背景动画类型',
'bg_url' => '背景文件地址',
'bg_music' => '背景音乐',
'bgm_url' => '背景音地址',
'state' => '状态',
'sn' => '序号',
'top' => '距离容器上边距',
'left' => '距离容器左边距',
'font_size' => '字号',
],
'options' => [
],
];
<style>
.box-card {
width: 380px;
border: 1px solid rgb(220, 223, 230);
border-radius: 40px;
margin-right: 24px;
padding: 37px 20px;
min-height: 679px;
}
.phone-content {
border: 1px solid rgb(220, 223, 230);
height: 605px;
overflow: hidden;
position: relative;
background: rgb(245, 245, 245);
}
.text {
font-size: 16px;
font-weight: 700;
color: rgb(38, 38, 38);
text-align: center;
position: absolute;
width: 100%;
top: 50px;
box-sizing: border-box;
}
.poem-block {
margin: 0;
padding: 0;
position: absolute;
text-align: center;
color: whitesmoke;
background-color: #5c6bc6;
opacity: 0.9;
top: 80px;
left: 0;
}
.poem-title {
font-size: 14px;
font-weight: bold;
margin: 10px;
}
.poem-author {
margin: 0;
text-align: right;
}
.poem-content {
font-size: 12px;
margin: 0;
}
</style>
<div class="box-card">
<div class="phone-content">
<div class="text">模板</div>
<img src="{{asset('storage/image/mobile-head.png')}}" alt="" width="338" height="80">
<div class="poem-block">
<p class="poem-title">题破山寺后禅院</p>
<p class="poem-author">-- 常建</p>
<p class="poem-content">清晨入古寺,初日照高林。</p>
<p class="poem-content">曲径通幽处,禅房花木深。</p>
<p class="poem-content">山光悦鸟性,潭影空人心。</p>
<p class="poem-content">万籁此都寂,但余钟磬音。</p>
</div>
</div>
</div>
<hr>
<button type="button" class="btn btn-primary sync"><i class="feather icon-repeat"></i> 同步基本设置</button>
<script>
Dcat.ready(function () {
$(document).off('click', '.sync').on('click', '.sync', function () {
let ori_top = 80;
let top = parseInt($('.field_top').val()) + ori_top;
let left = $('.field_left').val();
let font = $('.field_font_size').val();
let content_size = 12 + parseInt(font);
let title_size = 14 + parseInt(font);
$('.poem-block').css('top', top + 'px').css('left', left + 'px');
$('.poem-title').css('font-size', title_size + 'px');
$('.poem-content').css('font-size', content_size + 'px');
console.log(top)
console.log(left)
console.log(font)
})
})
</script>
\ No newline at end of file
<style>
.mailbox-attachment-icon {
max-height: none;
}
.mailbox-attachment-info {
background: #fff;
}
.mailbox-attachments .img-thumbnail {
border: 1px solid #fff;
border-radius: 0;
background-color: #fff;
}
.mailbox-attachment-icon.has-img>img {
max-width: 100%!important;
/*height: 180px!important;*/
}
.mailbox-attachment-info .item {
margin-bottom: 6px;
}
.mailbox-attachments li {
box-shadow: 0 2px 4px 0 rgba(0,0,0,.08);
border: 0;
background: #fff;
}
body.dark-mode .table {
background-color: #2c2c43;
}
body.dark-mode .mailbox-attachments .img-thumbnail {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-info {
background: #223;
}
body.dark-mode .mailbox-attachments li {
border-color: #223;
background-color: #223;
}
body.dark-mode .mailbox-attachment-name {
color: #a8a9bb
}
</style>
<div class="dcat-box custom-data-table dt-bootstrap4">
@include('admin::grid.table-toolbar')
{!! $grid->renderFilter() !!}
{!! $grid->renderHeader() !!}
<div class="table-responsive table-wrapper mt-1">
<ul class="mailbox-attachments clearfix {{ $grid->formatTableClass() }} p-0" id="{{ $tableId }}">
@foreach($grid->rows() as $row)
<li>
<span class="mailbox-attachment-icon has-img">
{!! $row->column('url') !!}
</span>
<div class="mailbox-attachment-info">
<div class="d-flex justify-content-between item">
<span class="mailbox-attachment-name">{!! $grid->columns()->get('id')->getLabel() !!}</span> {!! $row->column('id') !!}
</div>
<div class="d-flex justify-content-between item">
<span class="mailbox-attachment-name">{!! $grid->columns()->get('name')->getLabel() !!}</span> {!! $row->column('name') !!}
</div>
<span class="d-flex justify-content-between" style="margin-top: 5px">
{!! $row->column(Dcat\Admin\Grid\Column::SELECT_COLUMN_NAME) !!}
<div>{!! $row->column(Dcat\Admin\Grid\Column::ACTION_COLUMN_NAME) !!}</div>
</span>
</div>
</li>
@endforeach
</ul>
</div>
{!! $grid->renderFooter() !!}
@include('admin::grid.table-pagination')
</div>
\ No newline at end of file