Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
study
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
Damon
study
Commits
d79bb612
Commit
d79bb612
authored
Jul 28, 2021
by
Facius
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 学练记录页面:日历、记录
parent
7e984544
Changes
5
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
931 additions
and
87 deletions
+931
-87
learn.js
src/api/learn.js
+8
-0
index.vue
src/components/calendar/index.vue
+720
-0
index.vue
src/components/record-cell/index.vue
+33
-10
index.vue
src/pages/index/index.vue
+4
-2
record.vue
src/pages/learn/record.vue
+166
-75
No files found.
src/api/learn.js
View file @
d79bb612
...
@@ -89,6 +89,13 @@ let learnApiFun = function(vm) {
...
@@ -89,6 +89,13 @@ let learnApiFun = function(vm) {
// 检查是否具有体验资格
// 检查是否具有体验资格
let
checkGetQuestion
=
async
(
questionWarehouseId
)
=>
let
checkGetQuestion
=
async
(
questionWarehouseId
)
=>
await
vm
.
$u
.
get
(
'/rest/question/checkGetQuestion/'
+
questionWarehouseId
)
await
vm
.
$u
.
get
(
'/rest/question/checkGetQuestion/'
+
questionWarehouseId
)
// 每日一练统计
let
everyTaskList
=
async
(
questionWarehouseId
,
params
=
{})
=>
await
vm
.
$u
.
get
(
'/rest/question/query/everyTaskList/'
+
questionWarehouseId
,
params
)
const
learnApi
=
{
const
learnApi
=
{
getQuestion
,
getQuestion
,
getQuestionTotal
,
getQuestionTotal
,
...
@@ -111,6 +118,7 @@ let learnApiFun = function(vm) {
...
@@ -111,6 +118,7 @@ let learnApiFun = function(vm) {
bindCard
,
bindCard
,
searchQuestion
,
searchQuestion
,
checkGetQuestion
,
checkGetQuestion
,
everyTaskList
,
}
}
return
learnApi
return
learnApi
}
}
...
...
src/components/calendar/index.vue
0 → 100644
View file @
d79bb612
This diff is collapsed.
Click to expand it.
src/components/record-cell/index.vue
View file @
d79bb612
...
@@ -8,10 +8,10 @@
...
@@ -8,10 +8,10 @@
<view
<view
v-if=
"key == 'result'"
v-if=
"key == 'result'"
:class=
"['result-text',
{ passed: passed }]"
:class=
"['result-text',
{ passed: passed }]"
>
{{
resultText
}}
</view
>
{{
data
[
key
]
}}
</view
>
>
<view
v-else
class=
"content-text"
>
{{
info
[
key
]
}}
</view>
<view
v-else
class=
"content-text"
>
{{
data
[
key
]
}}
</view>
<view
class=
"unit-text"
>
{{
units
[
key
]
}}
</view>
<view
v-if=
"units[key]"
class=
"unit-text"
>
{{
units
[
key
]
}}
</view>
</view>
</view>
</view>
</view>
</view>
</view>
...
@@ -32,26 +32,48 @@ export default {
...
@@ -32,26 +32,48 @@ export default {
return
{}
return
{}
},
},
computed
:
{
computed
:
{
data
()
{
return
{
take
:
this
.
take
,
point
:
this
.
info
.
point
,
result
:
this
.
resultText
,
}
},
take
()
{
if
(
this
.
info
.
startDatetime
&&
this
.
info
.
endDatetime
)
{
let
timesStart
=
new
Date
(
this
.
info
.
startDatetime
.
replace
(
/
\-
/g
,
'/'
)
).
getTime
()
let
timesEnd
=
new
Date
(
this
.
info
.
endDatetime
.
replace
(
/
\-
/g
,
'/'
)
).
getTime
()
return
Math
.
ceil
((
timesEnd
-
timesStart
)
/
1000
/
60
)
}
return
0
},
timeText
()
{
timeText
()
{
return
this
.
$u
.
timeFormat
(
this
.
info
.
date
,
'yyyy.mm.dd'
)
return
this
.
info
.
endDatetime
?
this
.
info
.
endDatetime
.
split
(
' '
)[
0
].
replace
(
/
\-
/g
,
'.'
)
:
this
.
$u
.
timeFormat
(
new
Date
().
getTime
(),
'yyyy.mm.dd'
)
},
},
labels
()
{
labels
()
{
return
{
return
{
t
im
e
:
'模考用时'
,
t
ak
e
:
'模考用时'
,
score
:
'模考成绩'
,
point
:
'模考成绩'
,
result
:
'是否及格'
,
result
:
'是否及格'
,
}
}
},
},
units
()
{
units
()
{
return
{
return
{
t
im
e
:
'分钟'
,
t
ak
e
:
'分钟'
,
score
:
'分'
,
point
:
'分'
,
result
:
''
,
result
:
''
,
}
}
},
},
passed
()
{
passed
()
{
// 及格、不及格
// 及格、不及格
return
this
.
info
.
score
>=
60
return
this
.
info
.
point
>=
60
},
},
resultText
()
{
resultText
()
{
return
this
.
passed
?
'及格'
:
'不及格'
return
this
.
passed
?
'及格'
:
'不及格'
...
@@ -83,6 +105,7 @@ export default {
...
@@ -83,6 +105,7 @@ export default {
padding-top
:
16rpx
;
padding-top
:
16rpx
;
display
:
flex
;
display
:
flex
;
align-items
:
flex-end
;
align-items
:
flex-end
;
justify-content
:
center
;
.result-text
{
.result-text
{
font-size
:
44rpx
;
font-size
:
44rpx
;
color
:
#fa5a49
;
color
:
#fa5a49
;
...
@@ -103,7 +126,7 @@ export default {
...
@@ -103,7 +126,7 @@ export default {
.unit-text
{
.unit-text
{
padding-left
:
14rpx
;
padding-left
:
14rpx
;
font-weight
:
400
;
font-weight
:
400
;
margin-bottom
:
1
1
rpx
;
margin-bottom
:
1
2
rpx
;
}
}
}
}
}
}
...
...
src/pages/index/index.vue
View file @
d79bb612
...
@@ -413,8 +413,10 @@ export default {
...
@@ -413,8 +413,10 @@ export default {
if
(
this
.
info
.
id
)
{
if
(
this
.
info
.
id
)
{
// 跳转到学练记录
// 跳转到学练记录
this
.
$u
.
route
({
this
.
$u
.
route
({
url
:
'pages/learn/record?part='
,
url
:
'pages/learn/record?key='
,
key
,
params
:
{
key
:
key
,
},
})
})
}
else
{
}
else
{
this
.
$refs
.
uToast
.
show
({
this
.
$refs
.
uToast
.
show
({
...
...
src/pages/learn/record.vue
View file @
d79bb612
...
@@ -16,9 +16,22 @@
...
@@ -16,9 +16,22 @@
<image
class=
"xunzhang-image"
:src=
"xunzhangImage"
></image>
<image
class=
"xunzhang-image"
:src=
"xunzhangImage"
></image>
</view>
</view>
<view
class=
"body-view"
>
<view
class=
"body-view"
>
<scroll-view
scroll-y=
"true"
class=
"scroll-view"
@
scrolltolower=
"reachBottom"
scroll-anchoring
enable-back-to-top
:scroll-into-view=
"scrollId"
>
<view
class=
"date-view"
>
<view
class=
"date-view"
>
<view
class=
"content-title"
id=
"part-days"
>
每日一练
</view>
<view
class=
"content-title"
id=
"part-days"
>
每日一练
</view>
<view
class=
"date-content"
></view>
<view
class=
"date-content"
>
<Calendar
:initialDays=
"days"
@
change=
"handleChangeMonth"
></Calendar>
</view>
</view>
</view>
<view
class=
"charts-view"
>
<view
class=
"charts-view"
>
<view
class=
"content-title"
id=
"part-total"
>
练习分析
</view>
<view
class=
"content-title"
id=
"part-total"
>
练习分析
</view>
...
@@ -64,30 +77,42 @@
...
@@ -64,30 +77,42 @@
<view
class=
"content-title"
id=
"part-today"
>
模考成绩
</view>
<view
class=
"content-title"
id=
"part-today"
>
模考成绩
</view>
<view
class=
"list-content"
>
<view
class=
"list-content"
>
<RecordCell
<RecordCell
v-for=
"(item, index) in showedList
"
v-for=
"(item, index) in lists
"
:key=
"index"
:key=
"index"
:info=
"item"
:info=
"item"
></RecordCell>
></RecordCell>
<view
class=
"show-more"
@
click=
"showAll = true"
v-if=
"!showAll"
>
<!--
<view
class=
"show-more"
@
click=
"showAll = true"
v-if=
"!showAll"
>
<u-icon
name=
"arrow-down"
></u-icon>
<u-icon
name=
"arrow-down"
></u-icon>
<text>
查看更多
</text>
<text>
查看更多
</text>
</view>
-->
</view>
</view>
<u-loadmore
v-show=
"
(recordParams.current == 1 && loaded) || recordParams.current > 1
"
:status=
"currentLoadStatus"
></u-loadmore>
</view>
</view>
</view>
</
scroll-
view>
</view>
</view>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
RecordCell
from
'@/components/record-cell'
import
RecordCell
from
'@/components/record-cell'
import
Calendar
from
'@/components/calendar'
export
default
{
export
default
{
components
:
{
RecordCell
},
components
:
{
RecordCell
,
Calendar
},
data
()
{
data
()
{
return
{
return
{
lists
:
[],
lists
:
[],
days
:
[],
showSelect
:
false
,
showSelect
:
false
,
showAll
:
false
,
showAll
:
false
,
scrollId
:
null
,
scrollId
:
null
,
loaded
:
false
,
items
:
[
items
:
[
{
{
title
:
'近7天'
,
title
:
'近7天'
,
...
@@ -102,9 +127,13 @@ export default {
...
@@ -102,9 +127,13 @@ export default {
selected
:
false
,
selected
:
false
,
},
},
],
],
currentLoadStatus
:
'loading'
,
rangeDay0
:
this
.
getDate
(),
// 自定义开始日期
rangeDay0
:
this
.
getDate
(),
// 自定义开始日期
rangeDay1
:
this
.
getDate
(),
// 自定义结束日期
rangeDay1
:
this
.
getDate
(),
// 自定义结束日期
recordParams
:
{
current
:
0
,
size
:
15
,
},
}
}
},
},
...
@@ -119,23 +148,74 @@ export default {
...
@@ -119,23 +148,74 @@ export default {
day
:
true
,
day
:
true
,
}
}
},
},
showedList
()
{
return
this
.
showAll
?
this
.
lists
:
this
.
lists
.
slice
(
0
,
2
)
},
},
},
onLoad
(
e
)
{
onLoad
(
e
)
{
if
(
e
&&
e
.
key
)
{
if
(
e
&&
e
.
key
)
{
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
setTimeout
(()
=>
{
this
.
scrollId
=
'part-'
+
e
.
key
this
.
scrollId
=
'part-'
+
e
.
key
},
500
)
})
})
}
}
this
.
lists
=
[
this
.
queryExamRecord
()
{
time
:
36
,
score
:
80
,
date
:
new
Date
().
getTime
},
{
time
:
100
,
score
:
40
,
date
:
new
Date
().
getTime
},
{
time
:
40
,
score
:
60
,
date
:
new
Date
().
getTime
},
]
},
},
methods
:
{
methods
:
{
// 每日一练统计
everyTaskList
(
year
,
month
)
{
var
params
=
{
startDate
:
this
.
$u
.
timeFormat
(
new
Date
(
year
,
month
-
1
,
1
).
getTime
(),
'yyyy-mm-dd'
),
endDate
:
this
.
$u
.
timeFormat
(
new
Date
(
year
,
month
,
0
).
getTime
(),
'yyyy-mm-dd'
),
}
this
.
$u
.
api
.
everyTaskList
(
this
.
questionWarehouseId
,
params
)
.
then
((
res
)
=>
{
this
.
days
=
[]
for
(
var
item
of
res
)
{
this
.
days
.
push
(
item
.
time
.
replace
(
/
\-
0/g
,
'
\
-'
))
}
})
.
catch
((
err
)
=>
{
console
.
log
(
err
)
})
},
// 模考记录
queryExamRecord
()
{
this
.
recordParams
.
current
+=
1
;(
this
.
recordParams
.
model
=
{
questionWarehouseId
:
this
.
questionWarehouseId
,
}),
this
.
$u
.
api
.
queryExamRecord
(
this
.
recordParams
)
.
then
((
res
)
=>
{
this
.
loaded
=
true
if
(
this
.
recordParams
.
current
==
1
)
{
this
.
lists
=
[]
}
if
((
res
.
records
||
[]).
length
>
0
)
{
this
.
lists
.
push
(...
res
.
records
)
}
this
.
currentLoadStatus
=
res
.
total
>
this
.
lists
.
length
&&
(
res
.
records
||
[]).
length
==
this
.
recordParams
.
size
?
'loadmore'
:
'nomore'
})
.
catch
((
err
)
=>
{
this
.
loaded
=
true
console
.
log
(
err
)
})
},
handleChangeMonth
(
e
)
{
this
.
everyTaskList
(
e
.
year
,
e
.
month
)
},
handleClick
()
{},
handleClick
()
{},
handleClickRange
(
index
)
{
handleClickRange
(
index
)
{
for
(
var
item
of
this
.
items
)
{
for
(
var
item
of
this
.
items
)
{
...
@@ -158,17 +238,16 @@ export default {
...
@@ -158,17 +238,16 @@ export default {
getDate
()
{
getDate
()
{
return
this
.
$u
.
timeFormat
(
new
Date
().
getTime
(),
'yyyy-mm-dd'
)
return
this
.
$u
.
timeFormat
(
new
Date
().
getTime
(),
'yyyy-mm-dd'
)
},
},
reachBottom
()
{
if
(
this
.
currentLoadStatus
!=
'loadmore'
)
return
this
.
currentLoadStatus
==
'loading'
this
.
queryExamRecord
()
},
},
},
}
}
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
>
<
style
lang=
"scss"
scoped
>
::-webkit-scrollbar
{
width
:
0
;
height
:
0
;
color
:
transparent
;
display
:
none
;
}
.record-view
{
.record-view
{
display
:
flex
;
display
:
flex
;
flex-direction
:
column
;
flex-direction
:
column
;
...
@@ -207,26 +286,35 @@ export default {
...
@@ -207,26 +286,35 @@ export default {
}
}
}
}
.body-view
{
.body-view
{
::-webkit-scrollbar
{
width
:
0
;
height
:
0
;
color
:
transparent
;
display
:
none
;
}
border-radius
:
24rpx
24rpx
0
0
;
border-radius
:
24rpx
24rpx
0
0
;
background-color
:
#ffffff
;
background-color
:
#ffffff
;
height
:
100%
;
height
:
100%
;
padding
:
10rpx
0
0rpx
0
;
overflow
:
auto
;
overflow
:
auto
;
padding
:
24rpx
30rpx
44rpx
30rpx
;
.scroll-view
{
height
:
100%
;
}
.date-view
{
.date-view
{
.date-content
{
.date-content
{
min-height
:
6
48
rpx
;
min-height
:
6
50
rpx
;
}
}
}
}
.content-title
{
.content-title
{
font-size
:
32rpx
;
font-size
:
32rpx
;
color
:
#191c27
;
color
:
#191c27
;
font-weight
:
bold
;
font-weight
:
bold
;
padding
:
20rpx
30rpx
0rpx
30rpx
;
}
}
.charts-view
{
.charts-view
{
.range-view
{
.range-view
{
display
:
flex
;
display
:
flex
;
margin-top
:
40rpx
;
margin
:
40rpx
30rpx
40rpx
30rpx
;
margin-bottom
:
40rpx
;
.range-title
{
.range-title
{
font-size
:
28rpx
;
font-size
:
28rpx
;
color
:
#9ea5bb
;
color
:
#9ea5bb
;
...
@@ -275,7 +363,10 @@ export default {
...
@@ -275,7 +363,10 @@ export default {
}
}
}
}
.list-view
{
.list-view
{
padding-bottom
:
20rpx
;
.list-content
{
.list-content
{
padding
:
0
30rpx
20rpx
30rpx
;
.show-more
{
.show-more
{
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
...
...
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