四端上传
This commit is contained in:
1 parent
25bbb5f9c8
commit
c6e2cb4d5b
276 files changed
+17812
-3
No files matched your search
@@ -0,0 +1,56 @@
|
||||
// pages/IndexFreeCourseDetails/IndexFreeCourseDetails.js
|
||||
const api = require('../../utils/api');
|
||||
const format = require('../../utils/format');
|
||||
|
||||
Page({
|
||||
data: {
|
||||
VideoTitle: '',
|
||||
playdata: [],
|
||||
VideoPlayerSrc: '',
|
||||
HiddenVideoControl: true,
|
||||
top: 0,
|
||||
},
|
||||
|
||||
onLoad(options) {
|
||||
const seriesNo = options.seriesNo;
|
||||
if (!seriesNo) {
|
||||
wx.switchTab({ url: '/pages/index/index' });
|
||||
return;
|
||||
}
|
||||
|
||||
api
|
||||
.getFreeLessons(Number(seriesNo))
|
||||
.then((list) => {
|
||||
const rows = (list || []).map((item) => ({
|
||||
coverUrl: item.coverUrl,
|
||||
videoTitle: item.videoTitle,
|
||||
intro: item.intro,
|
||||
publishedAt: format.toDateString(item.publishedAt),
|
||||
duration: item.duration,
|
||||
videoUrl: item.videoUrl,
|
||||
}));
|
||||
this.setData({
|
||||
playdata: rows,
|
||||
VideoTitle: rows.length ? rows[0].videoTitle || '' : '',
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('[IndexFreeCourseDetails] 加载失败', err);
|
||||
this.setData({ playdata: [] });
|
||||
});
|
||||
},
|
||||
|
||||
onTapLesson(e) {
|
||||
const item = this.data.playdata[e.currentTarget.dataset.index];
|
||||
if (!item || !item.videoUrl) {
|
||||
wx.showToast({ title: '该课时暂无视频', icon: 'none' });
|
||||
return;
|
||||
}
|
||||
this.setData({ VideoPlayerSrc: item.videoUrl, HiddenVideoControl: false, top: 420 });
|
||||
},
|
||||
|
||||
onShareAppMessage() {
|
||||
return { title: '叶雷讲数学', path: '/pages/index/index' };
|
||||
},
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user