Commit 431000f3 authored by liujiangnan's avatar liujiangnan

feat: 上报和获取成绩

parent 3269a629
...@@ -92,7 +92,7 @@ cc.Class({ ...@@ -92,7 +92,7 @@ cc.Class({
this._isReadyToPlay = false; this._isReadyToPlay = false;
window['vv'] = this; window['vv'] = this;
cc.macro.ENABLE_TRANSPARENT_CANVAS = true; cc.macro.ENABLE_TRANSPARENT_CANVAS = true;
this.node.on('ready-to-play', () => { this.node.on('ready-to-play', () => {
...@@ -128,6 +128,12 @@ cc.Class({ ...@@ -128,6 +128,12 @@ cc.Class({
this.videoPlayer.currentTime = 0; this.videoPlayer.currentTime = 0;
// this.playButton.node.active = true; // this.playButton.node.active = true;
// this.pauseButton.node.active = false; // this.pauseButton.node.active = false;
// 上报答题结果
if (window && window.courseware) {
window.courseware.sendAnswer({isOver: true});
}
}); });
cc.view.setResizeCallback((params) => { cc.view.setResizeCallback((params) => {
console.log('Resize', params); console.log('Resize', params);
...@@ -254,20 +260,36 @@ cc.Class({ ...@@ -254,20 +260,36 @@ cc.Class({
// this.videoPlayer.keepAspectRatio = false; // 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) { if (window && window.courseware) {
// console.log('has window'); // console.log('has window');
getData = window.courseware.getData; getData = window.courseware.getData;
getAnswer = window.courseware.getAnswer;
} }
getData((data) => { getData((data) => {
console.log('data:', JSON.stringify(data)); console.log('data:', JSON.stringify(data));
this.data = data || this.getDefaultData(); this.data = data || this.getDefaultData();
this.videoPlayer.remoteURL = this.data.video_url; this.videoPlayer.remoteURL = this.data.video_url;
// this.preload() // this.preload()
if (window && window["air"]) { if (getAnswer) {
window["air"].hideAirClassLoading(); 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){ if(window.CustomEvent){
window.dispatchEvent(new CustomEvent('resize'), true) 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