Commit 302f5456 authored by limingzhe's avatar limingzhe

fix: 自幕版 滑动不了

parent 15a5a5e8
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<div #iframeContent style="position: absolute; top: 0; overflow: hidden; "> <div #iframeContent style="position: absolute; top: 0; overflow: hidden; ">
<div *ngFor="let t of templateArr; let i = index" > <div *ngFor="let t of templateArr; let i = index" >
<iframe *ngIf="!t.isHide" [style.left]="t?.leftOff || '100vw'" [src]="t?.playUrl || safeDefaultUrl" style="position: fixed; width: 100vw; height: 100vh; border: 0px solid #ccc; " frameborder="0"> <iframe *ngIf="!t.isHide" [style.width]="t?.leftOff || '0vw'" [src]="t?.playUrl || safeDefaultUrl" style="position: fixed; width: 100vw; height: 100vh; border: 0px solid #ccc; " frameborder="0">
</iframe> </iframe>
</div> </div>
</div> </div>
......
...@@ -229,7 +229,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -229,7 +229,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initDefaultData() { initDefaultData() {
const data = {"sentenceArr":[{"text":"222 _ 33333","answer":"2"},{"text":"4444 _ 55 5555","answer":"5"},{"text":"666 666 66 _ 77777","answer":"6"},{"text":"888 88 8 _ 999","answer":"9"}],"templateArr":[{"formUrl":"http://staging-teach.cdn.ireadabc.com/h5template/hw_001/v16/index.html?type=form&key=1","template":{"id":26,"uuid":"c94fb1b0-3395-42ca-9ae3-03ca7c242d3f","name":"hw_001","description":"音频课件","cover":"http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/3feddb01-4350-42ad-909f-236ad052fbb2.jpg","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","last_version":16},"data":{"contentObj":{"picArr":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/c8abf7383d65bcbdba8f390785cece60.png","audio_url":"http://staging-teach.cdn.ireadabc.com/85cff126986f5cc11b05e95181da5869.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/f6f4bbef497409fef3c8f1d375893829.png","audio_url":"http://staging-teach.cdn.ireadabc.com/9f0aee80e252005721a445cbbf04e8b1.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/7b18a7931d64f7b9e8b7ecd25cb5e3d4.png","audio_url":""}]}}},{"formUrl":"http://staging-teach.cdn.ireadabc.com/h5template/hw_002/v16/index.html?type=form&key=2","template":{"id":27,"uuid":"b8bedc68-9ef6-42a6-ba99-513daa244a6d","name":"hw_002","description":"视频课件","interaction_type":"个人 | 集体","recommend_type":"| 动画 | 绘本 | 儿歌 | 看图辨意","cover":"http://iplayabc-teach-yun.oss-cn-beijing.aliyuncs.com/1b11d370-9d8b-4358-98d3-4757f825d2a4.jpg","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","developer_id":12,"git":"{\"id\":59,\"ssh\":\"git@vcs.ireadabc.com:template/hw_002.git\",\"http\":\"http://vcs.ireadabc.com/template/hw_002.git\"}","del":0,"publish":1,"last_version":16,"pub_date":null,"is_public":1,"created_date":"2019-11-11T10:05:25.000Z","updated_date":"2020-10-12T02:01:13.000Z"},"data":{"contentObj":{"video_url":"http://staging-teach.cdn.ireadabc.com/f309f8dd44d59c65e44f375f818871e1.mp4"}}}],"title":"1111"}; const data = {"sentenceArr":[{"text":"1. She was not only _ but also very musical.","answer":"starfish"},{"text":"2. A _ is a flat sea creature in the shape of a star with five arms.","answer":"sea horse"},{"text":"3. A _ is a small sea fish with a horse-like head.","answer":"stream"},{"text":"4. There was a small _ at the end of the garden.","answer":"intelligent"}],"templateArr":[{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM_4-2/v17/index.html?type=form&key=1","template":{"id":740,"uuid":"b4279bef-f779-4ab7-be76-f1af96713a86","name":"JM_4-2","description":"JM04-02拼句子","interaction_type":"","recommend_type":"","cover":"https://staging-teach.cdn.ireadabc.com/d5baf57d-0175-4640-93a5-6baaff117867.png","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","developer_id":12,"git":"{\"id\":791,\"ssh\":\"git@vcs.ireadabc.com:template/JM_4-2.git\",\"http\":\"https://vcs.ireadabc.com/template/JM_4-2.git\"}","del":0,"publish":1,"last_version":17,"pub_date":null,"is_public":0,"created_date":"2021-07-26T10:01:26.000Z","updated_date":"2021-08-03T10:07:21.000Z"}},{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM04-3/v10/index.html?type=form&key=2","template":{"id":733,"uuid":"3900b0f7-d041-490e-9b42-da8d3855633b","name":"JM04-3","description":"JM04-03拼单词","interaction_type":"","recommend_type":"","cover":"https://staging-teach.cdn.ireadabc.com/0455da10-c452-4cec-9f01-530536b886b3.png","type":1,"t_type":2,"form_url":"index.html?type=form","play_url":"index.html","developer_id":119,"git":"{\"id\":784,\"ssh\":\"git@vcs.ireadabc.com:template/JM04-3.git\",\"http\":\"https://vcs.ireadabc.com/template/JM04-3.git\"}","del":0,"publish":1,"last_version":10,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-01T13:16:43.000Z"},"data":{"contentObj":{"version":"1.0","dataKey":"DataKey_JM04_3","title":{"NO":"C","mainText":"Solve the puzzle using the given clue","mainTextAudio_url":""},"size":{"wh":"12*12"},"dataArray":[{"image_url":"","audio_url":"","text":"smart and possessing sound knowledge","uuid":"9803c50c-3638-4a6a-a4f8-719bdeaacede","direction":"Across"},{"image_url":"","audio_url":"","direction":"Across","text":"running water flowing on the earth","uuid":"239d1dde-4fea-40a7-bc02-4fe681e6f20c"},{"image_url":"","audio_url":"","direction":"Across","text":"a fish whose head look like those of a horse","uuid":"5ae09383-2c3f-4c35-9ed8-f3f7c463dc3c"},{"image_url":"","audio_url":"","direction":"Down","text":"a star-shaped sea animal","uuid":"c9d5aeeb-e37a-41a7-8473-df34d28f1779"}],"grid":[[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"s"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[1],"text":"s"},{"index":[3],"text":"t"},{"index":[1],"text":"r"},{"index":[1],"text":"e"},{"index":[1],"text":"a"},{"index":[1],"text":"m"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[2],"text":"s"},{"index":[2],"text":"e"},{"index":[3],"text":"a"},{"index":[2],"text":"h"},{"index":[2],"text":"o"},{"index":[2],"text":"r"},{"index":[2],"text":"s"},{"index":[2],"text":"e"},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"r"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"f"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"i"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"s"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"h"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[0],"text":"i"},{"index":[0],"text":"n"},{"index":[0],"text":"t"},{"index":[3],"text":"e"},{"index":[0],"text":"l"},{"index":[0],"text":"l"},{"index":[0],"text":"i"},{"index":[0],"text":"g"},{"index":[0],"text":"e"},{"index":[0],"text":"n"},{"index":[0],"text":"t"}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[3],"text":"s"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}]]}}}],"title":"Vocabulary box"}
this.data = { contentObj: data }; this.data = { contentObj: data };
...@@ -1349,6 +1349,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1349,6 +1349,7 @@ export class PlayComponent implements OnInit, OnDestroy {
mapMove(event) { mapMove(event) {
event.preventDefault() event.preventDefault()
if (!this.curMoveItem) { if (!this.curMoveItem) {
...@@ -1433,11 +1434,15 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1433,11 +1434,15 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
sendSubTempIsShowMore(index, isShowMore) { sendSubTempIsShowMore(index, isShowMore) {
setTimeout(() => {
const divArr = this.iframeContent.nativeElement.children; const divArr = this.iframeContent.nativeElement.children;
const iframecont = divArr[index].children[0]; const iframecont = divArr[index].children[0];
const data = { msg: 'success', isShowMore}; const data = { msg: 'success', isShowMore};
iframecont.contentWindow.postMessage({ action: 'is_show_more', data: JSON.stringify(data) }, '*'); iframecont.contentWindow.postMessage({ action: 'is_show_more', data: JSON.stringify(data) }, '*');
console.log(' post msg is_show_more ') console.log(' post msg is_show_more ')
}, 1000);
} }
...@@ -1485,7 +1490,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1485,7 +1490,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.setPageData('progress', '2', false); this.setPageData('progress', '2', false);
this.setPageData('submitCount', this.submitCount); this.setPageData('submitCount', this.submitCount);
this.serverSendAnswer(); this.serverSendAnswer('4-1', this.resultAnswerArr);
}) })
} }
...@@ -1783,9 +1788,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1783,9 +1788,9 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('arr: ', arr); console.log('arr: ', arr);
for (let i=0; i<arr.length; i++) { for (let i=0; i<arr.length; i++) {
arr[i].leftOff = '100vw'; arr[i].leftOff = '0vw';
} }
arr[index].leftOff = '0vw'; arr[index].leftOff = '100vw';
this.appRef.tick(); this.appRef.tick();
} }
...@@ -1802,21 +1807,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1802,21 +1807,22 @@ export class PlayComponent implements OnInit, OnDestroy {
iframeArr; iframeArr;
initWindowListener() { initWindowListener() {
const iframeArr = this.iframeArr;
// setTimeout(() => { // const iframeArr = this.iframeArr;
console.log("iframeContent: ", this.iframeContent); // // setTimeout(() => {
let divArr = this.iframeContent.nativeElement.children;
console.log('divArr: ', divArr); // console.log("iframeContent: ", this.iframeContent);
for (let i=0; i<divArr.length; i++) { // let divArr = this.iframeContent.nativeElement.children;
const iframe = divArr[i].children[0]; // console.log('divArr: ', divArr);
console.log('iframe: ', iframe); // for (let i=0; i<divArr.length; i++) {
iframeArr.push(iframe) // const iframe = divArr[i].children[0];
} // console.log('iframe: ', iframe);
// iframeArr.push(iframe)
// }
console.log('iframeArr: ', iframeArr); // console.log('iframeArr: ', iframeArr);
// }, 1); // // }, 1);
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
...@@ -1853,6 +1859,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1853,6 +1859,8 @@ export class PlayComponent implements OnInit, OnDestroy {
iframecont.contentWindow.postMessage({ action: 'getData', data: JSON.stringify(data) }, '*'); iframecont.contentWindow.postMessage({ action: 'getData', data: JSON.stringify(data) }, '*');
// const data2 = { msg: 'success', data: JSON.stringify({'isShowMore': false})}; // const data2 = { msg: 'success', data: JSON.stringify({'isShowMore': false})};
// iframecont.contentWindow.postMessage({ action: 'is_show_more', data: JSON.stringify(data2) }, '*'); // iframecont.contentWindow.postMessage({ action: 'is_show_more', data: JSON.stringify(data2) }, '*');
...@@ -1863,6 +1871,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1863,6 +1871,17 @@ export class PlayComponent implements OnInit, OnDestroy {
if (msgData.action === "temp_send_result") { if (msgData.action === "temp_send_result") {
console.log(' in temp_send_result');
console.log('msgData.urlParams: ', msgData);
let key = msgData.key;
if (!key) {
key = '4-3';
}
console.log("key: ", key);
this.serverSendAnswer(key, JSON.parse( msgData.data ));
const progress = this.getPageData('progress'); const progress = this.getPageData('progress');
if (progress == '2') { if (progress == '2') {
this.setPageData('progress', '3'); this.setPageData('progress', '3');
...@@ -1896,13 +1915,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1896,13 +1915,22 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
serverSendAnswer() { serverResultObj;
serverSendAnswer(key, data) {
const c = window['courseware']; const c = window['courseware'];
if (!c) { if (!c) {
return; return;
} }
c.sendAnswer(this.resultAnswerArr);
console.log(' sendAnswer : ', this.resultAnswerArr); if (!this.serverResultObj) {
this.serverResultObj = {};
}
this.serverResultObj[key] = data;
c.sendAnswer(this.serverResultObj);
console.log(' sendAnswer : ', this.serverResultObj);
console.log(' sendAnswer : ' + JSON.stringify( this.serverResultObj ));
} }
......
...@@ -9,6 +9,12 @@ ...@@ -9,6 +9,12 @@
<link rel="icon" type="image/x-icon" href="favicon.ico"> <link rel="icon" type="image/x-icon" href="favicon.ico">
<script type="text/javascript" src="https://staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air_online_open.js"></script> <script type="text/javascript" src="https://staging-teach.cdn.ireadabc.com/h5template/h5-static-lib/js/air_online_open.js"></script>
<!-- <script src="https://cdn.bootcdn.net/ajax/libs/vConsole/3.9.0/vconsole.min.js"></script>
<script>
// init vConsole
var vConsole = new VConsole();
console.log('Hello world');
</script> -->
</head> </head>
<body> <body>
<app-root></app-root> <app-root></app-root>
......
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