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
fd305480
Commit
fd305480
authored
Dec 23, 2020
by
晏成浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20201222_show_student_answer' into 'master'
zhibo See merge request
!1
parents
edc9740b
545c15bc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
189 additions
and
10 deletions
+189
-10
icon-student-avator.png
src/assets/images/icon-student-avator.png
+0
-0
index.vue
src/views/paint-screen/components/answer-dialog/index.vue
+137
-0
index.vue
src/views/paint-screen/index.vue
+52
-10
No files found.
src/assets/images/icon-student-avator.png
0 → 100644
View file @
fd305480
22.9 KB
src/views/paint-screen/components/answer-dialog/index.vue
0 → 100644
View file @
fd305480
<
template
>
<div
class=
"answer-dialog-box"
>
<div
class=
"answer-dialog"
@
click=
"$event.stopPropagation()"
>
<div
v-for=
"(item,idx) in replyList"
:key=
"idx"
class=
"student-as-box"
>
<img
:src=
"require('@/assets/images/icon-student-avator.png')"
alt=
""
>
<div
class=
"info-box"
>
<p>
学生:
{{
item
.
username
}}
</p>
<div
class=
"answer-box"
>
<span>
答案:
</span>
<!-- 没答案 选择题-->
<span
v-if=
"!item.type||item.type===3"
>
{{
item
.
answer
||
'正在答题中'
}}
</span>
<img
v-else
@
click=
"handleShowImg(item.answer)"
:src=
"item.answer"
alt=
""
>
</div>
</div>
</div>
</div>
<div
v-if=
"imgSrc"
class=
"img-pre-box"
@
click=
"handleImgClick"
>
<img
:src=
"imgSrc"
alt=
""
>
</div>
</div>
</
template
>
<
script
>
export
default
{
name
:
'answer-dialog'
,
props
:
{
replyList
:
{
required
:
true
,
default
:
()
=>
[]}
},
data
()
{
return
{
// 放大展示的img Src
imgSrc
:
''
}
},
mounted
()
{
console
.
log
(
'answerList'
,
this
.
replyList
)
},
methods
:
{
handleShowImg
(
imgSrc
)
{
this
.
imgSrc
=
imgSrc
},
handleImgClick
(
e
)
{
this
.
imgSrc
=
''
e
.
stopPropagation
()
}
}
}
</
script
>
<
style
scoped
lang=
"scss"
>
.answer-dialog-box
{
position
:
fixed
;
width
:
100vw
;
height
:
100vh
;
left
:
0
;
top
:
0
;
}
.answer-dialog
{
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
background
:
white
;
border-radius
:
20px
;
width
:
900px
;
height
:
600px
;
padding
:
20px
;
box-shadow
:
0
0
8px
0
rgba
(
176
,
176
,
176
,
0
.5
);
display
:
flex
;
flex-wrap
:
wrap
;
overflow-y
:
auto
;
justify-content
:
space-between
;
align-items
:
flex-start
;
.student-as-box
{
width
:
240px
;
height
:
100px
;
margin-right
:
10px
;
border-radius
:
10px
;
border
:
2px
solid
rgba
(
70
,
131
,
230
,
.3
);
align-items
:
center
;
display
:
flex
;
padding
:
10px
;
margin-bottom
:
10px
;
img
{
display
:
inline-block
;
line-height
:
100px
;
width
:
60px
;
height
:
60px
;
margin-right
:
20px
;
}
.info-box
{
flex
:
1
;
height
:
100%
;
display
:
flex
;
flex-direction
:
column
;
justify-content
:
space-around
;
.answer-box
{
display
:
flex
;
align-items
:
center
;
img
{
height
:
30px
;
width
:
30px
;
border-radius
:
3px
;
cursor
:
pointer
;
}
}
}
}
}
.img-pre-box
{
height
:
100vh
;
width
:
100vw
;
background
:
rgba
(
0
,
0
,
0
,
.3
);
position
:
absolute
;
left
:
0
;
top
:
0
;
img
{
height
:
800px
;
width
:
800px
;
position
:
absolute
;
top
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
}
}
</
style
>
src/views/paint-screen/index.vue
View file @
fd305480
...
@@ -55,15 +55,17 @@
...
@@ -55,15 +55,17 @@
<el-button
@
click
.
stop=
"showAnsModal = !showAnsModal"
size=
"small"
>
回答
</el-button>
<el-button
@
click
.
stop=
"showAnsModal = !showAnsModal"
size=
"small"
>
回答
</el-button>
</el-badge>
</el-badge>
<div
class=
"std-ans"
v-if=
"showAnsModal"
>
<div
class=
"std-ans"
v-if=
"showAnsModal"
>
<
template
v-for=
"(itm, index) in replyList"
>
<
!-- <template v-for="(itm, index) in replyList">--
>
<p
class=
"st-itm"
v-if=
"itm.type === 1 || itm.type === 2"
:key=
"index"
>
<!-- <p class="st-itm" v-if="itm.type === 1 || itm.type === 2" :key="index">--
>
<span>
{{
itm
.
username
}}
回答
</span
>
<!-- <span>{{ itm.username }} 回答</span>--
>
<img
class=
"img"
:src=
"itm.answer"
alt=
""
/
>
<!-- <img class="img" :src="itm.answer" alt="" />--
>
</p
>
<!-- </p>--
>
<p
class=
"st-itm"
v-else
:key=
"index"
>
{{
itm
.
username
}}
回答:
{{
itm
.
answer
}}
</p
>
<!-- <p class="st-itm" v-else :key="index">{{ itm.username }} 回答: {{ itm.answer }}</p>--
>
</
template
>
<!-- </template>--
>
</div>
</div>
</div>
</div>
<answer-dialog
v-if=
"showAnsModal"
:reply-list=
"replyList"
/>
</div>
</div>
</template>
</template>
<
script
>
<
script
>
...
@@ -82,6 +84,7 @@ import {
...
@@ -82,6 +84,7 @@ import {
}
from
'@/assets/images/index'
}
from
'@/assets/images/index'
import
HWRTC
from
'@/utils/hwrtc'
import
HWRTC
from
'@/utils/hwrtc'
import
socket
from
'@/utils/socket'
import
socket
from
'@/utils/socket'
import
AnswerDialog
from
'./components/answer-dialog'
const
paintTypes
=
[
const
paintTypes
=
[
{
title
:
'pencil'
,
name
:
'铅笔'
,
width
:
20
},
{
title
:
'pencil'
,
name
:
'铅笔'
,
width
:
20
},
...
@@ -95,9 +98,11 @@ const paintTypes = [
...
@@ -95,9 +98,11 @@ const paintTypes = [
options
:
[
options
:
[
{
title
:
'选择题'
,
value
:
3
},
{
title
:
'选择题'
,
value
:
3
},
{
title
:
'简答题'
,
value
:
1
},
{
title
:
'简答题'
,
value
:
1
},
{
title
:
'填空题'
,
value
:
2
}
{
title
:
'抢答题'
,
value
:
2
},
// { title: '填空题', value: 2 } // 暂时屏蔽简答题
]
]
},
},
{
title
:
'question-stop'
,
name
:
'停止答题'
},
{
title
:
'full'
,
name
:
'全屏'
},
{
title
:
'full'
,
name
:
'全屏'
},
]
]
...
@@ -120,6 +125,7 @@ Vue.use(GeekDrawBoard)
...
@@ -120,6 +125,7 @@ Vue.use(GeekDrawBoard)
export
default
{
export
default
{
components
:
{
components
:
{
AnswerDialog
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -138,7 +144,7 @@ export default {
...
@@ -138,7 +144,7 @@ export default {
imgs
,
imgs
,
currentIndex
:
0
,
currentIndex
:
0
,
ansModal
:
false
,
ansModal
:
false
,
showAnsModal
:
false
showAnsModal
:
false
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -165,6 +171,17 @@ export default {
...
@@ -165,6 +171,17 @@ export default {
// eslint-disable-next-line no-unused-expressions
// eslint-disable-next-line no-unused-expressions
this
.
$refs
.
pain_main
&&
this
.
$refs
.
pain_main
.
requestFullscreen
();
this
.
$refs
.
pain_main
&&
this
.
$refs
.
pain_main
.
requestFullscreen
();
}
}
if
(
title
===
'question-stop'
)
{
this
.
eventId
=
`
${
new
Date
().
getTime
()}
`
socket
.
sendGroupMsg
({
type
:
'question-stop'
,
payload
:
{
eventId
:
this
.
eventId
}
},
(
res
)
=>
{
console
.
log
(
'teacher-stop-answer success: '
,
res
);
})
}
},
},
handleToolItm
(
opt
)
{
handleToolItm
(
opt
)
{
this
.
ansModal
=
false
this
.
ansModal
=
false
...
@@ -184,20 +201,32 @@ export default {
...
@@ -184,20 +201,32 @@ export default {
},
},
sendAnswerTag
(
type
,
title
)
{
sendAnswerTag
(
type
,
title
)
{
this
.
replyList
=
[]
this
.
replyList
=
[]
// 唯一时间戳 判断事件是否有效
this
.
eventId
=
`
${
new
Date
().
getTime
()}
`
socket
.
sendGroupMsg
({
socket
.
sendGroupMsg
({
type
:
'question'
,
type
:
'question'
,
payload
:
{
payload
:
{
type
,
type
,
title
,
title
,
eventId
:
this
.
eventId
}
}
},
(
res
)
=>
{
},
(
res
)
=>
{
console
.
log
(
'teacher send success: '
,
res
);
console
.
log
(
'teacher send success: '
,
res
);
// 暂时填入三个默认数据
this
.
replyList
=
[
{
username
:
'阿槑'
,},
{
username
:
'懒惰怪'
,},
{
username
:
'壮壮'
,}
]
})
})
},
},
registerMsgReceived
()
{
registerMsgReceived
()
{
socket
.
onMsg
((
data
)
=>
{
socket
.
onMsg
((
data
)
=>
{
console
.
log
(
'datadata'
,
data
)
const
{
type
,
payload
}
=
data
||
{}
const
{
type
,
payload
}
=
data
||
{}
const
{
username
=
''
}
=
payload
||
{}
const
{
username
=
''
}
=
payload
||
{}
// 根据eventId 来判断当前事件有效性
// if (type === 'answer' && this.eventId === payload.eventId) {
if
(
type
===
'answer'
)
{
if
(
type
===
'answer'
)
{
// this.$notify.info({
// this.$notify.info({
// title: `${username}`,
// title: `${username}`,
...
@@ -207,7 +236,20 @@ export default {
...
@@ -207,7 +236,20 @@ export default {
dangerouslyUseHTMLString
:
true
,
dangerouslyUseHTMLString
:
true
,
message
:
`<h1>
${
username
}
提交了答案</h1>`
message
:
`<h1>
${
username
}
提交了答案</h1>`
});
});
this
.
replyList
.
push
(
payload
);
// // 处理假数据
const
newAnswerList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
replyList
))
// 保证 只赋值一次
let
flag
=
true
newAnswerList
.
forEach
((
item
)
=>
{
if
(
flag
&&
!
item
.
answer
)
{
item
.
type
=
payload
.
type
item
.
answer
=
payload
.
answer
flag
=
false
}
})
// 更新视图
this
.
replyList
=
newAnswerList
// this.replyList.push(payload);
}
}
})
})
},
},
...
...
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