Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
d00b25bc
Commit
d00b25bc
authored
Oct 27, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
02ad470b
95b928f6
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
177 additions
and
18 deletions
+177
-18
QiniuTranscode.php
src/common/libs/QiniuTranscode.php
+8
-1
Teacher.php
src/common/models/Teacher.php
+28
-0
ClassesFilter.php
src/frontend/components/ClassesFilter.php
+7
-1
MobileFilter.php
src/frontend/components/MobileFilter.php
+33
-0
MyCourseController.php
src/frontend/controllers/MyCourseController.php
+6
-2
TeacherManagerController.php
src/frontend/controllers/TeacherManagerController.php
+26
-1
index.php
src/frontend/views/teacher-manager/index.php
+7
-2
style.css
src/frontend/web/css/style.css
+30
-11
index.js
src/frontend/web/js/teacher-manager/index.js
+31
-0
webpack.config.js
src/frontend/web/webpack.config.js
+1
-0
No files found.
src/common/libs/QiniuTranscode.php
View file @
d00b25bc
...
@@ -150,8 +150,15 @@ class QiniuTranscode
...
@@ -150,8 +150,15 @@ class QiniuTranscode
$fopsMain
.=
'/r/'
.
$target
[
'fps'
];
$fopsMain
.=
'/r/'
.
$target
[
'fps'
];
}
}
//print_r($avInfo);
//opcache_invalidate(__FILE__);
//exit;
//视频采样率对比,七牛文档指出如果给出的码率大于原码率,则会使用原码率转换,但某些视频仍然会出现码率变大,所以此处加上判断
//视频采样率对比,七牛文档指出如果给出的码率大于原码率,则会使用原码率转换,但某些视频仍然会出现码率变大,所以此处加上判断
$fopsAddon
.=
'/vb/'
.
(
$video
[
'bit_rate'
]
>
$target
[
'vb'
]
?
$target
[
'vb'
]
:
$video
[
'bit_rate'
]);
$bitRate
=
isset
(
$video
[
'bit_rate'
])
?
$video
[
'bit_rate'
]
:
(
isset
(
$avInfo
[
'format'
][
'bit_rate'
])
?
$avInfo
[
'format'
][
'bit_rate'
]
:
0
);
if
(
$bitRate
)
{
$fopsAddon
.=
'/vb/'
.
(
$bitRate
>
$target
[
'vb'
]
?
$target
[
'vb'
]
:
$bitRate
);
}
//编码对比
//编码对比
if
(
$video
[
'codec_name'
]
!=
'h264'
)
{
if
(
$video
[
'codec_name'
]
!=
'h264'
)
{
...
...
src/common/models/Teacher.php
View file @
d00b25bc
...
@@ -85,6 +85,20 @@ class Teacher extends ActiveRecord
...
@@ -85,6 +85,20 @@ class Teacher extends ActiveRecord
];
];
}
}
/**
* 删除当前讲师所有数据
*/
public
function
deleteMe
()
{
//删除头像
if
(
$this
->
avatar
)
{
UploadPools
::
deleteFile
(
'public:'
.
$this
->
avatar
);
}
CourseTeacher
::
deleteAll
([
'teacher_id'
=>
$this
->
id
]);
self
::
deleteAll
([
'id'
=>
$this
->
id
]);
}
/**
/**
* 获取指定课堂下所有讲师的简单列表
* 获取指定课堂下所有讲师的简单列表
*
*
...
@@ -149,4 +163,18 @@ class Teacher extends ActiveRecord
...
@@ -149,4 +163,18 @@ class Teacher extends ActiveRecord
return
$data
;
return
$data
;
}
}
/**
* 删除指定讲师所有数据
*
* @param int $teacherId
*/
public
static
function
deleteTeacher
(
$teacherId
)
{
$teacher
=
self
::
findOne
([
'id'
=>
$teacherId
]);
if
(
$teacher
)
{
$teacher
->
deleteMe
();
}
}
}
}
src/frontend/components/ClassesFilter.php
View file @
d00b25bc
...
@@ -52,8 +52,14 @@ class ClassesFilter extends ActionFilter
...
@@ -52,8 +52,14 @@ class ClassesFilter extends ActionFilter
}
}
if
(
$this
->
_checkStatus
&&
$class
[
'status'
]
!=
Classes
::
STATUS_OK
)
{
if
(
$this
->
_checkStatus
&&
$class
[
'status'
]
!=
Classes
::
STATUS_OK
)
{
switch
(
$class
[
'status'
])
{
case
Classes
::
STATUS_LOCKED
:
Utils
::
showWarn
(
'课堂被锁定无法访问!'
);
break
;
default
:
Utils
::
showWarn
(
'您提交的课堂资料尚未通过审核,无法访问此页面!'
);
Utils
::
showWarn
(
'您提交的课堂资料尚未通过审核,无法访问此页面!'
);
}
}
}
if
(
property_exists
(
Yii
::
$app
->
controller
,
'classStatus'
))
{
if
(
property_exists
(
Yii
::
$app
->
controller
,
'classStatus'
))
{
Yii
::
$app
->
controller
->
classStatus
=
$class
;
Yii
::
$app
->
controller
->
classStatus
=
$class
;
...
...
src/frontend/components/MobileFilter.php
0 → 100644
View file @
d00b25bc
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2016/10/27
* Time: 11:43
*/
namespace
frontend\components
;
use
common\libs\Utils
;
use
yii\base\ActionFilter
;
class
MobileFilter
extends
ActionFilter
{
protected
$message
;
public
function
setMessage
(
$message
)
{
$this
->
message
=
$message
;
}
public
function
beforeAction
(
$action
)
{
if
(
\Yii
::
$app
->
deviceDetect
->
isMobile
())
{
Utils
::
showWarn
(
$this
->
message
);
}
return
parent
::
beforeAction
(
$action
);
}
}
\ No newline at end of file
src/frontend/controllers/MyCourseController.php
View file @
d00b25bc
...
@@ -8,6 +8,7 @@ use common\models\CourseTeacher;
...
@@ -8,6 +8,7 @@ use common\models\CourseTeacher;
use
common\models\Courseware
;
use
common\models\Courseware
;
use
common\models\UploadPools
;
use
common\models\UploadPools
;
use
frontend\components\ClassesFilter
;
use
frontend\components\ClassesFilter
;
use
frontend\components\MobileFilter
;
use
frontend\models\CoursePublishForm
;
use
frontend\models\CoursePublishForm
;
use
Yii
;
use
Yii
;
use
yii\filters\AccessControl
;
use
yii\filters\AccessControl
;
...
@@ -38,10 +39,13 @@ class MyCourseController extends \yii\web\Controller
...
@@ -38,10 +39,13 @@ class MyCourseController extends \yii\web\Controller
'roles'
=>
[
'@'
]
'roles'
=>
[
'@'
]
]
]
]
]
],
],
[
'classes'
=>
[
'class'
=>
ClassesFilter
::
className
(),
'class'
=>
ClassesFilter
::
className
(),
'checkStatus'
=>
true
'checkStatus'
=>
true
],
[
'class'
=>
MobileFilter
::
className
(),
'only'
=>
[
'publish'
,
'edit'
],
'message'
=>
'移动端暂不支持发布课程'
]
]
];
];
}
}
...
...
src/frontend/controllers/TeacherManagerController.php
View file @
d00b25bc
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
...
@@ -4,6 +4,7 @@ namespace frontend\controllers;
use
common\components\Qiniu
;
use
common\components\Qiniu
;
use
common\libs\Utils
;
use
common\libs\Utils
;
use
common\models\CourseTeacher
;
use
common\models\Teacher
;
use
common\models\Teacher
;
use
common\models\UploadPools
;
use
common\models\UploadPools
;
use
common\models\User
;
use
common\models\User
;
...
@@ -146,5 +147,29 @@ class TeacherManagerController extends \yii\web\Controller
...
@@ -146,5 +147,29 @@ class TeacherManagerController extends \yii\web\Controller
return
Teacher
::
fetchTeacherNames
(
$classId
);
return
Teacher
::
fetchTeacherNames
(
$classId
);
}
}
/**
* 讲师管理
*
* @throws \yii\base\ExitException
*/
public
function
actionDelete
()
{
$teacherId
=
Yii
::
$app
->
request
->
post
(
'id'
,
0
);
if
(
!
$teacherId
)
{
Utils
::
ajaxResponse
(
false
,
'参数错误'
);
}
$teacher
=
Teacher
::
findOne
([
'id'
=>
$teacherId
,
'class_id'
=>
$this
->
classStatus
[
'id'
]]);
if
(
!
$teacher
)
{
Utils
::
ajaxResponse
(
false
,
'该讲师不存在或无权操作!'
);
}
//删除讲师与课程的关系
$teacher
->
deleteMe
();
Utils
::
ajaxResponse
(
true
);
}
}
}
src/frontend/views/teacher-manager/index.php
View file @
d00b25bc
<?php
<?php
/* @var $this yii\web\View */
/* @var $this yii\web\View */
use
frontend\assets\AppAsset
;
$this
->
title
=
'讲师管理'
;
$this
->
title
=
'讲师管理'
;
AppAsset
::
addScript
(
$this
,
'@web/assets/teacher_manager.js'
);
?>
?>
<div
class=
"teacher-list"
>
<div
class=
"teacher-list"
>
<?php
foreach
(
$data
as
$row
)
{
?>
<?php
foreach
(
$data
as
$row
)
{
?>
<div
class=
"col-md-3"
>
<div
class=
"col-md-3
TEACHER_ROW"
data-teacher-id=
"
<?=
$row
[
'id'
]
?>
"
>
<div
class=
"teacher-box"
>
<div
class=
"teacher-box"
>
<img
src=
"
<?=
\common\models\User
::
getAvatarUrl
(
$row
[
'avatar'
])
?>
"
>
<img
src=
"
<?=
\common\models\User
::
getAvatarUrl
(
$row
[
'avatar'
])
?>
"
>
<h3>
<?=
$row
[
'name'
]
?>
</h3>
<h3>
<?=
$row
[
'name'
]
?>
</h3>
<p>
<?=
$row
[
'intro'
]
?>
</p>
<p>
<?=
$row
[
'intro'
]
?>
</p>
<a
href=
"
<?=
\yii\helpers\Url
::
to
([
'teacher-manager/edit'
,
'id'
=>
$row
[
'id'
]])
?>
"
><i
class=
"icon-mode_edit"
></i></a>
<a
class=
"edit"
href=
"
<?=
\yii\helpers\Url
::
to
([
'teacher-manager/edit'
,
'id'
=>
$row
[
'id'
]])
?>
"
><i
class=
"icon-mode_edit"
></i></a>
<a
href=
"javascript:;"
class=
"delete"
><i
class=
"icon-trash"
></i></a>
</div>
</div>
</div>
</div>
<?php
}
?>
<?php
}
?>
...
...
src/frontend/web/css/style.css
View file @
d00b25bc
...
@@ -50,6 +50,13 @@ a:link,a:active,a:visited {
...
@@ -50,6 +50,13 @@ a:link,a:active,a:visited {
}
}
.logo
a
{
.logo
a
{
display
:
block
;
display
:
block
;
font-size
:
18px
;
color
:
#fff
;
height
:
60px
;
line-height
:
60px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
}
.logo
a
img
{
.logo
a
img
{
padding
:
21px
0
;
padding
:
21px
0
;
...
@@ -157,6 +164,15 @@ a:link,a:active,a:visited {
...
@@ -157,6 +164,15 @@ a:link,a:active,a:visited {
.avatar
>
a
{
.avatar
>
a
{
display
:
block
;
display
:
block
;
margin-top
:
15px
;
margin-top
:
15px
;
-webkit-transition
:
all
0.4s
ease
;
-o-transition
:
all
0.4s
ease
;
transition
:
all
0.4s
ease
;
}
.avatar
>
a
:hover
{
-webkit-transform
:
rotate
(
360deg
);
-ms-transform
:
rotate
(
360deg
);
-o-transform
:
rotate
(
360deg
);
transform
:
rotate
(
360deg
);
}
}
.avatar
>
a
>
img
{
.avatar
>
a
>
img
{
height
:
30px
;
height
:
30px
;
...
@@ -226,7 +242,7 @@ a:link,a:active,a:visited {
...
@@ -226,7 +242,7 @@ a:link,a:active,a:visited {
width
:
30px
;
width
:
30px
;
height
:
30px
;
height
:
30px
;
text-align
:
center
;
text-align
:
center
;
line-height
:
3
0
px
;
line-height
:
3
3
px
;
font-size
:
16px
;
font-size
:
16px
;
background-color
:
rgba
(
0
,
0
,
0
,
.3
);
background-color
:
rgba
(
0
,
0
,
0
,
.3
);
color
:
#fff
;
color
:
#fff
;
...
@@ -388,8 +404,6 @@ a:link,a:active,a:visited {
...
@@ -388,8 +404,6 @@ a:link,a:active,a:visited {
}
}
.teacher-box
>
a
{
.teacher-box
>
a
{
position
:
absolute
;
position
:
absolute
;
right
:
15px
;
top
:
15px
;
opacity
:
0
;
opacity
:
0
;
height
:
30px
;
height
:
30px
;
width
:
30px
;
width
:
30px
;
...
@@ -407,6 +421,17 @@ a:link,a:active,a:visited {
...
@@ -407,6 +421,17 @@ a:link,a:active,a:visited {
.teacher-box
>
a
:hover
{
.teacher-box
>
a
:hover
{
background-color
:
#2a6496
;
background-color
:
#2a6496
;
}
}
.teacher-box
>
a
.edit
{
top
:
15px
;
right
:
15px
;
}
.teacher-box
>
a
.delete
{
top
:
60px
;
right
:
15px
;
}
.teacher-box
>
p
{
.teacher-box
>
p
{
font-size
:
12px
;
font-size
:
12px
;
color
:
#999
;
color
:
#999
;
...
@@ -424,10 +449,6 @@ a:link,a:active,a:visited {
...
@@ -424,10 +449,6 @@ a:link,a:active,a:visited {
}
}
.teacher-box
:hover
>
img
{
.teacher-box
:hover
>
img
{
margin-top
:
50px
;
margin-top
:
50px
;
-webkit-transform
:
rotate
(
360deg
);
-ms-transform
:
rotate
(
360deg
);
-o-transform
:
rotate
(
360deg
);
transform
:
rotate
(
360deg
);
}
}
.teacher-box
:hover
>
p
{
.teacher-box
:hover
>
p
{
...
@@ -441,9 +462,6 @@ a:link,a:active,a:visited {
...
@@ -441,9 +462,6 @@ a:link,a:active,a:visited {
height
:
300px
;
height
:
300px
;
color
:
#999
;
color
:
#999
;
border-radius
:
3px
;
border-radius
:
3px
;
-webkit-transition
:
all
0.4s
ease
;
-o-transition
:
all
0.4s
ease
;
transition
:
all
0.4s
ease
;
}
}
.teacher-box
.add-teacher
a
:hover
{
.teacher-box
.add-teacher
a
:hover
{
text-decoration
:
none
;
text-decoration
:
none
;
...
@@ -974,7 +992,8 @@ textarea.input-r-control {
...
@@ -974,7 +992,8 @@ textarea.input-r-control {
line-height
:
22px
;
line-height
:
22px
;
}
}
.video-list-cnt
.teacher
b
{
.video-list-cnt
.teacher
b
{
color
:
red
;
color
:
#f7b940
;
font-weight
:
normal
;
}
}
.video-img-box
.outline
{
.video-img-box
.outline
{
position
:
absolute
;
position
:
absolute
;
...
...
src/frontend/web/js/teacher-manager/index.js
0 → 100644
View file @
d00b25bc
/**
* Created by pader on 2016/10/27.
*/
var
layer
=
require
(
"layer-js"
);
$
(
".TEACHER_ROW a.delete"
).
click
(
function
()
{
var
teacherId
=
$
(
this
).
closest
(
".TEACHER_ROW"
).
data
(
"teacherId"
);
layer
.
confirm
(
"确定删除该讲师吗?"
,
{
title
:
"删除讲师"
,
btn
:
[
'确定'
,
'取消'
]
},
function
()
{
var
idx
=
layer
.
msg
(
"正在提交.."
,
{
icon
:
16
,
shade
:
[
0.2
,
'#000'
],
time
:
0
});
$
.
post
(
"/teacher-manager/delete"
,
{
id
:
teacherId
},
function
(
t
)
{
layer
.
close
(
idx
);
if
(
t
.
status
)
{
layer
.
msg
(
"已删除指定讲师!"
,
{
time
:
1500
,
icon
:
1
,
end
:
function
()
{
location
.
reload
();
},
shade
:
[
0.2
,
'#000'
]
});
}
else
{
layer
.
alert
(
t
.
message
,
{
icon
:
5
,
title
:
"提示"
});
}
},
"json"
);
});
});
\ No newline at end of file
src/frontend/web/webpack.config.js
View file @
d00b25bc
...
@@ -25,6 +25,7 @@ var entry = {
...
@@ -25,6 +25,7 @@ var entry = {
home_video
:
[
js_dir
+
'/home/video.js'
],
home_video
:
[
js_dir
+
'/home/video.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_publish
:
[
js_dir
+
'/my-course/publish.js'
],
course_edit
:
[
js_dir
+
'/my-course/edit.js'
],
course_edit
:
[
js_dir
+
'/my-course/edit.js'
],
teacher_manager
:
[
js_dir
+
'/teacher-manager/index.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
teacher_form
:
[
js_dir
+
'/teacher-manager/form.js'
],
my_income
:
[
js_dir
+
'/my-income/index.js'
]
my_income
:
[
js_dir
+
'/my-income/index.js'
]
};
};
...
...
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