Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a1615a1ec | |||
| 874817f248 | |||
| 8a63b770cc | |||
| 86840fbbe2 | |||
| 86febe3f9b | |||
| 45784c44c3 | |||
| 5395fb6a32 | |||
| 9ccaf65526 | |||
| 486db5a1ab | |||
| 526c433ed6 | |||
| feb2cfe503 | |||
| f27240851e | |||
| c16bbb7dab | |||
| 890ae64980 | |||
| d0da1ef269 | |||
| 0db5c82627 | |||
| 41ed17d0fe | |||
| e96d9d9505 | |||
| 59a7f8f906 | |||
| 49da62127f | |||
| 85227256be | |||
| ed792d4847 | |||
| 0064eb71a9 | |||
| 0a775803d2 | |||
| 00d0e2da55 | |||
| f62a57deb4 | |||
| 97a6d9a182 | |||
| d2643c8f7c | |||
| 777caa187e | |||
| 6849e908c7 | |||
| 044a3c560a | |||
| 31780fa070 | |||
| cc49232051 | |||
| 6492690d4c | |||
| f54cb1e980 | |||
| d266b284a5 | |||
| 8a1739e6be | |||
| cd4d397fac | |||
| e31831cdb6 | |||
| 0e1d243bbf | |||
| 8d58d4784c | |||
| ed19a7f0ce | |||
| e4f40ebb9a | |||
| 3cbfd1dd90 | |||
| 7031b717fd | |||
| a4e4406cb4 | |||
| 0d89d7a44b | |||
| 160a71752f | |||
| 14011f9674 | |||
| ad0f7b25a1 | |||
| 7b5913969f | |||
| ec238d86de | |||
| b8de0788f1 | |||
| 30a10a1b3b | |||
| 3381820ba0 | |||
| 11b9e2ae76 | |||
| d89bc90cef |
@@ -24,6 +24,9 @@ class IndexController extends AdminController
|
|||||||
$grid->filter(function ($filter) {
|
$grid->filter(function ($filter) {
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->like('title', '广告名称');
|
$filter->like('title', '广告名称');
|
||||||
|
|
||||||
|
});
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->like('category.id', '分类名称')->select(Category::selectOptions(function ($model) {
|
$filter->like('category.id', '分类名称')->select(Category::selectOptions(function ($model) {
|
||||||
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
|
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
|
||||||
}, '所有分类'));
|
}, '所有分类'));
|
||||||
@@ -43,30 +46,29 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a form builder.
|
* Make a form builder.
|
||||||
|
*
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
protected function form()
|
protected function form(): Form
|
||||||
{
|
{
|
||||||
$form = new Form(new Advert);
|
$form = new Form(new Advert);
|
||||||
|
|
||||||
$form->text('title', '广告名称')->required();
|
$form->text('title', '广告名称')->required();
|
||||||
$form->select('category_id', '所属分类')
|
$form->select('category_id', '所属分类')
|
||||||
->options(Category::selectOptions(function ($model) {
|
->options(function () {
|
||||||
return $model->where('status', 1)->where('type', Category::TYPE_ADVERT);
|
return Category::query()
|
||||||
}, '选择分类'))
|
->where('status', 1)
|
||||||
|
->where('type', Category::TYPE_ADVERT)
|
||||||
|
->pluck('title', 'id');
|
||||||
|
})
|
||||||
->rules('required|min:1', [
|
->rules('required|min:1', [
|
||||||
'required' => '必须选择所属分类',
|
'required' => '必须选择所属分类',
|
||||||
'min' => '必须选择所属分类',
|
'min' => '必须选择所属分类',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$form->image('cover', '封面图片')
|
$form->image('cover', '封面图片')
|
||||||
->rules(function ($form) {
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
if ($form->model()->cover != []) {
|
->move('images/'.date('Y/m/d'))
|
||||||
return 'nullable|image';
|
|
||||||
} else {
|
|
||||||
return 'required';
|
|
||||||
}
|
|
||||||
})
|
|
||||||
->move('images/' . date('Y/m/d'))
|
|
||||||
->removable()
|
->removable()
|
||||||
->uniqueName();
|
->uniqueName();
|
||||||
$form->text('url', '链接地址');
|
$form->text('url', '链接地址');
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ namespace App\Admin\Controllers\Article;
|
|||||||
use App\Admin\Selectable\CategorySelectAble;
|
use App\Admin\Selectable\CategorySelectAble;
|
||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
use App\Models\CategoryOld;
|
||||||
use Encore\Admin\Controllers\AdminController;
|
use Encore\Admin\Controllers\AdminController;
|
||||||
use Encore\Admin\Form;
|
use Encore\Admin\Form;
|
||||||
use Encore\Admin\Grid;
|
use Encore\Admin\Grid;
|
||||||
@@ -21,9 +22,20 @@ class IndexController extends AdminController
|
|||||||
$grid->filter(function ($filter) {
|
$grid->filter(function ($filter) {
|
||||||
$filter->column(1 / 2, function ($filter) {
|
$filter->column(1 / 2, function ($filter) {
|
||||||
$filter->like('title', '文章标题');
|
$filter->like('title', '文章标题');
|
||||||
$filter->equal('categories.id', '所属分类')->select(Category::selectOptions(function ($model) {
|
$filter->equal('status', '状态')->select([
|
||||||
|
1 => '开启',
|
||||||
|
0 => '关闭',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->equal('category_id', '所属分类')->select(Category::selectOptions(function ($model) {
|
||||||
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||||
}, '所有分类'));
|
}, '所有分类'));
|
||||||
|
$filter->equal('recommen', '推荐')->select([
|
||||||
|
1 => '是',
|
||||||
|
0 => '否',
|
||||||
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
$filter->disableIdFilter();
|
$filter->disableIdFilter();
|
||||||
@@ -31,15 +43,19 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
$grid->column('id', '#ID#');
|
$grid->column('id', '#ID#');
|
||||||
$grid->column('cover', '封面图片')->image('', 100);
|
$grid->column('cover', '封面图片')->image('', 100);
|
||||||
$grid->column('所属分类')->display(function () {
|
$grid->column('category.title', '所属分类');
|
||||||
return $this->categories()->pluck('title');
|
|
||||||
})->label();
|
|
||||||
$grid->column('title', '文章标题');
|
$grid->column('title', '文章标题');
|
||||||
|
$grid->column('文章前台地址')
|
||||||
|
->display(function () {
|
||||||
|
return $this->link;
|
||||||
|
})
|
||||||
|
->hide();
|
||||||
$states = [
|
$states = [
|
||||||
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
|
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
|
||||||
'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'],
|
'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'],
|
||||||
];
|
];
|
||||||
$grid->column('status', '状态')->switch($states);
|
$grid->column('status', '状态')->switch($states);
|
||||||
|
$grid->column('recommen', '推荐')->switch();
|
||||||
$grid->column('sort', '序号');
|
$grid->column('sort', '序号');
|
||||||
$grid->column('created_at', '创建时间');
|
$grid->column('created_at', '创建时间');
|
||||||
|
|
||||||
@@ -51,13 +67,27 @@ class IndexController extends AdminController
|
|||||||
$form = new Form(new Article);
|
$form = new Form(new Article);
|
||||||
|
|
||||||
$form->text('title', '文章标题')->rules('min:2');
|
$form->text('title', '文章标题')->rules('min:2');
|
||||||
$form->belongsToMany('categories', CategorySelectAble::class, __('关联分类'));
|
$form->text('remark', '子标题');
|
||||||
|
$form->select('category_id', '所属分类')
|
||||||
|
->options(Category::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1)->whereIn('type', [
|
||||||
|
Category::TYPE_ARTICLE,
|
||||||
|
Category::TYPE_LINK,
|
||||||
|
Category::TYPE_SHOW
|
||||||
|
]);
|
||||||
|
}, '一级分类'));
|
||||||
|
|
||||||
$form->textarea('description', '内容简介');
|
$form->textarea('description', '内容简介');
|
||||||
$form->image('cover', '封面')
|
$form->image('cover', '封面')
|
||||||
->move('images/' . date('Y/m/d'))
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
->removable()
|
->move('images/'.date('Y/m/d'))
|
||||||
->uniqueName();
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->image('logo', 'logo')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
$form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
|
$form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
|
||||||
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
||||||
$states = [
|
$states = [
|
||||||
@@ -66,6 +96,7 @@ class IndexController extends AdminController
|
|||||||
];
|
];
|
||||||
$form->datetime('created_at', '发布时间');
|
$form->datetime('created_at', '发布时间');
|
||||||
$form->switch('status', '状态')->states($states)->default(1);
|
$form->switch('status', '状态')->states($states)->default(1);
|
||||||
|
$form->switch('recommen', '推荐')->default(0);
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|||||||
83
app/Admin/Controllers/Article/OldController.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers\Article;
|
||||||
|
|
||||||
|
use App\Admin\Selectable\CategorySelectAble;
|
||||||
|
use App\Models\ArticleOld;
|
||||||
|
use App\Models\Category;
|
||||||
|
use Encore\Admin\Controllers\AdminController;
|
||||||
|
use Encore\Admin\Form;
|
||||||
|
use Encore\Admin\Grid;
|
||||||
|
|
||||||
|
class OldController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $title = '内容管理';
|
||||||
|
|
||||||
|
public function grid()
|
||||||
|
{
|
||||||
|
$grid = new Grid(new ArticleOld);
|
||||||
|
$grid->model()->orderBy('id', 'desc');
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->like('title', '文章标题');
|
||||||
|
$filter->equal('category_id', '所属分类')->select(Category::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1)
|
||||||
|
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW]);
|
||||||
|
}, '所有分类'));
|
||||||
|
});
|
||||||
|
|
||||||
|
$filter->disableIdFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('id', '#ID#');
|
||||||
|
$grid->column('cover', '封面图片')->image('', 100);
|
||||||
|
$grid->column('category.title', '所属分类');
|
||||||
|
$grid->column('title', '文章标题');
|
||||||
|
$states = [
|
||||||
|
'on' => ['value' => 1, 'text' => '打开', 'color' => 'primary'],
|
||||||
|
'off' => ['value' => 2, 'text' => '关闭', 'color' => 'default'],
|
||||||
|
];
|
||||||
|
$grid->column('status', '状态')->switch($states);
|
||||||
|
$grid->column('sort', '序号');
|
||||||
|
$grid->column('测试')->display(function () {
|
||||||
|
$cids = $this->categories()->pluck('id')->toArray();
|
||||||
|
if (empty($this->category_id) && ! empty($cids)) {
|
||||||
|
$this->category_id = $cids[0];
|
||||||
|
$this->save();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$grid->column('created_at', '创建时间');
|
||||||
|
|
||||||
|
return $grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form()
|
||||||
|
{
|
||||||
|
$form = new Form(new ArticleOld);
|
||||||
|
|
||||||
|
$form->text('title', '文章标题')->rules('min:2');
|
||||||
|
$form->text('remark', '子标题');
|
||||||
|
$form->select('category_id', '上级分类')
|
||||||
|
->options(Category::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1)->whereIn('type', [Category::TYPE_ArticleOld, Category::TYPE_SHOW]);
|
||||||
|
}, '一级分类'));
|
||||||
|
$form->textarea('description', '内容简介');
|
||||||
|
$form->image('cover', '封面')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->ueditor('content', '文章内容')->rules('required', ['required' => '详情不能为空']);
|
||||||
|
$form->number('sort', '序号')->default(0)->rules('required', ['required' => '序号必须填写'])->help('倒序优先');
|
||||||
|
$states = [
|
||||||
|
'on' => ['value' => 1, 'text' => '打开', 'color' => 'success'],
|
||||||
|
'off' => ['value' => 0, 'text' => '关闭', 'color' => 'danger'],
|
||||||
|
];
|
||||||
|
$form->datetime('created_at', '发布时间');
|
||||||
|
$form->switch('status', '状态')->states($states)->default(1);
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,6 +19,7 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Index interface.
|
* Index interface.
|
||||||
|
*
|
||||||
* @return \Closure
|
* @return \Closure
|
||||||
*/
|
*/
|
||||||
public function grid()
|
public function grid()
|
||||||
@@ -33,23 +34,32 @@ class IndexController extends AdminController
|
|||||||
return $model->where('status', 1);
|
return $model->where('status', 1);
|
||||||
}, '一级分类'));
|
}, '一级分类'));
|
||||||
$form->text('title', '分类名称')->rules('required');
|
$form->text('title', '分类名称')->rules('required');
|
||||||
|
$form->text('alias', '别名');
|
||||||
$form->select('type', '分类类型')
|
$form->select('type', '分类类型')
|
||||||
->options(Category::TYPES)
|
->options(Category::TYPES)
|
||||||
->when('show', function (WidgetsForm $form) {
|
->when('show', function (WidgetsForm $form) {
|
||||||
$form->select('article_id', '关联文章')
|
$form->select('article_id', '关联文章')
|
||||||
->options(function ($option, $info) {
|
->options(function ($option, $info) {
|
||||||
return Article::whereHas('categories', function ($q) {
|
return Article::whereHas('category', function ($q) {
|
||||||
$q->where('type', 'show');
|
$q->where('type', 'show');
|
||||||
})->pluck('title', 'id');
|
})->pluck('title', 'id');
|
||||||
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
||||||
})
|
})
|
||||||
->required();
|
->when(Category::TYPE_LINK, function (WidgetsForm $form) {
|
||||||
|
$form->text('url', '跳转地址');
|
||||||
|
})
|
||||||
|
->required();
|
||||||
$form->textarea('description', '分类简介')
|
$form->textarea('description', '分类简介')
|
||||||
->rules('nullable');
|
->rules('nullable');
|
||||||
|
$form->image('logo', 'Logo')
|
||||||
|
->move('logos/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
$form->image('cover', '封面')
|
$form->image('cover', '封面')
|
||||||
->move('images/' . date('Y/m/d'))
|
->move('images/'.date('Y/m/d'))
|
||||||
->removable()
|
->removable()
|
||||||
->uniqueName();
|
->uniqueName();
|
||||||
|
$form->text('template', '模板');
|
||||||
$form->number('order', '排序')->default(0);
|
$form->number('order', '排序')->default(0);
|
||||||
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
||||||
$form->switch('status', '显示')->states()->default(1);
|
$form->switch('status', '显示')->states()->default(1);
|
||||||
@@ -76,8 +86,9 @@ class IndexController extends AdminController
|
|||||||
}
|
}
|
||||||
$payload .= " [ID:{$branch['id']}] - ";
|
$payload .= " [ID:{$branch['id']}] - ";
|
||||||
$payload .= " <strong>{$branch['title']}</strong> ";
|
$payload .= " <strong>{$branch['title']}</strong> ";
|
||||||
|
$payload .= " <strong>{$branch['alias']}</strong> ";
|
||||||
$payload .= " <small>{$branch['type']}</small> ";
|
$payload .= " <small>{$branch['type']}</small> ";
|
||||||
$payload .= " <small style='color:#999'>{$branch['description']}</small>";
|
$payload .= " <small style='color:#999'>{$branch['template']}</small>";
|
||||||
|
|
||||||
return $payload;
|
return $payload;
|
||||||
});
|
});
|
||||||
@@ -86,9 +97,10 @@ class IndexController extends AdminController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a form builder.
|
* Make a form builder.
|
||||||
|
*
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
protected function form()
|
protected function form(): Form
|
||||||
{
|
{
|
||||||
$form = new Form(new Category);
|
$form = new Form(new Category);
|
||||||
|
|
||||||
@@ -96,23 +108,34 @@ class IndexController extends AdminController
|
|||||||
return $model->where('status', 1);
|
return $model->where('status', 1);
|
||||||
}, '一级分类'));
|
}, '一级分类'));
|
||||||
$form->text('title', '分类名称')->rules('required');
|
$form->text('title', '分类名称')->rules('required');
|
||||||
|
$form->text('alias', '别名');
|
||||||
$form->select('type', '分类类型')
|
$form->select('type', '分类类型')
|
||||||
->options(Category::TYPES)
|
->options(Category::TYPES)
|
||||||
->when('show', function (Form $form) {
|
->when('show', function (Form $form) {
|
||||||
$form->select('article_id', '关联文章')
|
$form->select('article_id', '关联文章')
|
||||||
->options(function ($option, $info) {
|
->options(function ($option, $info) {
|
||||||
return Article::whereHas('categories', function ($q) {
|
return Article::whereHas('category', function ($q) {
|
||||||
$q->where('type', 'show');
|
$q->where('type', 'show');
|
||||||
})->pluck('title', 'id');
|
})->pluck('title', 'id');
|
||||||
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
||||||
})
|
})
|
||||||
->required()
|
->when(Category::TYPE_LINK, function (Form $form) {
|
||||||
->rules('required');
|
$form->text('url', '跳转地址');
|
||||||
|
})
|
||||||
|
->required()
|
||||||
|
->rules('required');
|
||||||
$form->textarea('description', '分类简介')->rows(4)->rules('nullable');
|
$form->textarea('description', '分类简介')->rows(4)->rules('nullable');
|
||||||
|
$form->image('logo', 'Logo')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('logos/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
$form->image('cover', '封面')
|
$form->image('cover', '封面')
|
||||||
->move('images/' . date('Y/m/d'))
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
->removable()
|
->move('images/'.date('Y/m/d'))
|
||||||
->uniqueName();
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->text('template', '模板');
|
||||||
$form->number('order', '排序')->default(0)->help('正序优先');
|
$form->number('order', '排序')->default(0)->help('正序优先');
|
||||||
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
||||||
$form->switch('status', '显示')->states()->default(1);
|
$form->switch('status', '显示')->states()->default(1);
|
||||||
|
|||||||
161
app/Admin/Controllers/Category/OldController.php
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers\Category;
|
||||||
|
|
||||||
|
use App\Models\Article;
|
||||||
|
use App\Models\CategoryOld;
|
||||||
|
use Encore\Admin\Controllers\AdminController;
|
||||||
|
use Encore\Admin\Form;
|
||||||
|
use Encore\Admin\Layout\Column;
|
||||||
|
use Encore\Admin\Layout\Row;
|
||||||
|
use Encore\Admin\Tree;
|
||||||
|
use Encore\Admin\Widgets\Box;
|
||||||
|
use Encore\Admin\Widgets\Form as WidgetsForm;
|
||||||
|
|
||||||
|
class OldController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $title = '分类管理';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Index interface.
|
||||||
|
*
|
||||||
|
* @return \Closure
|
||||||
|
*/
|
||||||
|
public function grid()
|
||||||
|
{
|
||||||
|
return function (Row $row) {
|
||||||
|
$row->column(6, $this->treeView());
|
||||||
|
|
||||||
|
$row->column(6, function (Column $column) {
|
||||||
|
$form = new WidgetsForm();
|
||||||
|
|
||||||
|
$form->select('parent_id', '上级分类')->options(CategoryOld::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1);
|
||||||
|
}, '一级分类'));
|
||||||
|
$form->text('title', '分类名称')->rules('required');
|
||||||
|
$form->text('alias', '别名');
|
||||||
|
$form->select('type', '分类类型')
|
||||||
|
->options(CategoryOld::TYPES)
|
||||||
|
->when('show', function (WidgetsForm $form) {
|
||||||
|
$form->select('article_id', '关联文章')
|
||||||
|
->options(function ($option, $info) {
|
||||||
|
return Article::whereHas('categories', function ($q) {
|
||||||
|
$q->where('type', 'show');
|
||||||
|
})->pluck('title', 'id');
|
||||||
|
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
||||||
|
})
|
||||||
|
->required();
|
||||||
|
$form->textarea('description', '分类简介')
|
||||||
|
->rules('nullable');
|
||||||
|
$form->image('logo', 'Logo')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('logos/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->image('cover', '封面')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->text('template', '模板');
|
||||||
|
$form->number('order', '排序')->default(0);
|
||||||
|
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
||||||
|
$form->switch('status', '显示')->states()->default(1);
|
||||||
|
$form->action(admin_url('categories'));
|
||||||
|
|
||||||
|
$column->append((new Box('新增分类', $form))->style('success'));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Tree
|
||||||
|
*/
|
||||||
|
protected function treeView()
|
||||||
|
{
|
||||||
|
return CategoryOld::tree(function (Tree $tree) {
|
||||||
|
$tree->disableCreate();
|
||||||
|
|
||||||
|
$tree->branch(function ($branch) {
|
||||||
|
if ($branch['status'] == 1) {
|
||||||
|
$payload = "<i class='fa fa-eye text-primary'></i> ";
|
||||||
|
} else {
|
||||||
|
$payload = "<i class='fa fa-eye text-gray'></i> ";
|
||||||
|
}
|
||||||
|
$payload .= " [ID:{$branch['id']}] - ";
|
||||||
|
$payload .= " <strong>{$branch['title']}</strong> ";
|
||||||
|
$payload .= " <strong>{$branch['alias']}</strong> ";
|
||||||
|
$payload .= " <small>{$branch['type']}</small> ";
|
||||||
|
$payload .= " <small style='color:#999'>{$branch['template']}</small>";
|
||||||
|
|
||||||
|
return $payload;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a form builder.
|
||||||
|
*
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
protected function form(): Form
|
||||||
|
{
|
||||||
|
$form = new Form(new CategoryOld);
|
||||||
|
|
||||||
|
$form->select('parent_id', '上级分类')->options(CategoryOld::selectOptions(function ($model) {
|
||||||
|
return $model->where('status', 1);
|
||||||
|
}, '一级分类'));
|
||||||
|
$form->text('title', '分类名称')->rules('required');
|
||||||
|
$form->text('alias', '别名');
|
||||||
|
$form->select('type', '分类类型')
|
||||||
|
->options(CategoryOld::TYPES)
|
||||||
|
->when('show', function (Form $form) {
|
||||||
|
$form->select('article_id', '关联文章')
|
||||||
|
->options(function ($option, $info) {
|
||||||
|
return Article::whereHas('categories', function ($q) {
|
||||||
|
$q->where('type', 'show');
|
||||||
|
})->pluck('title', 'id');
|
||||||
|
})->help('当分类类型是文章详情的时候需要选择关联文章');
|
||||||
|
})
|
||||||
|
->required()
|
||||||
|
->rules('required');
|
||||||
|
$form->textarea('description', '分类简介')->rows(4)->rules('nullable');
|
||||||
|
$form->image('logo', 'Logo')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('logos/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->image('cover', '封面')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
$form->text('template', '模板');
|
||||||
|
$form->number('order', '排序')->default(0)->help('正序优先');
|
||||||
|
$form->switch('top_show', '顶部导航显示')->states()->default(0);
|
||||||
|
$form->switch('status', '显示')->states()->default(1);
|
||||||
|
$form->saving(function (Form $form) {
|
||||||
|
|
||||||
|
if (request()->has('title')) {
|
||||||
|
// if (request()->type == CategoryOld::TYPE_SHOW && empty(request()->article_id)) {
|
||||||
|
// $error = new MessageBag([
|
||||||
|
// 'title' => '错误',
|
||||||
|
// 'message' => '文章类型是文章详情的时候需要选择关联文章',
|
||||||
|
// ]);
|
||||||
|
//
|
||||||
|
// return back()->withInput()->with(compact('error'));
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
return $this->form()->destroy($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,25 +10,12 @@ use Encore\Admin\Layout\Row;
|
|||||||
|
|
||||||
class HomeController extends Controller
|
class HomeController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
public function index(Content $content)
|
public function index(Content $content)
|
||||||
{
|
{
|
||||||
return $content
|
return $content
|
||||||
->title('Dashboard')
|
->title('看板')
|
||||||
->description('Description...')
|
->description('Description...');
|
||||||
->row(Dashboard::title())
|
|
||||||
->row(function (Row $row) {
|
|
||||||
|
|
||||||
$row->column(4, function (Column $column) {
|
|
||||||
$column->append(Dashboard::environment());
|
|
||||||
});
|
|
||||||
|
|
||||||
$row->column(4, function (Column $column) {
|
|
||||||
$column->append(Dashboard::extensions());
|
|
||||||
});
|
|
||||||
|
|
||||||
$row->column(4, function (Column $column) {
|
|
||||||
$column->append(Dashboard::dependencies());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
98
app/Admin/Controllers/Video/IndexController.php
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Admin\Controllers\Video;
|
||||||
|
|
||||||
|
use App\Models\Advert;
|
||||||
|
use App\Models\Category;
|
||||||
|
use App\Models\Video;
|
||||||
|
use Encore\Admin\Controllers\AdminController;
|
||||||
|
use Encore\Admin\Form;
|
||||||
|
use Encore\Admin\Grid;
|
||||||
|
|
||||||
|
class IndexController extends AdminController
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $title = '视频资源';
|
||||||
|
|
||||||
|
protected function grid()
|
||||||
|
{
|
||||||
|
$grid = new Grid(new Video());
|
||||||
|
|
||||||
|
$grid->filter(function ($filter) {
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->like('title', '视频名称');
|
||||||
|
|
||||||
|
});
|
||||||
|
$filter->column(1 / 2, function ($filter) {
|
||||||
|
$filter->like('category.id', '分类名称')
|
||||||
|
->select(Category::where([
|
||||||
|
'status' => 1,
|
||||||
|
'type' => Category::TYPE_VIDEO,
|
||||||
|
])->pluck('title', 'id'));
|
||||||
|
});
|
||||||
|
$filter->disableIdFilter();
|
||||||
|
});
|
||||||
|
|
||||||
|
$grid->column('id');
|
||||||
|
$grid->column('title', '视频名称')->width('500');
|
||||||
|
$grid->column('cover', '封面')->image();
|
||||||
|
$grid->column('link', '视频地址')->downloadable();
|
||||||
|
$grid->column('category.title', '分类名称');
|
||||||
|
$grid->column('sort', '排序');
|
||||||
|
$grid->column('created_at', '发布时间');
|
||||||
|
|
||||||
|
return $grid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make a form builder.
|
||||||
|
*
|
||||||
|
* @return Form
|
||||||
|
*/
|
||||||
|
protected function form(): Form
|
||||||
|
{
|
||||||
|
$form = new Form(new Video());
|
||||||
|
|
||||||
|
$form->text('title', '视频名称')->required();
|
||||||
|
|
||||||
|
$form->select('category_id', '所属分类')
|
||||||
|
->options(function () {
|
||||||
|
return Category::query()
|
||||||
|
->where('status', 1)
|
||||||
|
->where('type', Category::TYPE_VIDEO)
|
||||||
|
->pluck('title', 'id');
|
||||||
|
})
|
||||||
|
->rules('required|min:1', [
|
||||||
|
'required' => '必须选择所属分类',
|
||||||
|
'min' => '必须选择所属分类',
|
||||||
|
]);
|
||||||
|
|
||||||
|
$form->image('cover', '封面')
|
||||||
|
->rules('image|mimes:jpeg,jpg,png')
|
||||||
|
->move('images/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
|
||||||
|
$form->file('link', '视频')
|
||||||
|
->rules(function ($form) {
|
||||||
|
if ($form->model()->cover != []) {
|
||||||
|
return 'nullable|mimetypes:video/avi,video/mpeg,video/mp4';
|
||||||
|
} else {
|
||||||
|
return 'required|mimetypes:video/avi,video/mpeg,video/mp4';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->move('videos/'.date('Y/m/d'))
|
||||||
|
->removable()
|
||||||
|
->uniqueName();
|
||||||
|
|
||||||
|
$form->number('sort', '排序')
|
||||||
|
->default(1)
|
||||||
|
->required()
|
||||||
|
->help('数字越大越靠前');
|
||||||
|
|
||||||
|
$form->datetime('created_at', '发布时间');
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,5 +8,6 @@ Route::group([
|
|||||||
'middleware' => config('admin.route.middleware'),
|
'middleware' => config('admin.route.middleware'),
|
||||||
], function (Router $router) {
|
], function (Router $router) {
|
||||||
$router->resource('categories', 'IndexController');
|
$router->resource('categories', 'IndexController');
|
||||||
|
$router->resource('categorie_olds', 'OldController');
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
11
app/Admin/Routes/video.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Routing\Router;
|
||||||
|
|
||||||
|
Route::group([
|
||||||
|
'prefix' => config('admin.route.prefix'),
|
||||||
|
'namespace' => config('admin.route.namespace') . '\\Video',
|
||||||
|
'middleware' => config('admin.route.middleware'),
|
||||||
|
], function (Router $router) {
|
||||||
|
$router->resource('videos', 'IndexController');
|
||||||
|
});
|
||||||
@@ -19,3 +19,4 @@ require __DIR__ . '/Routes/article.php';
|
|||||||
require __DIR__ . '/Routes/category.php';
|
require __DIR__ . '/Routes/category.php';
|
||||||
require __DIR__ . '/Routes/link.php';
|
require __DIR__ . '/Routes/link.php';
|
||||||
require __DIR__ . '/Routes/advert.php';
|
require __DIR__ . '/Routes/advert.php';
|
||||||
|
require __DIR__ . '/Routes/video.php';
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use App\Models\Advert;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
|
use App\Models\Video;
|
||||||
|
|
||||||
function getOneCategory($categoryId, $return = '')
|
function getOneCategory($categoryId, $return = '')
|
||||||
{
|
{
|
||||||
@@ -17,19 +19,41 @@ function getOneCategory($categoryId, $return = '')
|
|||||||
return new Category;
|
return new Category;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取所有下级
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2022/8/19 17:24
|
||||||
|
* @param $array
|
||||||
|
* @param $categoryId
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function getAllChild($categories, $categoryId)
|
||||||
|
{
|
||||||
|
$arr = array();
|
||||||
|
foreach ($categories as $category) {
|
||||||
|
if ($category['parent_id'] == $categoryId) {
|
||||||
|
$arr[] = $category['id'];
|
||||||
|
$arr = array_merge($arr, getAllChild($categories, $category['id']));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return $arr;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取文章分类详情
|
* Notes: 获取文章分类详情
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/9/10 13:21
|
* @Date : 2020/9/10 13:21
|
||||||
* @param $categoryId
|
* @param $categoryId
|
||||||
* @param string $result
|
* @param string $result
|
||||||
* @return \App\Models\Article
|
* @return \App\Models\Article
|
||||||
*/
|
*/
|
||||||
function getOneArticleBYCate($categoryId, $result = '')
|
function getOneArticleBYCate($categoryId, $result = '')
|
||||||
{
|
{
|
||||||
$info = Article::where('status', 1)
|
$info = Article::where('status', 1)
|
||||||
->ByCategory($categoryId)
|
->ByCategory($categoryId)
|
||||||
->latest('sort')->latest()->first();
|
->latest('sort')->latest()->first();
|
||||||
|
|
||||||
if ($info) {
|
if ($info) {
|
||||||
if ($result) {
|
if ($result) {
|
||||||
@@ -46,43 +70,62 @@ function getOneArticleBYCate($categoryId, $result = '')
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取分类下的文章
|
* Notes: 获取分类下的文章
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/9/10 10:05
|
* @Date : 2020/9/10 10:05
|
||||||
* @param $categoryId
|
* @param $categoryId
|
||||||
* @param $take
|
* @param int $take
|
||||||
|
* @param int $recommen
|
||||||
* @return \App\Models\Article
|
* @return \App\Models\Article
|
||||||
*/
|
*/
|
||||||
function getArticlesBYCate($categoryId, $take = 8, $mark = 'one')
|
function getArticlesBYCate($categoryId, int $take = 8, $recommen = 0)
|
||||||
{
|
{
|
||||||
if ($mark == 'one') {
|
$cate = Category::find($categoryId);
|
||||||
$articles = Article::where('status', 1)
|
$ids = $cate ? $cate->getAllChildrenId() : [];
|
||||||
->ByCategory($categoryId)
|
|
||||||
->latest('sort')
|
|
||||||
->latest()
|
|
||||||
->take($take)
|
|
||||||
->get();
|
|
||||||
} else {
|
|
||||||
$cate = Category::find($categoryId);
|
|
||||||
$ids = $cate->getAllChildrenId();
|
|
||||||
|
|
||||||
$articles = Article::where('status', 1)
|
$articles = Article::where('status', 1)
|
||||||
->ByCategory($ids)
|
->ByCategory([$categoryId])
|
||||||
->latest('sort')
|
->latest('sort')
|
||||||
->latest()
|
->latest()
|
||||||
->take($take)
|
->when($recommen, function ($q) use ($recommen) {
|
||||||
->get();
|
$q->where('recommen', 1);
|
||||||
}
|
})
|
||||||
|
->take($take)
|
||||||
|
->get();
|
||||||
|
|
||||||
return $articles;
|
return $articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取有图片的文章
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/12/20 13:22
|
||||||
|
* @param $categoryId
|
||||||
|
* @param $take
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getHasCoverArticlesByCate($categoryId, $take = 8)
|
||||||
|
{
|
||||||
|
return Article::where('status', 1)
|
||||||
|
->ByCategory([$categoryId])
|
||||||
|
->whereNotNull('cover')
|
||||||
|
->latest('sort')
|
||||||
|
->latest()
|
||||||
|
->take($take)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
//获取子分类
|
//获取子分类
|
||||||
function getCateChild($categoryId)
|
function getCateChild($categoryId, $take = '')
|
||||||
{
|
{
|
||||||
return Category::where('status', 1)
|
return Category::where('status', 1)
|
||||||
->where('parent_id', $categoryId)
|
->where('parent_id', $categoryId)
|
||||||
->orderBy('order', 'asc')
|
->orderBy('order', 'asc')
|
||||||
->get();
|
->when($take, function ($q) use ($take) {
|
||||||
|
$q->take($take);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取顶级分类
|
//获取顶级分类
|
||||||
@@ -97,3 +140,150 @@ function getTopCate($categoryId)
|
|||||||
return $parent;
|
return $parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 根据分类获取一张图片
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 13:53
|
||||||
|
* @param $categoryId
|
||||||
|
* @param string $result
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getOneAdvertByCate($categoryId, $result = '')
|
||||||
|
{
|
||||||
|
$info = Advert::where('category_id', $categoryId)
|
||||||
|
->latest('sort')
|
||||||
|
->latest()
|
||||||
|
->first();
|
||||||
|
|
||||||
|
if ($info) {
|
||||||
|
if ($result) {
|
||||||
|
return $info->{$result};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取图片
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 10:05
|
||||||
|
* @param $categoryId
|
||||||
|
* @param string $take
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getAdvertsByCate($categoryId, $take = '8')
|
||||||
|
{
|
||||||
|
return Advert::where('category_id', $categoryId)
|
||||||
|
->latest()
|
||||||
|
->take($take)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 根据分类获取视频
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 10:05
|
||||||
|
* @param $categoryId
|
||||||
|
* @param string $result
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function getVideoByCate($categoryId, string $result = '')
|
||||||
|
{
|
||||||
|
$video = Video::where('category_id', $categoryId)->latest()->first();
|
||||||
|
|
||||||
|
if ($video) {
|
||||||
|
if ($result) {
|
||||||
|
return $video->{$result};
|
||||||
|
}
|
||||||
|
|
||||||
|
return $video;
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取视频列表
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 10:21
|
||||||
|
* @param $categoryId
|
||||||
|
* @param string $take
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
function getVideosByCate($categoryId, $take = '8')
|
||||||
|
{
|
||||||
|
return Video::where('category_id', $categoryId)
|
||||||
|
->latest()
|
||||||
|
->take($take)
|
||||||
|
->get();
|
||||||
|
}
|
||||||
|
|
||||||
|
function dateLocalMonth($m): string
|
||||||
|
{
|
||||||
|
$months = [
|
||||||
|
'1' => '一月',
|
||||||
|
'2' => '二月',
|
||||||
|
'3' => '三月',
|
||||||
|
'4' => '四月',
|
||||||
|
'5' => '五月',
|
||||||
|
'6' => '六月',
|
||||||
|
'7' => '七月',
|
||||||
|
'8' => '八月',
|
||||||
|
'9' => '九月',
|
||||||
|
'10' => '十月',
|
||||||
|
'11' => '十一月',
|
||||||
|
'12' => '十二月',
|
||||||
|
];
|
||||||
|
|
||||||
|
return $months[$m] ?? $m;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/12/8 10:31
|
||||||
|
* @param $article_id
|
||||||
|
*/
|
||||||
|
function getOneArticle($article_id, $key = '')
|
||||||
|
{
|
||||||
|
$info = Article::find($article_id);
|
||||||
|
if ($info) {
|
||||||
|
if ($key) {
|
||||||
|
return $info->{$key};
|
||||||
|
}
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 判断顶级分类
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/12/9 10:13
|
||||||
|
* @param $parent_id
|
||||||
|
* @param $category_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function isTopCategory($parent_id, $category_id): bool
|
||||||
|
{
|
||||||
|
$category_ids = [];
|
||||||
|
if (is_array($parent_id)) {
|
||||||
|
foreach ($parent_id as $id) {
|
||||||
|
$category_ids[] = (Category::getTopCategory($id))->id;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$category_ids[] = (Category::getTopCategory($parent_id))->id;
|
||||||
|
}
|
||||||
|
return in_array($category_id, $category_ids);
|
||||||
|
}
|
||||||
@@ -9,27 +9,24 @@ class ArticleController extends Controller
|
|||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示分类
|
* Notes: description
|
||||||
* @param \App\Models\Article $article
|
* @Author: 玄尘
|
||||||
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View [type] [description]
|
* @Date : 2021/10/8 14:54
|
||||||
|
* @param \App\Models\Article $article
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function show(Article $article)
|
public function show(Article $article)
|
||||||
{
|
{
|
||||||
// $parent = $category = $article->category;
|
|
||||||
// if ($category->childrens->isEmpty()) {
|
|
||||||
// $parent = $category->parent;
|
|
||||||
// }
|
|
||||||
// $advert = Advert::where('category_id',73)->first();
|
|
||||||
$categories = $article->categories;
|
|
||||||
$parent = [];
|
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
$parent = $category = $article->category;
|
||||||
$top = getTopCate($category->id);
|
|
||||||
$parent[] = $top->id;
|
if ($category->childrens->isEmpty() && $category->parent) {
|
||||||
|
$parent = $category->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('article.show', compact('article', 'parent'));
|
$article->increment('clicks');
|
||||||
// return view('article.show', compact('article', 'parent', 'category','advert'));
|
|
||||||
|
return view('article.show', compact('article', 'parent', 'category'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
40
app/Http/Controllers/Auth/ConfirmPasswordController.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Foundation\Auth\ConfirmsPasswords;
|
||||||
|
|
||||||
|
class ConfirmPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Confirm Password Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password confirmations and
|
||||||
|
| uses a simple trait to include the behavior. You're free to explore
|
||||||
|
| this trait and override any functions that require customization.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use ConfirmsPasswords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users when the intended url fails.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
}
|
||||||
|
}
|
||||||
22
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||||
|
|
||||||
|
class ForgotPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset emails and
|
||||||
|
| includes a trait which assists in sending these notifications from
|
||||||
|
| your application to your users. Feel free to explore this trait.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use SendsPasswordResetEmails;
|
||||||
|
}
|
||||||
40
app/Http/Controllers/Auth/LoginController.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||||
|
|
||||||
|
class LoginController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Login Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller handles authenticating users for the application and
|
||||||
|
| redirecting them to your home screen. The controller uses a trait
|
||||||
|
| to conveniently provide its functionality to your applications.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use AuthenticatesUsers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after login.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('guest')->except('logout');
|
||||||
|
}
|
||||||
|
}
|
||||||
73
app/Http/Controllers/Auth/RegisterController.php
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use App\User;
|
||||||
|
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
class RegisterController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Register Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller handles the registration of new users as well as their
|
||||||
|
| validation and creation. By default this controller uses a trait to
|
||||||
|
| provide this functionality without requiring any additional code.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use RegistersUsers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after registration.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('guest');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a validator for an incoming registration request.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return \Illuminate\Contracts\Validation\Validator
|
||||||
|
*/
|
||||||
|
protected function validator(array $data)
|
||||||
|
{
|
||||||
|
return Validator::make($data, [
|
||||||
|
'name' => ['required', 'string', 'max:255'],
|
||||||
|
'email' => ['required', 'string', 'email', 'max:255', 'unique:users'],
|
||||||
|
'password' => ['required', 'string', 'min:8', 'confirmed'],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new user instance after a valid registration.
|
||||||
|
*
|
||||||
|
* @param array $data
|
||||||
|
* @return \App\User
|
||||||
|
*/
|
||||||
|
protected function create(array $data)
|
||||||
|
{
|
||||||
|
return User::create([
|
||||||
|
'name' => $data['name'],
|
||||||
|
'email' => $data['email'],
|
||||||
|
'password' => Hash::make($data['password']),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
app/Http/Controllers/Auth/ResetPasswordController.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||||
|
|
||||||
|
class ResetPasswordController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Password Reset Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling password reset requests
|
||||||
|
| and uses a simple trait to include this behavior. You're free to
|
||||||
|
| explore this trait and override any methods you wish to tweak.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use ResetsPasswords;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after resetting their password.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
}
|
||||||
42
app/Http/Controllers/Auth/VerificationController.php
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Providers\RouteServiceProvider;
|
||||||
|
use Illuminate\Foundation\Auth\VerifiesEmails;
|
||||||
|
|
||||||
|
class VerificationController extends Controller
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Email Verification Controller
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| This controller is responsible for handling email verification for any
|
||||||
|
| user that recently registered with the application. Emails may also
|
||||||
|
| be re-sent if the user didn't receive the original email message.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
use VerifiesEmails;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Where to redirect users after verification.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $redirectTo = RouteServiceProvider::HOME;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new controller instance.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
$this->middleware('auth');
|
||||||
|
$this->middleware('signed')->only('verify');
|
||||||
|
$this->middleware('throttle:6,1')->only('verify', 'resend');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Advert;
|
use App\Models\Article;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
|
||||||
class CategoryController extends Controller
|
class CategoryController extends Controller
|
||||||
@@ -10,22 +10,66 @@ class CategoryController extends Controller
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示分类
|
* 显示分类
|
||||||
* @param Category $category [description]
|
*
|
||||||
* @return [type] [description]
|
* @param Category $category [description]
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View [type] [description]
|
||||||
*/
|
*/
|
||||||
public function index(Category $category)
|
public function index(Category $category)
|
||||||
{
|
{
|
||||||
if ($category->type == Category::TYPE_SHOW && $category->article_id) {
|
if ($category->type == Category::TYPE_SHOW && $category->article_id) {
|
||||||
return redirect("articles/" . $category->article_id);
|
return redirect("articles/".$category->article_id);
|
||||||
|
} elseif ($category->type == Category::TYPE_LINK && $category->url) {
|
||||||
|
return redirect()->away($category->url);
|
||||||
} else {
|
} else {
|
||||||
$articles = $category->relations(Category::TYPE_ARTICLE)->where('status', 1)->latest()->paginate();
|
$template = 'show';
|
||||||
$parent = $category;
|
if ($category->template) {
|
||||||
if ($parent->childrens->isEmpty()) {
|
$template = $category->template;
|
||||||
|
} else {
|
||||||
|
if ($category->type == Category::TYPE_VIDEO) {
|
||||||
|
$template = 'videos';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->type == Category::TYPE_ADVERT) {
|
||||||
|
$template = 'images';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($category->type == Category::TYPE_PHOTO) {
|
||||||
|
$template = 'photos';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//院所新闻
|
||||||
|
if ($category->id == 66) {
|
||||||
|
$articles = Article::ByCategory([66, 60, 61, 17, 26, 77])
|
||||||
|
->where('status', 1)
|
||||||
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
|
->paginate();
|
||||||
|
|
||||||
|
} elseif ($category->id == 7) {
|
||||||
|
$categories = Category::get();
|
||||||
|
$children = array_merge([$category->id], getAllChild($categories, $category->id));
|
||||||
|
$articles = Article::ByCategory($children)
|
||||||
|
->where('status', 1)
|
||||||
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
|
->paginate();
|
||||||
|
} else {
|
||||||
|
$articles = $category->relations($category->type)
|
||||||
|
->where('status', 1)
|
||||||
|
->latest('sort')
|
||||||
|
->latest('created_at')
|
||||||
|
->paginate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$parent = $category;
|
||||||
|
if ($category->childrens->isEmpty() && $category->parent) {
|
||||||
$parent = $category->parent;
|
$parent = $category->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
return view('category.show', compact('articles', 'category', 'parent'));
|
return view('category.'.$template, compact('articles', 'category', 'parent'));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Advert;
|
use App\Models\Advert;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
use App\Models\Link;
|
||||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||||
@@ -21,19 +22,21 @@ class Controller extends BaseController
|
|||||||
$categorys = Category::where('status', 1)
|
$categorys = Category::where('status', 1)
|
||||||
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
|
->whereIn('type', [Category::TYPE_ARTICLE, Category::TYPE_SHOW])
|
||||||
->where('top_show', 1)
|
->where('top_show', 1)
|
||||||
->latest('order')
|
->oldest('order')
|
||||||
->select('id', 'title')
|
->select('id', 'title')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
//地步友情链接
|
//友情链接
|
||||||
if (url()->current() == route('index.index')) {
|
if (url()->current() == route('index.index')) {
|
||||||
$adverts = Advert::where('category_id', 72)->get();
|
$adverts = Advert::where('category_id', 72)->get();
|
||||||
} else {
|
} else {
|
||||||
$adverts = Advert::where('category_id', 73)->get();
|
$adverts = Advert::where('category_id', 73)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$links = Link::get();
|
||||||
View::share('all_categorys', $categorys);
|
View::share('all_categorys', $categorys);
|
||||||
View::share('adverts', $adverts);
|
View::share('adverts', $adverts);
|
||||||
|
View::share('links', $links);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,34 +6,35 @@ use App\Models\Advert;
|
|||||||
use App\Models\Article;
|
use App\Models\Article;
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
use App\Models\Link;
|
use App\Models\Link;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
class IndexController extends Controller
|
class IndexController extends Controller
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 首页
|
* Notes: 首页
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/1 9:11
|
* @Date : 2020/6/1 9:11
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
//研究中心
|
$ysxw = Article::where('status', 1)
|
||||||
$links = Link::get();
|
->ByCategory([66, 60, 61, 17, 26, 77])
|
||||||
|
->latest('sort')
|
||||||
|
->latest()
|
||||||
|
->take(7)
|
||||||
|
->get();
|
||||||
|
|
||||||
$lt_adverts = Advert::where('category_id', 175)->latest('sort')->get();
|
return view('index.index', compact('ysxw'));
|
||||||
|
|
||||||
return view('index.index', compact('links', 'lt_adverts'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//通用获取文章
|
public function search(Request $request)
|
||||||
public function getArticle($category_ids, $take = 3)
|
|
||||||
{
|
{
|
||||||
return Article::where('status', 1)
|
$title = $request->title;
|
||||||
->ByCategory($category_ids)
|
$articles = Article::query()->where('title', 'like', "%{$title}%")->paginate();
|
||||||
->select('id', 'description', 'title', 'created_at', 'cover', 'content')
|
|
||||||
->orderBy('created_at', 'desc')
|
return view('index.search', compact('articles'));
|
||||||
->take($take)
|
|
||||||
->get();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
33
app/Http/Controllers/VideoController.php
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
|
||||||
|
use App\Models\Video;
|
||||||
|
|
||||||
|
class VideoController extends Controller
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: description
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 14:54
|
||||||
|
* @param \App\Models\Video $video
|
||||||
|
* @return \Illuminate\Contracts\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function show(Video $video)
|
||||||
|
{
|
||||||
|
|
||||||
|
$parent = $category = $video->category;
|
||||||
|
|
||||||
|
if ($category->childrens->isEmpty() && $category->parent) {
|
||||||
|
$parent = $category->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return view('video.show', compact('video', 'parent', 'category'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,13 +3,11 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\Traits\BelongsToCategory;
|
use App\Models\Traits\BelongsToCategory;
|
||||||
use App\Models\Traits\HasOneCover;
|
use App\Models\Traits\HasCovers;
|
||||||
use App\Models\Traits\OrderByIdDesc;
|
|
||||||
use App\Scopes\SortScope;
|
|
||||||
|
|
||||||
class Advert extends Model
|
class Advert extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasOneCover,
|
use HasCovers,
|
||||||
BelongsToCategory;
|
BelongsToCategory;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,19 +3,46 @@
|
|||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use App\Models\Traits\BelongsToCategory;
|
use App\Models\Traits\BelongsToCategory;
|
||||||
use App\Models\Traits\HasOneCover;
|
use App\Models\Traits\HasCovers;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
class Article extends Model
|
class Article extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use HasOneCover, BelongsToCategory;
|
use HasCovers, BelongsToCategory;
|
||||||
|
|
||||||
public function getLinkAttribute()
|
/**
|
||||||
|
* Notes: 获取详情地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:46
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLinkAttribute(): string
|
||||||
{
|
{
|
||||||
return route('article.show', $this);
|
return route('article.show', $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取logo地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:46
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLogoUrlAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->parseImageUrl($this->logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Notes: 获取详情内图片
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 11:58
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
public function get_content_cover()
|
public function get_content_cover()
|
||||||
{
|
{
|
||||||
preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches);
|
preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches);
|
||||||
@@ -29,21 +56,21 @@ class Article extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取一个默认图片
|
* Notes: 获取一个默认图片
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2020/6/3 16:29
|
* @Date : 2020/6/3 16:29
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
*/
|
*/
|
||||||
public function get_one_cover()
|
public function get_one_cover()
|
||||||
{
|
{
|
||||||
if ($this->cover_path) {
|
if ($this->cover_url) {
|
||||||
$path = $this->cover_path;
|
$path = $this->cover_url;
|
||||||
} else {
|
} else {
|
||||||
$path = $this->get_content_cover();
|
$path = $this->get_content_cover();
|
||||||
if ($path) {
|
if ($path) {
|
||||||
|
|
||||||
$this->cover = str_replace("/storage", "", $path);
|
$this->cover = str_replace("/storage", "", $path);
|
||||||
$this->save();
|
$this->save();
|
||||||
$path = config('app.url') . $path;
|
$path = config('app.url').$path;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,6 +82,7 @@ class Article extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 关联分类
|
* Notes: 关联分类
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/4/2 9:11
|
* @Date : 2021/4/2 9:11
|
||||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
@@ -62,11 +90,22 @@ class Article extends Model
|
|||||||
public function categories(): BelongsToMany
|
public function categories(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Category::class)
|
return $this->belongsToMany(Category::class)
|
||||||
->using(ArticleCategory::class);
|
->using(ArticleCategory::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Category::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category_old(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(CategoryOld::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: description
|
* Notes: description
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/4/2 9:17
|
* @Date : 2021/4/2 9:17
|
||||||
* @param $query
|
* @param $query
|
||||||
@@ -75,13 +114,11 @@ class Article extends Model
|
|||||||
*/
|
*/
|
||||||
public function scopeByCategory($query, $ids)
|
public function scopeByCategory($query, $ids)
|
||||||
{
|
{
|
||||||
if (!is_array($ids)) {
|
if (! is_array($ids)) {
|
||||||
$ids = [$ids];
|
$ids = [$ids];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $query->whereHas('categories', function ($q) use ($ids) {
|
return $query->whereIn('category_id', $ids);
|
||||||
$q->whereIN('id', $ids);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
10
app/Models/ArticleCategoryInfo.php
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
class ArticleCategoryInfo extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
public $table = 'article_categories';
|
||||||
|
|
||||||
|
}
|
||||||
100
app/Models/ArticleOld.php
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Traits\BelongsToCategory;
|
||||||
|
use App\Models\Traits\HasCovers;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
|
||||||
|
class ArticleOld extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
use HasCovers, BelongsToCategory;
|
||||||
|
|
||||||
|
public function getLinkAttribute(): string
|
||||||
|
{
|
||||||
|
return route('article.show', $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Notes: 获取详情内图片
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 11:58
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
|
public function get_content_cover()
|
||||||
|
{
|
||||||
|
preg_match("/<img.*?src=\"([^\"]+)\"[^>].*?>/isU", str_ireplace("\\", "", $this->content), $matches);
|
||||||
|
|
||||||
|
if (isset($matches[1])) {
|
||||||
|
return $matches[1];
|
||||||
|
} else {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取一个默认图片
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2020/6/3 16:29
|
||||||
|
* @return mixed|string
|
||||||
|
*/
|
||||||
|
public function get_one_cover()
|
||||||
|
{
|
||||||
|
if ($this->cover_url) {
|
||||||
|
$path = $this->cover_url;
|
||||||
|
} else {
|
||||||
|
$path = $this->get_content_cover();
|
||||||
|
if ($path) {
|
||||||
|
$this->cover = str_replace("/storage", "", $path);
|
||||||
|
$this->save();
|
||||||
|
$path = config('app.url') . $path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 关联分类
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/4/2 9:11
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||||
|
*/
|
||||||
|
public function categories(): BelongsToMany
|
||||||
|
{
|
||||||
|
return $this->belongsToMany(CategoryOld::class, 'article_old_category')
|
||||||
|
->using(ArticleOldCategory::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function category(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(CategoryOld::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: description
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/4/2 9:17
|
||||||
|
* @param $query
|
||||||
|
* @param $ids
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function scopeByCategory($query, $ids)
|
||||||
|
{
|
||||||
|
if (!is_array($ids)) {
|
||||||
|
$ids = [$ids];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $query->whereIn('category_id', $ids);
|
||||||
|
//
|
||||||
|
// return $query->whereHas('categories', function ($q) use ($ids) {
|
||||||
|
// $q->whereIN('id', $ids);
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
app/Models/ArticleOldCategory.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||||
|
|
||||||
|
class ArticleOldCategory extends Pivot
|
||||||
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
}
|
||||||
@@ -2,82 +2,142 @@
|
|||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Traits\HasCovers;
|
||||||
use Encore\Admin\Traits\AdminBuilder;
|
use Encore\Admin\Traits\AdminBuilder;
|
||||||
use Encore\Admin\Traits\ModelTree;
|
use Encore\Admin\Traits\ModelTree;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
|
|
||||||
use AdminBuilder, ModelTree;
|
use AdminBuilder, ModelTree, HasCovers;
|
||||||
|
|
||||||
public const TYPE_SHOW = 'show';
|
public const TYPE_SHOW = 'show';
|
||||||
public const TYPE_ARTICLE = 'article';
|
public const TYPE_ARTICLE = 'article';
|
||||||
public const TYPE_ADVERT = 'advert';
|
public const TYPE_ADVERT = 'advert';
|
||||||
|
public const TYPE_VIDEO = 'video';
|
||||||
|
public const TYPE_PHOTO = 'photo';
|
||||||
|
public const TYPE_LINK = 'link';
|
||||||
public const TYPES = [
|
public const TYPES = [
|
||||||
self::TYPE_ARTICLE => '文章列表',
|
self::TYPE_ARTICLE => '文章列表',
|
||||||
self::TYPE_SHOW => '文章详情',
|
self::TYPE_SHOW => '文章详情',
|
||||||
self::TYPE_ADVERT => '图片',
|
self::TYPE_ADVERT => '图片列表',
|
||||||
|
self::TYPE_PHOTO => '图集',
|
||||||
|
self::TYPE_VIDEO => '视频列表',
|
||||||
|
self::TYPE_LINK => '跳转链接',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function getLinkAttribute()
|
public $cover_field = 'cover';
|
||||||
|
|
||||||
|
public function getLogoUrlAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->parseImageUrl($this->logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLinkAttribute(): string
|
||||||
{
|
{
|
||||||
return route('category.show', $this);
|
return route('category.show', $this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联的数据
|
* Notes: description
|
||||||
* @return [type] [description]
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/14 11:53
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo|\Illuminate\Database\Eloquent\Relations\HasMany|null
|
||||||
*/
|
*/
|
||||||
public function relations()
|
public function relations()
|
||||||
{
|
{
|
||||||
switch ($this->type) {
|
switch ($this->type) {
|
||||||
case self::TYPE_SHOW:
|
case self::TYPE_SHOW:
|
||||||
return $this->hasOne(Article::class)->where('id', $this->article_id);
|
return $this->belongsTo(Article::class);
|
||||||
|
// return $this->hasOne(Article::class);
|
||||||
break;
|
break;
|
||||||
case self::TYPE_ARTICLE:
|
case self::TYPE_ARTICLE:
|
||||||
return $this->belongsToMany(Article::class);
|
// return $this->belongsToMany(Article::class);
|
||||||
|
return $this->hasMany(Article::class);
|
||||||
break;
|
break;
|
||||||
case self::TYPE_ADVERT:
|
case self::TYPE_ADVERT:
|
||||||
|
case self::TYPE_PHOTO:
|
||||||
return $this->hasMany(Advert::class);
|
return $this->hasMany(Advert::class);
|
||||||
break;
|
break;
|
||||||
|
case self::TYPE_VIDEO:
|
||||||
|
return $this->hasMany(Video::class);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function childrens()
|
public function childrens(): HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(self::class, 'parent_id');
|
return $this->hasMany(self::class, 'parent_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function parent()
|
public function parent(): HasOne
|
||||||
{
|
{
|
||||||
return $this->hasOne(self::class, 'id', 'parent_id');
|
return $this->hasOne(self::class, 'id', 'parent_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function article()
|
public function article(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Article::class);
|
return $this->belongsTo(Article::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: 获取当前分类及子分类ID
|
* Notes: 获取当前分类及子分类ID
|
||||||
|
*
|
||||||
* @Author: <C.Jason>
|
* @Author: <C.Jason>
|
||||||
* @Date : 2020/4/6 3:12 下午
|
* @Date : 2020/4/6 3:12 下午
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getAllChildrenId()
|
public function getAllChildrenId(): array
|
||||||
{
|
{
|
||||||
$ids = array_keys($this->buildSelectOptions([], $this->id));
|
$ids = array_keys($this->buildSelectOptions([], $this->id));
|
||||||
array_unshift($ids, $this->id);
|
|
||||||
|
|
||||||
return $ids;
|
if ($ids) {
|
||||||
|
array_unshift($ids, $this->id);
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [$this->id];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function articles(): BelongsToMany
|
// public function articles(): BelongsToMany
|
||||||
|
// {
|
||||||
|
// return $this->belongsToMany(Article::class);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function articles(): HasMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Article::class);
|
return $this->hasMany(Article::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 格式化description
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 15:24
|
||||||
|
*/
|
||||||
|
public function getDescriptionHtmlAttribute(): string
|
||||||
|
{
|
||||||
|
return str_replace("\n", "</br>", $this->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTopCategory($category_id)
|
||||||
|
{
|
||||||
|
$category = self::find($category_id);
|
||||||
|
|
||||||
|
while ($category) {
|
||||||
|
if ($category->parent) {
|
||||||
|
$category = $category->parent;
|
||||||
|
} else {
|
||||||
|
return $category;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
119
app/Models/CategoryOld.php
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Traits\HasCovers;
|
||||||
|
use Encore\Admin\Traits\AdminBuilder;
|
||||||
|
use Encore\Admin\Traits\ModelTree;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
class CategoryOld extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
use AdminBuilder, ModelTree, HasCovers;
|
||||||
|
|
||||||
|
public const TYPE_SHOW = 'show';
|
||||||
|
public const TYPE_ARTICLE = 'article';
|
||||||
|
public const TYPE_ADVERT = 'advert';
|
||||||
|
public const TYPE_VIDEO = 'video';
|
||||||
|
public const TYPES = [
|
||||||
|
self::TYPE_ARTICLE => '文章列表',
|
||||||
|
self::TYPE_SHOW => '文章详情',
|
||||||
|
self::TYPE_ADVERT => '图片列表',
|
||||||
|
self::TYPE_VIDEO => '视频列表',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $cover_field = 'cover';
|
||||||
|
|
||||||
|
public function getLogoUrlAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->parseImageUrl($this->logo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getLinkAttribute(): string
|
||||||
|
{
|
||||||
|
return route('category.show', $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的数据
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany|\Illuminate\Database\Eloquent\Relations\HasMany|\Illuminate\Database\Eloquent\Relations\HasOne|null [type] [description]
|
||||||
|
*/
|
||||||
|
public function relations()
|
||||||
|
{
|
||||||
|
switch ($this->type) {
|
||||||
|
case self::TYPE_SHOW:
|
||||||
|
return $this->hasOne(Article::class)->where('id', $this->article_id);
|
||||||
|
break;
|
||||||
|
case self::TYPE_ARTICLE:
|
||||||
|
return $this->belongsToMany(Article::class);
|
||||||
|
break;
|
||||||
|
case self::TYPE_ADVERT:
|
||||||
|
return $this->hasMany(Advert::class);
|
||||||
|
break;
|
||||||
|
case self::TYPE_VIDEO:
|
||||||
|
return $this->hasMany(Video::class);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function childrens(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(self::class, 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parent(): HasOne
|
||||||
|
{
|
||||||
|
return $this->hasOne(self::class, 'id', 'parent_id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function article(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Article::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取当前分类及子分类ID
|
||||||
|
* @Author: <C.Jason>
|
||||||
|
* @Date : 2020/4/6 3:12 下午
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getAllChildrenId(): array
|
||||||
|
{
|
||||||
|
$ids = array_keys($this->buildSelectOptions([], $this->id));
|
||||||
|
if ($ids) {
|
||||||
|
array_unshift($ids, $this->id);
|
||||||
|
|
||||||
|
return $ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
// public function articles(): BelongsToMany
|
||||||
|
// {
|
||||||
|
// return $this->belongsToMany(Article::class);
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function articles(): HasMany
|
||||||
|
{
|
||||||
|
return $this->hasMany(Article::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 格式化description
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date : 2021/10/8 15:24
|
||||||
|
*/
|
||||||
|
public function getDescriptionHtmlAttribute(): string
|
||||||
|
{
|
||||||
|
return str_replace("\n", "</br>", $this->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,22 +1,16 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
use DateTimeInterface;
|
use DateTimeInterface;
|
||||||
|
use Encore\Admin\Traits\DefaultDatetimeFormat;
|
||||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||||
|
|
||||||
class Model extends Eloquent
|
class Model extends Eloquent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
use DefaultDatetimeFormat;
|
||||||
|
|
||||||
protected $guarded = [];
|
protected $guarded = [];
|
||||||
|
|
||||||
/**
|
|
||||||
* 为数组 / JSON 序列化准备日期。
|
|
||||||
*
|
|
||||||
* @param \DateTimeInterface $date
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
protected function serializeDate(DateTimeInterface $date)
|
|
||||||
{
|
|
||||||
return $date->format($this->dateFormat ?: 'Y-m-d H:i:s');
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
83
app/Models/Traits/HasCovers.php
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models\Traits;
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
|
trait HasCovers
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 获取封面图片字段(单图)
|
||||||
|
* @Date : 2021/3/16 4:34 下午
|
||||||
|
* @Author : < Jason.C >
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCoverField(): string
|
||||||
|
{
|
||||||
|
return $this->cover_field ?? 'cover';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 获取图片字段(多图)
|
||||||
|
* @Date : 2021/3/16 4:35 下午
|
||||||
|
* @Author : < Jason.C >
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPicturesField(): string
|
||||||
|
{
|
||||||
|
return $this->pictures_field ?? 'pictures';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 解析单图地址
|
||||||
|
* @Date : 2021/3/16 4:54 下午
|
||||||
|
* @Author : < Jason.C >
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCoverUrlAttribute(): string
|
||||||
|
{
|
||||||
|
$cover = $this->getAttribute($this->getCoverField());
|
||||||
|
|
||||||
|
return $this->parseImageUrl($cover);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 解析多图地址
|
||||||
|
* @Date : 2021/3/16 4:54 下午
|
||||||
|
* @Author : < Jason.C >
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getPicturesUrlAttribute(): array
|
||||||
|
{
|
||||||
|
$pictures = $this->getAttribute($this->getPicturesField());
|
||||||
|
|
||||||
|
if (empty($pictures)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return collect($pictures)->map(function ($picture) {
|
||||||
|
return $this->parseImageUrl($picture);
|
||||||
|
})->toArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes : 解析图片文件的实际展示地址
|
||||||
|
* @Date : 2021/3/16 4:53 下午
|
||||||
|
* @Author : < Jason.C >
|
||||||
|
* @param string|null $image
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function parseImageUrl(?string $image): string
|
||||||
|
{
|
||||||
|
if (empty($image)) {
|
||||||
|
return '';
|
||||||
|
} elseif (Str::startsWith($image, 'http')) {
|
||||||
|
return $image;
|
||||||
|
} else {
|
||||||
|
return Storage::url($image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Models\Traits;
|
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
|
|
||||||
trait HasOneCover
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼接图片全地址
|
|
||||||
* @author 玄尘 2020-03-05
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCoverPathAttribute(): ?string
|
|
||||||
{
|
|
||||||
if ($this->cover) {
|
|
||||||
return Storage::url($this->cover);
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
38
app/Models/Video.php
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use App\Models\Traits\BelongsToCategory;
|
||||||
|
use App\Models\Traits\HasCovers;
|
||||||
|
|
||||||
|
class Video extends Model
|
||||||
|
{
|
||||||
|
|
||||||
|
use HasCovers,
|
||||||
|
BelongsToCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 返回视频地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:43
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLinkUrlAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->parseImageUrl($this->link);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 返回视频详情地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:43
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getShowLinkAttribute(): string
|
||||||
|
{
|
||||||
|
return route('video.show', $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,9 +9,9 @@ use Illuminate\Support\ServiceProvider;
|
|||||||
//add fixed sql
|
//add fixed sql
|
||||||
class AppServiceProvider extends ServiceProvider
|
class AppServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register any application services.
|
* Register any application services.
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function register()
|
public function register()
|
||||||
@@ -21,14 +21,14 @@ class AppServiceProvider extends ServiceProvider
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap any application services.
|
* Bootstrap any application services.
|
||||||
*
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function boot()
|
public function boot()
|
||||||
{
|
{
|
||||||
$table = config('admin.extensions.config.table', 'admin_config');
|
// $table = config('admin.extensions.config.table', 'admin_config');
|
||||||
if (Schema::hasTable($table)) {
|
// if (Schema::hasTable($table)) {
|
||||||
Config::load();
|
// Config::load();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
1977
composer.lock
generated
11
config/article.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
// 不显示时间段文章
|
||||||
|
'no_time' => [
|
||||||
|
'118',
|
||||||
|
'131',
|
||||||
|
'133',
|
||||||
|
'134',
|
||||||
|
]
|
||||||
|
];
|
||||||
23
config/template.php
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
return [
|
||||||
|
'name' => '分类模板',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分类所有模板
|
||||||
|
*/
|
||||||
|
'lists' => [
|
||||||
|
'djwh' => '党建文化',
|
||||||
|
'images' => '图片',
|
||||||
|
'jianjie' => '简介',
|
||||||
|
'kjpt' => '科技平台',
|
||||||
|
'kxjs' => '学科建设与人才队伍',
|
||||||
|
'kxyj' => '科学研究',
|
||||||
|
'personnel' => '人员列表',
|
||||||
|
'photos' => 'XXXXXX',
|
||||||
|
'sqhg' => '所庆回顾',
|
||||||
|
'videos' => '媒体宣传视频',
|
||||||
|
'xh_qk' => '学会与期刊',
|
||||||
|
'yjsjy' => '研究生教育',
|
||||||
|
],
|
||||||
|
];
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateVideosTable extends Migration
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('videos', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedBigInteger('category_id')->index();
|
||||||
|
$table->string('title');
|
||||||
|
$table->string('cover');
|
||||||
|
$table->string('url')->nullable();
|
||||||
|
$table->integer('sort');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('videos');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,567 +0,0 @@
|
|||||||
@charset "utf-8";
|
|
||||||
|
|
||||||
/******基础样式开始******/
|
|
||||||
body {
|
|
||||||
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #333;
|
|
||||||
background: #fff;
|
|
||||||
text-align: justify;
|
|
||||||
text-justify: inter-ideograph;
|
|
||||||
background-image: url(about:blank);
|
|
||||||
background-attachment: fixed;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
table,
|
|
||||||
td {
|
|
||||||
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
|
|
||||||
font-size: 12px;
|
|
||||||
line-height: 24px;
|
|
||||||
color: #2e2e2e;
|
|
||||||
}
|
|
||||||
|
|
||||||
html,
|
|
||||||
body,
|
|
||||||
div,
|
|
||||||
span,
|
|
||||||
p,
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4,
|
|
||||||
h5,
|
|
||||||
h6,
|
|
||||||
em,
|
|
||||||
img,
|
|
||||||
strong,
|
|
||||||
blockquote,
|
|
||||||
sub,
|
|
||||||
sup,
|
|
||||||
tt,
|
|
||||||
i,
|
|
||||||
b,
|
|
||||||
dd,
|
|
||||||
dl,
|
|
||||||
dt,
|
|
||||||
form,
|
|
||||||
label,
|
|
||||||
table,
|
|
||||||
caption,
|
|
||||||
tbody,
|
|
||||||
tfoot,
|
|
||||||
thead,
|
|
||||||
tr,
|
|
||||||
th,
|
|
||||||
td,
|
|
||||||
ul,
|
|
||||||
li,
|
|
||||||
p,
|
|
||||||
a,
|
|
||||||
ol {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
s,
|
|
||||||
i,
|
|
||||||
em {
|
|
||||||
font-style: normal;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
ul,
|
|
||||||
ol,
|
|
||||||
li {
|
|
||||||
list-style-type: none;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
button,
|
|
||||||
input,
|
|
||||||
select,
|
|
||||||
textarea {
|
|
||||||
vertical-align: middle;
|
|
||||||
font-family: Microsoft Yahei;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3,
|
|
||||||
h4,
|
|
||||||
h5,
|
|
||||||
h6 {
|
|
||||||
font-size: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
address,
|
|
||||||
cite,
|
|
||||||
dfn,
|
|
||||||
em,
|
|
||||||
var {
|
|
||||||
font-style: normal;
|
|
||||||
}
|
|
||||||
|
|
||||||
code,
|
|
||||||
kbd,
|
|
||||||
pre,
|
|
||||||
samp {
|
|
||||||
font-family: courier new, courier, monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
sup {
|
|
||||||
vertical-align: text-top;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub {
|
|
||||||
vertical-align: text-bottom;
|
|
||||||
}
|
|
||||||
|
|
||||||
legend {
|
|
||||||
color: #000;
|
|
||||||
}
|
|
||||||
|
|
||||||
fieldset,
|
|
||||||
img {
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
button,
|
|
||||||
input,
|
|
||||||
select,
|
|
||||||
textarea {
|
|
||||||
font-size: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
border-collapse: collapse;
|
|
||||||
border-spacing: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: #6e6e6e;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.white,
|
|
||||||
.white a {
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.white,
|
|
||||||
a:hover {
|
|
||||||
color: green;
|
|
||||||
}
|
|
||||||
|
|
||||||
.clearfix {
|
|
||||||
clear: both;
|
|
||||||
height: 1px;
|
|
||||||
margin-top: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fw {
|
|
||||||
font-family: Microsoft Yahei, Arial, Helvetica, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fl {
|
|
||||||
float: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fr {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fb {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.disb {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.disn {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: 'impact';
|
|
||||||
src: url(impact.ttf);
|
|
||||||
src: url('impact.eot');
|
|
||||||
/* IE9 Compat Modes */
|
|
||||||
src: url('impact.eot?#iefix') format('embedded-opentype'),
|
|
||||||
/* IE6-IE8 */
|
|
||||||
url('impact.woff') format('woff'),
|
|
||||||
/* Modern Browsers */
|
|
||||||
url('impact.ttf') format('truetype'),
|
|
||||||
/* Safari, Android, iOS */
|
|
||||||
url('impact.svg#impact') format('svg');
|
|
||||||
/* Legacy iOS */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.area-dialog-ct {
|
|
||||||
width: 760px;
|
|
||||||
padding: 10px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bar {
|
|
||||||
height: 40px;
|
|
||||||
background: #003a52;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bar span,
|
|
||||||
.area-dialog-bar a {
|
|
||||||
line-height: 40px;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 14px;
|
|
||||||
padding: 0 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bar a#_a_c_close {
|
|
||||||
float: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-ct .area-dialog-content {
|
|
||||||
margin0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-ct .area-dialog-content::after {
|
|
||||||
clear: both;
|
|
||||||
display: block;
|
|
||||||
content: "";
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content li {
|
|
||||||
float: left;
|
|
||||||
padding: 10px;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .area-m-o {
|
|
||||||
width: 150px;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0 10px;
|
|
||||||
background: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content li .a-i-disable {
|
|
||||||
background: #d8d8d8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .area-m-o .a-check-num {
|
|
||||||
color: #d00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content input {
|
|
||||||
margin: -3px 5px 0 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .area-m-o lable {
|
|
||||||
line-height: 35px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content li .a-city-ct {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content li.area-item-mover {
|
|
||||||
background: #f7e76a;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content li.area-item-mover .a-city-ct {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bottom {
|
|
||||||
margin-top: 10px;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bottom a {
|
|
||||||
padding: 5px 15px;
|
|
||||||
color: #fff;
|
|
||||||
background: #007ba9;
|
|
||||||
font-size: 14px;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-bottom a:hover {
|
|
||||||
background: #003a52;
|
|
||||||
transition: 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .a-city-ct {
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 45px;
|
|
||||||
background: #f7e76a;
|
|
||||||
padding: 10px;
|
|
||||||
z-index: 100;
|
|
||||||
width: 480px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .a-city-ct:after {
|
|
||||||
content: "";
|
|
||||||
display: block;
|
|
||||||
clear: both;
|
|
||||||
}
|
|
||||||
|
|
||||||
.area-dialog-content .a-city-ct p {
|
|
||||||
float: left;
|
|
||||||
width: 100px;
|
|
||||||
padding: 5px 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.color-1 {
|
|
||||||
background-color: #249edc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-2 {
|
|
||||||
background-color: #17a668;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-3 {
|
|
||||||
background-color: #741d88;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-4 {
|
|
||||||
background-color: #da9627;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-5 {
|
|
||||||
background-color: #ff9933;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-6 {
|
|
||||||
background-color: #6666ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-7 {
|
|
||||||
background-color: #ff99ff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-8 {
|
|
||||||
background-color: #66cc66;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-9 {
|
|
||||||
background-color: #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-10 {
|
|
||||||
background-color: #ff7800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-11 {
|
|
||||||
background-color: #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-12 {
|
|
||||||
background-color: #ff3333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.color-white {
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bgcolor-gray {
|
|
||||||
background: #f5f5f5;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ipt-txt {
|
|
||||||
outline: none;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ipt-txt:focus,
|
|
||||||
.ipt-sec:focus {
|
|
||||||
border: 1px solid #0078b5;
|
|
||||||
box-shadow: #ccc 2px 4px 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-ipt {
|
|
||||||
line-height: 16px;
|
|
||||||
width: 150px;
|
|
||||||
height: 16px;
|
|
||||||
padding: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ipt-sec {
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ipt-radio,
|
|
||||||
.ipt-check {
|
|
||||||
vertical-align: middle;
|
|
||||||
margin: 0 5px 4px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btnBox {
|
|
||||||
width: 100%;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Submit {
|
|
||||||
width: 200px;
|
|
||||||
height: 42px;
|
|
||||||
line-height: 42px;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #fff;
|
|
||||||
border: 0;
|
|
||||||
outline: none;
|
|
||||||
margin: 0 auto;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s ease;
|
|
||||||
-moz-transition: background-color 0.3s ease;
|
|
||||||
-webkit-transition: background-color 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.Submit:hover {
|
|
||||||
background-color: #F60;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 弹性盒子布局 */
|
|
||||||
|
|
||||||
.flexrow {
|
|
||||||
display: -webkit-box;
|
|
||||||
/* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
|
|
||||||
display: -moz-box;
|
|
||||||
/* Firefox 17- */
|
|
||||||
display: -webkit-flex;
|
|
||||||
/* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
|
|
||||||
display: -moz-flex;
|
|
||||||
/* Firefox 18+ */
|
|
||||||
display: -ms-flexbox;
|
|
||||||
/* IE 10 */
|
|
||||||
display: flex;
|
|
||||||
/* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flexcolumn {
|
|
||||||
display: -webkit-box;
|
|
||||||
/* Chrome 4+, Safari 3.1, iOS Safari 3.2+ */
|
|
||||||
display: -moz-box;
|
|
||||||
/* Firefox 17- */
|
|
||||||
display: -webkit-flex;
|
|
||||||
/* Chrome 21+, Safari 6.1+, iOS Safari 7+, Opera 15/16 */
|
|
||||||
display: -moz-flex;
|
|
||||||
/* Firefox 18+ */
|
|
||||||
display: -ms-flexbox;
|
|
||||||
/* IE 10 */
|
|
||||||
display: flex;
|
|
||||||
/* Chrome 29+, Firefox 22+, IE 11+, Opera 12.1/17/18, Android 4.4+ */
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jc_start {
|
|
||||||
justify-content: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jc_end {
|
|
||||||
justify-content: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jc_sb {
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.jc_sr {
|
|
||||||
justify-content: space-around;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* align-items: stretch|center|flex-start|flex-end|baseline|initial|inherit; */
|
|
||||||
|
|
||||||
.ai_start {
|
|
||||||
align-items: flex-start;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ai_end {
|
|
||||||
align-items: flex-end;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex1 {
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex2 {
|
|
||||||
flex: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex3 {
|
|
||||||
flex: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex4 {
|
|
||||||
flex: 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flex5 {
|
|
||||||
flex: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* wrap 超出一行隐藏... 超出两行隐藏...*/
|
|
||||||
|
|
||||||
|
|
||||||
.overflow1 {
|
|
||||||
text-overflow: -o-ellipsis-lastline;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 1;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow2 {
|
|
||||||
text-overflow: -o-ellipsis-lastline;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow3 {
|
|
||||||
text-overflow: -o-ellipsis-lastline;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow4 {
|
|
||||||
text-overflow: -o-ellipsis-lastline;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 4;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
.overflow7 {
|
|
||||||
text-overflow: -o-ellipsis-lastline;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 7;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
}
|
|
||||||
|
|
||||||
.flexwrap{
|
|
||||||
flex-wrap: wrap;
|
|
||||||
}
|
|
||||||
6
public/assets/index/css/bootstrap.min.css
vendored
Normal file
14
public/assets/index/css/font-awesome-ie7.min.css
vendored
Normal file
1672
public/assets/index/css/font-awesome.css
vendored
Normal file
@@ -1,23 +0,0 @@
|
|||||||
@charset "utf-8";
|
|
||||||
html, body { font-family:"微软雅黑"}
|
|
||||||
/*
|
|
||||||
* jQuery图片轮播(焦点图)插件
|
|
||||||
* ADD.JENA.201206291027
|
|
||||||
* EDIT.JENA.201206300904
|
|
||||||
* Author: jena
|
|
||||||
* Demo: http://ishere.cn/demo/jquery.slidebox/
|
|
||||||
*/
|
|
||||||
div.slideBox{ position:relative; width:670px; height:300px; overflow:hidden;}
|
|
||||||
div.slideBox ul.items{ position:absolute; float:left; background:none; list-style:none; padding:0px; margin:0px;}
|
|
||||||
div.slideBox ul.items li{ float:left; background:none; list-style:none; padding:0px; margin:0px;}
|
|
||||||
div.slideBox ul.items li a{ float:left; line-height:normal !important; padding:0px !important; border:none/*For IE.ADD.JENA.201206300844*/;}
|
|
||||||
div.slideBox ul.items li a img{ margin:0px !important; padding:0px !important; display:block; border:none/*For IE.ADD.JENA.201206300844*/;}
|
|
||||||
div.slideBox div.tips{ position:absolute; bottom:0px; width:100%; height:32px; background-color:#000; overflow:hidden;}
|
|
||||||
div.slideBox div.tips div.title{ position:absolute; left:0px; top:0px; height:100%;}
|
|
||||||
div.slideBox div.tips div.title a{ color:#FFF; font-size:12px; line-height:32px; margin-left:10px; text-decoration:none;}
|
|
||||||
div.slideBox div.tips div.title a:hover{ text-decoration:underline !important;}
|
|
||||||
div.slideBox div.tips div.nums{ position:absolute; right:0px; top:0px; height:100%;}
|
|
||||||
div.slideBox div.tips div.nums a{ display:inline-block; >float:left/*For IE.ADD.JENA.201206300844*/; width:10px; height:10px; background-color:#FFF; text-indent:-99999px; margin:12px 5px 0px 0px;}
|
|
||||||
div.slideBox div.tips div.nums a.active{ background-color:#093;}
|
|
||||||
|
|
||||||
|
|
||||||
3262
public/assets/index/css/style.css
Normal file
601
public/assets/index/css/video.css
Normal file
@@ -0,0 +1,601 @@
|
|||||||
|
ul,
|
||||||
|
li {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
* {
|
||||||
|
-webkit-box-sizing: border-box;
|
||||||
|
-moz-box-sizing: border-box;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 视频播放器
|
||||||
|
* */
|
||||||
|
.video-box {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 0;
|
||||||
|
z-index: 99999999999;
|
||||||
|
}
|
||||||
|
.video-box button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0;
|
||||||
|
border: 0 none;
|
||||||
|
background: none;
|
||||||
|
text-align: center;
|
||||||
|
outline: none;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.video-box .video-button {
|
||||||
|
display: inline-block;
|
||||||
|
width: 36px;
|
||||||
|
height: 36px;
|
||||||
|
color: #fff;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.video-box .video-button i {
|
||||||
|
font-size: 56px;
|
||||||
|
}
|
||||||
|
.video-box .video-button.video-btn-volume i {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.video-box .video-button.video-tooltip-toggle i {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.video-box .video-video {
|
||||||
|
position: relative;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.video-box .video-video video {
|
||||||
|
position: relative;
|
||||||
|
display: block;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: #000;
|
||||||
|
}
|
||||||
|
.video-box .video-container {
|
||||||
|
width: 852px;
|
||||||
|
min-height: 550px;
|
||||||
|
max-height: 90vh;
|
||||||
|
background: #000000;
|
||||||
|
overflow: hidden;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.video-box .video-container.video-ready {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.video-box.quanping .video-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
position: relative;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
.video-box.video-playing .video-div.video-hide-ui .video-ui {
|
||||||
|
-webkit-transform: translateY(39px);
|
||||||
|
-ms-transform: translateY(39px);
|
||||||
|
transform: translateY(39px);
|
||||||
|
}
|
||||||
|
.video-box.heibian .video-container {
|
||||||
|
padding: 40px 0;
|
||||||
|
}
|
||||||
|
.video-box.heibian .video-div.video-hide-ui .video-ui {
|
||||||
|
-webkit-transform: translateY(0px);
|
||||||
|
-ms-transform: translateY(0px);
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
.video-box.heibian.quanping .video-container {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.video-box.hideui .video-div .video-ui {
|
||||||
|
-webkit-transform: translateY(39px);
|
||||||
|
-ms-transform: translateY(39px);
|
||||||
|
transform: translateY(39px);
|
||||||
|
}
|
||||||
|
.video-box .i {
|
||||||
|
font-family: none;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background-size: 80%;
|
||||||
|
background-position: center;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
.video-box .i:before,
|
||||||
|
.video-box i:after {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
.video-box .i-voice-on {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%20%20%3E%3Cg%20%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M2%2C10L2%2C20L5%2C20L13%2C25L13%2C5L5%2C10L5%2C10Z'%2F%3E%3Cpath%20d%3D'M18%2C10C%2022%2C12%2022%2C18%2018%2C20'%20%2F%3E%3Cpath%20d%3D'M22%2C6C%2028%2C10%2028%2C20%2022%2C24'%20%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-box .i-voice-off {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%20%20%3E%3Cg%20%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20%3E%3Cpath%20d%3D'M2%2C10L2%2C20L5%2C20L13%2C25L13%2C5L5%2C10L5%2C10Z'%2F%3E%3Cpath%20d%3D'M18%2C11L27%2C20'%20%2F%3E%3Cpath%20d%3D'M18%2C20L27%2C11'%20%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-box .i-bofang {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%3E%3Cg%20fill%3D'%23fff'%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M10%2C7L10%2C23L24%2C15z'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-box .i-zhanting {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%3E%3Cg%20fill%3D'%23fff'%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%3E%3Cpath%20d%3D'M7%2C7L7%2C23L11%2C23L11%2C7z'%2F%3E%3Cpath%20d%3D'M20%2C7L20%2C23L24%2C23L24%2C7z'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-box .i-quanping {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%20%20%3E%3Cg%20%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20%3E%3Cpath%20d%3D'M6%2C10L6%2C6L10%2C6'%2F%3E%3Cpath%20d%3D'M6%2C21L6%2C25L10%2C25'%2F%3E%3Cpath%20d%3D'M20%2C6L24%2C6L24%2C10'%2F%3E%3Cpath%20d%3D'M20%2C25L24%2C25L24%2C21'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-box .i-suoxiao {
|
||||||
|
background-image: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%20%20%3E%3Cg%20%20stroke%3D'%23fff'%20stroke-width%3D'1'%20stroke-linecap%3D'round'%20stroke-linejoin%3D'round'%20%3E%3Cpath%20d%3D'M6%2C10L10%2C10L10%2C6'%2F%3E%3Cpath%20d%3D'M6%2C21L10%2C21L10%2C25'%2F%3E%3Cpath%20d%3D'M20%2C6L20%2C10L24%2C10'%2F%3E%3Cpath%20d%3D'M20%2C25L20%2C21L24%2C21'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
}
|
||||||
|
.video-bg {
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
background: #000;
|
||||||
|
opacity: .9;
|
||||||
|
}
|
||||||
|
.video-div {
|
||||||
|
background: #000;
|
||||||
|
font-size: 0;
|
||||||
|
letter-spacing: -1px;
|
||||||
|
position: absolute;
|
||||||
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
.video-ui {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 41px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 6;
|
||||||
|
letter-spacing: .25px;
|
||||||
|
-webkit-transition: transform 0.3s ease;
|
||||||
|
-o-transition: transform 0.3s ease;
|
||||||
|
-ms-transition: transform 0.3s ease;
|
||||||
|
-moz-transition: transform 0.3s ease;
|
||||||
|
transition: transform 0.3s ease;
|
||||||
|
-webkit-transform: translateY(0px);
|
||||||
|
-o-transform: translateY(0px);
|
||||||
|
-ms-transform: translateY(0px);
|
||||||
|
-moz-transform: translateY(0px);
|
||||||
|
transform: translateY(0px);
|
||||||
|
}
|
||||||
|
.video-loading-pulse {
|
||||||
|
position: absolute;
|
||||||
|
width: 6px;
|
||||||
|
height: 24px;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
-webkit-animation: pulse 750ms infinite;
|
||||||
|
animation: pulse 750ms infinite;
|
||||||
|
-webkit-animation-delay: 250ms;
|
||||||
|
animation-delay: 250ms;
|
||||||
|
}
|
||||||
|
.video-loading-pulse:before,
|
||||||
|
.video-loading-pulse:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
display: block;
|
||||||
|
height: 16px;
|
||||||
|
width: 6px;
|
||||||
|
background: rgba(255, 255, 255, 0.2);
|
||||||
|
top: 50%;
|
||||||
|
-webkit-transform: translateY(-50%);
|
||||||
|
transform: translateY(-50%);
|
||||||
|
-webkit-animation: pulse 750ms infinite;
|
||||||
|
animation: pulse 750ms infinite;
|
||||||
|
}
|
||||||
|
.video-loading-pulse:before {
|
||||||
|
left: -12px;
|
||||||
|
}
|
||||||
|
.video-loading-pulse:after {
|
||||||
|
left: 12px;
|
||||||
|
-webkit-animation-delay: 500ms;
|
||||||
|
animation-delay: 500ms;
|
||||||
|
}
|
||||||
|
@keyframes pulse {
|
||||||
|
50% {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.video-loading {
|
||||||
|
opacity: 1;
|
||||||
|
color: #2c97f6;
|
||||||
|
font-size: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0px 0px 0px 3600px #000;
|
||||||
|
background: #000;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
-webkit-transition: all 0.5s;
|
||||||
|
-o-transition: all 0.5s;
|
||||||
|
-ms-transition: all 0.5s;
|
||||||
|
-moz-transition: all 0.5s;
|
||||||
|
transition: all 0.5s;
|
||||||
|
}
|
||||||
|
.video-loading i {
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
display: block;
|
||||||
|
border: 0.25rem solid rgba(255, 255, 255, 0.2);
|
||||||
|
border-top-color: white;
|
||||||
|
-webkit-animation: adeg 1s infinite linear;
|
||||||
|
-o-animation: adeg 1s infinite linear;
|
||||||
|
-ms-animation: adeg 1s infinite linear;
|
||||||
|
-moz-animation: adeg 1s infinite linear;
|
||||||
|
animation: adeg 1s infinite linear;
|
||||||
|
}
|
||||||
|
.video-loading .i-loading:before {
|
||||||
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
.video-loading.yihuanchun {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
@keyframes adeg {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.video-close {
|
||||||
|
position: absolute;
|
||||||
|
top: calc(52px + 2%);
|
||||||
|
right: 5%;
|
||||||
|
width: 30px;
|
||||||
|
height: 30px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: url("data:image/svg+xml;utf8,%3Csvg%20xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg'%20viewBox%3D'0%200%2030%2030'%3E%3Cg%20fill%3D'%23fff'%3E%3Cpath%20d%3D'M0%2C1L1%2C0L30%2C29L29%2C30z'%2F%3E%3Cpath%20d%3D'M29%2C0L29%2C0L30%2C1L1%2C30L0%2C29z'%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
.video-bofang.f-czspjuzhong {
|
||||||
|
z-index: 2;
|
||||||
|
font-size: 0;
|
||||||
|
}
|
||||||
|
.video-bofang.f-czspjuzhong i {
|
||||||
|
display: block;
|
||||||
|
border-radius: 50%;
|
||||||
|
text-align: center;
|
||||||
|
background-color: rgba(0, 0, 0, 0.8);
|
||||||
|
color: #fff;
|
||||||
|
width: 60px;
|
||||||
|
height: 60px;
|
||||||
|
cursor: pointer;
|
||||||
|
line-height: 62px;
|
||||||
|
font-size: 66px;
|
||||||
|
-webkit-transition: transform 1s;
|
||||||
|
-o-transition: transform 1s;
|
||||||
|
-ms-transition: transform 1s;
|
||||||
|
-moz-transition: transform 1s;
|
||||||
|
transition: transform 1s;
|
||||||
|
}
|
||||||
|
.video-hide {
|
||||||
|
z-index: 0 !important;
|
||||||
|
}
|
||||||
|
.video-hide i {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transform: scale(3);
|
||||||
|
-o-transform: scale(3);
|
||||||
|
-ms-transform: scale(3);
|
||||||
|
-moz-transform: scale(3);
|
||||||
|
transform: scale(3);
|
||||||
|
will-change: transform, opacity;
|
||||||
|
z-index: 0;
|
||||||
|
}
|
||||||
|
.video-progress {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
bottom: 36px;
|
||||||
|
height: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
-webkit-transition: all 0.3s ease;
|
||||||
|
-o-transition: all 0.3s ease;
|
||||||
|
-ms-transition: all 0.3s ease;
|
||||||
|
-moz-transition: all 0.3s ease;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.video-progress:hover .video-progress-hover,
|
||||||
|
.video-progress:hover .video-tooltip-time {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.video-tooltip-time {
|
||||||
|
width: 46px;
|
||||||
|
position: absolute;
|
||||||
|
height: 20px;
|
||||||
|
z-index: 5;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 8px;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 0.5s;
|
||||||
|
-o-transition: opacity 0.5s;
|
||||||
|
-ms-transition: opacity 0.5s;
|
||||||
|
-moz-transition: opacity 0.5s;
|
||||||
|
transition: opacity 0.5s;
|
||||||
|
}
|
||||||
|
.video-tooltip-time .video-tinytip-content {
|
||||||
|
margin-left: -23px;
|
||||||
|
}
|
||||||
|
.video-tooltip-time .video-text {
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
padding: 2px;
|
||||||
|
border-radius: 2px;
|
||||||
|
}
|
||||||
|
.video-tinytip .video-tooltip-content {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 4px;
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
font-size: 10px;
|
||||||
|
line-height: 20px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
.video-progress-padding {
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 16px;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 40;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
.video-progress-list {
|
||||||
|
position: relative;
|
||||||
|
top: -1px;
|
||||||
|
z-index: 39;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(255, 255, 255, 0.2);
|
||||||
|
-webkit-transform: scaleY(0.6);
|
||||||
|
-ms-transform: scaleY(0.6);
|
||||||
|
transform: scaleY(0.6);
|
||||||
|
transition: -webkit-transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
transition: transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
transition: transform 0.1s cubic-bezier(0.4, 0, 1, 1), -webkit-transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
}
|
||||||
|
.video-progress-play,
|
||||||
|
.video-progress-buffer,
|
||||||
|
.video-progress-hover {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.video-progress-buffer {
|
||||||
|
z-index: 33;
|
||||||
|
background-color: rgba(255, 255, 255, 0.4);
|
||||||
|
-webkit-transition: all 0.3s ease;
|
||||||
|
-o-transition: all 0.3s ease;
|
||||||
|
-ms-transition: all 0.3s ease;
|
||||||
|
-moz-transition: all 0.3s ease;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
}
|
||||||
|
.video-progress-hover {
|
||||||
|
z-index: 34;
|
||||||
|
background-color: rgba(255, 255, 255, 0.5);
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
-o-transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
-ms-transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
-moz-transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1);
|
||||||
|
}
|
||||||
|
.video-progress-play {
|
||||||
|
z-index: 35;
|
||||||
|
background-color: #2c97f6;
|
||||||
|
}
|
||||||
|
.video-progress-handle {
|
||||||
|
width: 13px;
|
||||||
|
height: 13px;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: -6.5px;
|
||||||
|
margin-top: -6.5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background-color: #2c97f6;
|
||||||
|
-webkit-transform: scale(0);
|
||||||
|
-ms-transform: scale(0);
|
||||||
|
transform: scale(0);
|
||||||
|
transition: -webkit-transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
transition: transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
transition: transform 0.1s cubic-bezier(0.4, 0, 1, 1), -webkit-transform 0.1s cubic-bezier(0.4, 0, 1, 1);
|
||||||
|
}
|
||||||
|
.video-progress-padding:hover + .video-progress-list {
|
||||||
|
-webkit-transform: scaleY(1);
|
||||||
|
-ms-transform: scaleY(1);
|
||||||
|
transform: scaleY(1);
|
||||||
|
}
|
||||||
|
.video-progress-padding:hover + .video-progress-list .video-progress-handle {
|
||||||
|
-webkit-transform: scale(1);
|
||||||
|
-ms-transform: scale(1);
|
||||||
|
transform: scale(1);
|
||||||
|
}
|
||||||
|
.video-controls-buttons {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
height: 36px;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0 10px;
|
||||||
|
z-index: 3;
|
||||||
|
}
|
||||||
|
.video-time-panel {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #777;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: top;
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 5px;
|
||||||
|
line-height: 36px;
|
||||||
|
letter-spacing: .25px;
|
||||||
|
}
|
||||||
|
.video-time-panel-current {
|
||||||
|
color: #DEDEDF;
|
||||||
|
}
|
||||||
|
.video-fullscreen {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.video-definition {
|
||||||
|
float: right;
|
||||||
|
width: 55px;
|
||||||
|
height: 36px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.video-definition .video-button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.video-definition .video-button span {
|
||||||
|
background: #fff;
|
||||||
|
color: #333;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 2px 5px;
|
||||||
|
}
|
||||||
|
.video-definition .video-tooltip-content {
|
||||||
|
width: 80px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -40px;
|
||||||
|
display: none;
|
||||||
|
background: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.video-definition:hover .video-tooltip-content {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 35px;
|
||||||
|
color: #aaa;
|
||||||
|
display: block;
|
||||||
|
z-index: 6;
|
||||||
|
}
|
||||||
|
.video-menu .video-menu-item {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
line-height: 36px;
|
||||||
|
font-size: 14px;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding: 0 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
position: relative;
|
||||||
|
height: 38px;
|
||||||
|
background: -webkit-linear-gradient(top, transparent 0, transparent 50%, rgba(255, 255, 255, 0.1) 50%) center bottom no-repeat;
|
||||||
|
background-size: 80% 1px;
|
||||||
|
}
|
||||||
|
.video-menu .video-menu-item:hover {
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(255, 255, 255, 0.12);
|
||||||
|
}
|
||||||
|
.video-menu .video-menu-item.video-active {
|
||||||
|
color: #FF8F00;
|
||||||
|
}
|
||||||
|
.video-volume {
|
||||||
|
float: right;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.video-popup .video-popup-content {
|
||||||
|
transform: scaleY(0);
|
||||||
|
bottom: 41px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.video-popup .video-popup-content:after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
bottom: -10px;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -5px;
|
||||||
|
border: 5px solid transparent;
|
||||||
|
border-top-color: rgba(0, 0, 0, 0.5);
|
||||||
|
}
|
||||||
|
.video-popup:hover .video-popup-content {
|
||||||
|
-webkit-transform: scaleY(1);
|
||||||
|
-o-transform: scaleY(1);
|
||||||
|
-ms-transform: scaleY(1);
|
||||||
|
-moz-transform: scaleY(1);
|
||||||
|
transform: scaleY(1);
|
||||||
|
}
|
||||||
|
.video-volume-slider {
|
||||||
|
left: 0;
|
||||||
|
width: 36px;
|
||||||
|
height: 100px;
|
||||||
|
cursor: pointer;
|
||||||
|
background: rgba(0, 0, 0, 0.8);
|
||||||
|
}
|
||||||
|
.video-tinytip-tiao {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
.video-volume-range {
|
||||||
|
position: absolute;
|
||||||
|
left: 16px;
|
||||||
|
top: 10px;
|
||||||
|
width: 4px;
|
||||||
|
height: 80px;
|
||||||
|
background-color: rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
.video-volume-range-current {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 50%;
|
||||||
|
background-color: #2c97f6;
|
||||||
|
}
|
||||||
|
.video-volume-handle {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: -4px;
|
||||||
|
width: 12px;
|
||||||
|
height: 3px;
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
@media (max-width: 998px) {
|
||||||
|
.video-box .video-container {
|
||||||
|
width: 80vw;
|
||||||
|
max-height: 80vh;
|
||||||
|
min-height: 44.9vw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media (max-width: 468px) {
|
||||||
|
.video-box .video-container {
|
||||||
|
width: 100vw;
|
||||||
|
min-height: 54.9vw;
|
||||||
|
}
|
||||||
|
.video-loading i {
|
||||||
|
font-size: 26px;
|
||||||
|
}
|
||||||
|
.video-definition {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* 视频结尾
|
||||||
|
* */
|
||||||
|
.f-czspjuzhong {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
-o-transform: translate(-50%, -50%);
|
||||||
|
-ms-transform: translate(-50%, -50%);
|
||||||
|
-moz-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
Before Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 956 KiB |
|
Before Width: | Height: | Size: 127 KiB |
|
Before Width: | Height: | Size: 161 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 7.5 KiB |
|
Before Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 57 KiB |
|
Before Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
BIN
public/assets/index/images/briefIcon/briefAlbum_back.jpg
Normal file
|
After Width: | Height: | Size: 31 KiB |
BIN
public/assets/index/images/briefIcon/briefAlbum_left.jpg
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/assets/index/images/briefIcon/briefAlbum_right.jpg
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/assets/index/images/briefIcon/briefAlbum_title_icon.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
public/assets/index/images/briefIcon/briefHistoy-back.jpg
Normal file
|
After Width: | Height: | Size: 109 KiB |
BIN
public/assets/index/images/briefIcon/briefHistoy-icon.png
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
public/assets/index/images/briefIcon/briefResearch-icon.png
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-1.png
Normal file
|
After Width: | Height: | Size: 3.8 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-2.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-3.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-4.png
Normal file
|
After Width: | Height: | Size: 4.1 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-5.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle-6.png
Normal file
|
After Width: | Height: | Size: 4.5 KiB |
BIN
public/assets/index/images/briefIcon/briefTitle.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/assets/index/images/briefOrganize.jpg
Normal file
|
After Width: | Height: | Size: 69 KiB |
BIN
public/assets/index/images/educateIcon.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/assets/index/images/educatePop.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 15 KiB |
BIN
public/assets/index/images/facade.jpg
Normal file
|
After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 3.7 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 4.6 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 39 KiB |
|
Before Width: | Height: | Size: 35 KiB |
|
Before Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 40 KiB |
BIN
public/assets/index/images/icon/close.png
Normal file
|
After Width: | Height: | Size: 598 B |
BIN
public/assets/index/images/icon/loading.gif
Normal file
|
After Width: | Height: | Size: 8.6 KiB |
BIN
public/assets/index/images/icon/next.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.7 KiB |