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
c8d53abb
Commit
c8d53abb
authored
Jul 09, 2020
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加媒资类别列表
parent
c04306c2
Pipeline
#9846
passed with stages
in 33 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
188 additions
and
240 deletions
+188
-240
MediaController.php
app/Http/Controllers/Api/Client/MediaController.php
+1
-1
MediaCategoryController.php
app/Http/Controllers/Web/MediaCategoryController.php
+2
-2
MediaModel.php
app/Model/MediaModel.php
+1
-1
media_edit.blade.php
resources/views/admin/media/media_edit.blade.php
+2
-2
list.blade.php
resources/views/admin/media_category/list.blade.php
+182
-234
No files found.
app/Http/Controllers/Api/Client/MediaController.php
View file @
c8d53abb
...
...
@@ -98,7 +98,7 @@ class MediaController extends Controller
SrsHookValidate
::
srsHookCallback
(
$request
,[
'media_name'
=>
'required'
,
'media_type'
=>
'required'
,
'media_type'
=>
'required'
,
'media_id'
=>
'required'
,
'access_key'
=>
''
,
'secret_key'
=>
''
,
...
...
app/Http/Controllers/Web/MediaCategoryController.php
View file @
c8d53abb
...
...
@@ -16,9 +16,9 @@ class MediaCategoryController extends Controller
$catgList
=
MediaCategoryModel
::
catgListPage
(
$request
);
return
$catgList
;
});
$data
[
'name'
]
=
$request
->
name
;
$data
[
'media_categories'
]
=
$result
;
return
view
(
'admin.media_category.list'
);
return
view
(
'admin.media_category.list'
,
$data
);
}
}
app/Model/MediaModel.php
View file @
c8d53abb
...
...
@@ -145,7 +145,7 @@ class MediaModel extends Eloquent
*/
$media_info
=
explode
(
"&"
,
$request
->
media_name
);
$mediaCatg
=
MediaCategoryModel
::
where
(
'
_id
'
,
$request
->
media_type
)
->
first
();
$mediaCatg
=
MediaCategoryModel
::
where
(
'
name
'
,
$request
->
media_type
)
->
first
();
if
(
empty
(
$mediaCatg
)){
throw
new
\Exception
(
"媒资类别不存在"
);
}
...
...
resources/views/admin/media/media_edit.blade.php
View file @
c8d53abb
...
...
@@ -61,9 +61,9 @@
@foreach($media_types as $media_type)
@if($media_type['name'] == $media['media_type'])
<option
value=
"{{$media
['media_type_id
']}}"
selected
>
{{$media_type['name']}}
</option>
<option
value=
"{{$media
_type['name
']}}"
selected
>
{{$media_type['name']}}
</option>
@else
<option
value=
"{{$media
['media_type_id
']}}"
>
{{$media_type['name']}}
</option>
<option
value=
"{{$media
_type['name
']}}"
>
{{$media_type['name']}}
</option>
@endif
@endforeach
...
...
resources/views/admin/media_category/list.blade.php
View file @
c8d53abb
...
...
@@ -3,6 +3,12 @@
@include('admin.common.commonMedia')
<link
rel=
"stylesheet"
href=
"{{ asset('xadmin/extra/datepicker/css/daterangepicker.css')}}"
>
<link
rel=
"stylesheet"
href=
"{{ asset('xadmin/extra/datepicker/css/htmleaf-demo.css')}}"
>
<script
src=
"{{ asset('xadmin/extra/datepicker/js/moment.js')}}"
></script>
<script
src=
"{{ asset('xadmin/extra/datepicker/js/daterangepicker.js')}}"
></script>
<body>
<!--====================================================
...
...
@@ -22,211 +28,80 @@
<div
class=
"card form"
>
<div
class=
"card-header"
>
<h3>
<i
class=
"fa fa-user-circle"
></i>
栏目
列表
</h3>
<h3>
媒资类别
列表
</h3>
</div>
<br>
<!--***** CONTENT *****-->
<div
class=
"row"
style=
"margin: 0 20px;"
>
<xblock>
<button
class=
"btn btn-primary"
onclick=
"x_admin_show('/web/news_category/create')"
>
<div
class=
"row ml20"
>
<div
class=
"xblock"
>
<button
class=
"btn btn-primary"
onclick=
"x_admin_show('/web/media_category/create')"
>
添加
</button>
<span
class=
"x-right"
>
共有数据:{{$count}} 条
</span>
</xblock>
<table
class=
"table table-condensed"
>
<form>
<input
type=
"text"
name=
"name"
class=
"form-input"
placeholder=
"类别名称"
value=
"{{$name}}"
>
<button
type=
"submit"
class=
"btn btn-primary"
>
搜索
</button>
</form>
<span
style=
"display: inline-block;height: 40px;line-height: 40px; float: right"
>
共{{$media_categories->total()}}条
</span>
</div>
<table
class=
"table table-hover"
>
<thead>
<tr>
<th>
ID
</th>
<th>
分类名
</th>
<th>
排序
</th>
<tr
class=
"bg-info text-white"
>
<th>
序号
</th>
<th>
类别编号
</th>
<th>
媒资类别名称
</th>
<th>
状态
</th>
{{--
<th>
链接
</th>
--}}
{{--
<th>
方法名称
</th>
--}}
<th>
描述
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody
class=
"x-cate"
>
@if (count($result)>=1)
@foreach($result as $v)
@if ($v['parent_id'] == 0)
@if(isset($v['son']))
<tr
cate-id=
"{{$v['id']}}"
fid=
"0"
>
<td>
{{$v['id']}}
</td>
<td><i
class=
"iconfont x-show"
status=
'true'
>

</i>
{{$v['title']}}
</td>
<td>
{{$v['sort']}}
</td>
@if($v['st']== 0)
<td>
启用
</td>
@else
<td>
禁用
</td>
@endif
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$v['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"news_category/{{$v['id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$v['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@foreach($v['son'] as $son)
@if(isset($son['son']))
<tr
cate-id=
"{{$son['id']}}"
fid=
"{{$v['id']}}"
>
<td>
{{$son['id']}}
</td>
<td>
├
<i
class=
"iconfont x-show"
status=
'true'
>

</i>
{{$son['title']}}
</td>
<td>
{{$son['sort']}}
</td>
@if($son['st']== 0)
<td>
启用
</td>
@else
<td>
禁用
</td>
@endif
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$son['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"news_category/{{$son['id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$son['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@foreach($son['son'] as $last_son)
<tr
cate-id=
"{{$last_son['id']}}"
fid=
"{{$son['id']}}"
>
<td>
{{$last_son['id']}}
</td>
<td>
├{{$last_son['title']}}
</td>
<td>
{{$last_son['sort']}}
</td>
@if($last_son['st']== 0)
<td>
启用
</td>
@else
<td>
禁用
</td>
@endif
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$last_son['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"news_category/{{$last_son['id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$last_son['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@endforeach
@else
<tr
cate-id=
"{{$son['id']}}"
fid=
"{{$v['id']}}"
>
<td>
{{$son['id']}}
</td>
<td>
├
<i
class=
"iconfont x-show"
status=
'true'
>

</i>
{{$son['title']}}
</td>
<td>
{{$son['sort']}}
</td>
@if($son['st']== 0)
<td>
启用
</td>
@else
<td>
禁用
</td>
@endif
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$son['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"news_category/{{$son['id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$son['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@endif
@endforeach
@else
<tr
cate-id=
"{{$v['id']}}"
fid=
"0"
>
<td>
{{$v['id']}}
</td>
<td><i
class=
"iconfont x-show"
status=
'true'
>

</i>
{{$v['title']}}
</td>
<td>
{{$v['sort']}}
</td>
@if($v['st']== 0)
<td>
启用
</td>
@else
<td>
禁用
</td>
@endif
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$v['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"news_category/{{$v['id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$v['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@endif
@else
<tr
cate-id=
"{{$v['id']}}"
fid=
"{{$v['parent_id']}}"
>
<td>
{{$v['id']}}
</td>
<td>
├{{$v['title']}}
</td>
<td>
{{$v['sort']}}
</td>
@if($v['st']== 0)
<td>
启用
</td>
<tbody>
@if(count($media_categories)>0)
@foreach ($media_categories as $key => $media_category)
<tr
class=
"
<?php
if
(
$key
%
2
==
0
)
echo
'table-success'
;
?>
"
>
<td>
{{$key+1}}
</td>
<td
style=
"max-width: 150px;"
>
{{$media_category['_id']}}
</td>
<td>
{{$media_category['name']}}
</td>
<td>
@if($media_category['status']==0)
启用
@else
<td>
禁用
</td>
停用
@endif
{{--
<td>
{{$v['link']}}
</td>
--}}
{{--
<td>
{{$v['slug']}}
</td>
--}}
<td>
{{$v['description']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
onclick=
"x_admin_show('编辑','news_category/{{$v['id']}}/edit',440,500)"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
<a
title=
"删除"
onclick=
"member_del(this,'{{$v['id']}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@endif
</td>
<td
class=
"td-manage"
>
<a
onclick=
"member_stop(this,'{{$media_category["
_id
"]}}')"
href=
"javascript:;"
status=
"{{$media_category['status']}}"
>
<i
class=
"iconfont"
>
@if( $media_category['status'] == 1 )

@else

@endif
</i>
</a>
<a
title=
"编辑"
href=
"/web/member/{{$media_category['_id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
{{--
<a
onclick=
"x_admin_show('修改密码','/web/password/{{$user->id}}',500,300)"
title=
"修改密码"
--
}}
{{
--href=
"javascript:;"
>
--}}
{{--
<i
class=
"iconfont"
>

</i>
--}}
{{--
</a>
--}}
<a
title=
"删除"
onclick=
"member_del(this,'{{$media_category["
_id
"]}}')"
href=
"javascript:;"
>
<i
class=
"iconfont"
>

</i>
</a>
</td>
</tr>
@endforeach
@else
<tr>
<td
colspan=
"
6
"
style=
"text-align:center"
>
暂无数据
</td>
<td
colspan=
"
9
"
style=
"text-align:center"
>
暂无数据
</td>
</tr>
@endif
</tbody>
</table>
<div
class=
"page"
>
<div>
{{$media_categories->appends(['name'=>$name])->links()}}
</div>
</div>
</div>
</div>
...
...
@@ -247,14 +122,12 @@
<script
src=
"{{ asset('xadmin/js/jquery.validate.js')}}"
></script>
<script
type=
"text/javascript"
>
function
x_admin_show
(
url
)
{
window
.
location
.
href
=
url
;
// window.open(url);
function
x_admin_show
(
url
){
window
.
location
.
href
=
url
;
}
/*权限-删除*/
function
member_del
(
row
,
id
)
{
function
member_del
(
row
,
id
){
$
.
confirm
({
...
...
@@ -262,70 +135,145 @@
// cancelButtonClass: 'btn-info',
cancelButtonClass
:
'btn-info'
,
confirmButtonClass
:
'btn-danger'
,
con
firmButton
:
'确认
'
,
c
ancelButton
:
'取消
'
,
c
ontent
:
'确认要删除吗?
'
,
con
tent
:
'确认要刪除吗?
'
,
c
onfirmButton
:
'确认
'
,
c
ancelButton
:
'取消
'
,
confirm
:
function
()
{
fetch_response
(
'DELETE'
,
"/web/news_category/"
+
id
).
then
(
function
(
res
)
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
res
.
msg
,
duration
:
1000
,
top
:
'50%'
});
if
(
res
.
code
==
200
)
{
fetch_response
(
'DELETE'
,
"/web/media_category/"
+
id
).
then
(
function
(
res
)
{
if
(
res
.
code
==
200
)
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
res
.
msg
,
duration
:
1000
,
top
:
'50%'
});
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/news_category'
;
},
2000
)
window
.
location
.
href
=
'/web/media_category'
;
},
2000
)
}
else
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
res
.
msg
,
duration
:
1000
,
top
:
'50%'
});
}
}).
error
(
function
(
err
)
{
console
.
log
(
'err'
)
})
},
cancel
:
function
()
{
$
.
alert
(
'cancel triggered!'
);
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
'已取消'
,
duration
:
1000
,
top
:
'50%'
});
}
});
}
$
(
"tbody.x-cate tr[fid!='0']"
).
hide
();
function
member_stop
(
obj
,
id
){
var
cateIds
=
[];
var
status
=
$
(
obj
).
attr
(
'status'
);
var
opts
=
new
FormData
();
var
title
=
"停用"
;
opts
.
append
(
'_token'
,
"{{csrf_token()}}"
)
function
getCateId
(
cateId
)
{
if
(
status
==
'1'
){
title
=
"开启"
;
}
$
(
"tbody tr[fid="
+
cateId
+
"]"
).
each
(
function
(
index
,
el
)
{
id
=
$
(
el
).
attr
(
'cate-id'
);
cateIds
.
push
(
id
);
getCateId
(
id
);
});
}
// 栏目多级显示效果
$
(
'.x-show'
).
click
(
function
()
{
if
(
$
(
this
).
attr
(
'status'
)
==
'true'
)
{
$
(
this
).
html
(
''
);
$
(
this
).
attr
(
'status'
,
'false'
);
cateId
=
$
(
this
).
parents
(
'tr'
).
attr
(
'cate-id'
);
$
(
"tbody tr[fid="
+
cateId
+
"]"
).
show
();
}
else
{
cateIds
=
[];
$
(
this
).
html
(
''
);
$
(
this
).
attr
(
'status'
,
'true'
);
cateId
=
$
(
this
).
parents
(
'tr'
).
attr
(
'cate-id'
);
getCateId
(
cateId
);
for
(
var
i
in
cateIds
)
{
$
(
"tbody tr[cate-id="
+
cateIds
[
i
]
+
"]"
).
hide
().
find
(
'.x-show'
).
html
(
''
).
attr
(
'status'
,
'true'
);
$
.
confirm
({
// confirmButtonClass: 'btn-info',
// cancelButtonClass: 'btn-info',
cancelButtonClass
:
'btn-info'
,
confirmButtonClass
:
'btn-danger'
,
content
:
'确认要'
+
title
+
'吗?'
,
confirmButton
:
'确认'
,
cancelButton
:
'取消'
,
confirm
:
function
()
{
if
(
title
==
'停用'
){
//发异步把用户状态进行更改
opts
.
append
(
'id'
,
id
);
opts
.
append
(
'status'
,
0
);
fetch_response
(
'POST'
,
'/web/media_category/disable'
,
opts
).
then
(
function
(
res
){
if
(
res
.
code
==
200
){
$
(
obj
).
attr
(
'title'
,
'启用'
)
$
(
obj
).
find
(
'i'
).
html
(
''
);
$
(
obj
).
parents
(
"tr"
).
find
(
".td-status"
).
find
(
'span'
).
addClass
(
'layui-btn-disabled'
).
html
(
'已停用'
);
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
'已停用'
,
duration
:
1000
,
top
:
'50%'
});
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/member'
;
},
2000
)
}
else
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
res
.
msg
,
duration
:
1000
,
top
:
'50%'
});
}
});
}
else
{
opts
.
append
(
'id'
,
id
);
opts
.
append
(
'status'
,
1
);
fetch_response
(
'POST'
,
'/web/media_category/disable'
,
opts
).
then
(
function
(
res
){
if
(
res
.
code
==
200
){
$
(
obj
).
attr
(
'title'
,
'停用'
)
$
(
obj
).
find
(
'i'
).
html
(
''
);
$
(
obj
).
parents
(
"tr"
).
find
(
".td-status"
).
find
(
'span'
).
removeClass
(
'layui-btn-disabled'
).
html
(
'已启用'
);
// layer.msg('已启用!',{icon: 6,time:1000},function(){
// window.location.reload();
// });
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
'已启用'
,
duration
:
1000
,
top
:
'50%'
});
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/media_category'
;
},
2000
)
}
else
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
res
.
msg
,
duration
:
1000
,
top
:
'50%'
});
}
});
}
},
cancel
:
function
()
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
'已取消'
,
duration
:
1000
,
top
:
'50%'
});
}
}
})
});
}
</script>
</body>
...
...
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