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
575607aa
Commit
575607aa
authored
Dec 24, 2020
by
晏成浩
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/20201222_show_student_answer' into 'master'
Feature/20201222 show student answer See merge request
!3
parents
18fe370c
8c73ca80
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
196 additions
and
89 deletions
+196
-89
icon-close.png
src/assets/images/icon-close.png
+0
-0
index.vue
src/views/paint-screen/components/answer-dialog/index.vue
+140
-51
index.vue
src/views/paint-screen/index.vue
+56
-38
No files found.
src/assets/images/icon-close.png
0 → 100644
View file @
575607aa
2.27 KB
src/views/paint-screen/components/answer-dialog/index.vue
View file @
575607aa
<
template
>
<
template
>
<div
class=
"answer-dialog-box"
>
<div
class=
"answer-dialog-box"
>
<div
class=
"answer-dialog"
@
click=
"$event.stopPropagation()"
>
<div
class=
"as-tool-box"
@
click=
"$event.stopPropagation()"
>
<div
class=
"total"
@
click=
"isShowContent = !isShowContent"
>
<span>
{{
replyList
.
filter
(
item
=>
item
.
answer
).
length
}}
</span>
<span>
/
{{
replyList
.
length
}}
</span>
<i
:class=
"[isShowContent ? 'el-icon-d-arrow-left':'el-icon-d-arrow-right']"
class=
"icon"
></i>
</div>
<el-button
@
click=
"handleQuestionStop"
>
结束答题
</el-button>
<el-button
type=
"danger"
@
click=
"$emit('question-exit',false)"
>
退出
</el-button>
</div>
<div
v-if=
"quickResponse"
>
<div
v-if=
"isShowQuickResponse"
class=
"student-as-box"
>
<img
:src=
"require('@/assets/images/icon-student-avator.png')"
alt=
""
>
<div
class=
"info-box"
>
<p>
学生:
{{
quickResponse
.
username
}}
</p>
<div
class=
"answer-box"
>
<span>
答案:
{{
quickResponse
.
answer
}}
</span>
</div>
</div>
</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"
>
<div
v-for=
"(item,idx) in replyList"
:key=
"idx"
class=
"student-as-box"
>
<img
:src=
"require('@/assets/images/icon-student-avator.png')"
alt=
""
>
<img
:src=
"require('@/assets/images/icon-student-avator.png')"
alt=
""
>
<div
class=
"info-box"
>
<div
class=
"info-box"
>
...
@@ -14,33 +35,57 @@
...
@@ -14,33 +35,57 @@
</div>
</div>
</div>
</div>
</div>
</div>
<div
v-if=
"imgSrc"
class=
"img-pre-box"
@
click=
"handleImgClick"
>
<div
v-if=
"imgSrc"
class=
"img-pre-box"
@
click=
"handleImgClick"
ref=
"imgBox"
>
<img
:src=
"imgSrc"
alt=
""
>
<img
:src=
"imgSrc"
class=
"as-img"
alt=
""
>
<img
:src=
"require('@/assets/images/icon-close.png')"
@
click=
"imgSrc = ''"
class=
"close-img"
alt=
""
>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
socket
from
'@/utils/socket'
;
export
default
{
export
default
{
name
:
'answer-dialog'
,
name
:
'answer-dialog'
,
props
:
{
props
:
{
replyList
:
{
required
:
true
,
default
:
()
=>
[]}
replyList
:
{
required
:
true
,
default
:
()
=>
[]},
quickResponse
:
{}
},
},
data
()
{
data
()
{
return
{
return
{
// 放大展示的img Src
// 放大展示的img Src
imgSrc
:
''
imgSrc
:
''
,
isShowContent
:
false
,
isShowQuickResponse
:
false
}
}
},
},
mounted
()
{
mounted
()
{
console
.
log
(
'answerList'
,
this
.
replyList
)
console
.
log
(
'answerList'
,
this
.
replyList
)
},
},
watch
:
{
quickResponse
(
newVal
,
oldVal
)
{
if
(
newVal
)
{
this
.
isShowContent
=
true
}
}
},
methods
:
{
methods
:
{
handleQuestionStop
()
{
console
.
log
(
'eventId: this.$parent.eventId'
,
this
.
$parent
.
eventId
)
socket
.
sendGroupMsg
({
type
:
'question-stop'
,
payload
:
{
eventId
:
this
.
$parent
.
eventId
}
},
(
res
)
=>
{
console
.
log
(
'teacher-stop-answer success: '
,
res
);
})
},
handleShowImg
(
imgSrc
)
{
handleShowImg
(
imgSrc
)
{
this
.
imgSrc
=
imgSrc
this
.
imgSrc
=
imgSrc
},
},
handleImgClick
(
e
)
{
handleImgClick
(
e
)
{
this
.
imgSrc
=
''
//
this.imgSrc = ''
e
.
stopPropagation
()
e
.
stopPropagation
()
}
}
}
}
...
@@ -50,17 +95,51 @@ export default {
...
@@ -50,17 +95,51 @@ export default {
<
style
scoped
lang=
"scss"
>
<
style
scoped
lang=
"scss"
>
.answer-dialog-box
{
.answer-dialog-box
{
position
:
fixed
;
position
:
fixed
;
width
:
100vw
;
height
:
100vh
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
}
}
.as-tool-box
{
position
:
fixed
;
left
:
110px
;
top
:
20px
;
border-radius
:
20px
;
padding
:
20px
;
background
:white
;
box-shadow
:
0
0
8px
0
rgba
(
176
,
176
,
176
,
0
.5
);
width
:
200px
;
.total
{
cursor
:
pointer
;
display
:
flex
;
align-items
:
flex-end
;
justify-content
:
center
;
position
:
relative
;
margin-bottom
:
20px
;
.icon
{
position
:
absolute
;
right
:
0px
;
font-size
:
20px
;
border-radius
:
50%
;
border
:
1px
solid
rgba
(
0
,
0
,
0
,
03
);
padding
:
5px
;
top
:
50%
;
transform
:
translateY
(
-50%
);
}
span
:nth-child
(
1
)
{
font-size
:
45px
;
color
:
#42b983
;
font-weight
:
bold
;
}
span
:nth-child
(
2
)
{
font-size
:
25px
;
font-weight
:
bold
;
margin-bottom
:
7px
;
}
}
}
.answer-dialog
{
.answer-dialog
{
position
:
absolute
;
position
:
fixed
;
top
:
50%
;
top
:
20px
;
left
:
50%
;
left
:
365px
;
transform
:
translate
(
-50%
,
-50%
);
background
:
white
;
background
:
white
;
border-radius
:
20px
;
border-radius
:
20px
;
width
:
900px
;
width
:
900px
;
...
@@ -73,45 +152,44 @@ export default {
...
@@ -73,45 +152,44 @@ export default {
justify-content
:
space-between
;
justify-content
:
space-between
;
align-items
:
flex-start
;
align-items
:
flex-start
;
.student-as-box
{
}
width
:
240px
;
.student-as-box
{
height
:
100px
;
width
:
240px
;
margin-right
:
10px
;
height
:
100px
;
border-radius
:
10px
;
margin-right
:
10px
;
border
:
2px
solid
rgba
(
70
,
131
,
230
,
.3
);
border-radius
:
10px
;
align-items
:
center
;
border
:
2px
solid
rgba
(
70
,
131
,
230
,
.3
);
display
:
flex
;
align-items
:
center
;
padding
:
10px
;
display
:
flex
;
margin-bottom
:
10px
;
padding
:
10px
;
margin-bottom
:
10px
;
img
{
img
{
display
:
inline-block
;
display
:
inline-block
;
line-height
:
100px
;
line-height
:
100px
;
width
:
60px
;
width
:
60px
;
height
:
60px
;
height
:
60px
;
margin-right
:
20px
;
margin-right
:
20px
;
}
}
.info-box
{
.info-box
{
flex
:
1
;
flex
:
1
;
height
:
100%
;
height
:
100%
;
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
justify-content
:
space-around
;
justify-content
:
space-around
;
.answer-box
{
.answer-box
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
img
{
img
{
height
:
30px
;
height
:
30px
;
width
:
30px
;
width
:
30px
;
border-radius
:
3px
;
border-radius
:
3px
;
cursor
:
pointer
;
cursor
:
pointer
;
}
}
}
}
}
}
}
}
}
...
@@ -119,18 +197,29 @@ export default {
...
@@ -119,18 +197,29 @@ export default {
.img-pre-box
{
.img-pre-box
{
height
:
100vh
;
height
:
100vh
;
width
:
100vw
;
width
:
100vw
;
background
:
rgba
(
0
,
0
,
0
,
.3
);
//background: rgba(0, 0, 0, .3);
position
:
absolute
;
background-size
:
100%
100%
;
background-image
:
url("//test-static-1257124244.cos.ap-chengdu.myqcloud.com/gk-online-static/courseware/demo/1.png")
;
position
:
fixed
;
left
:
0
;
left
:
0
;
top
:
0
;
top
:
0
;
img
{
.as-
img
{
height
:
800px
;
height
:
100vh
;
width
:
800px
;
width
:
100vw
;
position
:
absolute
;
position
:
absolute
;
top
:
50%
;
top
:
50%
;
left
:
50%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
transform
:
translate
(
-50%
,
-50%
);
}
}
.close-img
{
cursor
:
pointer
;
width
:
50px
;
height
:
50px
;
position
:
absolute
;
top
:
20px
;
right
:
20px
;
}
}
}
</
style
>
</
style
>
src/views/paint-screen/index.vue
View file @
575607aa
...
@@ -50,21 +50,21 @@
...
@@ -50,21 +50,21 @@
v-for="opt in itm.options" :key="opt.title">{{ opt.title }}</span>
v-for="opt in itm.options" :key="opt.title">{{ opt.title }}</span>
</div> -->
</div> -->
<div
class=
"reply-tips"
>
<!-- <div class="reply-tips">--
>
<el-badge
:value=
"(replyList || []).length"
class=
"item"
>
<!-- <el-badge :value="(replyList || []).length" class="item">--
>
<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"
/>
<answer-dialog
v-if=
"showAnsModal"
:
quick-response=
"quickResponseData"
@
question-exit=
"handleQuestionExit"
:
reply-list=
"replyList"
/>
</div>
</div>
</template>
</template>
...
@@ -102,7 +102,7 @@ const paintTypes = [
...
@@ -102,7 +102,7 @@ const paintTypes = [
// { title: '填空题', value: 2 } // 暂时屏蔽简答题
// { title: '填空题', value: 2 } // 暂时屏蔽简答题
]
]
},
},
{
title
:
'question-stop'
,
name
:
'停止答题'
},
//
{ title: 'question-stop', name: '停止答题' },
{
title
:
'full'
,
name
:
'全屏'
},
{
title
:
'full'
,
name
:
'全屏'
},
]
]
...
@@ -174,6 +174,7 @@ export default {
...
@@ -174,6 +174,7 @@ export default {
currentIndex
:
0
,
currentIndex
:
0
,
ansModal
:
false
,
ansModal
:
false
,
showAnsModal
:
false
,
showAnsModal
:
false
,
quickResponseData
:
null
};
};
},
},
computed
:
{
computed
:
{
...
@@ -200,17 +201,6 @@ export default {
...
@@ -200,17 +201,6 @@ 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
...
@@ -232,6 +222,7 @@ export default {
...
@@ -232,6 +222,7 @@ export default {
this
.
replyList
=
[]
this
.
replyList
=
[]
// 唯一时间戳 判断事件是否有效
// 唯一时间戳 判断事件是否有效
this
.
eventId
=
`
${
new
Date
().
getTime
()}
`
this
.
eventId
=
`
${
new
Date
().
getTime
()}
`
this
.
quickResponseData
=
null
socket
.
sendGroupMsg
({
socket
.
sendGroupMsg
({
type
:
'question'
,
type
:
'question'
,
payload
:
{
payload
:
{
...
@@ -257,27 +248,42 @@ export default {
...
@@ -257,27 +248,42 @@ export default {
const
{
type
,
payload
}
=
data
||
{}
const
{
type
,
payload
}
=
data
||
{}
const
{
username
=
''
}
=
payload
||
{}
const
{
username
=
''
}
=
payload
||
{}
// 根据eventId 来判断当前事件有效性
// 根据eventId 来判断当前事件有效性
// if (type === 'answer' && this.eventId === payload.eventId) {
// // 处理假数据
if
(
type
===
'answer'
)
{
const
newAnswerList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
replyList
))
if
(
type
===
'answer'
&&
this
.
eventId
===
payload
.
eventId
)
{
// 抢答题
if
(
`
${
payload
.
type
}
`
===
'2'
&&
!
this
.
quickResponseData
)
{
console
.
log
(
'asdfffff'
)
this
.
quickResponseData
=
payload
newAnswerList
.
forEach
((
item
)
=>
{
if
(
!
item
.
answer
&&
item
.
username
===
username
)
{
item
.
type
=
payload
.
type
item
.
answer
=
'抢答成功'
// flag = false
}
})
}
else
{
// 非抢答题
this
.
$notify
({
dangerouslyUseHTMLString
:
true
,
message
:
`<h1>
${
username
}
提交了答案</h1>`
});
// 保证 只赋值一次
// let flag = true
newAnswerList
.
forEach
((
item
)
=>
{
if
(
!
item
.
answer
&&
item
.
username
===
username
)
{
item
.
type
=
payload
.
type
item
.
answer
=
payload
.
answer
// flag = false
}
})
}
// this.$notify.info({
// this.$notify.info({
// title: `${username}`,
// title: `${username}`,
// message: '提交了答案'
// message: '提交了答案'
// });
// });
this
.
$notify
({
// if ()
dangerouslyUseHTMLString
:
true
,
message
:
`<h1>
${
username
}
提交了答案</h1>`
});
// // 处理假数据
const
newAnswerList
=
JSON
.
parse
(
JSON
.
stringify
(
this
.
replyList
))
// 保证 只赋值一次
// let flag = true
newAnswerList
.
forEach
((
item
)
=>
{
if
(
!
item
.
answer
&&
item
.
username
===
username
)
{
item
.
type
=
payload
.
type
item
.
answer
=
payload
.
answer
// flag = false
}
})
// 更新视图
// 更新视图
this
.
replyList
=
newAnswerList
this
.
replyList
=
newAnswerList
// this.replyList.push(payload);
// this.replyList.push(payload);
...
@@ -302,6 +308,18 @@ export default {
...
@@ -302,6 +308,18 @@ export default {
},
},
drawChange
(
actions
)
{
drawChange
(
actions
)
{
this
.
paints
[
this
.
currentIndex
]
=
actions
this
.
paints
[
this
.
currentIndex
]
=
actions
},
handleQuestionExit
()
{
socket
.
sendGroupMsg
({
type
:
'question-exit'
,
payload
:
{
eventId
:
this
.
eventId
,
}
},()
=>
{
console
.
log
(
'退出成功'
)
this
.
showAnsModal
=
false
})
}
}
},
},
async
mounted
()
{
async
mounted
()
{
...
...
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