Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
media-resource
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨昕
media-resource
Commits
ef0a079d
Commit
ef0a079d
authored
Apr 02, 2021
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加模板文件
parent
bae3e6ca
Pipeline
#14105
passed with stages
in 15 minutes 38 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
91 additions
and
1 deletions
+91
-1
MediasExport.php
app/Exports/MediasExport.php
+12
-1
MubanExport.php
app/Exports/MubanExport.php
+58
-0
MediaController.php
app/Http/Controllers/Web/MediaController.php
+9
-0
batch_media.blade.php
resources/views/admin/media/batch_media.blade.php
+12
-0
No files found.
app/Exports/MediasExport.php
View file @
ef0a079d
...
@@ -7,8 +7,9 @@ use Maatwebsite\Excel\Concerns\FromArray;
...
@@ -7,8 +7,9 @@ use Maatwebsite\Excel\Concerns\FromArray;
use
Maatwebsite\Excel\Concerns\FromQuery
;
use
Maatwebsite\Excel\Concerns\FromQuery
;
use
Maatwebsite\Excel\Concerns\Exportable
;
use
Maatwebsite\Excel\Concerns\Exportable
;
use
Maatwebsite\Excel\Concerns\WithHeadings
;
use
Maatwebsite\Excel\Concerns\WithHeadings
;
use
Maatwebsite\Excel\Concerns\WithColumnWidths
;
class
MediasExport
implements
WithHeadings
,
FromArray
class
MediasExport
implements
WithHeadings
,
FromArray
,
WithColumnWidths
{
{
use
Exportable
;
use
Exportable
;
...
@@ -17,6 +18,16 @@ class MediasExport implements WithHeadings,FromArray
...
@@ -17,6 +18,16 @@ class MediasExport implements WithHeadings,FromArray
$this
->
media_ids
=
$params
;
$this
->
media_ids
=
$params
;
}
}
public
function
columnWidths
()
:
array
{
return
[
'A'
=>
30
,
'B'
=>
55
,
'C'
=>
45
,
'D'
=>
45
,
];
}
/**
/**
* 设置表头
* 设置表头
* @return array
* @return array
...
...
app/Exports/MubanExport.php
0 → 100644
View file @
ef0a079d
<?php
namespace
App\Exports
;
use
Maatwebsite\Excel\Concerns\FromArray
;
use
Maatwebsite\Excel\Concerns\Exportable
;
use
Maatwebsite\Excel\Concerns\WithHeadings
;
use
Maatwebsite\Excel\Concerns\WithColumnWidths
;
use
Maatwebsite\Excel\Concerns\WithStyles
;
use
PhpOffice\PhpSpreadsheet\Worksheet\Worksheet
;
class
MubanExport
implements
WithColumnWidths
,
WithHeadings
,
FromArray
,
WithStyles
{
use
Exportable
;
public
function
headings
()
:
array
{
return
[
'#'
,
'视频名称'
,
'媒资编号'
,
];
}
/**
* 设置表头
* @return array
*/
public
function
columnWidths
()
:
array
{
return
[
'B'
=>
55
,
'C'
=>
45
,
];
}
public
function
array
()
:
array
{
return
[
[
""
,
"【第一章马克思主义哲学是科学的世界观和方法论第一节哲学及其基本问题】.mp4"
,
"mda-250f994a93f2688ba225532c641b2a34"
],
[
""
,
"【19课堂】2021.03.02-月半时政-脱贫攻坚-公基-李浩祥】.mp4"
,
"mda-a4c0ad458d3592ff798277a42cb57be6"
],
[
""
,
"第二列是非必填项"
,
"媒资编号为必填项"
]
];
}
public
function
styles
(
Worksheet
$sheet
)
{
return
[
'B4'
=>
[
'font'
=>
[
'bold'
=>
true
]],
'C4'
=>
[
'font'
=>
[
'bold'
=>
true
]],
];
}
}
app/Http/Controllers/Web/MediaController.php
View file @
ef0a079d
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
App\Http\Controllers\Web
;
namespace
App\Http\Controllers\Web
;
use
App\Exports\MediasExport
;
use
App\Exports\MediasExport
;
use
App\Exports\MubanExport
;
use
App\Imports\MediasImport
;
use
App\Imports\MediasImport
;
use
App\Model\MediaCategoryModel
;
use
App\Model\MediaCategoryModel
;
use
App\Model\MediaModel
;
use
App\Model\MediaModel
;
...
@@ -232,19 +233,27 @@ class MediaController extends Controller
...
@@ -232,19 +233,27 @@ class MediaController extends Controller
*/
*/
public
function
export_batch_media
(
Request
$request
){
public
function
export_batch_media
(
Request
$request
){
$type
=
$request
->
type
??
'media'
;
$type
=
$request
->
type
??
'media'
;
$data
=
null
;
$data
=
null
;
switch
(
$type
){
switch
(
$type
){
case
'media'
:
case
'media'
:
$data
=
new
MediasExport
([
"mda-f72b5ea1c0dfc7203bf7ac522cd8baf9"
,
"mda-f6eb263d99752afc"
]);
$data
=
new
MediasExport
([
"mda-f72b5ea1c0dfc7203bf7ac522cd8baf9"
,
"mda-f6eb263d99752afc"
]);
break
;
break
;
case
'muban'
:
$data
=
new
MubanExport
();
break
;
default
:
default
:
$data
=
new
MediasExport
([
"mda-f72b5ea1c0dfc7203bf7ac522cd8baf9"
,
"mda-f6eb263d99752afc"
]);
$data
=
new
MediasExport
([
"mda-f72b5ea1c0dfc7203bf7ac522cd8baf9"
,
"mda-f6eb263d99752afc"
]);
break
;
break
;
}
}
return
Excel
::
download
(
$data
,
$type
.
'.xlsx'
);
return
Excel
::
download
(
$data
,
$type
.
'.xlsx'
);
}
}
/**
/**
...
...
resources/views/admin/media/batch_media.blade.php
View file @
ef0a079d
...
@@ -44,9 +44,14 @@
...
@@ -44,9 +44,14 @@
</form>
</form>
<div
class=
"muban"
>
<span
class=
"btn btn-info btn-small"
><a
href=
"{{asset('/web/media_manager/export_batch_media?type=muban')}}"
>
模板文件
</a></span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -68,6 +73,13 @@
...
@@ -68,6 +73,13 @@
.batch-media
{
.batch-media
{
margin-top
:
10px
;
margin-top
:
10px
;
}
}
.muban
{
padding-top
:
30px
;
padding-left
:
10px
;
}
.muban
a
{
color
:
#eee
;
}
</style>
</style>
<script>
<script>
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment