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
9b4235e2
Commit
9b4235e2
authored
Oct 24, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
overwrite teacher afterfind
parent
d53fd0fe
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
Teacher.php
src/common/models/Teacher.php
+18
-7
video-play.vue
src/frontend/web/js/home/components/video-play.vue
+2
-2
No files found.
src/common/models/Teacher.php
View file @
9b4235e2
...
@@ -32,7 +32,8 @@ class Teacher extends ActiveRecord
...
@@ -32,7 +32,8 @@ class Teacher extends ActiveRecord
return
'teacher'
;
return
'teacher'
;
}
}
public
function
formName
()
{
public
function
formName
()
{
return
''
;
return
''
;
}
}
...
@@ -45,13 +46,23 @@ class Teacher extends ActiveRecord
...
@@ -45,13 +46,23 @@ class Teacher extends ActiveRecord
[[
'name'
,
'class_id'
],
'required'
],
[[
'name'
,
'class_id'
],
'required'
],
[[
'user_id'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'user_id'
,
'created_at'
,
'updated_at'
],
'integer'
],
[[
'intro'
],
'string'
],
[[
'intro'
],
'string'
],
[[
'intro'
],
'default'
,
'value'
=>
''
],
[[
'intro'
],
'default'
,
'value'
=>
''
],
[[
'name'
],
'string'
,
'min'
=>
2
,
'max'
=>
64
],
[[
'name'
],
'string'
,
'min'
=>
2
,
'max'
=>
64
],
[[
'avatar'
],
'string'
,
'max'
=>
100
],
[[
'avatar'
],
'string'
,
'max'
=>
100
],
[[
'avatar'
],
'default'
,
'value'
=>
''
],
[[
'avatar'
],
'default'
,
'value'
=>
''
],
];
];
}
}
/**
* @inheritdoc
*/
public
function
afterFind
()
{
parent
::
afterFind
();
// TODO: Change the autogenerated stub
$this
->
avatar
=
User
::
getAvatarUrl
(
$this
->
avatar
);
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
@@ -101,7 +112,7 @@ class Teacher extends ActiveRecord
...
@@ -101,7 +112,7 @@ class Teacher extends ActiveRecord
//return $obj->select('t.id,t.user_id,t.name,t.avatar')->join('LEFT JOIN', $teacherTable.' t', 't.id=c.teacher_id')
//return $obj->select('t.id,t.user_id,t.name,t.avatar')->join('LEFT JOIN', $teacherTable.' t', 't.id=c.teacher_id')
// ->from(self::tableName().' c')->where(['c.class_id'=>$classId])->asArray()->all();
// ->from(self::tableName().' c')->where(['c.class_id'=>$classId])->asArray()->all();
return
$obj
->
select
(
'id,user_id,name,avatar'
)
->
where
([
'class_id'
=>
$classId
])
->
asArray
()
->
all
();
return
$obj
->
select
(
'id,user_id,name,avatar'
)
->
where
([
'class_id'
=>
$classId
])
->
asArray
()
->
all
();
}
}
/**
/**
...
@@ -113,7 +124,7 @@ class Teacher extends ActiveRecord
...
@@ -113,7 +124,7 @@ class Teacher extends ActiveRecord
*/
*/
public
static
function
filterOwnTeacherIds
(
$classId
,
$teacherIds
)
public
static
function
filterOwnTeacherIds
(
$classId
,
$teacherIds
)
{
{
$result
=
self
::
find
()
->
select
(
'id'
)
->
where
([
'class_id'
=>
$classId
,
'id'
=>
$teacherIds
])
->
all
();
$result
=
self
::
find
()
->
select
(
'id'
)
->
where
([
'class_id'
=>
$classId
,
'id'
=>
$teacherIds
])
->
all
();
$ids
=
[];
$ids
=
[];
...
@@ -132,10 +143,10 @@ class Teacher extends ActiveRecord
...
@@ -132,10 +143,10 @@ class Teacher extends ActiveRecord
* @param int $pageSize
* @param int $pageSize
* @return array
* @return array
*/
*/
public
static
function
fetchTeachers
(
$classId
,
$page
=
0
,
$pageSize
=
10
)
public
static
function
fetchTeachers
(
$classId
,
$page
=
0
,
$pageSize
=
10
)
{
{
$query
=
self
::
find
()
->
select
(
'id,user_id,name,avatar,intro'
)
$query
=
self
::
find
()
->
select
(
'id,user_id,name,avatar,intro'
)
->
where
([
'class_id'
=>
$classId
])
->
orderBy
([
'id'
=>
SORT_DESC
])
->
asArray
();
->
where
([
'class_id'
=>
$classId
])
->
orderBy
([
'id'
=>
SORT_DESC
])
->
asArray
();
$provider
=
new
ActiveDataProvider
([
$provider
=
new
ActiveDataProvider
([
'query'
=>
$query
,
'query'
=>
$query
,
...
...
src/frontend/web/js/home/components/video-play.vue
View file @
9b4235e2
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<div
class=
"video-detail-info"
>
<div
class=
"video-detail-info"
>
<div
v-for=
"(index,item) in coursewareInfo.teachers"
class=
"video-teacher"
>
<div
v-for=
"(index,item) in coursewareInfo.teachers"
class=
"video-teacher"
>
<a
data-toggle=
"modal"
data-target=
"
{{
{
'#teacherInfo'
+
index
}}
}
"><img
<a
data-toggle=
"modal"
data-target=
"
{{
{
'#teacherInfo'
+
index
}}
}
"><img
:src="
getFullPic
(
item
.
avatar
)
"></a>
:src="
item
.
avatar
"></a>
<p><a href="
javascript
:;
" data-toggle="
modal
" data-target="
#
myModal2
">{{item.name
}}
</a></p>
<p><a href="
javascript
:;
" data-toggle="
modal
" data-target="
#
myModal2
">{{item.name
}}
</a></p>
</div>
</div>
<div class="
video
-
sm
-
info
pull
-
right
">
<div class="
video
-
sm
-
info
pull
-
right
">
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
</div>
</div>
<div class="
modal
-
body
">
<div class="
modal
-
body
">
<div class="
teacher
-
info
text
-
center
">
<div class="
teacher
-
info
text
-
center
">
<img :src="
getFullPic
(
item
.
avatar
)
">
<img :src="
item
.
avatar
">
<h3>{{item.name
}}
</h3>
<h3>{{item.name
}}
</h3>
<p class="
teacher
-
detail
">{{{item.intro
}}
}
</p>
<p class="
teacher
-
detail
">{{{item.intro
}}
}
</p>
</div>
</div>
...
...
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