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
5cab2d6c
Commit
5cab2d6c
authored
Mar 24, 2022
by
zhengke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
f33d5a3b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
146 additions
and
33 deletions
+146
-33
Pronunciation.vue
src/components/word/Pronunciation.vue
+28
-10
test.vue
src/pages/word/test.vue
+25
-1
wordStudy.vue
src/pages/word/wordStudy.vue
+93
-22
No files found.
src/components/word/Pronunciation.vue
View file @
5cab2d6c
...
...
@@ -19,10 +19,13 @@
</view>
</view>
<view
class=
"listen"
@
click=
"play(item.FileUrl)"
>
<!--
<image
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/laba2x.png"
mode=
"aspectFit"
class=
"listenIcon"
></image>
-->
<i
class=
"icon_audio_default"
v-if=
"!isPlay"
></i>
<i
class=
"icon_audio_playing"
v-else
></i>
<template
v-if=
"!isLoading"
>
<i
class=
"icon_audio_default"
v-if=
"!isPlay"
></i>
<i
class=
"icon_audio_playing"
v-else
></i>
</
template
>
<
template
v-else
>
<van-loading
type=
"spinner"
color=
"#7b7f80"
/>
</
template
>
</view>
<view
class=
"listenText"
>
播放读音
...
...
@@ -63,13 +66,14 @@
default
:
()
=>
{
return
{}
}
}
}
,
},
setup
(
props
)
{
const
data
=
reactive
({
isPlay
:
false
let
data
=
reactive
({
isPlay
:
false
,
isLoading
:
false
})
cons
t
methods
=
{
le
t
methods
=
{
play
(
src
)
{
if
(
src
){
innerAudioContext
.
src
=
encodeURI
(
src
);
...
...
@@ -77,10 +81,24 @@
innerAudioContext
.
src
=
`https://fanyi.baidu.com/gettts?lan=jp&text=
${
encodeURIComponent
(
props
.
item
.
WordContent
)}
&spd=3&source=web`
}
innerAudioContext
.
play
()
data
.
isPlay
=
true
;
innerAudioContext
.
play
();
if
(
!
data
.
isPlay
){
data
.
isLoading
=
true
;
}
innerAudioContext
.
onCanplay
(()
=>
{
data
.
isLoading
=
false
;
data
.
isPlay
=
true
;
})
innerAudioContext
.
onEnded
((
e
)
=>
{
data
.
isPlay
=
false
;
data
.
isLoading
=
false
;
})
},
stopVoice
(){
data
.
isPlay
=
false
;
innerAudioContext
.
stop
();
innerAudioContext
.
offCanplay
(()
=>
{
})
}
}
...
...
src/pages/word/test.vue
View file @
5cab2d6c
...
...
@@ -75,7 +75,15 @@
const
total
=
data
.
reviewGroupList
.
length
+
data
.
prepGroupList
.
length
if
(
data
.
curTest
==
total
)
{
methods
.
submitWordsTest
()
uni
.
removeStorageSync
(
"testData"
,
obj
);
}
let
obj
=
{
CourseId
:
data
.
msg
.
CourseId
,
ChapterId
:
data
.
msg
.
ChapterId
,
NextChapterId
:
data
.
msg
.
NextChapterId
,
index
:
data
.
curTest
}
uni
.
setStorageSync
(
"testData"
,
obj
);
},
next
(
val
,
item
)
{
if
(
val
)
{
...
...
@@ -106,7 +114,23 @@
},
};
onMounted
(()
=>
{
data
.
startTime
=
getCurrentTime
()
data
.
startTime
=
getCurrentTime
();
let
testObj
=
uni
.
getStorageSync
(
'testData'
);
if
(
testObj
){
if
((
data
.
msg
.
CourseId
==
testObj
.
CourseId
)
&&
(
data
.
msg
.
ChapterId
==
testObj
.
ChapterId
)
&&
(
data
.
msg
.
NextChapterId
==
testObj
.
NextChapterId
)){
uni
.
showModal
({
title
:
'提示'
,
content
:
`是否继续上次测试`
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
data
.
curTest
=
testObj
.
index
;
}
else
if
(
res
.
cancel
)
{
data
.
curTest
=
0
;
}
}
});
}
}
});
let
that
=
methods
;
return
{
...
...
src/pages/word/wordStudy.vue
View file @
5cab2d6c
<
template
>
<view
class=
"word"
>
<van-skeleton
title
row=
"10"
v-if=
"loading"
/>
<van-empty
description=
"暂无数据"
v-if=
"nodata"
/>
<van-empty
description=
"暂无数据"
v-if=
"nodata"
/>
<swiper
class=
"swiper"
next-margin=
"60rpx"
@
change=
"swiperChange"
:current=
"current"
v-if=
"!loading&&!nodata"
>
<swiper-item
v-for=
"(item,index) in StudyList"
v-if=
"Type==2"
:key=
"index"
class=
"swiper-item"
>
<Pronunciation
:item=
"item"
:cur=
"index+1"
:total=
"StudyList.length"
></Pronunciation>
<Pronunciation
:item=
"item"
:cur=
"index+1"
:
ref=
"'cur'+index"
:
total=
"StudyList.length"
></Pronunciation>
</swiper-item>
<swiper-item
v-for=
"(item,index) in ReviewList"
v-if=
"Type==1"
:key=
"index"
class=
"swiper-item"
>
<Pronunciation
:item=
"item"
:cur=
"index+1"
:total=
"ReviewList.length"
:type=
"1"
></Pronunciation>
<Pronunciation
:item=
"item"
:cur=
"index+1"
:total=
"ReviewList.length"
:type=
"1"
>
</Pronunciation>
</swiper-item>
<swiper-item></swiper-item>
</swiper>
...
...
@@ -57,48 +58,118 @@
StudyNum
:
0
,
//学习总单词数量
StudyType
:
1
,
//1-预习,2-复习
},
Type
:
1
,
//1复习 2 单词
TotalHours
:
0
,
CourseName
:
''
,
Type
:
1
,
//1复习 2 单词
TotalHours
:
0
,
CourseName
:
''
,
loading
:
false
,
nodata
:
false
,
nodata
:
false
})
let
methods
=
{
getData
()
{
data
.
loading
=
true
data
.
loading
=
true
proxy
.
$request
(
'/AppletWords/GetStudyWords'
,
data
.
msg
).
then
(
res
=>
{
data
.
loading
=
false
data
.
loading
=
false
data
.
StudyList
=
res
.
Data
.
StudyList
data
.
ReviewList
=
res
.
Data
.
ReviewList
;
data
.
current
=
0
data
.
current
=
0
if
(
data
.
StudyList
.
length
===
0
&&
data
.
ReviewList
.
length
==
0
)
{
data
.
nodata
=
true
}
}).
catch
(
err
=>
{
data
.
loading
=
false
}).
catch
(
err
=>
{
data
.
loading
=
false
data
.
nodata
=
true
})
},
getCountine
()
{
if
(
data
.
StudyList
.
length
>
0
)
{
let
ChapterId
=
data
.
StudyList
[
0
].
ChapterId
;
let
CourseId
=
data
.
StudyList
[
0
].
CourseId
;
let
studyObj
=
uni
.
getStorageSync
(
'studyData'
);
if
(
ChapterId
==
studyObj
.
ChapterId
&&
CourseId
==
studyObj
.
CourseId
)
{
data
.
current
=
studyObj
.
index
;
}
}
if
(
data
.
ReviewList
.
length
>
0
)
{
let
ChapterId
=
data
.
ReviewList
[
0
].
ChapterId
;
let
CourseId
=
data
.
ReviewList
[
0
].
CourseId
;
let
studyObj
=
uni
.
getStorageSync
(
'reviewData'
);
if
(
ChapterId
==
studyObj
.
ChapterId
&&
CourseId
==
studyObj
.
CourseId
)
{
data
.
current
=
studyObj
.
index
;
}
}
},
swiperChange
(
val
)
{
data
.
current
=
val
.
detail
.
current
if
(
data
.
Type
==
1
)
{
if
(
val
.
detail
.
current
+
1
==
data
.
ReviewList
.
length
+
1
&&
data
.
ReviewList
.
length
>
1
)
{
if
(
data
.
Type
==
1
)
{
if
(
val
.
detail
.
current
+
1
==
data
.
ReviewList
.
length
+
1
&&
data
.
ReviewList
.
length
>
1
)
{
uni
.
navigateTo
({
url
:
`/pages/word/readComplete?ClassId=
${
data
.
readMsg
.
ClassId
}
&&CourseId=
${
data
.
readMsg
.
CourseId
}
&&CourseName=
${
data
.
CourseName
}
&&TotalHours=
${
data
.
TotalHours
}
`
})
uni
.
removeStorageSync
(
"reviewData"
)
}
let
obj
=
{
ChapterId
:
0
,
CourseId
:
0
,
index
:
0
}
let
name
=
'cur'
+
val
.
detail
.
current
;
if
(
val
.
detail
.
current
+
1
<=
data
.
ReviewList
.
length
){
obj
.
ChapterId
=
data
.
ReviewList
[
data
.
current
].
ChapterId
;
obj
.
CourseId
=
data
.
ReviewList
[
data
.
current
].
CourseId
;
obj
.
index
=
data
.
current
;
uni
.
setStorageSync
(
"reviewData"
,
obj
);
this
.
$refs
[
name
][
0
].
stopVoice
();
}
}
if
(
data
.
Type
==
2
)
{
if
(
val
.
detail
.
current
+
1
==
data
.
StudyList
.
length
+
1
&&
data
.
StudyList
.
length
>
1
)
{
if
(
data
.
Type
==
2
)
{
if
(
val
.
detail
.
current
+
1
==
data
.
StudyList
.
length
+
1
&&
data
.
StudyList
.
length
>
1
)
{
uni
.
navigateTo
({
url
:
`/pages/word/readComplete?ClassId=
${
data
.
readMsg
.
ClassId
}
&&CourseId=
${
data
.
readMsg
.
CourseId
}
&&CourseName=
${
data
.
CourseName
}
&&TotalHours=
${
data
.
TotalHours
}
`
})
uni
.
removeStorageSync
(
"studyData"
)
}
let
obj
=
{
ChapterId
:
0
,
CourseId
:
0
,
index
:
0
}
let
name
=
'cur'
+
val
.
detail
.
current
;
if
(
val
.
detail
.
current
+
1
<=
data
.
StudyList
.
length
){
obj
.
ChapterId
=
data
.
StudyList
[
data
.
current
].
ChapterId
;
obj
.
CourseId
=
data
.
StudyList
[
data
.
current
].
CourseId
;
obj
.
index
=
data
.
current
;
uni
.
setStorageSync
(
"studyData"
,
obj
);
this
.
$refs
[
name
][
0
].
stopVoice
();
}
}
},
}
onMounted
(()
=>
{
var
studyObj
=
uni
.
getStorageSync
(
"studyData"
);
if
((
data
.
msg
.
ChapterId
==
studyObj
.
ChapterId
)
&&
(
data
.
msg
.
CourseId
==
studyObj
.
CourseId
))
{
let
str
=
''
if
(
data
.
Type
==
1
)
{
str
=
'复习'
}
else
{
str
=
'学习'
}
if
(
studyObj
&&
studyObj
.
index
>
1
)
{
uni
.
showModal
({
title
:
'提示'
,
content
:
`是否继续上次
${
str
}
?`
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
that
.
getCountine
();
}
else
if
(
res
.
cancel
)
{
data
.
current
=
0
;
}
}
});
}
}
})
let
that
=
methods
;
return
{
...
...
@@ -117,13 +188,13 @@
if
(
options
.
ChapterId
&&
options
.
CourseId
&&
options
.
ReviewChapterId
)
{
this
.
getData
();
}
if
(
options
.
Type
)
{
this
.
Type
=
options
.
Type
if
(
options
.
Type
)
{
this
.
Type
=
options
.
Type
}
if
(
options
.
CourseName
)
{
this
.
CourseName
=
options
.
CourseName
;
if
(
options
.
CourseName
)
{
this
.
CourseName
=
options
.
CourseName
;
}
if
(
options
.
TotalHours
)
{
if
(
options
.
TotalHours
)
{
this
.
TotalHours
=
options
.
TotalHours
;
}
const
userInfo
=
uni
.
getStorageSync
(
'userInfo'
);
...
...
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