提交 7b0e9ffd authored 作者: 王鹏飞's avatar 王鹏飞

Merge branch 'master' into bluestar

......@@ -8,7 +8,8 @@ const getMyMsg = (callback) => {
util.requestApi({
url: util.config.URL_PATH1 + '/v2/education/message/my',
callback: function (res) {
let json = res.data.map(function (_, i) {
let list = Array.isArray(res.data) ? res.data : res.data.list || []
let json = list.map(function (_, i) {
return {
isRead: false,
id: _.id,
......
......@@ -27,7 +27,6 @@
"color": "#313131",
"backgroundColor": "#ffffff",
"selectedColor": "#b49441",
"aniamtion": "true",
"list": [
{
"pagePath": "pages/learnSystem/home/home",
......
......@@ -22,7 +22,7 @@ Page({
onLoad: function (options) {
wx.showLoading({ title: '页面加载中...', mask: true })
MsgApi.getMyMsg((json) => {
this.setData({ 'msgList': json })
this.setData({ msgList: json })
wx.hideLoading()
})
},
......@@ -47,15 +47,15 @@ Page({
*/
onPullDownRefresh: function () {
// 显示顶部刷新图标
wx.showNavigationBarLoading();
wx.showNavigationBarLoading()
wx.showLoading({ title: '更新中...', mask: true })
MsgApi.getMyMsg((json) => {
this.setData({ 'msgList': json })
this.setData({ msgList: json.list })
wx.hideLoading()
// 隐藏导航栏加载框
wx.hideNavigationBarLoading();
wx.hideNavigationBarLoading()
// 停止下拉动作
wx.stopPullDownRefresh();
wx.stopPullDownRefresh()
})
},
/**
......@@ -81,7 +81,7 @@ Page({
* 滚动到底部,加载更多数据
*/
loadmore: function () {
let _that = this;
let _that = this
wx.showLoading({ title: '数据加载中...', mask: true })
setTimeout(function () {
wx.showToast({ title: '没有更多了', icon: 'none' })
......
......@@ -5,12 +5,12 @@
*/
var Audio = function (src, _that) {
if (!(this instanceof Audio)) {
return new Audio(src, _that);
return new Audio(src, _that)
} else {
this._audio = this.init(src, _that);
this.currentTime = 0; // 当前时间
this.totalTime = 0; // 总时间
this.rateIndex = 2; // 取值为 RATE中的 下标 0,1,2,3,4
this._audio = this.init(src, _that)
this.currentTime = 0 // 当前时间
this.totalTime = 0 // 总时间
this.rateIndex = 2 // 取值为 RATE中的 下标 0,1,2,3,4
}
}
/**
......@@ -27,38 +27,48 @@ Audio.prototype = {
constructor: Audio,
RATE: ['0.5', '0.8', '1.0', '1.25', '1.5'],
init: function (src, _that) {
let _auCtx = wx.createInnerAudioContext();
_auCtx.autoplay = false;
_auCtx.src = src;
let _auCtx = wx.createInnerAudioContext()
wx.setInnerAudioOption({ obeyMuteSwitch: false })
_auCtx.autoplay = false
_auCtx.src = src
/* 使用绑定事件,代替wxml中的事件绑定 */
_auCtx.onTimeUpdate(() => { let e = { detail: { currentTime: _auCtx.currentTime, duration: _auCtx.duration } }; _that.timeUpdate(e) })
_auCtx.onPlay(() => { _that.beginPlayVA() })
_auCtx.onError((e) => { _that.playError(e) })
_auCtx.onEnded(() => { _that.playEnded })
return _auCtx;
_auCtx.onTimeUpdate(() => {
let e = {
detail: { currentTime: _auCtx.currentTime, duration: _auCtx.duration }
}
_that.timeUpdate(e)
})
_auCtx.onPlay(() => {
_that.beginPlayVA()
})
_auCtx.onError((e) => {
_that.playError(e)
})
_auCtx.onEnded(() => {
_that.playEnded
})
return _auCtx
},
play: function () {
this._audio.play();
this._audio.play()
},
pause: function () {
this._audio.pause();
this._audio.pause()
},
stop: function () {
this._audio.stop();
this._audio.stop()
},
seek: function (time) {
this._audio.seek(time);
this._audio.seek(time)
},
fastSlow15: function (timeStr) {
this._audio.seek(this.currentTime + parseInt(timeStr));
this._audio.seek(this.currentTime + parseInt(timeStr))
},
rate: function () {
this.rateIndex++;
if (this.rateIndex > 4) this.rateIndex = 0;
this._audio.playbackRate(parseFloat(this.RATE[this.rateIndex]));
this.rateIndex++
if (this.rateIndex > 4) this.rateIndex = 0
this._audio.playbackRate(parseFloat(this.RATE[this.rateIndex]))
}
}
module.exports = {
Audio: Audio
......
<template name='contentAudio'>
<view class='content-audio'
style='{{status.isSet && status.isAudio ? "display: none;" : "" }} {{status.isImages && status.isAudio ? "display: none;" : "" }} {{status.isVideo ? "display: none;" : "" }}'
>
<view class='content-audio' wx:if="{{status.isAudio}}">
<image src='./contentAudio/icons/loading_small.gif' class='loading-image {{status.imagesLoaded && "none"}}' mode='aspectFit'/>
<image wx:if='{{image.imgUrls[image.current]}}' src='{{image.imgUrls[image.current]}}' class='slide-image' mode='aspectFill' bindload='imagesLoaded'/>
<view wx:if='{{!image.imgUrls[image.current]}}' class='slide-image'>本课程暂无PPT</view>
......
<template name='contentVideo'>
<!-- 这里加 这么多判断原因,video组件在真机上测试,一定在最上层,其他任何元素都挡不住,只能先隐藏,需要时再显示 -->
<view class='content-video'
style='{{status.isSet && status.isVideo ? "display: none;" : "" }} {{status.isImages && status.isVideo ? "display: none;" : "" }} {{status.isAudio ? "display: none;" : "" }} {{chapterList.isShow && status.isVideo ? "display: none;" : "" }} {{ status.isLoading ? "display: none": "" }}'
>
<view class='content-video' wx:if="{{status.isVideo}}">
<video id='my-video' class='my-video' src='{{video.src}}' show-center-play-btn='{{false}}' controls='{{false}}' bindtimeupdate='timeUpdate' bindfullscreenchange='beginAndOutFullScreen' bindpause='beginPauseVA' bindplay='beginPlayVA' binderror='playError' bindended='playEnded' autoplay='{{true}}'></video>
</view>
</template>
\ No newline at end of file
......@@ -13,14 +13,16 @@
<template is='pageLoading'></template>
</block>
<block wx:if='{{status.isSupport}}'>
<template is='contentAudio' data='{{status, audio, image, ctrlBar}}'></template>
<template is='contentVideo' data='{{status, video, chapterList, ctrlBar}}'></template>
<block wx:if='{{status.isSet}}'>
<template is='setContent' data='{{ctrlBar}}'></template>
</block><block wx:elif='{{status.isImages}}'>
</block>
<block wx:elif='{{status.isImages}}'>
<template is='contentImages' data='{{status, image}}'></template>
</block>
<template is='contentAudio' data='{{status, audio, image, ctrlBar}}'></template>
<template is='contentVideo' data='{{status, video, chapterList, ctrlBar}}'></template>
</block><block wx:else>
</block>
<block wx:else>
<template is='noSupport'></template>
</block>
<template is='controlBar' data='{{status, video, ctrlBar, chapterList, initVAFlag}}'></template>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论