Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
educationStu
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
向伟
educationStu
Commits
53049eb2
Commit
53049eb2
authored
Sep 06, 2021
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
3c658e38
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
426 additions
and
20 deletions
+426
-20
ListenTopic.vue
src/components/subject/ListenTopic.vue
+183
-0
MultipleChoice.vue
src/components/subject/MultipleChoice.vue
+13
-6
SingleChoice.vue
src/components/subject/SingleChoice.vue
+188
-0
SingleChoiceNumber.vue
src/components/subject/SingleChoiceNumber.vue
+7
-8
examPaper.vue
src/pages/exam/examPaper.vue
+35
-6
No files found.
src/components/subject/ListenTopic.vue
0 → 100644
View file @
53049eb2
<
template
>
<!-- 听力题 -->
<view>
<view
class=
"item"
>
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
data
.
GSortNum
+
1
)
}}
、
{{
data
.
GroupName
}}
<text
style=
"color:#999999;"
>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
</view>
<view>
<text
class=
"Single_Before"
>
{{
ExamIndex
}}
</text>
/
<text
class=
"Exam_Total"
>
{{
data
.
DetailsList
.
length
}}
</text>
</view>
</view>
<swiper
class=
"swiper-box"
:autoplay=
"autoplay"
:current=
"current"
@
change=
"onchange"
>
<swiper-item></swiper-item>
<swiper-item
v-for=
"(item1, index1) in data.DetailsList"
:key=
"item1.id"
>
<view
class=
"item1"
>
<view
class=
"flex flex_start_center"
>
<view>
{{
index1
+
1
}}
、
</view>
<view
class=
"num"
v-html=
"item1.Title"
></view>
<!--
<view>
{{
item1
.
Title
}}
</view>
-->
</view>
<view
v-for=
"(item2, index2, index3) in item1.QuestionContentObj"
:key=
"index2"
class=
"flex item2 flex_wrap flex_start_center"
v-if=
"index2 === 0"
>
<view
v-for=
"(item3, index3) in item2"
:key=
"index3"
class=
"flex item3 flex_start_center"
>
<view
class=
"chooseNum"
:class=
"
{ myAnswer: item1.myAnswer.find((e) => e == item3.Name) }"
@click="change(index1, index2, index3)">
{{
item3
.
Name
}}
</view>
<view
class=
"chooseName"
@
click=
"change(index1, index2, index3)"
v-html=
"item3.Content"
>
</view>
</view>
</view>
</view>
</swiper-item>
</swiper>
<van-toast
id=
"van-toast"
/>
</view>
</view>
</
template
>
<
script
>
import
{
ref
,
reactive
,
toRefs
,
toRef
,
getCurrentInstance
,
watch
,
computed
,
onMounted
,
}
from
"vue"
;
import
{
changeNumToHan
}
from
"../../utils/index"
;
export
default
{
props
:
{
paperData
:
Object
},
setup
(
props
,
context
)
{
let
{
ctx
}
=
getCurrentInstance
();
props
.
paperData
.
DetailsList
.
forEach
((
item
,
index
)
=>
{
item
.
myAnswer
=
[];
});
let
data
=
reactive
({
data
:
props
.
paperData
,
autoplay
:
false
,
Score
:
0
,
//总分
current
:
1
,
//默认从第几个开始-用于从快捷菜单点入
ExamIndex
:
1
,
//第几题
});
let
methods
=
{
changeNumToHan
,
jumpPage
()
{
uni
.
navigateTo
({
url
:
"/pages/exam/examPaper"
,
});
},
back
()
{
uni
.
navigateBack
();
},
//选题
change
(
index1
,
index2
,
index3
)
{
let
myAnswer
=
data
.
data
.
DetailsList
[
index1
].
myAnswer
;
let
res
=
data
.
data
.
DetailsList
[
index1
].
QuestionContentObj
[
index2
][
index3
].
Name
;
let
find
=
myAnswer
.
indexOf
(
res
);
if
(
find
==
-
1
)
{
myAnswer
.
push
(
res
);
}
else
{
myAnswer
.
splice
(
find
,
1
);
}
},
onchange
(
e
)
{
data
.
ExamIndex
=
e
.
detail
.
current
;
if
(
data
.
ExamIndex
===
data
.
data
.
DetailsList
.
length
+
1
)
{
console
.
log
(
'进入'
)
this
.
$emit
(
'getAfterTopic'
);
}
if
(
e
.
detail
.
current
==
0
)
{
this
.
$emit
(
'getBeforeTopic'
);
}
}
};
return
{
...
toRefs
(
data
),
...
methods
,
};
},
};
</
script
>
<
style
scoped
>
.name
{
height
:
90
rpx
;
font-size
:
28
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
800
;
color
:
#111111
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
.swiper-box
{
height
:
calc
(
100vh
-
270
rpx
);
box-sizing
:
border-box
;
}
.num
{
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#111111
;
}
.item
{
margin-bottom
:
40
rpx
;
}
.item1
{
margin
:
25
rpx
0
;
align-items
:
center
;
}
.item2
{
/* padding-left: 25rpx;
margin: 30rpx 0; */
}
.item3
{
width
:
100%
;
padding-left
:
25
rpx
;
margin
:
20
rpx
0
;
}
.myAnswer
{
background-color
:
#00acf9
!important
;
color
:
#ffffff
!important
;
}
.chooseNum
{
width
:
40
rpx
;
height
:
40
rpx
;
text-align
:
center
;
line-height
:
40
rpx
;
border-radius
:
50%
;
border
:
1px
solid
#e2e2e2
;
margin-right
:
30
rpx
;
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#111111
;
}
.chooseName
{
font-size
:
24
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#111111
;
}
</
style
>
src/components/subject/MultipleChoice.vue
View file @
53049eb2
...
...
@@ -5,7 +5,7 @@
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
data
.
GSortNum
+
1
)
}}
、
{{
data
.
GroupName
}}
<text>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
<text
style=
"color:#999999;"
>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
</view>
<view>
<text
class=
"Single_Before"
>
{{
ExamIndex
}}
</text>
/
<text
...
...
@@ -13,6 +13,7 @@
</view>
</view>
<swiper
class=
"swiper-box"
:autoplay=
"autoplay"
:current=
"current"
@
change=
"onchange"
>
<swiper-item></swiper-item>
<swiper-item
v-for=
"(item1, index1) in data.DetailsList"
:key=
"item1.id"
>
<view
class=
"item1"
>
<view
class=
"flex flex_start_center"
>
...
...
@@ -51,7 +52,8 @@
}
from
"../../utils/index"
;
export
default
{
props
:
{
paperData
:
Object
paperData
:
Object
,
isLast
:
Boolean
},
setup
(
props
,
context
)
{
props
.
paperData
.
DetailsList
.
forEach
((
item
,
index
)
=>
{
...
...
@@ -61,7 +63,7 @@
data
:
props
.
paperData
,
autoplay
:
false
,
Score
:
0
,
//总分
current
:
0
,
//默认从第几个开始-用于从快捷菜单点入
current
:
1
,
//默认从第几个开始-用于从快捷菜单点入
ExamIndex
:
1
,
//第几题
});
let
methods
=
{
...
...
@@ -93,16 +95,21 @@
})
},
onchange
(
e
)
{
data
.
ExamIndex
=
e
.
detail
.
current
+
1
;
data
.
ExamIndex
=
e
.
detail
.
current
;
if
(
data
.
ExamIndex
===
data
.
data
.
DetailsList
.
length
+
1
)
{
console
.
log
(
'进入'
)
this
.
$emit
(
'getIndex'
);
this
.
$emit
(
'getAfterTopic'
);
}
if
(
e
.
detail
.
current
==
0
){
this
.
$emit
(
'getBeforeTopic'
);
}
},
};
onMounted
(()
=>
{
that
.
getScore
();
if
(
props
.
isLast
){
data
.
current
=
props
.
paperData
.
DetailsList
.
length
;
}
});
let
that
=
methods
;
return
{
...
...
src/components/subject/SingleChoice.vue
0 → 100644
View file @
53049eb2
<
template
>
<!-- 单选题 -->
<view>
<view
class=
"item"
>
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
sort
+
1
)
}}
、
{{
data
.
GroupName
}}
<text
style=
"color:#999999;"
>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
</view>
<view>
<text
class=
"Single_Before"
>
{{
ExamIndex
}}
</text>
/
<text
class=
"Exam_Total"
>
{{
data
.
DetailsList
.
length
}}
</text>
</view>
</view>
<swiper
class=
"swiper-box"
:autoplay=
"autoplay"
:current=
"current"
@
change=
"onchange"
>
<swiper-item></swiper-item>
<swiper-item
v-for=
"(item1, index1) in data.DetailsList"
:key=
"item1.id"
>
<view
class=
"item1"
>
<view
class=
"flex flex_start_center"
>
<view>
{{
index1
+
1
}}
、
</view>
<view
class=
"num"
v-html=
"item1.Title"
></view>
</view>
<view
v-for=
"(item2, index2) in item1.QuestionContentObj"
:key=
"item2.id"
class=
"flex item2 flex_start_center"
>
<view
class=
"chooseNum"
:class=
"
{ myAnswer: item1.myAnswer === item2.Name }"
@click="change(index1, index2)"
>
{{
item2
.
Name
}}
</view>
<view
class=
"chooseName"
@
click=
"change(index1, index2)"
v-html=
"item2.Content"
></view>
</view>
</view>
</swiper-item>
<swiper-item></swiper-item>
</swiper>
</view>
<van-toast
id=
"van-toast"
/>
</view>
</
template
>
<
script
>
import
{
ref
,
reactive
,
toRefs
,
toRef
,
getCurrentInstance
,
watch
,
computed
,
onMounted
,
}
from
"vue"
;
import
{
changeNumToHan
}
from
"../../utils/index"
;
export
default
{
props
:
{
paperData
:
Object
,
sort
:
Number
},
setup
(
props
,
context
)
{
let
{
ctx
}
=
getCurrentInstance
();
let
data
=
reactive
({
autoplay
:
false
,
data
:
props
.
paperData
,
Score
:
0
,
//总分
current
:
1
,
//默认从第几个开始-用于从快捷菜单点入
ExamIndex
:
1
,
//第几题
});
let
methods
=
{
changeNumToHan
,
jumpPage
()
{
uni
.
navigateTo
({
url
:
"/pages/exam/examPaper"
,
});
},
back
()
{
uni
.
navigateBack
();
},
//选题
change
(
index1
,
index2
)
{
data
.
data
.
DetailsList
[
index1
].
myAnswer
=
data
.
data
.
DetailsList
[
index1
].
QuestionContentObj
[
index2
].
Name
;
},
//获取总分
getScore
(){
data
.
Score
=
0
;
data
.
data
.
DetailsList
.
forEach
(
x
=>
{
data
.
Score
+=
x
.
Score
})
},
onchange
(
e
){
data
.
ExamIndex
=
e
.
detail
.
current
;
if
(
data
.
ExamIndex
===
data
.
data
.
DetailsList
.
length
+
1
){
console
.
log
(
'进入'
)
this
.
$emit
(
'getAfterTopic'
);
}
if
(
e
.
detail
.
current
==
0
){
this
.
$emit
(
'getBeforeTopic'
);
}
}
};
onMounted
(()
=>
{
console
.
log
(
props
.
paperData
,
'props.paperData'
);
that
.
getScore
();
})
let
that
=
methods
;
return
{
...
toRefs
(
data
),
...
methods
,
};
},
};
</
script
>
<
style
scoped
>
.name
{
height
:
90
rpx
;
font-size
:
28
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
800
;
color
:
#111111
;
display
:
flex
;
align-items
:
center
;
justify-content
:
space-between
;
}
.Single_Before
{
font-size
:
28
rpx
;
font-weight
:
bold
;
color
:
#DA7878
;
}
.Exam_Total
{
font-size
:
25
rpx
;
color
:
gray
;
}
.swiper-box
{
height
:
calc
(
100vh
-
270
rpx
);
box-sizing
:
border-box
;
}
.num
{
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#111111
;
}
.item
{
/* margin-bottom: 40rpx; */
position
:
relative
;
}
.item1
{
/* margin: 25rpx 0; */
align-items
:
center
;
}
.item2
{
padding-left
:
25
rpx
;
margin
:
30
rpx
0
;
}
.myAnswer
{
background-color
:
#00acf9
!important
;
color
:
#ffffff
!important
;
}
.chooseNum
{
width
:
40
rpx
;
height
:
40
rpx
;
text-align
:
center
;
line-height
:
40
rpx
;
border-radius
:
50%
;
border
:
1px
solid
#e2e2e2
;
margin-right
:
30
rpx
;
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#111111
;
}
.chooseName
{
font-size
:
24
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#111111
;
}
</
style
>
\ No newline at end of file
src/components/subject/SingleChoiceNumber.vue
View file @
53049eb2
...
...
@@ -5,7 +5,7 @@
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
sort
+
1
)
}}
、
{{
data
.
GroupName
}}
<text>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
<text
style=
"color:#999999;"
>
(共
{{
data
.
DetailsList
.
length
}}
道,
{{
Score
}}
分)
</text>
</view>
<view>
<text
class=
"Single_Before"
>
{{
ExamIndex
}}
</text>
/
<text
class=
"Exam_Total"
>
{{
data
.
DetailsList
.
length
}}
</text>
...
...
@@ -61,7 +61,7 @@ import {
}
from
"vue"
;
import
{
changeNumToHan
}
from
"../../utils/index"
;
export
default
{
props
:
{
paperData
:
Object
,
sort
:
Number
},
props
:
{
paperData
:
Object
,
sort
:
Number
,
isLast
:
Boolean
},
setup
(
props
,
context
)
{
let
{
ctx
}
=
getCurrentInstance
();
...
...
@@ -98,18 +98,17 @@ export default {
},
onchange
(
e
){
data
.
ExamIndex
=
e
.
detail
.
current
+
1
;
console
.
log
(
data
.
ExamIndex
,
'index1'
);
console
.
log
(
data
.
data
.
DetailsList
.
length
,
'index2'
);
if
(
data
.
ExamIndex
===
data
.
data
.
DetailsList
.
length
+
1
){
console
.
log
(
'进入'
)
this
.
$emit
(
'getIndex'
);
this
.
$emit
(
'getAfterTopic'
);
}
}
};
onMounted
(()
=>
{
console
.
log
(
props
.
paperData
,
'props.paperData'
);
that
.
getScore
();
console
.
log
(
props
.
isLast
,
'props.isLast'
);
if
(
props
.
isLast
){
data
.
current
=
props
.
paperData
.
DetailsList
.
length
;
}
})
let
that
=
methods
;
return
{
...
...
src/pages/exam/examPaper.vue
View file @
53049eb2
...
...
@@ -27,18 +27,35 @@
<view
v-for=
"(item, index) in peaperDetail.Paper.GroupList"
:key=
"index"
>
<SingleChoiceNumber
:paperData=
"item"
@
get
Index=
"getIndex
()"
@
get
AfterTopic=
"getAfterTopic
()"
:sort=
"index"
:isLast=
"isLast"
v-if=
"item.QuestionTypeKey === 'single-number'&&index===changeIndex"
/>
<MultipleChoice
:paperData=
"item"
:isLast=
"isLast"
@
getBeforeTopic=
"getBeforeTopic()"
@
getAfterTopic=
"getAfterTopic()"
v-if=
"item.QuestionTypeKey === 'multiple'&&index===changeIndex"
/>
<SingleChoice
:paperData=
"item"
:isLast=
"isLast"
@
getBeforeTopic=
"getBeforeTopic()"
@
getAfterTopic=
"getAfterTopic()"
v-if=
"item.QuestionTypeKey === 'single'&&index===changeIndex"
/>
<ListenTopic
:paperData=
"item"
:isLast=
"isLast"
@
getBeforeTopic=
"getBeforeTopic()"
@
getAfterTopic=
"getAfterTopic()"
v-if=
"item.QuestionTypeKey === 'listening'&&index===changeIndex"
/>
<FillInTheBlanks
:paperData=
"item"
v-if=
"item.QuestionTypeKey === 'fill-in'"
/>
<Judge
:paperData=
"item"
v-if=
"item.QuestionTypeKey === 'judge'"
/>
<!--
<Judge :paperData="item" v-if="item.QuestionTypeKey === 'judge'" />
<Write
:paperData="item"
v-if="
...
...
@@ -56,7 +73,7 @@
item.QuestionTypeKey === 'sorting-problem' ||
item.QuestionTypeKey === 'listening'
"
/>
/>
-->
</view>
</view>
<van-toast
id=
"van-toast"
/>
...
...
@@ -77,7 +94,10 @@ import {
import
{
getSystemInfo
}
from
"../../utils/index"
;
import
{
getPaperDetail
}
from
"../../api/exam"
;
import
SingleChoiceNumber
from
"../../components/subject/SingleChoiceNumber.vue"
;
import
SingleChoice
from
"../../components/subject/SingleChoice.vue"
import
MultipleChoice
from
"../../components/subject/MultipleChoice.vue"
;
import
ListenTopic
from
"../../components/subject/ListenTopic.vue"
import
FillInTheBlanks
from
"../../components/subject/FillInTheBlanks"
;
import
Judge
from
"../../components/subject/judge.vue"
;
import
Write
from
"../../components/subject/write.vue"
;
...
...
@@ -86,7 +106,9 @@ import Sort from "../../components/subject/Sort"; //"排序题"
export
default
{
components
:
{
SingleChoiceNumber
,
SingleChoice
,
MultipleChoice
,
ListenTopic
,
FillInTheBlanks
,
Judge
,
Write
,
...
...
@@ -99,10 +121,11 @@ export default {
let
data
=
reactive
({
time
:
2
*
60
*
60
*
1000
,
statusBarHeight
:
0
,
//
msg: { GuestId: Gid, PaperId: 6, Id: 3 },
msg
:
{
GuestId
:
Gid
,
PaperId
:
24
,
Id
:
0
},
msg
:
{
GuestId
:
Gid
,
PaperId
:
6
,
Id
:
3
},
//
msg: { GuestId: Gid, PaperId: 24, Id: 0 },
peaperDetail
:
{},
changeIndex
:
0
,
isLast
:
false
,
//用于判断是否从后往前翻
});
let
methods
=
{
jumpPage
()
{
...
...
@@ -123,8 +146,14 @@ export default {
console
.
log
(
90
,
res
.
Data
.
Paper
.
GroupList
);
}
},
getIndex
(){
//往后翻
getAfterTopic
(){
this
.
changeIndex
++
},
//往前翻
getBeforeTopic
(){
this
.
changeIndex
--
;
this
.
isLast
=
true
;
}
};
onMounted
(()
=>
{
...
...
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