Commit 431000f3 authored by liujiangnan's avatar liujiangnan

feat: 上报和获取成绩

parent 3269a629
......@@ -92,7 +92,7 @@ cc.Class({
this._isReadyToPlay = false;
window['vv'] = this;
cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
this.node.on('ready-to-play', () => {
......@@ -128,6 +128,12 @@ cc.Class({
this.videoPlayer.currentTime = 0;
// this.playButton.node.active = true;
// this.pauseButton.node.active = false;
// 上报答题结果
if (window && window.courseware) {
window.courseware.sendAnswer({isOver: true});
}
});
cc.view.setResizeCallback((params) => {
console.log('Resize', params);
......@@ -254,20 +260,36 @@ cc.Class({
// this.videoPlayer.keepAspectRatio = false;
if (window && window.courseware) {
}
let getData = this.getData.bind(this);
let getData = this.getData.bind(this);
let getAnswer;
if (window && window.courseware) {
// console.log('has window');
getData = window.courseware.getData;
getData = window.courseware.getData;
getAnswer = window.courseware.getAnswer;
}
getData((data) => {
console.log('data:', JSON.stringify(data));
this.data = data || this.getDefaultData();
this.videoPlayer.remoteURL = this.data.video_url;
// this.preload()
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
if (getAnswer) {
getAnswer((ans) => {
if (ans) {
this.isOver = JSON.parse(ans).isOver;
}
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
});
} else {
if (window && window["air"]) {
window["air"].hideAirClassLoading();
}
}
});
if(window.CustomEvent){
window.dispatchEvent(new CustomEvent('resize'), true)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment