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
e0ca408a
Commit
e0ca408a
authored
Sep 09, 2021
by
zhengke
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://gitlab.oytour.com/xiangwei/educationstu
parents
c010e298
c687298a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
22 deletions
+44
-22
ListenTopic.vue
src/components/subject/ListenTopic.vue
+41
-17
pages.json
src/pages.json
+3
-5
No files found.
src/components/subject/ListenTopic.vue
View file @
e0ca408a
<
template
>
<!-- 单选题 -->
<view>
<view
class=
"listen"
>
<view
class=
"item"
style=
"padding: 0 20px"
>
<view
class=
"name"
>
<view>
...
...
@@ -34,7 +34,13 @@
style=
"width: 26rpx; height: 22rpx"
src=
"https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/Static/educationStu/horn.png"
/>
{{
audioTime
}}
<van-count-down
:time=
"audioTime"
:auto-start=
"false"
class=
"flex flex_center_center"
ref=
"listenCountdown"
format=
"mm:ss"
/>
</view>
</view>
<view
class=
"questionView"
>
...
...
@@ -138,9 +144,11 @@ import {
watch
,
computed
,
onMounted
,
onUnmounted
,
}
from
"vue"
;
import
{
changeNumToHan
}
from
"../../utils/index"
;
const
innerAudioContext
=
uni
.
createInnerAudioContext
();
innerAudioContext
.
autoplay
=
true
export
default
{
props
:
{
paperData
:
Object
,
...
...
@@ -149,7 +157,7 @@ export default {
isLast
:
Boolean
,
},
setup
(
props
,
context
)
{
let
{
ctx
}
=
getCurrentInstance
();
let
{
refs
}
=
getCurrentInstance
();
let
data
=
reactive
({
autoplay
:
false
,
sortIndex
:
props
.
sort
+
1
,
//大题序号
...
...
@@ -157,8 +165,8 @@ export default {
data
:
props
.
paperData
,
current
:
1
,
//默认从第几个开始-用于从快捷菜单点入
ExamIndex
:
1
,
//第几题
audioTime
:
'00:00'
,
isPlay
:
fals
e
,
audioTime
:
60
*
60
*
1000
,
isPlay
:
tru
e
,
});
data
.
data
.
DetailsList
.
map
((
item
)
=>
{
let
arr
=
item
.
Title
.
split
(
" "
);
//按空格分段
...
...
@@ -188,25 +196,30 @@ export default {
audioManage
(
url
)
{
innerAudioContext
.
src
=
url
;
console
.
log
(
188
,
innerAudioContext
);
innerAudioContext
.
autoplay
=
true
innerAudioContext
.
onCanplay
(()
=>
{
console
.
log
(
innerAudioContext
.
duration
)
// 必须。可以当做是初始化时长
innerAudioContext
.
duration
;
// 必须。不然也获取不到时长
setTimeout
(()
=>
{
let
t
=
innerAudioContext
.
duration
let
m
=
parseInt
(
t
/
60
)
<
10
?
'0'
+
parseInt
(
t
/
60
):
parseInt
(
t
/
60
)
let
s
=
parseInt
(
t
%
60
)
<
10
?
'0'
+
parseInt
(
t
%
60
):
parseInt
(
t
%
60
)
data
.
audioTime
=
m
+
':'
+
s
console
.
log
(
data
.
audioTime
);
// 401.475918
let
t
=
innerAudioContext
.
duration
//
let m=parseInt(t/60)
<
10
?
'0'
+
parseInt
(
t
/
60
):
parseInt
(
t
/
60
)
//
let s=parseInt(t%60)
<
10
?
'0'
+
parseInt
(
t
%
60
):
parseInt
(
t
%
60
)
data
.
audioTime
=
t
*
1000
console
.
log
(
207
,
t
,
data
.
audioTime
);
// 401.475918
},
100
)
})
innerAudioContext
.
onPlay
(()
=>
{
console
.
log
(
"开始播放"
);
});
if
(
data
.
isPlay
)
{
innerAudioContext
.
play
();
// refs.listenCountdown.start();
console
.
log
(
"开始播放"
,
refs
);
data
.
isPlay
=
false
}
else
{
innerAudioContext
.
stop
();
console
.
log
(
"停了"
);
data
.
isPlay
=
true
}
// console.log(189, innerAudioContext.duration);
innerAudioContext
.
onError
((
res
)
=>
{
console
.
log
(
res
.
errMsg
);
...
...
@@ -240,6 +253,7 @@ export default {
},
onchange
(
e
)
{
data
.
audioTime
=
"00:00"
innerAudioContext
.
stop
();
data
.
ExamIndex
=
e
.
detail
.
current
;
if
(
data
.
ExamIndex
===
data
.
data
.
DetailsList
.
length
+
1
)
{
console
.
log
(
"听力"
,
e
.
detail
);
...
...
@@ -255,6 +269,10 @@ export default {
data
.
current
=
props
.
paperData
.
DetailsList
.
length
;
}
});
onUnmounted
(()
=>
{
innerAudioContext
.
stop
();
data
.
isPlay
=
true
});
let
that
=
methods
;
return
{
...
toRefs
(
data
),
...
...
@@ -263,7 +281,7 @@ export default {
},
};
</
script
>
<
style
scoped
>
<
style
>
.name
{
height
:
90
rpx
;
font-size
:
28
rpx
;
...
...
@@ -318,6 +336,7 @@ export default {
font-weight
:
500
;
color
:
#00acf9
;
}
.item2
{
box-sizing
:
border-box
;
margin
:
30
rpx
0
;
...
...
@@ -363,4 +382,9 @@ export default {
font-weight
:
bold
;
color
:
#111111
;
}
.listen
.van-count-down
{
font-size
:
22
rpx
!important
;
color
:
#00acf9
!important
;
background-color
:
#000000
}
</
style
>
src/pages.json
View file @
e0ca408a
...
...
@@ -59,10 +59,7 @@
},
{
"path"
:
"examPaper"
,
//试卷内容
"style"
:
{
"navigationStyle"
:
"custom"
,
"usingComponents"
:
{
"van-count-down"
:
"/wxcomponents/vant/count-down/index"
//
}
"navigationStyle"
:
"custom"
}
}]
}
...
...
@@ -119,7 +116,8 @@
"van-nav-bar"
:
"/wxcomponents/vant/nav-bar/index"
,
//
"van-tab"
:
"/wxcomponents/vant/tab/index"
,
//
"van-tabs"
:
"/wxcomponents/vant/tabs/index"
,
//
"van-tree-select"
:
"/wxcomponents/vant/tree-select/index"
//
"van-tree-select"
:
"/wxcomponents/vant/tree-select/index"
,
//
"van-count-down"
:
"/wxcomponents/vant/count-down/index"
}
}
}
\ No newline at end of file
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