调整视频详情页
This commit is contained in:
@@ -35,15 +35,17 @@ class IndexController extends AdminController
|
|||||||
$grid->column('link', '视频地址')->downloadable();
|
$grid->column('link', '视频地址')->downloadable();
|
||||||
$grid->column('category.title', '分类名称');
|
$grid->column('category.title', '分类名称');
|
||||||
$grid->column('sort', '排序');
|
$grid->column('sort', '排序');
|
||||||
|
$grid->column('created_at', '发布时间');
|
||||||
|
|
||||||
return $grid;
|
return $grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a form builder.
|
* Make a form builder.
|
||||||
|
*
|
||||||
* @return Form
|
* @return Form
|
||||||
*/
|
*/
|
||||||
protected function form()
|
protected function form(): Form
|
||||||
{
|
{
|
||||||
$form = new Form(new Video());
|
$form = new Form(new Video());
|
||||||
|
|
||||||
@@ -90,6 +92,8 @@ class IndexController extends AdminController
|
|||||||
->required()
|
->required()
|
||||||
->help('数字越大越靠前');
|
->help('数字越大越靠前');
|
||||||
|
|
||||||
|
$form->datetime('created_at', '发布时间');
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
33
app/Http/Controllers/VideoController.php
Normal file
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'));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -12,11 +12,25 @@ class Article extends Model
|
|||||||
|
|
||||||
use HasCovers, BelongsToCategory;
|
use HasCovers, BelongsToCategory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 获取详情地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:46
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getLinkAttribute(): 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
|
public function getLogoUrlAttribute(): string
|
||||||
{
|
{
|
||||||
return $this->parseImageUrl($this->logo);
|
return $this->parseImageUrl($this->logo);
|
||||||
@@ -24,6 +38,7 @@ class Article extends Model
|
|||||||
|
|
||||||
/***
|
/***
|
||||||
* Notes: 获取详情内图片
|
* Notes: 获取详情内图片
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/10/8 11:58
|
* @Date : 2021/10/8 11:58
|
||||||
* @return mixed|string
|
* @return mixed|string
|
||||||
@@ -41,6 +56,7 @@ 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
|
||||||
@@ -66,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
|
||||||
@@ -88,6 +105,7 @@ class Article extends Model
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Notes: description
|
* Notes: description
|
||||||
|
*
|
||||||
* @Author: 玄尘
|
* @Author: 玄尘
|
||||||
* @Date : 2021/4/2 9:17
|
* @Date : 2021/4/2 9:17
|
||||||
* @param $query
|
* @param $query
|
||||||
@@ -101,10 +119,6 @@ class Article extends Model
|
|||||||
}
|
}
|
||||||
|
|
||||||
return $query->whereIn('category_id', $ids);
|
return $query->whereIn('category_id', $ids);
|
||||||
//
|
|
||||||
// return $query->whereHas('categories', function ($q) use ($ids) {
|
|
||||||
// $q->whereIN('id', $ids);
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,28 @@ class Video extends Model
|
|||||||
use HasCovers,
|
use HasCovers,
|
||||||
BelongsToCategory;
|
BelongsToCategory;
|
||||||
|
|
||||||
public function getlinkUrlAttribute(): string
|
/**
|
||||||
|
* Notes: 返回视频地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:43
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLinkUrlAttribute(): string
|
||||||
{
|
{
|
||||||
return $this->parseImageUrl($this->link);
|
return $this->parseImageUrl($this->link);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes: 返回视频详情地址
|
||||||
|
*
|
||||||
|
* @Author: 玄尘
|
||||||
|
* @Date: 2021/11/29 15:43
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getShowLinkAttribute(): string
|
||||||
|
{
|
||||||
|
return route('video.show', $this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -262,21 +262,19 @@
|
|||||||
poster="{{ getVideoByCate(29,'cover_url') }}"
|
poster="{{ getVideoByCate(29,'cover_url') }}"
|
||||||
style="object-fit: fill;">
|
style="object-fit: fill;">
|
||||||
</video>
|
</video>
|
||||||
{{-- <img class="srSpread-video-icon"--}}
|
|
||||||
{{-- src="/assets/index/images/srIcon/srSpread_icon.png"/>--}}
|
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="srSpread-video-cont-title">
|
<div class="srSpread-video-cont-title"
|
||||||
|
data-href="{{ getVideoByCate(29,'show_link') }}">
|
||||||
{{ getVideoByCate(29,'title') }}
|
{{ getVideoByCate(29,'title') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-12 col-md-7">
|
<div class="col-xs-12 col-md-7">
|
||||||
<ul class="srSpread-list">
|
<ul class="srSpread-list">
|
||||||
@if(getVideosByCate(29,8))
|
@if(getVideosByCate(29,10))
|
||||||
@foreach(getVideosByCate(29,8) as $video)
|
@foreach(getVideosByCate(29,10) as $video)
|
||||||
@if($loop->iteration>1)
|
@if($loop->iteration>1)
|
||||||
<li data-href="" class="publicHover">
|
<li data-href="{{ $video->show_link }}" class="publicHover">
|
||||||
<div class="srRrends-list-cont">
|
<div class="srRrends-list-cont">
|
||||||
<div class="srRrends-list-text">
|
<div class="srRrends-list-text">
|
||||||
<div class="ce-nowrap-multi srRrends-list-name">
|
<div class="ce-nowrap-multi srRrends-list-name">
|
||||||
@@ -307,14 +305,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="srRrendText">
|
<div class="srRrendText">
|
||||||
@if (getArticlesBYCate(30,2)->isNotEmpty())
|
@if (getArticlesBYCate(30,2)->isNotEmpty())
|
||||||
<div class="ce-img srRrends-list-img">
|
<div class="ce-img srRrends-list-img"
|
||||||
<span style="background-image: url({{ getArticlesBYCate(30)->cover_url }});"></span>
|
data-href="{{ getOneArticleBYCate(30)->link }}">
|
||||||
|
<span style="background-image: url({{ getOneArticleBYCate(30)->cover_url }});"></span>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
@if (getArticlesBYCate(30,2)->isNotEmpty())
|
@if (getArticlesBYCate(30,2)->isNotEmpty())
|
||||||
<ul class="srRrends-list">
|
<ul class="srRrends-list">
|
||||||
@foreach (getArticlesBYCate(30,2) as $info)
|
@foreach (getArticlesBYCate(30,2) as $info)
|
||||||
|
@if($loop->iteration>1)
|
||||||
<li data-href="{{ $info->link }}" class="publicHover">
|
<li data-href="{{ $info->link }}" class="publicHover">
|
||||||
<div class="srRrends-list-cont">
|
<div class="srRrends-list-cont">
|
||||||
<div class="srRrends-list-text">
|
<div class="srRrends-list-text">
|
||||||
@@ -327,34 +327,12 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@endif
|
||||||
@endforeach
|
@endforeach
|
||||||
</ul>
|
</ul>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{-- <div class="srSpread-atlas">--}}
|
|
||||||
{{-- <div class="srSpread-atlas-title"--}}
|
|
||||||
{{-- style="background-image: url(/assets/index/images/srIcon/srSpread_back_00.png);">--}}
|
|
||||||
{{-- {{ getOneCategory(30,'title') }}--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- <ul class="srSpread-atlas-list">--}}
|
|
||||||
{{-- @if (getArticlesBYCate(30,2)->isNotEmpty())--}}
|
|
||||||
{{-- @foreach (getArticlesBYCate(30,2) as $info)--}}
|
|
||||||
{{-- <li data-href="{{ $info->link }}">--}}
|
|
||||||
{{-- <div class="ce-img srSpread-atlas-img">--}}
|
|
||||||
{{-- <span style="background-image: url({{ $info->cover_url }});"></span>--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- <div class="srSpread-atlas-name">{{ $info->title }}</div>--}}
|
|
||||||
{{-- </li>--}}
|
|
||||||
{{-- @endforeach--}}
|
|
||||||
{{-- @endif--}}
|
|
||||||
{{-- </ul>--}}
|
|
||||||
{{-- <div class="srSpread-atlas-more" data-href="{{ getOneCategory(30,'link') }}">--}}
|
|
||||||
{{-- <span>查看更多></span>--}}
|
|
||||||
{{-- </div>--}}
|
|
||||||
{{-- </div> --}}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
36
resources/views/video/show.blade.php
Normal file
36
resources/views/video/show.blade.php
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
@extends('layouts.app')
|
||||||
|
|
||||||
|
@section('title', '视频详情')
|
||||||
|
|
||||||
|
@section('content')
|
||||||
|
|
||||||
|
<!-- 面包屑导航 -->
|
||||||
|
@include('category.navigation')
|
||||||
|
|
||||||
|
<!-- 内容 -->
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<!-- 左侧导航部分 -->
|
||||||
|
@include('category.left')
|
||||||
|
<!-- 右侧内容部分 -->
|
||||||
|
<div class="col-xs-12 col-md-9">
|
||||||
|
<div class="details-title">{{ $video->title }}</div>
|
||||||
|
<div class="details-time">
|
||||||
|
<span>{{ $video->created_at->format('Y-m-d') }}</span>
|
||||||
|
</div>
|
||||||
|
<div class="details-cont">
|
||||||
|
<video width="100%" height="100%" style="object-fit:fill" controls=""
|
||||||
|
src="{{ $video->link_url }}"
|
||||||
|
poster="{{ $video->cover_url }}">
|
||||||
|
</video>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- <div class="col-md-12 col-md-9">
|
||||||
|
<div class="no-searchCont">
|
||||||
|
<img src="/assets/index/images/org55.png"/>
|
||||||
|
<span>抱歉,暂无内容</span>
|
||||||
|
</div>
|
||||||
|
</div> -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
@endsection
|
||||||
@@ -15,7 +15,11 @@ Route::get('search', 'IndexController@search')->name('index.search');
|
|||||||
|
|
||||||
Route::get('articles/{article}', 'ArticleController@show')->name('article.show');
|
Route::get('articles/{article}', 'ArticleController@show')->name('article.show');
|
||||||
|
|
||||||
|
Route::get('videos/{video}', 'VideoController@show')->name('video.show');
|
||||||
|
|
||||||
Route::get('category/{category}', 'CategoryController@index')->name('category.show');
|
Route::get('category/{category}', 'CategoryController@index')->name('category.show');
|
||||||
|
|
||||||
|
|
||||||
//以下为导入数据
|
//以下为导入数据
|
||||||
Route::get('test/set_article_category', 'TestController@set_article_category');
|
Route::get('test/set_article_category', 'TestController@set_article_category');
|
||||||
Route::get('test/set_category', 'TestController@set_category');
|
Route::get('test/set_category', 'TestController@set_category');
|
||||||
|
|||||||
Reference in New Issue
Block a user