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
f576a5a8
Commit
f576a5a8
authored
Sep 07, 2021
by
罗超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
33416f68
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
196 additions
and
177 deletions
+196
-177
readingCompre.vue
src/components/subject/readingCompre.vue
+196
-177
No files found.
src/components/subject/readingCompre.vue
View file @
f576a5a8
<
template
>
<!-- 单选题 -->
<view>
<view
class=
"item"
>
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
sortIndex
)
}}
、
{{
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 readTitle"
v-html=
"item1.Title"
></view>
</view>
<!-- 单选题 -->
<view>
<view
class=
"item"
>
<view
class=
"name"
>
<view>
{{
changeNumToHan
(
sortIndex
)
}}
、
{{
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 readTitle"
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>
<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
();
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
,
sortIndex
:
props
.
sort
+
1
,
data
:
props
.
paperData
,
Score
:
0
,
//总分
current
:
1
,
//默认从第几个开始-用于从快捷菜单点入
ExamIndex
:
1
,
//第几题
});
data
.
data
.
DetailsList
.
forEach
((
item
)
=>
{
item
.
Title
=
item
.
Title
.
replace
(
/\<img/gi
,
'<img style="max-width:100%"'
);
console
.
log
(
90
,
item
.
Title
);
});
let
data
=
reactive
({
autoplay
:
false
,
sortIndex
:
props
.
sort
+
1
,
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
+=
parseFloat
(
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
,
};
},
};
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
+=
parseFloat
(
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
;
}
.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
:
#DA
7878
;
}
.Single_Before
{
font-size
:
28
rpx
;
font-weight
:
bold
;
color
:
#da
7878
;
}
.Exam_Total
{
font-size
:
25
rpx
;
color
:
gray
;
}
.Exam_Total
{
font-size
:
25
rpx
;
color
:
gray
;
}
.swiper-box
{
height
:
calc
(
100vh
-
270
rpx
);
box-sizing
:
border-box
;
}
.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
;
}
.readTitle
img
{
max-width
:
100%
;
}
.item
{
/* margin-bottom: 40rpx; */
position
:
relative
;
}
.num
{
font-size
:
26
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
bold
;
color
:
#111111
;
}
.readTitle
img
{
max-width
:
100%
;
}
.item
{
/* margin-bottom: 40rpx; */
position
:
relative
;
}
.item1
{
/* margin: 25rpx 0; */
align-items
:
center
;
}
.item1
{
/* margin: 25rpx 0; */
align-items
:
center
;
}
.item2
{
padding-left
:
25
rpx
;
margin
:
30
rpx
0
;
}
.item2
{
padding-left
:
25
rpx
;
margin
:
30
rpx
0
;
}
.myAnswer
{
background-color
:
#00acf9
!important
;
color
:
#ffffff
!important
;
}
.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
;
}
.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
;
}
.chooseName
{
font-size
:
24
rpx
;
font-family
:
PingFang
SC
;
font-weight
:
500
;
color
:
#111111
;
}
</
style
>
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