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
17af9925
Commit
17af9925
authored
Jul 06, 2020
by
杨昕
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编辑媒资
parent
3f24562e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
159 deletions
+106
-159
MediaController.php
app/Http/Controllers/Web/MediaController.php
+19
-7
MediaModel.php
app/Model/MediaModel.php
+18
-1
media_edit.blade.php
resources/views/admin/media/media_edit.blade.php
+59
-32
media_list.blade.php
resources/views/admin/media/media_list.blade.php
+10
-119
No files found.
app/Http/Controllers/Web/MediaController.php
View file @
17af9925
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers\Web
;
use
App\Model\MediaCategoryModel
;
use
App\Model\MediaModel
;
use
Illuminate\Http\Request
;
use
App\Http\Controllers\Controller
;
...
...
@@ -10,7 +11,6 @@ class MediaController extends Controller
{
public
function
index
(
Request
$request
){
$medias
=
MediaModel
::
mediaList
(
$request
);
return
view
(
'admin.media.media_list'
,
[
...
...
@@ -23,12 +23,24 @@ class MediaController extends Controller
}
public
function
edit
(
Request
$request
){
/**
* 编辑房间
* @param Request $request
* @param $id
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
* @throws \App\Exceptions\ControllerException
*/
public
function
edit
(
Request
$request
,
$id
){
$media
=
handler_drive
(
function
()
use
(
$request
,
$id
){
return
MediaModel
::
getMediaDetail
(
$id
);
});
$media_types
=
MediaCategoryModel
::
catgList
(
$request
);
return
view
(
'admin.media.media_edit'
,
[
'media'
=>
$media
,
'media_types'
=>
$media_types
]);
}
...
...
app/Model/MediaModel.php
View file @
17af9925
...
...
@@ -89,9 +89,26 @@ class MediaModel extends Eloquent
return
$id
;
}
public
static
function
upload
(
$request
){
/**
* 获取媒资详情
* @param $id
* @return mixed
* @throws DatabaseException
*/
public
static
function
getMediaDetail
(
$id
){
try
{
$media
=
MediaModel
::
find
(
$id
);
if
(
empty
(
$media
)){
throw
new
\Exception
(
'媒资不存在'
);
}
}
catch
(
\Exception
$exception
){
throw
new
DatabaseException
(
$exception
->
getMessage
());
}
return
$media
;
}
...
...
resources/views/admin/media/media_edit.blade.php
View file @
17af9925
...
...
@@ -38,7 +38,7 @@
<!--***** FORM GROUP *****-->
<div
class=
"card form"
id=
"form5"
>
<div
class=
"card-header"
>
<h3>
编辑
用户
</h3>
<h3>
编辑
媒资
</h3>
</div>
<br>
<form
id=
"newForm"
>
...
...
@@ -46,16 +46,33 @@
<input
type=
"hidden"
name=
"_token"
value=
"{{csrf_token()}}"
>
{{ method_field('PUT')}}
<input
type=
"hidden"
name=
"id"
value=
"{{$
info
['_id']}}"
>
<input
type=
"hidden"
name=
"id"
value=
"{{$
media
['_id']}}"
>
<div
class=
"form-group"
>
<label
for=
"
uesrname"
>
姓名
</label>
<label
for=
"
media_name"
>
媒资名称
</label>
<div
class=
"input-group "
>
<div
class=
"input-group-addon"
><i
class=
"
fa fa-user-o"
>
</i></div>
<input
type=
"text"
class=
"form-control"
name=
"name"
id=
"
uesr
name"
placeholder=
"姓名"
value=
"{{$
info['
name']}}"
>
<div
class=
"input-group-addon"
><i
class=
"
icon iconfont icon-title"
>

</i></div>
<input
type=
"text"
class=
"form-control"
name=
"name"
id=
"
media_
name"
placeholder=
"姓名"
value=
"{{$
media['media_
name']}}"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"exampleSelect1"
>
媒资类别
</label>
<select
class=
"form-control"
id=
"exampleSelect1"
>
@foreach($media_types as $media_type)
@if($media_type['name'] == $media['media_type'])
<option
value=
"{{$media['media_type']}}"
selected
>
{{$media_type['name']}}
</option>
@else
<option
value=
"{{$media['media_type']}}"
>
{{$media_type['name']}}
</option>
@endif
@endforeach
</select>
</div>
{{--
<div
class=
"form-group"
>
--}}
{{--
<label
for=
"mobile"
>
电话号码
</label>
--}}
...
...
@@ -66,36 +83,46 @@
{{--
</div>
--}}
{{--
</div>
--}}
{{--
<div
class=
"form-group"
>
--}}
{{--
<label
for=
"mobile"
>
邮箱
</label>
--}}
{{--
<div
class=
"input-group "
>
--}}
{{--
<div
class=
"input-group-addon"
><i
class=
"iconfont"
>

</i></div>
--}}
{{--
<input
type=
"text"
class=
"form-control"
name=
"email"
id=
"emial"
value=
"{{$info['email']}}"
--
}}
{{
--placeholder=
"邮箱"
>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
<div
class=
"form-group"
>
<label
for=
"mobile"
>
媒资视频链接
</label>
<div
class=
"input-group "
>
<div
class=
"input-group-addon"
><i
class=
"iconfont"
>

</i></div>
<input
type=
"text"
class=
"form-control"
name=
"media_url"
id=
"media_url"
value=
"{{$media['media_url']}}"
placeholder=
"视频链接"
>
</div>
</div>
<div
class=
"form-group"
>
<label
for=
"role"
>
状态
</label>
<div
class=
"input-group "
>
<div
class=
"checkbox"
>
<label
class=
"radio-inline"
>
<input
type=
"radio"
name=
"status"
value=
"1"
@
if
($
info
['
status
']
==
1
)
checked
@
endif
>
<span
class=
"mr5"
style=
"margin-right: 20px;"
>
不可用
</span>
</label>
</div>
<div
class=
"checkbox"
>
<label
class=
"radio-inline"
>
<input
type=
"radio"
name=
"status"
value=
"0"
@
if
($
info
['
status
']
==
0
)
checked
@
endif
>
<span
class=
"mr5"
style=
"margin-right: 20px;"
>
可用
</span>
</label>
</div>
<label
class=
"digest"
>
公钥
</label>
<textarea
class=
"form-control"
name=
"access_key"
id=
"digest"
rows=
"5"
placeholder=
"公钥"
>
{{$media['access_key']}}
</textarea>
</div>
</div>
<div
class=
"form-group"
>
<label
class=
"digest"
>
私钥
</label>
<textarea
class=
"form-control"
name=
"secret_key"
id=
"digest"
rows=
"5"
placeholder=
"私钥"
>
{{$media['secret_key']}}
</textarea>
</div>
{{--
<div
class=
"form-group"
>
--}}
{{--
<label
for=
"role"
>
状态
</label>
--}}
{{--
<div
class=
"input-group "
>
--}}
{{--
<div
class=
"checkbox"
>
--}}
{{--
<label
class=
"radio-inline"
>
--}}
{{--
<input
type=
"radio"
name=
"status"
value=
"1"
@
if
($
media
['
status
']
==
1
)
checked
@
endif
>
--}}
{{--
<span
class=
"mr5"
style=
"margin-right: 20px;"
>
不可用
</span>
--}}
{{--
</label>
--}}
{{--
</div>
--}}
{{--
<div
class=
"checkbox"
>
--}}
{{--
<label
class=
"radio-inline"
>
--}}
{{--
<input
type=
"radio"
name=
"status"
value=
"0"
@
if
($
info
['
status
']
==
0
)
checked
@
endif
>
--}}
{{--
<span
class=
"mr5"
style=
"margin-right: 20px;"
>
可用
</span>
--}}
{{--
</label>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
{{--
</div>
--}}
<button
type=
"submit"
onclick=
"registerUser();"
...
...
@@ -168,7 +195,7 @@
console
.
log
(
"formdata"
,
formdata
)
fetch_response
(
'POST'
,
"/web/me
mber/{{$info
['_id']}}"
,
formdata
).
then
(
function
(
res
)
{
fetch_response
(
'POST'
,
"/web/me
dia_manager/{{$media
['_id']}}"
,
formdata
).
then
(
function
(
res
)
{
if
(
res
.
code
==
200
)
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
...
...
@@ -177,7 +204,7 @@
top
:
'50%'
});
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/me
mb
er'
;
window
.
location
.
href
=
'/web/me
dia_manag
er'
;
},
2000
)
}
else
{
...
...
resources/views/admin/media/media_list.blade.php
View file @
17af9925
...
...
@@ -41,9 +41,8 @@
</button>
<form>
<input
type=
"text"
name=
"name"
class=
"form-input"
placeholder=
"用户名称"
value=
"{{$name}}"
>
<input
id=
"endDate"
width=
"312"
class=
"form-input"
/>
<input
type=
"text"
name=
"name"
class=
"form-input"
placeholder=
"媒资名称"
value=
"{{$name}}"
>
{{--
<input
id=
"endDate"
width=
"312"
class=
"form-input"
/>
--}}
<button
type=
"submit"
class=
"btn btn-primary"
>
搜索
</button>
</form>
{{--
<span
style=
"display: inline-block;height: 40px;line-height: 40px; float: right"
>
共{{$users->total()}}条
</span>
--}}
...
...
@@ -54,6 +53,8 @@
<tr
class=
"bg-info text-white"
>
<th>
序号
</th>
<th>
媒资编号
</th>
<th>
媒资名称
</th>
<th>
视频类别
</th>
<th>
视频地址
</th>
<th>
创建时间
</th>
<th>
操作
</th>
...
...
@@ -66,12 +67,14 @@
<tr
class=
"
<?php
if
(
$key
%
2
==
0
)
echo
'table-success'
;
?>
"
>
<td>
{{$key+1}}
</td>
<td
style=
"max-width: 150px;"
>
{{$media['_id']}}
</td>
<td
style=
"max-width: 300px;"
>
{{$media['media_url']}}
</td>
<td
style=
"max-width: 150px;"
>
{{$media['media_name']}}
</td>
<td
style=
"max-width: 50px;"
>
{{$media['media_type']}}
</td>
<td
style=
"max-width: 200px;"
>
{{$media['media_url']}}
</td>
<td
style=
"max-width: 100px;"
>
{{$media['create_time']}}
</td>
<td
class=
"td-manage"
>
<a
title=
"编辑"
href=
"/web/me
mb
er/{{$media['_id']}}/edit"
>
<a
title=
"编辑"
href=
"/web/me
dia_manag
er/{{$media['_id']}}/edit"
>
<i
class=
"iconfont"
>

</i>
</a>
{{--
<a
onclick=
"x_admin_show('修改密码','/web/password/{{$user->id}}',500,300)"
title=
"修改密码"
--
}}
...
...
@@ -138,7 +141,7 @@
confirm
:
function
()
{
fetch_response
(
'DELETE'
,
"/web/me
mb
er/"
+
id
).
then
(
function
(
res
)
{
fetch_response
(
'DELETE'
,
"/web/me
dia_manag
er/"
+
id
).
then
(
function
(
res
)
{
if
(
res
.
code
==
200
)
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
...
...
@@ -147,7 +150,7 @@
top
:
'50%'
});
setTimeout
(
function
()
{
window
.
location
.
href
=
'/web/me
mb
er'
;
window
.
location
.
href
=
'/web/me
dia_manag
er'
;
},
2000
)
}
else
{
$
(
'body'
).
toast
({
...
...
@@ -171,106 +174,8 @@
});
}
function
member_stop
(
obj
,
id
){
var
status
=
$
(
obj
).
attr
(
'status'
);
var
opts
=
new
FormData
();
var
title
=
"停用"
;
opts
.
append
(
'_token'
,
"{{csrf_token()}}"
)
if
(
status
==
'1'
){
title
=
"开启"
;
}
$
.
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/member/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/member/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
(
'已启用'
);
$
(
'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%'
});
}
});
}
},
cancel
:
function
()
{
$
(
'body'
).
toast
({
position
:
'fixed'
,
content
:
'已取消'
,
duration
:
1000
,
top
:
'50%'
});
}
});
}
// updateConfig(1);
$
(
'#endDate'
).
bind
(
"onclickOnce"
,
function
()
{
alert
(
'sdfs'
)
})
...
...
@@ -285,20 +190,6 @@
console
.
log
(
"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')"
);
});
// var options = {};
//
// options.locale = {
...
...
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