Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gk-online-teacher
Project
Project
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
huanglu
gk-online-teacher
Commits
f4920dd0
Commit
f4920dd0
authored
Dec 24, 2020
by
晏成浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 计时器
parent
0a527cae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
127 additions
and
6 deletions
+127
-6
index.vue
src/views/paint-screen/components/answer-dialog/index.vue
+5
-4
index.vue
src/views/paint-screen/components/timer/index.vue
+113
-0
index.vue
src/views/paint-screen/index.vue
+9
-2
No files found.
src/views/paint-screen/components/answer-dialog/index.vue
View file @
f4920dd0
...
...
@@ -22,7 +22,7 @@
</div>
</div>
<div
v-if=
"isShowContent"
class=
"answer-dialog"
@
click=
"$event.stopPropagation()"
>
<div
v-for=
"(item,idx) in replyList"
:key=
"idx"
class=
"student-as-box"
:style=
"
{borderColor:item.answer?'#42b983':'rgba(70, 131, 230, .3)
'}">
<div
@
click=
"handleShowImg(item)"
v-for=
"(item,idx) in replyList"
:key=
"idx"
class=
"student-as-box"
:style=
"
{borderColor:item.answer?'#42b983':'rgba(70, 131, 230, .3)',cursor:'pointer
'}">
<img
:src=
"require('@/assets/images/icon-student-avator.png')"
alt=
""
>
<div
class=
"info-box"
>
<p>
{{
item
.
username
}}
</p>
...
...
@@ -30,7 +30,8 @@
<!--
<span></span>
-->
<!-- 没答案 选择题-->
<span
v-if=
"!item.type||item.type!==1"
>
{{
item
.
answer
||
'正在答题中'
}}
</span>
<img
v-else
@
click=
"handleShowImg(item.answer)"
:src=
"item.answer"
alt=
""
>
<span
v-else
>
{{
'答案已提交'
}}
</span>
<!--
<img
v-else
@
click=
"handleShowImg(item.answer)"
:src=
"item.answer"
alt=
""
>
-->
</div>
</div>
</div>
...
...
@@ -88,8 +89,8 @@ export default {
console
.
log
(
'teacher-stop-answer success: '
,
res
);
})
},
handleShowImg
(
imgSrc
)
{
this
.
imgSrc
=
imgSrc
handleShowImg
(
payload
)
{
if
(
`
${
payload
.
type
}
`
===
'1'
)
this
.
imgSrc
=
payload
.
answer
},
handleImgClick
(
e
)
{
// this.imgSrc = ''
...
...
src/views/paint-screen/components/timer/index.vue
0 → 100644
View file @
f4920dd0
<!--临时 演示用的计时器-->
<
template
>
<div
class=
"timer"
>
<div
class=
"set-time-box"
>
<el-input-number
v-model=
"setMinutes"
:step=
"1"
step-strictly
style=
"margin-right: 10px"
></el-input-number>
分
<el-input-number
v-model=
"setSeconds"
:step=
"1"
step-strictly
style=
"margin-right: 10px;margin-left: 10px"
></el-input-number>
秒
</div>
<div
class=
"content-box"
>
<div
class=
"minutes-box"
>
{{
getNumberWithString
(
timerMinutes
)
}}
</div>
:
<div
class=
"seconds-box"
>
{{
getNumberWithString
(
timerSecs
)
}}
</div>
</div>
<div
class=
"tool-box"
>
<el-button
type=
"primary"
@
click=
"handleTimerStart"
style=
"margin-right: 15px"
>
开始
</el-button>
<el-button
type=
"success"
@
click=
"handleTimerFinish"
style=
"margin-left: 15px"
>
结束
</el-button>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'timer'
,
data
()
{
return
{
setMinutes
:
5
,
setSeconds
:
0
,
// 剩余分钟
timerMinutes
:
0
,
// 剩余秒数
timerSecs
:
0
,
// 开始时间,
startTime
:
null
,
// timer
timer
:
null
,
}
},
computed
:
{
// 定时的秒数
// countSecs(){
// return
// },
},
mounted
()
{
},
methods
:
{
handleTimerStart
()
{
clearInterval
(
this
.
timer
)
this
.
timerMinutes
=
this
.
setMinutes
this
.
timerSecs
=
this
.
setSeconds
this
.
startTime
=
new
Date
().
getTime
()
/
1000
const
countSecs
=
this
.
setMinutes
*
60
+
this
.
setSeconds
this
.
timer
=
setInterval
(()
=>
{
// 距离开始过了多少秒
const
passSec
=
new
Date
().
getTime
()
/
1000
-
this
.
startTime
// 剩余秒数
const
rmSec
=
countSecs
-
passSec
if
(
rmSec
<
0
)
{
this
.
timerMinutes
=
0
this
.
timerSecs
=
0
clearInterval
(
this
.
timer
)
}
else
{
this
.
timerMinutes
=
Math
.
floor
(
rmSec
/
60
)
this
.
timerSecs
=
Math
.
floor
(
rmSec
%
60
)
}
},
100
)
},
handleTimerFinish
()
{
this
.
timerMinutes
=
0
this
.
timerSecs
=
0
clearInterval
(
this
.
timer
)
},
// 不足10 则 补0
getNumberWithString
(
val
)
{
if
(
val
<
10
)
return
`0
${
val
}
`
return
val
}
},
beforeDestroy
()
{
clearInterval
(
this
.
timer
)
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.timer
{
position
:
fixed
;
top
:
10px
;
left
:
120px
;
border-radius
:
20px
;
background
:
white
;
font-size
:
30px
;
padding
:
15px
;
.set-time-box
{
display
:
flex
;
font-size
:
20px
;
align-items
:
center
;
}
.content-box
{
margin
:
20px
0
;
display
:
flex
;
justify-content
:
center
;
font-weight
:
bold
;
font-size
:
50px
;
}
.tool-box
{
display
:
flex
;
justify-content
:
center
;
}
}
</
style
>
src/views/paint-screen/index.vue
View file @
f4920dd0
...
...
@@ -65,7 +65,7 @@
<!-- </div>-->
<!-- </div>-->
<answer-dialog
v-if=
"showAnsModal"
:question-img=
"currentImg"
:quick-response=
"quickResponseData"
@
question-exit=
"handleQuestionExit"
:reply-list=
"replyList"
/>
<timer
v-show=
"isShowTimer"
/>
</div>
</template>
<
script
>
...
...
@@ -84,6 +84,7 @@ import {
}
from
'@/assets/images/index'
import
HWRTC
from
'@/utils/hwrtc'
import
socket
from
'@/utils/socket'
import
Timer
from
'@/views/paint-screen/components/timer'
;
import
AnswerDialog
from
'./components/answer-dialog'
const
paintTypes
=
[
...
...
@@ -102,6 +103,7 @@ const paintTypes = [
// { title: '填空题', value: 2 } // 暂时屏蔽简答题
]
},
{
title
:
'timer'
,
name
:
'计时器'
},
// { title: 'question-stop', name: '停止答题' },
{
title
:
'full'
,
name
:
'全屏'
},
]
...
...
@@ -154,6 +156,7 @@ Vue.use(GeekDrawBoard)
export
default
{
components
:
{
Timer
,
AnswerDialog
},
data
()
{
...
...
@@ -174,7 +177,8 @@ export default {
currentIndex
:
0
,
ansModal
:
false
,
showAnsModal
:
false
,
quickResponseData
:
null
quickResponseData
:
null
,
isShowTimer
:
false
,
};
},
computed
:
{
...
...
@@ -201,6 +205,9 @@ export default {
// eslint-disable-next-line no-unused-expressions
this
.
$refs
.
pain_main
&&
this
.
$refs
.
pain_main
.
requestFullscreen
();
}
if
(
title
===
'timer'
)
{
this
.
isShowTimer
=
!
this
.
isShowTimer
}
},
handleToolItm
(
opt
)
{
this
.
ansModal
=
false
...
...
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