提交 d42658c5 authored 作者: hexi's avatar hexi

Merge branch 'master' into bluestar

...@@ -20,6 +20,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -20,6 +20,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo = { prevVideo = {
id: _.children[j-1].resource_id, id: _.children[j-1].resource_id,
time: _.children[j-1].video && util.durationToTimeString(_.children[j-1].video.video_length) || '', time: _.children[j-1].video && util.durationToTimeString(_.children[j-1].video.video_length) || '',
videoType: _.children[j-1].video && _.children[j-1].video.video_provider || '',
name: _.children[j-1].name name: _.children[j-1].name
} }
} else if (i-1>=0) { } else if (i-1>=0) {
...@@ -27,6 +28,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -27,6 +28,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
prevVideo = { prevVideo = {
id: _temp.children[_temp.children.length-1].resource_id, id: _temp.children[_temp.children.length-1].resource_id,
time: _temp.children[_temp.children.length-1].video && util.durationToTimeString(_temp.children[_temp.children.length-1].video.video_length) || '', time: _temp.children[_temp.children.length-1].video && util.durationToTimeString(_temp.children[_temp.children.length-1].video.video_length) || '',
videoType: _.children[_temp.children.length-1].video && _.children[_temp.children.length-1].video.video_provider || '',
name: _temp.children[_temp.children.length-1].name name: _temp.children[_temp.children.length-1].name
} }
} }
...@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -34,6 +36,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = { nextVideo = {
id: _.children[j + 1].resource_id, id: _.children[j + 1].resource_id,
time: _.children[j + 1].video && util.durationToTimeString(_.children[j + 1].video.video_length) || '', time: _.children[j + 1].video && util.durationToTimeString(_.children[j + 1].video.video_length) || '',
videoType: _.children[j + 1].video && _.children[j + 1].video.video_provider || '',
name: _.children[j + 1].name name: _.children[j + 1].name
} }
} else if (i + 1 < res.data.chapters.length) { } else if (i + 1 < res.data.chapters.length) {
...@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -41,6 +44,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
nextVideo = { nextVideo = {
id: _temp.children[0].resource_id, id: _temp.children[0].resource_id,
time: _temp.children[0].video && util.durationToTimeString(_temp.children[0].video.video_length) || '', time: _temp.children[0].video && util.durationToTimeString(_temp.children[0].video.video_length) || '',
videoType: _.children[0].video && _.children[0].video.video_provider || '',
name: _temp.children[0].name name: _temp.children[0].name
} }
} }
...@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -64,6 +68,7 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
return { return {
id: __.resource_id, id: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '', time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name, name: __.name,
homework: _homework homework: _homework
} }
...@@ -78,9 +83,17 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback) ...@@ -78,9 +83,17 @@ const getChapterList = (cur_course_id, cur_semester_id, cur_video_id, callback)
}) })
} }
/* 获取对应某个章节的详细信息 */ /* 获取对应某个章节的详细信息 */
const getCurrentChapterDetail = (vid, callback) => { const getCurrentChapterDetail = (vid, videoType,callback) => {
// CC视频请求数据接口
let _url = null;
if(videoType == 3){
_url = util.config.URL_PATH1 + '/v2/education/aliyun-video-streaming'
}else{
_url = util.config.URL_PATH1 + '/v2/education/video-streaming'
}
util.requestApi({ util.requestApi({
url: util.config.URL_PATH1 + '/v2/education/video-streaming', url: _url,
method: 'POST', method: 'POST',
data: { data: {
vid: vid vid: vid
...@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => { ...@@ -88,11 +101,11 @@ const getCurrentChapterDetail = (vid, callback) => {
callback: function (res) { callback: function (res) {
let json = { let json = {
video: { video: {
src: res.data.video[0].playurl, src: videoType == 3 ? res.data.video &&res.data.video.LD : res.data.video[0] && res.data.video[0].playurl,
spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正式环境时,需要将 contentVideo 中 spareSrc 改成 src spareSrc: 'http://pd4t7ae3m.bkt.clouddn.com/test.mp4' // 正式环境时,需要将 contentVideo 中 spareSrc 改成 src
}, },
audio: { audio: {
src: res.data.audio[0].url, src: videoType == 3 ? res.data.video &&res.data.video.SQ : res.data.audio[0].url,
poster: res.data.ppts && res.data.ppts[0] && res.data.ppts[0].ppt_url || '' poster: res.data.ppts && res.data.ppts[0] && res.data.ppts[0].ppt_url || ''
}, },
image: { image: {
......
...@@ -106,6 +106,7 @@ const getCourseDetail = (id, sid, callback) => { ...@@ -106,6 +106,7 @@ const getCourseDetail = (id, sid, callback) => {
sid: cur.semester_id, sid: cur.semester_id,
vid: __.resource_id, vid: __.resource_id,
time: __.video && util.durationToTimeString(__.video.video_length) || '', time: __.video && util.durationToTimeString(__.video.video_length) || '',
videoType:__.video && __.video.video_provider,
name: __.name, name: __.name,
homework: _homework homework: _homework
} }
......
#### 3.0.8.2019.07.25
1、增加阿里视频源
#### 3.0.8.2019.07.22 #### 3.0.8.2019.07.22
1、修复安卓手机数据上报问题 1、修复安卓手机数据上报问题
#### 3.0.7.2019.07.17 #### 3.0.7.2019.07.17
......
...@@ -223,7 +223,7 @@ Page({ ...@@ -223,7 +223,7 @@ Page({
/* 如果未选课,不能查看课程内容 */ /* 如果未选课,不能查看课程内容 */
if (!this.data.headerInfo.isStart) { wx.showToast({ title: '先选课,才能看', icon: 'none', duration: 1500 }); return ; } if (!this.data.headerInfo.isStart) { wx.showToast({ title: '先选课,才能看', icon: 'none', duration: 1500 }); return ; }
let _data = e.target.dataset let _data = e.target.dataset
let cid = _data.cid, sid = _data.sid, vid = _data.vid let cid = _data.cid, sid = _data.sid, vid = _data.vid,video_type = _data.videoType;
if (!_data.hasva) { if (!_data.hasva) {
/* 如果存在 - 课后习题类型, type:3、work_type:1 */ /* 如果存在 - 课后习题类型, type:3、work_type:1 */
let i1 = _data.index, i2 = _data.index1 let i1 = _data.index, i2 = _data.index1
...@@ -238,8 +238,9 @@ Page({ ...@@ -238,8 +238,9 @@ Page({
} }
wx.showToast({ title: '请在PC上使用该功能', icon: 'none' }); return ; wx.showToast({ title: '请在PC上使用该功能', icon: 'none' }); return ;
} }
wx.navigateTo({ wx.navigateTo({
url: '/pages/videoPlayer/show' + '?cid=' + cid + '&sid=' + sid + '&vid=' + vid url: '/pages/videoPlayer/show' + '?cid=' + cid + '&sid=' + sid + '&vid=' + vid + '&type=' + video_type
}) })
}, },
/** /**
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
</view> </view>
<block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'> <block wx:for='{{_item.chapters}}' wx:key='{{index1}}' wx:for-item='item1' wx:for-index='index1'>
<view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'> <view class='body {{item1.id === item.chapterList.currentChapterId && "on"}}'>
<view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'> <view class='name' data-vid='{{item1.vid}}' data-cid='{{item1.cid}}' data-sid='{{item1.sid}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}} {{item1.name}}
<view class='time'>{{item1.time}}</view> <view class='time'>{{item1.time}}</view>
</view> </view>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<view class='title'>{{item.title}}</view> <view class='title'>{{item.title}}</view>
<block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'> <block wx:for='{{item.chapters}}' wx:key='{{index1}}' wx:for-item="item1" wx:for-index='index1'>
<view class='body {{item1.id === chapterList.currentChapterId && "on"}}'> <view class='body {{item1.id === chapterList.currentChapterId && "on"}}'>
<view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}'> <view class='name' data-id='{{item1.id}}' data-hasVA='{{item1.time}}' data-name='{{item1.name}}' bindtap='jumpToOtherVA' data-index='{{index}}' data-index1='{{index1}}' data-type='{{item1.videoType}}'>
{{item1.name}} {{item1.name}}
<view class='time'>{{item1.time}}</view> <view class='time'>{{item1.time}}</view>
</view> </view>
......
...@@ -142,12 +142,14 @@ Page({ ...@@ -142,12 +142,14 @@ Page({
}, 200); }, 200);
}, },
/* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */ /* 页面初始入口,会 先走 AJAX 读取 章节列表数据、音视频和PPT数据、进度数据 */
ajaxInitGetInfo: function (vid) { ajaxInitGetInfo: function (vid,videoType) {
let cid = this.data.options.cid, sid = this.data.options.sid, did = 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8'; let cid = this.data.options.cid, sid = this.data.options.sid, did = 'jjhz92fn0.le2a6c06c9g0.thhg7ekb1f8';
ChapterApi.getChapterList(cid, sid, vid, (json) => { ChapterApi.getChapterList(cid, sid, vid, (json) => {
this.setData({ 'chapterList': json }) this.setData({ 'chapterList': json })
}) })
ChapterApi.getCurrentChapterDetail(vid, (json) => { // CC视频走这个接口
ChapterApi.getCurrentChapterDetail(vid,videoType, (json) => {
// 播放的视频数据
this.setData({ 'video': json.video }) this.setData({ 'video': json.video })
this.setData({ 'audio': json.audio }) this.setData({ 'audio': json.audio })
this.setData({ 'image': json.image }) this.setData({ 'image': json.image })
...@@ -191,7 +193,7 @@ Page({ ...@@ -191,7 +193,7 @@ Page({
} }
}, },
/* 生命周期函数--监听页面初次渲染完成 */ /* 生命周期函数--监听页面初次渲染完成 */
onReady: function () { this.ajaxInitGetInfo(this.data.options.vid); }, onReady: function () { this.ajaxInitGetInfo(this.data.options.vid,this.data.options.type); },
/* controlBar页面 - 切换音频页面 - bindTap事件 */ /* controlBar页面 - 切换音频页面 - bindTap事件 */
showContentAudio: function () { showContentAudio: function () {
...@@ -230,7 +232,6 @@ Page({ ...@@ -230,7 +232,6 @@ Page({
jumpToOtherVA: function (e) { jumpToOtherVA: function (e) {
/* 跳转时,清空当前播放状态 */ /* 跳转时,清空当前播放状态 */
this.heartbeat && clearInterval(this.heartbeat) this.heartbeat && clearInterval(this.heartbeat)
let _data = e.target.dataset; let _data = e.target.dataset;
if (!_data.hasva) { if (!_data.hasva) {
/* 如果存在 - 课后习题类型, type:3、work_type:1 */ /* 如果存在 - 课后习题类型, type:3、work_type:1 */
...@@ -248,7 +249,7 @@ Page({ ...@@ -248,7 +249,7 @@ Page({
} }
this.isFirstInitAndSwitchVideo = true; this.isFirstInitAndSwitchVideo = true;
this.statusClear(_data.name, _data.id); this.statusClear(_data.name, _data.id);
this.ajaxInitGetInfo(_data.id); this.ajaxInitGetInfo(_data.id,_data.type);
}, },
/* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */ /* controlBar页面 和 selectChapterList页面 - 切换章节列表: 辅助方法 - 1. 暂停视频;2. 关闭章节选择列表;3. 状态清理(status、videoCacheCtrlBar、audioCacheCtrlBar);4. 设置微信导航头 */
statusClear: function (name, id) { statusClear: function (name, id) {
......
...@@ -21,7 +21,7 @@ const url_online = { ...@@ -21,7 +21,7 @@ const url_online = {
tenant: 'sofia', tenant: 'sofia',
version: '3.0.8' version: '3.0.8'
} }
let config = url_online; let config = url_test;
/* 请求接口统一 重定义 */ /* 请求接口统一 重定义 */
const requestApi = (obj) => { const requestApi = (obj) => {
let _token = wx.getStorageSync('userSession').sessionKey let _token = wx.getStorageSync('userSession').sessionKey
...@@ -160,7 +160,7 @@ const loginApi = (obj, callback) => { ...@@ -160,7 +160,7 @@ const loginApi = (obj, callback) => {
unionid: res.data.union_id unionid: res.data.union_id
}, },
success: res2 => { success: res2 => {
if (res2.statusCode != 200) { wx.showToast({ title: res.data.message||'获取用户信息失败', icon: 'none' }); return; } if (res2.statusCode != 200) { wx.showToast({ title: res2.data.message||'获取用户信息失败', icon: 'none' }); return; }
wx.setStorageSync("sid", res2.data.id); wx.setStorageSync("sid", res2.data.id);
wx.setStorageSync("uid", res1.data.uid); wx.setStorageSync("uid", res1.data.uid);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论