Commit 5adbefc4 authored by liujiaxin's avatar liujiaxin

qqqq

parent c41c1d5a
...@@ -17,8 +17,7 @@ import { debounceTime } from 'rxjs/operators'; ...@@ -17,8 +17,7 @@ import { debounceTime } from 'rxjs/operators';
import * as _ from 'lodash'; import * as _ from 'lodash';
import TWEEN from '@tweenjs/tween.js'; import TWEEN from '@tweenjs/tween.js';
import { loadFonts } from './Util' import { loadFonts } from './Util';
import { faTshirt } from '@fortawesome/free-solid-svg-icons';
import { DomSanitizer } from '@angular/platform-browser'; import { DomSanitizer } from '@angular/platform-browser';
import { NzMessageService } from 'ng-zorro-antd'; import { NzMessageService } from 'ng-zorro-antd';
import { HttpClient, HttpHeaders } from '@angular/common/http'; import { HttpClient, HttpHeaders } from '@angular/common/http';
...@@ -32,8 +31,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; ...@@ -32,8 +31,6 @@ import { HttpClient, HttpHeaders } from '@angular/common/http';
styleUrls: ['./play.component.css'] styleUrls: ['./play.component.css']
}) })
export class PlayComponent implements OnInit, OnDestroy { export class PlayComponent implements OnInit, OnDestroy {
// 数据
_data;
@Input() @Input()
set data(data) { set data(data) {
...@@ -43,6 +40,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -43,6 +40,13 @@ export class PlayComponent implements OnInit, OnDestroy {
return this._data; return this._data;
} }
constructor(private message: NzMessageService, private http: HttpClient, private sanitizer: DomSanitizer, private appRef: ApplicationRef) {
}
// 数据
_data;
@Input() @Input()
sid; sid;
...@@ -125,20 +129,125 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -125,20 +129,125 @@ export class PlayComponent implements OnInit, OnDestroy {
bg; bg;
topArr; topArr;
isTeacher = false;
@HostListener('window:resize', ['$event']) // 用于存储公共数据 当翻页时清空
onResize(event) { pageData;
this.winResizeEventStream.next();
}
// 用于存储私有数据 当翻页时清空
storeData;
constructor(private message: NzMessageService, private http: HttpClient, private sanitizer: DomSanitizer, private appRef: ApplicationRef) { sentenceArr = [];
submitCount = 0;
safeDefaultUrl;
resultAnswerArr;
} scrollView;
resultSv;
isTeacher = false; uploadUrl;
userData;
checkText = 'Hello boys and girls, my name is Alex. Today I will give you a speech about our beautiful country. Before I start my speech, I want you to guess where I am talking about. There is a very famous poem saying: The sky is blue, the wild is boundless. When the winds blow, the grass is low, and you can see the sheep and cattle. Now do you know where I am talking about? Yes, it is Inner Mongolia, the second largest province in China. My mother took me there in the summer holiday. Inner Mongolia is very large. It has many cities, such as Ulanhot, Hohhot,Ordos and Baotou. The native Inner Mongolia people live on the grassland and enjoy their lives all the time. I have been to Xilamuren Grassland. It has many cows and horses. When I was there, I rode horses, hugged the lamb, and played with my new friend Wangqi. How big Inner Mongolia is! The most brilliant place I’ve visited is Mongolian yurts. It is so plain outside, but once you go inside the yurts, you will find how big it is, and how good the people they are! I love the people there. The most famous person in Inner Mongolia is Genghis Khan. He had built the biggest China in the history. Can you guess how big it was when Genghis Khan ruled China? It is almost three times as big as today’s China! I admire him very much. I wish I can be a man as brave as him when I grow up. Camels are amazing animals in Inner Mongolia. A camel has two humps. It stores fat inside the humps. A camel can live a week without water, and can live a month without food, which benefits from its body-its humps and stomach can provide energy and water as necessary. Camels can endure extremely cold and extremely hot temperatures. Camels are important transportation tools in dessert, they help to deliver passengers and goods. However, they have been killed a lot these years. We should protect them! Our country is great and Inner Mongolia is great. I wish I have chance to travel around China.';
infoLabel;
infoLabel2;
maskPic;
resultLayer;
resultPanel;
moreBtn;
submitBtn;
btnArr = [];
btnDisH = 120;
sendBtn;
uploadAudioBtn1;
uploadAudioBtn2;
uploadAudioBtn3;
uploadAudioBtn4;
uploadAudioBtn5;
uploadAudioBtn6;
startRecordBtn;
stopRecordBtn;
greadPapersForTextBtn;
greadPapersForCheckBtn;
lansiEvaluationBtn;
sendAnswerBtn;
startTestBtn;
stopTestBtn;
sentBtn;
sentenceEmptyArr;
panel;
curMoveItem = null;
downFlag = false;
templateArr = [];
iframeArr;
readyObj;
serverResultObj;
isUpdateStop = false;
maskBg;
openBtn;
@HostListener('window:resize', ['$event'])
onResize(event) {
this.winResizeEventStream.next();
}
async ngOnInit() { async ngOnInit() {
...@@ -148,7 +257,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -148,7 +257,7 @@ export class PlayComponent implements OnInit, OnDestroy {
await loadFonts('Aileron-Black', 'Aileron-Black.ttf'); await loadFonts('Aileron-Black', 'Aileron-Black.ttf');
await loadFonts('Aileron-Bold', 'Aileron-Bold.ttf'); await loadFonts('Aileron-Bold', 'Aileron-Bold.ttf');
const getData = (<any>window).courseware.getData; const getData = (window as any).courseware.getData;
getData((data, aspect) => { getData((data, aspect) => {
...@@ -186,10 +295,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -186,10 +295,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
// 用于存储公共数据 当翻页时清空
pageData;
initPageData(aspect) { initPageData(aspect) {
const pageDataStr = aspect?.page_aspect?.pagedata; const pageDataStr = aspect?.page_aspect?.pagedata;
if (!pageDataStr) { if (!pageDataStr) {
...@@ -200,7 +305,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -200,7 +305,7 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('this.pageData: ', this.pageData); console.log('this.pageData: ', this.pageData);
} }
setPageData(key, value, isSend=true) { setPageData(key, value, isSend= true) {
if (this.pageData) { if (this.pageData) {
...@@ -223,16 +328,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -223,16 +328,12 @@ export class PlayComponent implements OnInit, OnDestroy {
const data = this.pageData; const data = this.pageData;
if (window && window['courseware']) { if (window && window['courseware']) {
let storePageAspect = window['courseware'].storePageAspect; const storePageAspect = window['courseware'].storePageAspect;
if (storePageAspect) { if (storePageAspect) {
storePageAspect(data); storePageAspect(data);
} }
} }
} }
// 用于存储私有数据 当翻页时清空
storeData;
initStoreData(aspect) { initStoreData(aspect) {
const storeDataStr = aspect?.user_aspect; const storeDataStr = aspect?.user_aspect;
if (!storeDataStr) { if (!storeDataStr) {
...@@ -243,7 +344,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -243,7 +344,7 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('initStoreData this.storeData: ', this.storeData); console.log('initStoreData this.storeData: ', this.storeData);
} }
setStoreData(key, value, isSend=true) { setStoreData(key, value, isSend= true) {
if (this.storeData) { if (this.storeData) {
...@@ -265,7 +366,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -265,7 +366,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const data = this.storeData; const data = this.storeData;
if (window && window['courseware']) { if (window && window['courseware']) {
let storeAspect = window['courseware'].storeAspect; const storeAspect = window['courseware'].storeAspect;
if (storeAspect) { if (storeAspect) {
storeAspect(data); storeAspect(data);
} }
...@@ -277,7 +378,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -277,7 +378,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initDefaultData() { initDefaultData() {
const data = {"sentenceArr":[{"text":"1.There can be mentally and physically _ for a person to use.","answer":"exhausting"},{"text":"2.To travel through beautiful scenery at a speed of four horsepower is just _ .","answer":"marvellous"},{"text":"3.The Park is known as a place for _ and hiking, as well as events.","answer":"recreation"},{"text":"4.She looked at him in _ distress that he had to look away.","answer":"such"},{"text":"5.He enjoys the finer things in life, like _ with his wife.","answer":"ballroom dancing"},{"text":"6.Rappers always dress in their own _.","answer":"style"},{"text":"7.They suggest _ reasons for the difference in the federal government's attitudes toward the two lawsuits.","answer":"a couple of"},{"text":"8.Mr. Smith bought a new house near _ by the beach.","answer":"waterfront"},{"text":"9.One has to be knowledgeable in low to do international _ .","answer":"trade"},{"text":"10.Planes must _ from one ground beacon (信标) to the next to flight through the Mount Everest.","answer":"zigzag"},{"text":"11.Baltimore in its heyday(鼎盛时期) was a major centre of industrial and _ activity.","answer":"commercial"},{"text":"12.Despite persistent rain showers, the music festival’s _ were packed with fans.","answer":"pavilion"},{"text":"13.If something _ you, it surprises you very much. ","answer":"amazes"}],"templateArr":[{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM_4-2/v11/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":11,"pub_date":null,"is_public":0,"created_date":"2021-07-26T10:01:26.000Z","updated_date":"2021-08-02T03:24:44.000Z"},"data":{"sentenceArr":[{"answer":"zigzag","text":"1. They staggered (蹒跚)in a _ across the road.","audio_url":"https://staging-teach.cdn.ireadabc.com/2ee1851630ae13b645f41acba1500109.mp3"},{"answer":"pavilion","text":"2. Despite persistent rain showers, the lawn and _ were packed with fans.","audio_url":"https://staging-teach.cdn.ireadabc.com/d051865834696ed4a161660ea9bd5e67.mp3"},{"answer":"amazed","text":"3. We just moved house and are _ with the amount of junk we have.","audio_url":"https://staging-teach.cdn.ireadabc.com/7c0432dc51915132f139dce7a75f1808.mp3"},{"answer":"Trade","text":"4. _between the two countries has increased.","audio_url":"https://staging-teach.cdn.ireadabc.com/30ad4162816dd0fc9747d0f38236fdba.mp3"},{"text":"5. They went for a walk along the_ .","answer":"waterfront","audio_url":"https://staging-teach.cdn.ireadabc.com/4736dddf059affd06cccc2bed72b2608.mp3"},{"text":"6. Yunnan has indeed become more _ over the past decade.","answer":"commercial","audio_url":"https://staging-teach.cdn.ireadabc.com/b68d81e3e216e80a5d14aef66a11b0c7.mp3"},{"text":"7. What’s the _ of haircut do you like?","answer":"style","audio_url":"https://staging-teach.cdn.ireadabc.com/0206e3bfd21c45d89e12612230742b19.mp3"},{"text":"8. Saturday afternoon is for _ and outings.","answer":"recreation","audio_url":"https://staging-teach.cdn.ireadabc.com/3298442f14bf32f3dbdaa32929cfe8f6.mp3"},{"text":"9. It's the most _ piece of music.","answer":"marvellous","audio_url":"https://staging-teach.cdn.ireadabc.com/4b6005977408e74acdcddc9a936cc423.mp3"},{"text":"10. She was too _ and distressed(痛苦的)to talk about the tragedy.","answer":"exhausted","audio_url":"https://staging-teach.cdn.ireadabc.com/96c2a53cfc64ea56e0ae24c24fe1731d.mp3"},{"text":"11. He is _ a fool to cheat on an exam.","answer":"such","audio_url":"https://staging-teach.cdn.ireadabc.com/a5f60ce1e9e13c1905636ac9ba170f0d.mp3"},{"text":"12. I also enjoy dancing like_ .","answer":" ballroom dancing","audio_url":"https://staging-teach.cdn.ireadabc.com/079c1935a169043acc524c8c19449c88.mp3"},{"text":"13. We went to the US _ years ago.","answer":"a couple of","audio_url":"https://staging-teach.cdn.ireadabc.com/1af6c6dae99270fe36eaae56588dae46.mp3"}],"templateArr":[],"title":"Spell the words according to what you heard"}},{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM04-3/v16/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":16,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-17T03:18:58.000Z"},"data":{"contentObj":{"version":"1.0","dataKey":"DataKey_JM04_3","title":{"NO":"C","mainText":"connected with the buying and selling of goods and services","mainTextAudio_url":""},"size":{"wh":"17*17"},"dataArray":[{"image_url":"","audio_url":"","text":"used to emphasize the great degree of something","uuid":"9803c50c-3638-4a6a-a4f8-719bdeaacede","direction":"Across"},{"image_url":"","audio_url":"","direction":"Down","text":"","uuid":"64635d65-972a-42d1-95c5-148efc9bd866"},{"image_url":"","audio_url":"","direction":"Down","text":"the particular way in which something is done","uuid":"1e27124a-49f2-44e6-8478-fcbc461e420f"},{"image_url":"","audio_url":"","direction":"Across","text":"emely good; wonderful","uuid":"6c6dce11-9a9d-484d-90b2-39a8ffe827f5"},{"image_url":"","audio_url":"","direction":"Down","text":"very surprised","uuid":"97ffbe71-6304-43e1-9688-a0002b45fadf"},{"image_url":"","audio_url":"","direction":"Down","text":"a part of a town or an area that is next to water","uuid":"8532c243-0036-432e-92d4-5cfdfa67a958"},{"image_url":"","audio_url":"","direction":"Down","text":"a line that has a series of angles in it like a continuous series","uuid":"8f1d8024-ebdc-4094-89ae-8238c5a9b47b"},{"image_url":"","audio_url":"","direction":"Across","text":"making you feel very tired","uuid":"8d4742d0-ee35-4c27-8da1-ff649c477222"},{"image_url":"","audio_url":"","direction":"Down","text":"the activity of buying and selling or of exchanging goods or services between people or countries","uuid":"2bd8882e-b637-4652-8c0e-da232e698223"},{"image_url":"","audio_url":"","direction":"Across","text":"a building next to a sports ground, used by players and people watching the game","uuid":"5ab70f33-0523-46aa-ac52-e0b1b191a4d7"},{"image_url":"","audio_url":"","direction":"Across","text":"(a way of) enjoying yourself when you are not working","uuid":"c2a844a2-fd57-4cc7-bec0-3930e4423c5f"}],"grid":[[{"index":[],"text":""},{"index":[],"text":""},{"index":[0],"text":"s"},{"index":[0],"text":"u"},{"index":[0,1],"text":"c"},{"index":[0],"text":"h"},{"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":[1],"text":"o"},{"index":[],"text":""},{"index":[2],"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":[1],"text":"m"},{"index":[],"text":""},{"index":[2],"text":"t"},{"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":[1],"text":"m"},{"index":[],"text":""},{"index":[2],"text":"y"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[3],"text":"m"},{"index":[3,4],"text":"a"},{"index":[3],"text":"r"},{"index":[3],"text":"v"},{"index":[1,3],"text":"e"},{"index":[3],"text":"l"},{"index":[2,3],"text":"l"},{"index":[3],"text":"o"},{"index":[3],"text":"u"},{"index":[3],"text":"s"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[4],"text":"m"},{"index":[],"text":""},{"index":[],"text":""},{"index":[1],"text":"r"},{"index":[],"text":""},{"index":[2],"text":"e"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[4],"text":"a"},{"index":[],"text":""},{"index":[],"text":""},{"index":[1],"text":"c"},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"w"},{"index":[],"text":""},{"index":[],"text":""},{"index":[6],"text":"z"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[4],"text":"z"},{"index":[],"text":""},{"index":[],"text":""},{"index":[1],"text":"i"},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"a"},{"index":[],"text":""},{"index":[],"text":""},{"index":[6],"text":"i"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[4,7],"text":"e"},{"index":[7],"text":"x"},{"index":[7],"text":"h"},{"index":[1,7],"text":"a"},{"index":[7],"text":"u"},{"index":[7],"text":"s"},{"index":[5,7],"text":"t"},{"index":[7],"text":"i"},{"index":[7],"text":"n"},{"index":[7,6],"text":"g"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[4],"text":"d"},{"index":[],"text":""},{"index":[],"text":""},{"index":[1],"text":"l"},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"e"},{"index":[],"text":""},{"index":[],"text":""},{"index":[6],"text":"z"},{"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":[5],"text":"r"},{"index":[],"text":""},{"index":[],"text":""},{"index":[6],"text":"a"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[8],"text":"t"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"f"},{"index":[],"text":""},{"index":[],"text":""},{"index":[6],"text":"g"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[8],"text":"r"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"r"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[9],"text":"p"},{"index":[9,8],"text":"a"},{"index":[9],"text":"v"},{"index":[9],"text":"i"},{"index":[9],"text":"l"},{"index":[9],"text":"i"},{"index":[5,9],"text":"o"},{"index":[9],"text":"n"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[],"text":""},{"index":[8],"text":"d"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[5],"text":"n"},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""},{"index":[],"text":""}],[{"index":[],"text":""},{"index":[10],"text":"r"},{"index":[8,10],"text":"e"},{"index":[10],"text":"c"},{"index":[10],"text":"r"},{"index":[10],"text":"e"},{"index":[10],"text":"a"},{"index":[5,10],"text":"t"},{"index":[10],"text":"i"},{"index":[10],"text":"o"},{"index":[10],"text":"n"},{"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","bg_url":"https://staging-teach.cdn.ireadabc.com/1aaccbaa8f3a32df099f3308feac49e7.png"} const data = {sentenceArr: [{text: '1.There can be mentally and physically _ for a person to use.', answer: 'exhausting'}, {text: '2.To travel through beautiful scenery at a speed of four horsepower is just _ .', answer: 'marvellous'}, {text: '3.The Park is known as a place for _ and hiking, as well as events.', answer: 'recreation'}, {text: '4.She looked at him in _ distress that he had to look away.', answer: 'such'}, {text: '5.He enjoys the finer things in life, like _ with his wife.', answer: 'ballroom dancing'}, {text: '6.Rappers always dress in their own _.', answer: 'style'}, {text: '7.They suggest _ reasons for the difference in the federal government\'s attitudes toward the two lawsuits.', answer: 'a couple of'}, {text: '8.Mr. Smith bought a new house near _ by the beach.', answer: 'waterfront'}, {text: '9.One has to be knowledgeable in low to do international _ .', answer: 'trade'}, {text: '10.Planes must _ from one ground beacon (信标) to the next to flight through the Mount Everest.', answer: 'zigzag'}, {text: '11.Baltimore in its heyday(鼎盛时期) was a major centre of industrial and _ activity.', answer: 'commercial'}, {text: '12.Despite persistent rain showers, the music festival’s _ were packed with fans.', answer: 'pavilion'}, {text: '13.If something _ you, it surprises you very much. ', answer: 'amazes'}], templateArr: [{formUrl: 'https://staging-teach.cdn.ireadabc.com/h5template/JM_4-2/v11/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: 11, pub_date: null, is_public: 0, created_date: '2021-07-26T10:01:26.000Z', updated_date: '2021-08-02T03:24:44.000Z'}, data: {sentenceArr: [{answer: 'zigzag', text: '1. They staggered (蹒跚)in a _ across the road.', audio_url: 'https://staging-teach.cdn.ireadabc.com/2ee1851630ae13b645f41acba1500109.mp3'}, {answer: 'pavilion', text: '2. Despite persistent rain showers, the lawn and _ were packed with fans.', audio_url: 'https://staging-teach.cdn.ireadabc.com/d051865834696ed4a161660ea9bd5e67.mp3'}, {answer: 'amazed', text: '3. We just moved house and are _ with the amount of junk we have.', audio_url: 'https://staging-teach.cdn.ireadabc.com/7c0432dc51915132f139dce7a75f1808.mp3'}, {answer: 'Trade', text: '4. _between the two countries has increased.', audio_url: 'https://staging-teach.cdn.ireadabc.com/30ad4162816dd0fc9747d0f38236fdba.mp3'}, {text: '5. They went for a walk along the_ .', answer: 'waterfront', audio_url: 'https://staging-teach.cdn.ireadabc.com/4736dddf059affd06cccc2bed72b2608.mp3'}, {text: '6. Yunnan has indeed become more _ over the past decade.', answer: 'commercial', audio_url: 'https://staging-teach.cdn.ireadabc.com/b68d81e3e216e80a5d14aef66a11b0c7.mp3'}, {text: '7. What’s the _ of haircut do you like?', answer: 'style', audio_url: 'https://staging-teach.cdn.ireadabc.com/0206e3bfd21c45d89e12612230742b19.mp3'}, {text: '8. Saturday afternoon is for _ and outings.', answer: 'recreation', audio_url: 'https://staging-teach.cdn.ireadabc.com/3298442f14bf32f3dbdaa32929cfe8f6.mp3'}, {text: '9. It\'s the most _ piece of music.', answer: 'marvellous', audio_url: 'https://staging-teach.cdn.ireadabc.com/4b6005977408e74acdcddc9a936cc423.mp3'}, {text: '10. She was too _ and distressed(痛苦的)to talk about the tragedy.', answer: 'exhausted', audio_url: 'https://staging-teach.cdn.ireadabc.com/96c2a53cfc64ea56e0ae24c24fe1731d.mp3'}, {text: '11. He is _ a fool to cheat on an exam.', answer: 'such', audio_url: 'https://staging-teach.cdn.ireadabc.com/a5f60ce1e9e13c1905636ac9ba170f0d.mp3'}, {text: '12. I also enjoy dancing like_ .', answer: ' ballroom dancing', audio_url: 'https://staging-teach.cdn.ireadabc.com/079c1935a169043acc524c8c19449c88.mp3'}, {text: '13. We went to the US _ years ago.', answer: 'a couple of', audio_url: 'https://staging-teach.cdn.ireadabc.com/1af6c6dae99270fe36eaae56588dae46.mp3'}], templateArr: [], title: 'Spell the words according to what you heard'}}, {formUrl: 'https://staging-teach.cdn.ireadabc.com/h5template/JM04-3/v16/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: 16, pub_date: null, is_public: 0, created_date: '2021-07-20T06:18:52.000Z', updated_date: '2021-08-17T03:18:58.000Z'}, data: {contentObj: {version: '1.0', dataKey: 'DataKey_JM04_3', title: {NO: 'C', mainText: 'connected with the buying and selling of goods and services', mainTextAudio_url: ''}, size: {wh: '17*17'}, dataArray: [{image_url: '', audio_url: '', text: 'used to emphasize the great degree of something', uuid: '9803c50c-3638-4a6a-a4f8-719bdeaacede', direction: 'Across'}, {image_url: '', audio_url: '', direction: 'Down', text: '', uuid: '64635d65-972a-42d1-95c5-148efc9bd866'}, {image_url: '', audio_url: '', direction: 'Down', text: 'the particular way in which something is done', uuid: '1e27124a-49f2-44e6-8478-fcbc461e420f'}, {image_url: '', audio_url: '', direction: 'Across', text: 'emely good; wonderful', uuid: '6c6dce11-9a9d-484d-90b2-39a8ffe827f5'}, {image_url: '', audio_url: '', direction: 'Down', text: 'very surprised', uuid: '97ffbe71-6304-43e1-9688-a0002b45fadf'}, {image_url: '', audio_url: '', direction: 'Down', text: 'a part of a town or an area that is next to water', uuid: '8532c243-0036-432e-92d4-5cfdfa67a958'}, {image_url: '', audio_url: '', direction: 'Down', text: 'a line that has a series of angles in it like a continuous series', uuid: '8f1d8024-ebdc-4094-89ae-8238c5a9b47b'}, {image_url: '', audio_url: '', direction: 'Across', text: 'making you feel very tired', uuid: '8d4742d0-ee35-4c27-8da1-ff649c477222'}, {image_url: '', audio_url: '', direction: 'Down', text: 'the activity of buying and selling or of exchanging goods or services between people or countries', uuid: '2bd8882e-b637-4652-8c0e-da232e698223'}, {image_url: '', audio_url: '', direction: 'Across', text: 'a building next to a sports ground, used by players and people watching the game', uuid: '5ab70f33-0523-46aa-ac52-e0b1b191a4d7'}, {image_url: '', audio_url: '', direction: 'Across', text: '(a way of) enjoying yourself when you are not working', uuid: 'c2a844a2-fd57-4cc7-bec0-3930e4423c5f'}], grid: [[{index: [], text: ''}, {index: [], text: ''}, {index: [0], text: 's'}, {index: [0], text: 'u'}, {index: [0, 1], text: 'c'}, {index: [0], text: 'h'}, {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: [1], text: 'o'}, {index: [], text: ''}, {index: [2], 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: [1], text: 'm'}, {index: [], text: ''}, {index: [2], text: 't'}, {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: [1], text: 'm'}, {index: [], text: ''}, {index: [2], text: 'y'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [3], text: 'm'}, {index: [3, 4], text: 'a'}, {index: [3], text: 'r'}, {index: [3], text: 'v'}, {index: [1, 3], text: 'e'}, {index: [3], text: 'l'}, {index: [2, 3], text: 'l'}, {index: [3], text: 'o'}, {index: [3], text: 'u'}, {index: [3], text: 's'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [4], text: 'm'}, {index: [], text: ''}, {index: [], text: ''}, {index: [1], text: 'r'}, {index: [], text: ''}, {index: [2], text: 'e'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [4], text: 'a'}, {index: [], text: ''}, {index: [], text: ''}, {index: [1], text: 'c'}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'w'}, {index: [], text: ''}, {index: [], text: ''}, {index: [6], text: 'z'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [4], text: 'z'}, {index: [], text: ''}, {index: [], text: ''}, {index: [1], text: 'i'}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'a'}, {index: [], text: ''}, {index: [], text: ''}, {index: [6], text: 'i'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [4, 7], text: 'e'}, {index: [7], text: 'x'}, {index: [7], text: 'h'}, {index: [1, 7], text: 'a'}, {index: [7], text: 'u'}, {index: [7], text: 's'}, {index: [5, 7], text: 't'}, {index: [7], text: 'i'}, {index: [7], text: 'n'}, {index: [7, 6], text: 'g'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [4], text: 'd'}, {index: [], text: ''}, {index: [], text: ''}, {index: [1], text: 'l'}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'e'}, {index: [], text: ''}, {index: [], text: ''}, {index: [6], text: 'z'}, {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: [5], text: 'r'}, {index: [], text: ''}, {index: [], text: ''}, {index: [6], text: 'a'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [], text: ''}, {index: [8], text: 't'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'f'}, {index: [], text: ''}, {index: [], text: ''}, {index: [6], text: 'g'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [], text: ''}, {index: [8], text: 'r'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'r'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [9], text: 'p'}, {index: [9, 8], text: 'a'}, {index: [9], text: 'v'}, {index: [9], text: 'i'}, {index: [9], text: 'l'}, {index: [9], text: 'i'}, {index: [5, 9], text: 'o'}, {index: [9], text: 'n'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [], text: ''}, {index: [8], text: 'd'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [5], text: 'n'}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}, {index: [], text: ''}], [{index: [], text: ''}, {index: [10], text: 'r'}, {index: [8, 10], text: 'e'}, {index: [10], text: 'c'}, {index: [10], text: 'r'}, {index: [10], text: 'e'}, {index: [10], text: 'a'}, {index: [5, 10], text: 't'}, {index: [10], text: 'i'}, {index: [10], text: 'o'}, {index: [10], text: 'n'}, {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', bg_url: 'https://staging-teach.cdn.ireadabc.com/1aaccbaa8f3a32df099f3308feac49e7.png'};
// 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/JM04-3/v14/index.html?type=form&key=1","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":14,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-11T13:46:52.000Z"}},{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM04-3/v14/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":14,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-11T13:46:52.000Z"}}],"title":"Vocabulary box","bg_url":"https://staging-teach.cdn.ireadabc.com/892d0db2075efa3fa7aea6911bf36a83.png"} // 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/JM04-3/v14/index.html?type=form&key=1","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":14,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-11T13:46:52.000Z"}},{"formUrl":"https://staging-teach.cdn.ireadabc.com/h5template/JM04-3/v14/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":14,"pub_date":null,"is_public":0,"created_date":"2021-07-20T06:18:52.000Z","updated_date":"2021-08-11T13:46:52.000Z"}}],"title":"Vocabulary box","bg_url":"https://staging-teach.cdn.ireadabc.com/892d0db2075efa3fa7aea6911bf36a83.png"}
this.data = { contentObj: data }; this.data = { contentObj: data };
...@@ -289,17 +390,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -289,17 +390,6 @@ export class PlayComponent implements OnInit, OnDestroy {
window.cancelAnimationFrame(this.animationId); window.cancelAnimationFrame(this.animationId);
this.gameEndFlag = true; this.gameEndFlag = true;
} }
sentenceArr = [];
submitCount = 0;
safeDefaultUrl;
resultAnswerArr;
scrollView;
resultSv;
uploadUrl;
userData;
initData() { initData() {
...@@ -328,7 +418,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -328,7 +418,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.uploadUrl = (<any> window).courseware.uploadUrl(); this.uploadUrl = (window as any).courseware.uploadUrl();
window['air'].getUploadCallback = (url, data) => { window['air'].getUploadCallback = (url, data) => {
this.uploadUrl = url; this.uploadUrl = url;
}; };
...@@ -355,16 +445,16 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -355,16 +445,16 @@ export class PlayComponent implements OnInit, OnDestroy {
replaceSentenceText() { replaceSentenceText() {
const arr = this.data.contentObj.sentenceArr; const arr = this.data.contentObj.sentenceArr;
if (!arr) { if (!arr) {
console.error('没有数据') console.error('没有数据');
return; return;
} }
this.sentenceArr = JSON.parse(JSON.stringify(arr)); this.sentenceArr = JSON.parse(JSON.stringify(arr));
for (let i=0; i<this.sentenceArr.length; i++) { for (let i = 0; i < this.sentenceArr.length; i++) {
const text = this.sentenceArr[i].text; const text = this.sentenceArr[i].text;
this.sentenceArr[i].text = text.replace(/_/, "____________________") this.sentenceArr[i].text = text.replace(/_/, '____________________');
} }
} }
...@@ -530,7 +620,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -530,7 +620,7 @@ export class PlayComponent implements OnInit, OnDestroy {
this.init(); this.init();
this.update(); this.update();
cb() cb();
} }
addServerListener() { addServerListener() {
...@@ -538,25 +628,25 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -538,25 +628,25 @@ export class PlayComponent implements OnInit, OnDestroy {
const c = window['courseware']; const c = window['courseware'];
if (!c) { if (!c) {
console.log(' window.courseware not exist !!!!!!!!') console.log(' window.courseware not exist !!!!!!!!');
return; return;
} }
const air = window['air'] const air = window['air'];
if (!air) { if (!air) {
console.log(' window air err !!!!!!!!') console.log(' window air err !!!!!!!!');
return; return;
} }
air.onCourseInScreen = (next) => { air.onCourseInScreen = (next) => {
//各种逻辑 // 各种逻辑
// this.showTemplateStartAnima(); // this.showTemplateStartAnima();
console.log('in onCourseInScreen') console.log('in onCourseInScreen');
this.loadEnd(() => { this.loadEnd(() => {
next(); next();
}); });
} };
...@@ -566,9 +656,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -566,9 +656,9 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
c.onEvent('sendBtnClick', (data, next) => { c.onEvent('sendBtnClick', (data, next) => {
const durTime = new Date().getTime() - data.time const durTime = new Date().getTime() - data.time;
const useTime = ( Math.round( durTime / 1000 * 1000) / 1000) ; const useTime = ( Math.round( durTime / 1000 * 1000) / 1000) ;
const infoText = '发题 用时: ' + useTime + '' const infoText = '发题 用时: ' + useTime + '';
this.infoLabel.text = infoText; this.infoLabel.text = infoText;
...@@ -578,64 +668,64 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -578,64 +668,64 @@ export class PlayComponent implements OnInit, OnDestroy {
c.onEvent('uploadAudioBtn1Click', (data, next) => { c.onEvent('uploadAudioBtn1Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn1Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn1Click: data: ${JSON.stringify(data)}`;
//30秒 // 30秒
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3';
this.uploadTestAudio('30秒', audioUrl, 30); this.uploadTestAudio('30秒', audioUrl, 30);
next(); next();
}); });
c.onEvent('uploadAudioBtn2Click', (data, next) => { c.onEvent('uploadAudioBtn2Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn2Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn2Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/7c1f608da28f4a42646724c4011bfd46.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/7c1f608da28f4a42646724c4011bfd46.mp3';
this.uploadTestAudio('1分钟', audioUrl, 60); this.uploadTestAudio('1分钟', audioUrl, 60);
next(); next();
}); });
c.onEvent('uploadAudioBtn3Click', (data, next) => { c.onEvent('uploadAudioBtn3Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn3Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn3Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/b1c832ecdd7e58632af6c48f37245b88.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/b1c832ecdd7e58632af6c48f37245b88.mp3';
this.uploadTestAudio('1分半', audioUrl, 90); this.uploadTestAudio('1分半', audioUrl, 90);
next(); next();
}); });
c.onEvent('uploadAudioBtn4Click', (data, next) => { c.onEvent('uploadAudioBtn4Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn4Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn4Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/3b6ea60055587e6d6fce27d179bf36eb.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/3b6ea60055587e6d6fce27d179bf36eb.mp3';
this.uploadTestAudio('2分半', audioUrl, 120); this.uploadTestAudio('2分半', audioUrl, 120);
next(); next();
}); });
c.onEvent('uploadAudioBtn5Click', (data, next) => { c.onEvent('uploadAudioBtn5Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn5Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn5Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/82b7cd5a8ac70b12d2b70229bae990ea.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/82b7cd5a8ac70b12d2b70229bae990ea.mp3';
this.uploadTestAudio('3分钟', audioUrl, 180); this.uploadTestAudio('3分钟', audioUrl, 180);
next(); next();
}); });
c.onEvent('uploadAudioBtn6Click', (data, next) => { c.onEvent('uploadAudioBtn6Click', (data, next) => {
this.infoLabel.text = `uploadAudioBtn6Click: data: ${JSON.stringify(data)}`; this.infoLabel.text = `uploadAudioBtn6Click: data: ${JSON.stringify(data)}`;
const audioUrl = 'http://staging-teach.cdn.ireadabc.com/811fad370642b71d21ed7f47f95a9d04.mp3' const audioUrl = 'http://staging-teach.cdn.ireadabc.com/811fad370642b71d21ed7f47f95a9d04.mp3';
this.uploadTestAudio('5分钟', audioUrl, 300); this.uploadTestAudio('5分钟', audioUrl, 300);
next(); next();
}); });
c.onEvent('greadPapersForTextBtnClick', (data, next) => { c.onEvent('greadPapersForTextBtnClick', (data, next) => {
this.infoLabel.text = `greadPapersForTextBtnClick: data: ${JSON.stringify(data)}`; this.infoLabel.text = `greadPapersForTextBtnClick: data: ${JSON.stringify(data)}`;
//文本纠错 // 文本纠错
this.showGreadPapersForText() this.showGreadPapersForText();
next(); next();
}); });
c.onEvent('greadPapersForCheckBtnClick', (data, next) => { c.onEvent('greadPapersForCheckBtnClick', (data, next) => {
this.infoLabel.text = `greadPapersForCheckBtnClick: data: ${JSON.stringify(data)}`; this.infoLabel.text = `greadPapersForCheckBtnClick: data: ${JSON.stringify(data)}`;
//词性检查 // 词性检查
this.showGreadPapersForCheck(); this.showGreadPapersForCheck();
next(); next();
}); });
c.onEvent('lansiEvaluationBtnClick', (data, next) => { c.onEvent('lansiEvaluationBtnClick', (data, next) => {
this.infoLabel.text = `lansiEvaluationBtnClick: data: ${JSON.stringify(data)}`; this.infoLabel.text = `lansiEvaluationBtnClick: data: ${JSON.stringify(data)}`;
//蓝思值 // 蓝思值
this.showLansiEvaluation(); this.showLansiEvaluation();
next(); next();
}); });
c.onEvent('sendAnswerBtnClick', (data, next) => { c.onEvent('sendAnswerBtnClick', (data, next) => {
this.infoLabel.text = `sendAnswerBtnClick: data: ${JSON.stringify(data)}`; this.infoLabel.text = `sendAnswerBtnClick: data: ${JSON.stringify(data)}`;
//蓝思值 // 蓝思值
this.showSendAnswer(); this.showSendAnswer();
next(); next();
}); });
...@@ -678,7 +768,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -678,7 +768,7 @@ export class PlayComponent implements OnInit, OnDestroy {
testData[key] = { testData[key] = {
useTime, useTime,
info info
} };
this.setStoreData('testData', testData, false); this.setStoreData('testData', testData, false);
...@@ -709,11 +799,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -709,11 +799,11 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
const useTime = (Math.round(durTime / 1000 * 1000) / 1000 ) const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '上报成绩 用时' + useTime + '' this.infoLabel.text = '上报成绩 用时' + useTime + '';
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text); this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text);
}}) }});
} }
...@@ -730,11 +820,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -730,11 +820,11 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
const useTime = (Math.round(durTime / 1000 * 1000) / 1000 ); const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '蓝思值 用时' + useTime + '' this.infoLabel.text = '蓝思值 用时' + useTime + '';
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text); this.sendTestData('lansiEvaluation', useTime, this.infoLabel.text);
}) });
} }
showGreadPapersForCheck() { showGreadPapersForCheck() {
...@@ -750,14 +840,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -750,14 +840,12 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
const useTime = (Math.round(durTime / 1000 * 1000) / 1000 ); const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '词性检查 用时' + useTime + '' this.infoLabel.text = '词性检查 用时' + useTime + '';
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('greadPapersForCheck', useTime, this.infoLabel.text); this.sendTestData('greadPapersForCheck', useTime, this.infoLabel.text);
}) });
} }
checkText = "Hello boys and girls, my name is Alex. Today I will give you a speech about our beautiful country. Before I start my speech, I want you to guess where I am talking about. There is a very famous poem saying: The sky is blue, the wild is boundless. When the winds blow, the grass is low, and you can see the sheep and cattle. Now do you know where I am talking about? Yes, it is Inner Mongolia, the second largest province in China. My mother took me there in the summer holiday. Inner Mongolia is very large. It has many cities, such as Ulanhot, Hohhot,Ordos and Baotou. The native Inner Mongolia people live on the grassland and enjoy their lives all the time. I have been to Xilamuren Grassland. It has many cows and horses. When I was there, I rode horses, hugged the lamb, and played with my new friend Wangqi. How big Inner Mongolia is! The most brilliant place I’ve visited is Mongolian yurts. It is so plain outside, but once you go inside the yurts, you will find how big it is, and how good the people they are! I love the people there. The most famous person in Inner Mongolia is Genghis Khan. He had built the biggest China in the history. Can you guess how big it was when Genghis Khan ruled China? It is almost three times as big as today’s China! I admire him very much. I wish I can be a man as brave as him when I grow up. Camels are amazing animals in Inner Mongolia. A camel has two humps. It stores fat inside the humps. A camel can live a week without water, and can live a month without food, which benefits from its body-its humps and stomach can provide energy and water as necessary. Camels can endure extremely cold and extremely hot temperatures. Camels are important transportation tools in dessert, they help to deliver passengers and goods. However, they have been killed a lot these years. We should protect them! Our country is great and Inner Mongolia is great. I wish I have chance to travel around China."
showGreadPapersForText() { showGreadPapersForText() {
const greadPapersForText = window['courseware'].greadPapersForText; const greadPapersForText = window['courseware'].greadPapersForText;
...@@ -773,33 +861,38 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -773,33 +861,38 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
const useTime = (Math.round(durTime / 1000 * 1000) / 1000 ); const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '文本纠错 用时' + useTime + '' this.infoLabel.text = '文本纠错 用时' + useTime + '';
console.log('res: ', res); console.log('res: ', res);
this.sendTestData('greadPapersForText', useTime, this.infoLabel.text); this.sendTestData('greadPapersForText', useTime, this.infoLabel.text);
}) });
} }
url2Blob (url) { url2Blob(url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(' in url2Blob ..'); console.log(' in url2Blob ..');
const xhr = new XMLHttpRequest();
const u = new URL(url);
u.protocol = 'https';
url = u.toString();
console.log('url: ', url); console.log('url: ', url);
// const xhr = new XMLHttpRequest(); // url = 'https://staging-teach.cdn.ireadabc.com/107582309ca6d5de35404bcf56af69bf.mp3';
// url = 'https://staging-teach.cdn.ireadabc.com/855f137e750124c448eb544d0d923e12.png';
fetch(url,{ // fetch(url, {
method: 'GET', // method: 'GET',
mode: 'cors' // mode: 'cors'
}) // }).then(response => {
// Retrieve its body as ReadableStream // console.log(' in url2Blob load end..');
.then(response => { // console.log(response.arrayBuffer);
console.log(' in url2Blob load end..'); // resolve(response.arrayBuffer);
console.log(response.arrayBuffer); // }).catch(err => {
resolve(response.arrayBuffer); // reject(err);
}); // });
// xhr.open('get', url, true); // xhr.open('get', url, true);
// xhr.responseType = 'arraybuffer'; // xhr.responseType = 'arraybuffer';
...@@ -813,7 +906,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -813,7 +906,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// } // }
// }; // };
/*
xhr.onreadystatechange = () => { xhr.onreadystatechange = () => {
if (xhr.readyState !== 4) { if (xhr.readyState !== 4) {
return; return;
...@@ -837,24 +930,34 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -837,24 +930,34 @@ export class PlayComponent implements OnInit, OnDestroy {
xhr.responseType = 'arraybuffer'; xhr.responseType = 'arraybuffer';
xhr.open('get', url, true); xhr.open('get', url, true);
xhr.send(); xhr.send();
*/
}); });
} }
formatBytes(bytes, decimals = 2) {
if (bytes === 0) { return '0 Bytes'; }
const k = 1024;
const dm = decimals < 0 ? 0 : decimals;
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
const i = Math.floor(Math.log(bytes) / Math.log(k));
return parseFloat((bytes / Math.pow(k, i)).toFixed(dm)) + ' ' + sizes[i];
}
uploadTestAudio(text, url, key) { uploadTestAudio(text, url, key) {
console.log(' in uploadTestAudio 111'); console.log(' in uploadTestAudio 111');
this.url2Blob(url).then((buffer) => { this.url2Blob(url).then((buffer: ArrayBuffer) => {
console.log('res: ', buffer); console.log('res: ', buffer);
const startTime = new Date().getTime(); const startTime = new Date().getTime();
this.infoLabel.text = '音频大小' + this.formatBytes(buffer.byteLength) + 'MB\n';
const blob = new Blob([buffer], {type: 'audio/mpeg'});
const blob = new Blob([<ArrayBuffer>buffer], {type: "audio/mpeg"});
// const blob = res //new Blob([u8arr], {type: mime}); // const blob = res //new Blob([u8arr], {type: mime});
const fd = new FormData(); const fd = new FormData();
fd.append("file", <Blob>blob, 'test_audio.mp3'); fd.append('file', blob as Blob, 'test_audio.mp3');
this.http.post(this.uploadUrl, fd).subscribe((res) => { this.http.post(this.uploadUrl, fd).subscribe((res) => {
// 存储服务器的截图url // 存储服务器的截图url
if (res['url']) { if (res['url']) {
...@@ -862,8 +965,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -862,8 +965,8 @@ export class PlayComponent implements OnInit, OnDestroy {
const endTime = new Date().getTime(); const endTime = new Date().getTime();
const durTime = endTime - startTime; const durTime = endTime - startTime;
const useTime = (Math.round(durTime / 1000 * 1000) / 1000 ) const useTime = (Math.round(durTime / 1000 * 1000) / 1000 );
this.infoLabel.text = '音频'+text+'上传 用时' + useTime + '' this.infoLabel.text += '音频' + text + '上传 用时' + useTime + '';
this.sendTestData('uploadAudio-' + key, useTime, this.infoLabel.text); this.sendTestData('uploadAudio-' + key, useTime, this.infoLabel.text);
...@@ -930,16 +1033,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -930,16 +1033,13 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.initResultView(); // this.initResultView();
} }
infoLabel;
infoLabel2;
initLabel() { initLabel() {
const richText = new RichText(); const richText = new RichText();
richText.fontColor = '#ffffff'; richText.fontColor = '#ffffff';
richText.x = this.canvasWidth / 2; richText.x = this.canvasWidth / 2;
richText.y = this.canvasHeight / 2; //100 * this.mapScale; richText.y = this.canvasHeight / 2; // 100 * this.mapScale;
richText.text = '...' richText.text = '...';
richText.width = this.canvasWidth * 0.9; richText.width = this.canvasWidth * 0.9;
richText.textAlign = 'center'; richText.textAlign = 'center';
...@@ -948,7 +1048,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -948,7 +1048,7 @@ export class PlayComponent implements OnInit, OnDestroy {
richText2.fontColor = '#ffffff'; richText2.fontColor = '#ffffff';
richText2.x = this.canvasWidth / 2; richText2.x = this.canvasWidth / 2;
richText2.y = 100 * this.mapScale; richText2.y = 100 * this.mapScale;
richText2.text = '...' richText2.text = '...';
richText2.width = this.canvasWidth * 0.9; richText2.width = this.canvasWidth * 0.9;
richText2.textAlign = 'center'; richText2.textAlign = 'center';
...@@ -976,10 +1076,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -976,10 +1076,10 @@ export class PlayComponent implements OnInit, OnDestroy {
if (progress == '1') { if (progress == '1') {
const progressStore = this.getStoreData('progress') const progressStore = this.getStoreData('progress');
if (progressStore == '2' || progressStore == '3') { if (progressStore == '2' || progressStore == '3') {
this.gameStart(); this.gameStart();
const submitCount = this.getStoreData('submitCount') const submitCount = this.getStoreData('submitCount');
this.submitCount = submitCount; this.submitCount = submitCount;
this.checkShowSubTemplateOne(); this.checkShowSubTemplateOne();
return; return;
...@@ -1005,9 +1105,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1005,9 +1105,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
maskPic;
initMaskPic() { initMaskPic() {
const bgUrl = this.data.contentObj.bg_url; const bgUrl = this.data.contentObj.bg_url;
console.log('bgUrl', bgUrl); console.log('bgUrl', bgUrl);
...@@ -1030,7 +1127,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1030,7 +1127,7 @@ export class PlayComponent implements OnInit, OnDestroy {
getMySprite(resName, isSetScale = true) { getMySprite(resName, isSetScale = true) {
const spr = new MySprite(); const spr = new MySprite();
spr.init(this.images.get(resName)) spr.init(this.images.get(resName));
if (isSetScale) { if (isSetScale) {
spr.setScaleXY(this.mapScale); spr.setScaleXY(this.mapScale);
} }
...@@ -1039,16 +1136,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1039,16 +1136,12 @@ export class PlayComponent implements OnInit, OnDestroy {
setRectRight(data) { setRectRight(data) {
for (let i=0; i<this.sentenceEmptyArr.length; i++) { for (let i = 0; i < this.sentenceEmptyArr.length; i++) {
if (data[i]) { if (data[i]) {
this.sentenceEmptyArr[i].isRight = true; this.sentenceEmptyArr[i].isRight = true;
} }
} }
} }
resultLayer;
resultPanel;
moreBtn;
initResultView(data = null) { initResultView(data = null) {
if (data) { if (data) {
...@@ -1060,31 +1153,31 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1060,31 +1153,31 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
const resultLayer = new MySprite() const resultLayer = new MySprite();
resultLayer.x = this.canvasWidth / 2; resultLayer.x = this.canvasWidth / 2;
resultLayer.y = this.canvasHeight / 2; resultLayer.y = this.canvasHeight / 2;
const bg = new MySprite(); const bg = new MySprite();
bg.init(this.images.get("result_bg")) bg.init(this.images.get('result_bg'));
bg.x = 0 bg.x = 0;
bg.y = 0; bg.y = 0;
bg.setScaleXY(this.mapScaleMax); bg.setScaleXY(this.mapScaleMax);
resultLayer.addChild(bg); resultLayer.addChild(bg);
const bgItem = new MySprite(); const bgItem = new MySprite();
bgItem.init(this.images.get("result_bg_item")); bgItem.init(this.images.get('result_bg_item'));
bg.addChild(bgItem); bg.addChild(bgItem);
const panelOffY = -50 * this.mapScale; const panelOffY = -50 * this.mapScale;
const panel = new MySprite(); const panel = new MySprite();
panel.init(this.images.get("result_panel")); panel.init(this.images.get('result_panel'));
panel.setScaleXY(this.mapScale); panel.setScaleXY(this.mapScale);
panel.y = panelOffY; panel.y = panelOffY;
resultLayer.addChild(panel, 1); resultLayer.addChild(panel, 1);
const panelItem = new MySprite(); const panelItem = new MySprite();
panelItem.init(this.images.get("result_panel_item")); panelItem.init(this.images.get('result_panel_item'));
panelItem.y = -600; panelItem.y = -600;
panel.addChild(panelItem); panel.addChild(panelItem);
...@@ -1092,28 +1185,28 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1092,28 +1185,28 @@ export class PlayComponent implements OnInit, OnDestroy {
itemLabel.fontSize = 52; itemLabel.fontSize = 52;
// itemLabel.y = 5; // itemLabel.y = 5;
itemLabel.width = panelItem.width; itemLabel.width = panelItem.width;
itemLabel.fontColor = '#ffffff' itemLabel.fontColor = '#ffffff';
itemLabel.fontName = 'Aileron-Black'; itemLabel.fontName = 'Aileron-Black';
itemLabel.text = 'Check' itemLabel.text = 'Check';
itemLabel.y = 10; itemLabel.y = 10;
itemLabel.textAlign = 'center'; itemLabel.textAlign = 'center';
panelItem.addChild(itemLabel, 5); panelItem.addChild(itemLabel, 5);
const panelShadow = new MySprite(); const panelShadow = new MySprite();
panelShadow.init(this.images.get("result_panel_shadow")); panelShadow.init(this.images.get('result_panel_shadow'));
// panelShadow.setScaleXY(this.mapScale); // panelShadow.setScaleXY(this.mapScale);
panelShadow.y = ( panel.height / 2 - 20 ); panelShadow.y = ( panel.height / 2 - 20 );
panel.addChild(panelShadow); panel.addChild(panelShadow);
const btn = new MySprite(); const btn = new MySprite();
btn.init(this.images.get("big_btn")); btn.init(this.images.get('big_btn'));
btn.setScaleXY(this.mapScale); btn.setScaleXY(this.mapScale);
btn.y = panel.y + ( panel.height / 2 + 120 ) * panel.scaleY; btn.y = panel.y + ( panel.height / 2 + 120 ) * panel.scaleY;
resultLayer.addChild(btn, 2); resultLayer.addChild(btn, 2);
this.moreBtn = btn; this.moreBtn = btn;
const btnShadow = new MySprite(); const btnShadow = new MySprite();
btnShadow.init(this.images.get("big_btn_shadow")); btnShadow.init(this.images.get('big_btn_shadow'));
btnShadow.setScaleXY(this.mapScale); btnShadow.setScaleXY(this.mapScale);
btnShadow.y = btn.y + 30 * this.mapScale; btnShadow.y = btn.y + 30 * this.mapScale;
resultLayer.addChild(btnShadow); resultLayer.addChild(btnShadow);
...@@ -1145,7 +1238,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1145,7 +1238,7 @@ export class PlayComponent implements OnInit, OnDestroy {
getResultData() { getResultData() {
const dataArr = []; const dataArr = [];
for (let i=0; i<this.sentenceEmptyArr.length; i++) { for (let i = 0; i < this.sentenceEmptyArr.length; i++) {
dataArr.push(this.sentenceEmptyArr[i].isRight == true); dataArr.push(this.sentenceEmptyArr[i].isRight == true);
} }
return dataArr; return dataArr;
...@@ -1157,7 +1250,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1157,7 +1250,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const resultSv = new ScrollView(); const resultSv = new ScrollView();
resultSv.setShowSize(this.resultPanel.width, this.resultPanel.height * 0.85); resultSv.setShowSize(this.resultPanel.width, this.resultPanel.height * 0.85);
resultSv.setBgColor("#3e9e33"); resultSv.setBgColor('#3e9e33');
resultSv.x = -this.resultPanel.width / 2; resultSv.x = -this.resultPanel.width / 2;
resultSv.y = -this.resultPanel.height / 2 + 120; resultSv.y = -this.resultPanel.height / 2 + 120;
resultSv.setScrollBarSize(20 * this.mapScale, 5); resultSv.setScrollBarSize(20 * this.mapScale, 5);
...@@ -1165,8 +1258,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1165,8 +1258,8 @@ export class PlayComponent implements OnInit, OnDestroy {
this.resultPanel.addChild(resultSv); this.resultPanel.addChild(resultSv);
this.resultSv = resultSv; this.resultSv = resultSv;
let baseY = 0 //-500; let baseY = 0; // -500;
for (let i=0; i<this.sentenceArr.length; i++) { for (let i = 0; i < this.sentenceArr.length; i++) {
const richText = new RichText(); const richText = new RichText();
richText.disH = 5; richText.disH = 5;
// richText.x = -this.panel.width / 2 * 0.9 // richText.x = -this.panel.width / 2 * 0.9
...@@ -1175,7 +1268,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1175,7 +1268,7 @@ export class PlayComponent implements OnInit, OnDestroy {
richText.fontSize = 48; richText.fontSize = 48;
richText.width = this.panel.width * 0.9; richText.width = this.panel.width * 0.9;
richText.fontColor = '#ffffff' richText.fontColor = '#ffffff';
richText.fontName = 'DroidSansFallback'; richText.fontName = 'DroidSansFallback';
richText.text = this.sentenceArr[i].text; richText.text = this.sentenceArr[i].text;
...@@ -1198,22 +1291,22 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1198,22 +1291,22 @@ export class PlayComponent implements OnInit, OnDestroy {
const colorRect = new ShapeRectNew(); const colorRect = new ShapeRectNew();
colorRect.setSize(rect.width, rect.height, 10); colorRect.setSize(rect.width, rect.height, 10);
colorRect.fillColor = '#007b3e' colorRect.fillColor = '#007b3e';
const offX = 4; const offX = 4;
colorRect.x = rect.x + offX - rect.width; colorRect.x = rect.x + offX - rect.width;
colorRect.y = rect.y -rect.height / 2; colorRect.y = rect.y - rect.height / 2;
// colorRect.alpha = 0.5; // colorRect.alpha = 0.5;
richText.addChild(colorRect); richText.addChild(colorRect);
baseY = richText.y + richText.getAreaHeight(); baseY = richText.y + richText.getAreaHeight();
if (!this.sentenceEmptyArr[i].isRight) { if (!this.sentenceEmptyArr[i].isRight) {
colorRect.fillColor = '#d71818' colorRect.fillColor = '#d71818';
const infoBg = new MySprite(); const infoBg = new MySprite();
infoBg.init(this.images.get("info_bg")); infoBg.init(this.images.get('info_bg'));
infoBg.y = baseY + 50; infoBg.y = baseY + 50;
infoBg.x = this.resultPanel.width / 2 //* this.mapScale; infoBg.x = this.resultPanel.width / 2; // * this.mapScale;
resultSv.addItem(infoBg); resultSv.addItem(infoBg);
// this.resultPanel.addChild(infoBg); // this.resultPanel.addChild(infoBg);
baseY += 130; baseY += 130;
...@@ -1221,7 +1314,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1221,7 +1314,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const infoIcon = new MySprite(); const infoIcon = new MySprite();
infoIcon.init(this.images.get("info_icon")); infoIcon.init(this.images.get('info_icon'));
infoIcon.x = -infoBg.width / 2 + 100; infoIcon.x = -infoBg.width / 2 + 100;
infoBg.addChild(infoIcon); infoBg.addChild(infoIcon);
...@@ -1230,7 +1323,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1230,7 +1323,7 @@ export class PlayComponent implements OnInit, OnDestroy {
infoLabel.fontSize = 48; infoLabel.fontSize = 48;
infoLabel.y = 5; infoLabel.y = 5;
infoLabel.width = infoBg.width; infoLabel.width = infoBg.width;
infoLabel.fontColor = '#ffe9b1' infoLabel.fontColor = '#ffe9b1';
infoLabel.fontName = 'Aileron-Black'; infoLabel.fontName = 'Aileron-Black';
infoLabel.text = this.sentenceArr[i].answer; infoLabel.text = this.sentenceArr[i].answer;
infoBg.addChild(infoLabel); infoBg.addChild(infoLabel);
...@@ -1238,7 +1331,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1238,7 +1331,7 @@ export class PlayComponent implements OnInit, OnDestroy {
} else { } else {
const labelAnswer = this.getFillLabel(); const labelAnswer = this.getFillLabel();
labelAnswer.fontSize = 48; labelAnswer.fontSize = 48;
labelAnswer.fontColor = '#ffffff' labelAnswer.fontColor = '#ffffff';
labelAnswer.fontName = 'Aileron-Black'; labelAnswer.fontName = 'Aileron-Black';
labelAnswer.text = this.sentenceArr[i].answer; labelAnswer.text = this.sentenceArr[i].answer;
labelAnswer.setScaleXY(1); labelAnswer.setScaleXY(1);
...@@ -1254,14 +1347,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1254,14 +1347,14 @@ export class PlayComponent implements OnInit, OnDestroy {
if (i != this.sentenceArr.length - 1) { if (i != this.sentenceArr.length - 1) {
const line = new MySprite(); const line = new MySprite();
line.init(this.images.get("line")); line.init(this.images.get('line'));
line.x = this.resultPanel.width / 2; line.x = this.resultPanel.width / 2;
line.y = baseY + 30; line.y = baseY + 30;
resultSv.addItem(line); resultSv.addItem(line);
// this.resultPanel.addChild(line); // this.resultPanel.addChild(line);
baseY = line.y baseY = line.y;
} }
...@@ -1270,32 +1363,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1270,32 +1363,11 @@ export class PlayComponent implements OnInit, OnDestroy {
resultSv.content.height = baseY; resultSv.content.height = baseY;
resultSv.refreshScrollBar(); resultSv.refreshScrollBar();
} }
submitBtn;
btnArr = [];
btnDisH = 120;
sendBtn;
uploadAudioBtn1;
uploadAudioBtn2;
uploadAudioBtn3;
uploadAudioBtn4;
uploadAudioBtn5;
uploadAudioBtn6;
startRecordBtn;
stopRecordBtn;
greadPapersForTextBtn;
greadPapersForCheckBtn;
lansiEvaluationBtn;
sendAnswerBtn;
startTestBtn;
stopTestBtn;
initBtn() { initBtn() {
const sendBtn = this.getBtnWithLabel('发题'); const sendBtn = this.getBtnWithLabel('发题');
sendBtn.x = this.canvasWidth / 2 //- 300 * this.mapScale; sendBtn.x = this.canvasWidth / 2; // - 300 * this.mapScale;
sendBtn.y = this.canvasHeight / 2 - 600 * this.mapScale; sendBtn.y = this.canvasHeight / 2 - 600 * this.mapScale;
sendBtn.setScaleXY(this.mapScale); sendBtn.setScaleXY(this.mapScale);
this.sendBtn = sendBtn; this.sendBtn = sendBtn;
...@@ -1323,21 +1395,21 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1323,21 +1395,21 @@ export class PlayComponent implements OnInit, OnDestroy {
this.topArr.push(uploadAudioBtn3); this.topArr.push(uploadAudioBtn3);
const uploadAudioBtn4 = this.getBtnWithLabel('音频 上传 两分半'); const uploadAudioBtn4 = this.getBtnWithLabel('音频 上传 两分半');
uploadAudioBtn4.x = this.canvasWidth / 2 //- 300 * this.mapScale; uploadAudioBtn4.x = this.canvasWidth / 2; // - 300 * this.mapScale;
uploadAudioBtn4.y = this.canvasHeight / 2 - 400 * this.mapScale; uploadAudioBtn4.y = this.canvasHeight / 2 - 400 * this.mapScale;
uploadAudioBtn4.setScaleXY(this.mapScale * 0.8); uploadAudioBtn4.setScaleXY(this.mapScale * 0.8);
this.uploadAudioBtn4 = uploadAudioBtn4; this.uploadAudioBtn4 = uploadAudioBtn4;
this.topArr.push(uploadAudioBtn4); this.topArr.push(uploadAudioBtn4);
const uploadAudioBtn5 = this.getBtnWithLabel('音频 上传 三分钟'); const uploadAudioBtn5 = this.getBtnWithLabel('音频 上传 三分钟');
uploadAudioBtn5.x = this.canvasWidth / 2 //- 300 * this.mapScale; uploadAudioBtn5.x = this.canvasWidth / 2; // - 300 * this.mapScale;
uploadAudioBtn5.y = this.canvasHeight / 2 - 200 * this.mapScale; uploadAudioBtn5.y = this.canvasHeight / 2 - 200 * this.mapScale;
uploadAudioBtn5.setScaleXY(this.mapScale * 0.8); uploadAudioBtn5.setScaleXY(this.mapScale * 0.8);
this.uploadAudioBtn5 = uploadAudioBtn5; this.uploadAudioBtn5 = uploadAudioBtn5;
this.topArr.push(uploadAudioBtn5); this.topArr.push(uploadAudioBtn5);
const uploadAudioBtn6 = this.getBtnWithLabel('音频 上传 五分钟'); const uploadAudioBtn6 = this.getBtnWithLabel('音频 上传 五分钟');
uploadAudioBtn6.x = this.canvasWidth / 2 //- 300 * this.mapScale; uploadAudioBtn6.x = this.canvasWidth / 2; // - 300 * this.mapScale;
uploadAudioBtn6.y = this.canvasHeight / 2 - 0 * this.mapScale; uploadAudioBtn6.y = this.canvasHeight / 2 - 0 * this.mapScale;
uploadAudioBtn6.setScaleXY(this.mapScale * 0.8); uploadAudioBtn6.setScaleXY(this.mapScale * 0.8);
this.uploadAudioBtn6 = uploadAudioBtn6; this.uploadAudioBtn6 = uploadAudioBtn6;
...@@ -1431,29 +1503,25 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1431,29 +1503,25 @@ export class PlayComponent implements OnInit, OnDestroy {
getBtnWithLabel(text) { getBtnWithLabel(text) {
const btn = this.getMySprite('btn_normal'); const btn = this.getMySprite('btn_normal');
const label = this.getFillLabel() const label = this.getFillLabel();
label.textAlign = 'center'; label.textAlign = 'center';
label.text = text; label.text = text;
btn.addChild(label); btn.addChild(label);
return btn; return btn;
} }
sentBtn;
initSentBtn() { initSentBtn() {
const panel = this.panel; const panel = this.panel;
const btn = new MySprite(); const btn = new MySprite();
btn.init(this.images.get("big_btn")); btn.init(this.images.get('big_btn'));
btn.setScaleXY(this.mapScale); btn.setScaleXY(this.mapScale);
btn.x = this.canvasWidth / 2; btn.x = this.canvasWidth / 2;
btn.y = panel.y + ( panel.height / 2 - 120 ) * panel.scaleY; btn.y = panel.y + ( panel.height / 2 - 120 ) * panel.scaleY;
this.sentBtn = btn; this.sentBtn = btn;
const btnShadow = new MySprite(); const btnShadow = new MySprite();
btnShadow.init(this.images.get("big_btn_shadow")); btnShadow.init(this.images.get('big_btn_shadow'));
btnShadow.setScaleXY(this.mapScale); btnShadow.setScaleXY(this.mapScale);
btnShadow.x = btn.x; btnShadow.x = btn.x;
btnShadow.y = btn.y + 20 * this.mapScale; btnShadow.y = btn.y + 20 * this.mapScale;
...@@ -1514,8 +1582,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1514,8 +1582,6 @@ export class PlayComponent implements OnInit, OnDestroy {
btn.text = text; btn.text = text;
return label; return label;
} }
sentenceEmptyArr;
initSentence() { initSentence() {
const row = Math.floor( (this.btnArr.length - 1) / 5 ) + 1; const row = Math.floor( (this.btnArr.length - 1) / 5 ) + 1;
...@@ -1525,10 +1591,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1525,10 +1591,10 @@ export class PlayComponent implements OnInit, OnDestroy {
sv.setShowSize(this.panel.width, 900 - subH); sv.setShowSize(this.panel.width, 900 - subH);
sv.x = -this.panel.width / 2; sv.x = -this.panel.width / 2;
sv.y = -395 + subH; sv.y = -395 + subH;
sv.setBgColor('#faf7ee') sv.setBgColor('#faf7ee');
// sv.setMapScale(this.mapScale); // sv.setMapScale(this.mapScale);
// sv.content.setScaleXY(1/this.mapScale); // sv.content.setScaleXY(1/this.mapScale);
sv.setScrollBarSize(20 * this.mapScale, 5) sv.setScrollBarSize(20 * this.mapScale, 5);
// this.renderArr.push(sv); // this.renderArr.push(sv);
// sv.setScaleXY(this.mapScale); // sv.setScaleXY(this.mapScale);
// sv.x = 0; // sv.x = 0;
...@@ -1548,9 +1614,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1548,9 +1614,9 @@ export class PlayComponent implements OnInit, OnDestroy {
return; return;
} }
const baseX = this.panel.width / 2 - 1000; const baseX = this.panel.width / 2 - 1000;
let curY = 70 // this.canvasHeight / 2 - 110 * this.mapScale; let curY = 70; // this.canvasHeight / 2 - 110 * this.mapScale;
const disH = 70 * this.mapScale; const disH = 70 * this.mapScale;
for (let i=0; i<arr.length; i++) { for (let i = 0; i < arr.length; i++) {
const richText = this.getSentenceLabel(); const richText = this.getSentenceLabel();
richText.x = baseX; richText.x = baseX;
richText.y = curY; richText.y = curY;
...@@ -1619,7 +1685,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1619,7 +1685,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const label = new Label(); const label = new Label();
label.fontSize = 56; label.fontSize = 56;
label.fontColor = '#ffffff' label.fontColor = '#ffffff';
label.fontName = 'Aileron-Black'; label.fontName = 'Aileron-Black';
// label.setScaleXY(this.mapScale); // label.setScaleXY(this.mapScale);
...@@ -1632,8 +1698,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1632,8 +1698,8 @@ export class PlayComponent implements OnInit, OnDestroy {
richText.disH = 0; richText.disH = 0;
richText.fontSize = 56; richText.fontSize = 56;
richText.width = 2000 / this.mapScale richText.width = 2000 / this.mapScale;
richText.fontColor = '#000000' richText.fontColor = '#000000';
richText.fontName = 'DroidSansFallback'; richText.fontName = 'DroidSansFallback';
richText.setScaleXY(this.mapScale); richText.setScaleXY(this.mapScale);
...@@ -1643,7 +1709,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1643,7 +1709,7 @@ export class PlayComponent implements OnInit, OnDestroy {
changeBtnOff() { changeBtnOff() {
for (let i=0; i<this.btnArr.length; i++) { for (let i = 0; i < this.btnArr.length; i++) {
if (this.btnArr[i].visible) { if (this.btnArr[i].visible) {
this.btnArr[i].init(this.images.get('btn_off')); this.btnArr[i].init(this.images.get('btn_off'));
this.btnArr[i].isOff = true; this.btnArr[i].isOff = true;
...@@ -1654,7 +1720,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1654,7 +1720,7 @@ export class PlayComponent implements OnInit, OnDestroy {
changeBtnOn() { changeBtnOn() {
for (let i=0; i<this.btnArr.length; i++) { for (let i = 0; i < this.btnArr.length; i++) {
if (this.btnArr[i].visible) { if (this.btnArr[i].visible) {
this.btnArr[i].init(this.images.get('btn')); this.btnArr[i].init(this.images.get('btn'));
this.btnArr[i].isOff = false; this.btnArr[i].isOff = false;
...@@ -1799,30 +1865,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1799,30 +1865,13 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
panel;
initBg() { initBg() {
console.log('this.data: ', this.data); console.log('this.data: ', this.data);
const bg = new MySprite(); const bg = new MySprite();
bg.init(this.images.get("bg")); bg.init(this.images.get('bg'));
bg.x = this.canvasWidth / 2; bg.x = this.canvasWidth / 2;
bg.y = this.canvasHeight / 2; bg.y = this.canvasHeight / 2;
...@@ -1833,7 +1882,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1833,7 +1882,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const bgItem = new MySprite(); const bgItem = new MySprite();
bgItem.init(this.images.get("bg_item")); bgItem.init(this.images.get('bg_item'));
bgItem.x = this.canvasWidth / 2; bgItem.x = this.canvasWidth / 2;
bgItem.y = this.canvasHeight / 2; bgItem.y = this.canvasHeight / 2;
bgItem.setScaleXY(this.mapScale); bgItem.setScaleXY(this.mapScale);
...@@ -1856,7 +1905,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1856,7 +1905,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// stopTestBtn; // stopTestBtn;
sendBtnClick() { sendBtnClick() {
console.log(' in sendBtnClick') console.log(' in sendBtnClick');
const time = new Date().getTime(); const time = new Date().getTime();
this.sendServerEvent('sendBtnClick', {time}); this.sendServerEvent('sendBtnClick', {time});
...@@ -1864,53 +1913,53 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1864,53 +1913,53 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
uploadAudioBtn1Click() { uploadAudioBtn1Click() {
console.log(' in uploadAudioBtn1Click') console.log(' in uploadAudioBtn1Click');
this.sendServerEvent('uploadAudioBtn1Click', {}); this.sendServerEvent('uploadAudioBtn1Click', {});
} }
uploadAudioBtn2Click() { uploadAudioBtn2Click() {
console.log(' in uploadAudioBtn2Click') console.log(' in uploadAudioBtn2Click');
this.sendServerEvent('uploadAudioBtn2Click', {}); this.sendServerEvent('uploadAudioBtn2Click', {});
} }
uploadAudioBtn3Click() { uploadAudioBtn3Click() {
console.log(' in uploadAudioBtn3Click') console.log(' in uploadAudioBtn3Click');
this.sendServerEvent('uploadAudioBtn3Click', {}); this.sendServerEvent('uploadAudioBtn3Click', {});
} }
uploadAudioBtn4Click() { uploadAudioBtn4Click() {
console.log(' in uploadAudioBtn4Click') console.log(' in uploadAudioBtn4Click');
this.sendServerEvent('uploadAudioBtn4Click', {}); this.sendServerEvent('uploadAudioBtn4Click', {});
} }
uploadAudioBtn5Click() { uploadAudioBtn5Click() {
console.log(' in uploadAudioBtn5Click') console.log(' in uploadAudioBtn5Click');
this.sendServerEvent('uploadAudioBtn5Click', {}); this.sendServerEvent('uploadAudioBtn5Click', {});
} }
uploadAudioBtn6Click() { uploadAudioBtn6Click() {
console.log(' in uploadAudioBtn6Click') console.log(' in uploadAudioBtn6Click');
this.sendServerEvent('uploadAudioBtn6Click', {}); this.sendServerEvent('uploadAudioBtn6Click', {});
} }
greadPapersForTextBtnClick() { greadPapersForTextBtnClick() {
console.log(' in greadPapersForTextBtnClick') console.log(' in greadPapersForTextBtnClick');
this.sendServerEvent('greadPapersForTextBtnClick', {}); this.sendServerEvent('greadPapersForTextBtnClick', {});
} }
greadPapersForCheckBtnClick() { greadPapersForCheckBtnClick() {
console.log(' in greadPapersForCheckBtnClick') console.log(' in greadPapersForCheckBtnClick');
this.sendServerEvent('greadPapersForCheckBtnClick', {}); this.sendServerEvent('greadPapersForCheckBtnClick', {});
} }
lansiEvaluationBtnClick() { lansiEvaluationBtnClick() {
console.log(' in lansiEvaluationBtnClick') console.log(' in lansiEvaluationBtnClick');
this.sendServerEvent('lansiEvaluationBtnClick', {}); this.sendServerEvent('lansiEvaluationBtnClick', {});
} }
sendAnswerBtnClick() { sendAnswerBtnClick() {
console.log(' in sendAnswerBtnClick') console.log(' in sendAnswerBtnClick');
this.sendServerEvent('sendAnswerBtnClick', {}); this.sendServerEvent('sendAnswerBtnClick', {});
} }
...@@ -1925,14 +1974,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1925,14 +1974,6 @@ export class PlayComponent implements OnInit, OnDestroy {
btnFunc(); btnFunc();
} }
} }
curMoveItem = null;
downFlag = false;
mapDown(event) { mapDown(event) {
...@@ -1973,7 +2014,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1973,7 +2014,7 @@ export class PlayComponent implements OnInit, OnDestroy {
mapMove(event) { mapMove(event) {
if (event) { if (event) {
event.preventDefault() event.preventDefault();
} }
...@@ -2010,7 +2051,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2010,7 +2051,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.showSubTemplate(0); // this.showSubTemplate(0);
console.log(' in checkShowSubTemplateOne') console.log(' in checkShowSubTemplateOne');
const progress = this.getStoreData('progress'); const progress = this.getStoreData('progress');
console.log(' progress: ', progress); console.log(' progress: ', progress);
...@@ -2055,7 +2096,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2055,7 +2096,7 @@ export class PlayComponent implements OnInit, OnDestroy {
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); }, 1000);
} }
...@@ -2079,7 +2120,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2079,7 +2120,7 @@ export class PlayComponent implements OnInit, OnDestroy {
label['fillRect'] = emptyRect.label.fillRect; label['fillRect'] = emptyRect.label.fillRect;
this.curMoveItem = label; this.curMoveItem = label;
this.mapMove(null) this.mapMove(null);
return; return;
} }
} }
...@@ -2096,7 +2137,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2096,7 +2137,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const time = 0.07; const time = 0.07;
this.canTouch = false; this.canTouch = false;
tweenChange(this.submitBtn, {y: btnTargetY, scaleX: targetS, scaleY: targetS}, time, ()=> { tweenChange(this.submitBtn, {y: btnTargetY, scaleX: targetS, scaleY: targetS}, time, () => {
// tweenChange(this.submitBtn, {y: btnBaseY, scaleX: baseS, scaleY: baseS}, time) // tweenChange(this.submitBtn, {y: btnBaseY, scaleX: baseS, scaleY: baseS}, time)
this.canTouch = true; this.canTouch = true;
...@@ -2112,25 +2153,25 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2112,25 +2153,25 @@ export class PlayComponent implements OnInit, OnDestroy {
delayCall(0.3, ()=> { delayCall(0.3, () => {
this.initResultView(); this.initResultView();
this.setStoreData('progress', '2', false); this.setStoreData('progress', '2', false);
this.setStoreData('submitCount', this.submitCount); this.setStoreData('submitCount', this.submitCount);
this.serverSendAnswer('4-1', this.resultAnswerArr); this.serverSendAnswer('4-1', this.resultAnswerArr);
}) });
} }
}) });
const shadow = this.submitBtn.shadowSpr; const shadow = this.submitBtn.shadowSpr;
const shadowBaseY = shadow['baseY']; const shadowBaseY = shadow['baseY'];
const shadowTargetY = shadow['baseY'] - 15 * this.mapScale; const shadowTargetY = shadow['baseY'] - 15 * this.mapScale;
tweenChange(shadow, {y: shadowTargetY, alpha: 0}, time, ()=> { tweenChange(shadow, {y: shadowTargetY, alpha: 0}, time, () => {
// tweenChange(shadow, {y: shadowBaseY, alpha: 1}, time) // tweenChange(shadow, {y: shadowBaseY, alpha: 1}, time)
}) });
this.addResultAnswer(); this.addResultAnswer();
...@@ -2138,12 +2179,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2138,12 +2179,12 @@ export class PlayComponent implements OnInit, OnDestroy {
addResultAnswer() { addResultAnswer() {
console.log('this.data.contentObj.sentenceArr: ', this.data.contentObj.sentenceArr) console.log('this.data.contentObj.sentenceArr: ', this.data.contentObj.sentenceArr);
console.log('this.sentenceEmptyArr: ', this.sentenceEmptyArr); console.log('this.sentenceEmptyArr: ', this.sentenceEmptyArr);
const sentenceArr = this.data.contentObj.sentenceArr; const sentenceArr = this.data.contentObj.sentenceArr;
const resultAnswer = []; const resultAnswer = [];
for (let i=0; i<sentenceArr.length; i++) { for (let i = 0; i < sentenceArr.length; i++) {
const label = this.sentenceEmptyArr[i].label; const label = this.sentenceEmptyArr[i].label;
const tmpData = {}; const tmpData = {};
tmpData['question'] = sentenceArr[i]; tmpData['question'] = sentenceArr[i];
...@@ -2172,14 +2213,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2172,14 +2213,14 @@ export class PlayComponent implements OnInit, OnDestroy {
checkAnswer() { checkAnswer() {
let isAllRight = true; let isAllRight = true;
for (let i=0; i<this.sentenceEmptyArr.length; i++) { for (let i = 0; i < this.sentenceEmptyArr.length; i++) {
const rightData = this.sentenceArr[i]; const rightData = this.sentenceArr[i];
console.log('rightData: ', rightData); console.log('rightData: ', rightData);
const answer = this.sentenceEmptyArr[i].label.text; const answer = this.sentenceEmptyArr[i].label.text;
console.log('answer: ', answer) console.log('answer: ', answer);
if (rightData.answer != answer) { if (rightData.answer != answer) {
this.removeRectText( this.sentenceEmptyArr[i] ); this.removeRectText( this.sentenceEmptyArr[i] );
isAllRight = false; isAllRight = false;
...@@ -2207,20 +2248,20 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2207,20 +2248,20 @@ export class PlayComponent implements OnInit, OnDestroy {
if (!emptyRect.isRight) { if (!emptyRect.isRight) {
emptyRect.isRight = true; emptyRect.isRight = true;
const pos = {x: emptyRect.width / 2, y: emptyRect.height / 2}; const pos = {x: emptyRect.width / 2, y: emptyRect.height / 2};
this.showRightParticle(emptyRect, pos) this.showRightParticle(emptyRect, pos);
} }
} }
showRightParticle(emptyRect, point ) { showRightParticle(emptyRect, point ) {
const shapeW = 25 // * this.mapScale; const shapeW = 25; // * this.mapScale;
const shapeH = 25 // * this.mapScale; const shapeH = 25; // * this.mapScale;
showShapeParticle( 'rect', shapeW, shapeH, point, emptyRect, 20, 50, 180, 0.4); showShapeParticle( 'rect', shapeW, shapeH, point, emptyRect, 20, 50, 180, 0.4);
} }
showBtnByText(text) { showBtnByText(text) {
for (let i=0; i<this.btnArr.length; i++) { for (let i = 0; i < this.btnArr.length; i++) {
if (this.btnArr[i].text == text) { if (this.btnArr[i].text == text) {
this.btnArr[i].visible = true; this.btnArr[i].visible = true;
return; return;
...@@ -2294,7 +2335,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2294,7 +2335,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.renderArr.push(emptyRect.label); // this.renderArr.push(emptyRect.label);
} }
const label = emptyRect.label const label = emptyRect.label;
label.text = text; label.text = text;
// label.width = emptyRect.width / this.mapScale; // label.width = emptyRect.width / this.mapScale;
// label.setScaleXY(1); // label.setScaleXY(1);
...@@ -2305,7 +2346,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2305,7 +2346,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// label.x = emptyRect.parent.x + ( emptyRect.x + emptyRect.width / 2 - label.width / 2 ) * this.mapScale // label.x = emptyRect.parent.x + ( emptyRect.x + emptyRect.width / 2 - label.width / 2 ) * this.mapScale
label.y = emptyRect.height / 2; label.y = emptyRect.height / 2;
label.x = ( emptyRect.width / 2 ) label.x = ( emptyRect.width / 2 );
// const w1 = emptyRect.width / this.mapScale; // const w1 = emptyRect.width / this.mapScale;
...@@ -2314,7 +2355,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2314,7 +2355,7 @@ export class PlayComponent implements OnInit, OnDestroy {
label['moveOffX'] = -label.width / 2 * label.scaleX; label['moveOffX'] = -label.width / 2 * label.scaleX;
label['moveOffY'] = 0// -label.height / 2 * label.scaleY; label['moveOffY'] = 0; // -label.height / 2 * label.scaleY;
label['baseX'] = label.x; label['baseX'] = label.x;
label['baseY'] = label.y; label['baseY'] = label.y;
emptyRect.label = label; emptyRect.label = label;
...@@ -2325,7 +2366,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2325,7 +2366,7 @@ export class PlayComponent implements OnInit, OnDestroy {
checkShowSubmit() { checkShowSubmit() {
for (let i=0; i<this.btnArr.length; i++) { for (let i = 0; i < this.btnArr.length; i++) {
if (this.btnArr[i].visible) { if (this.btnArr[i].visible) {
return; return;
} }
...@@ -2348,13 +2389,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2348,13 +2389,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.curMoveItem.x = this.curMoveItem['baseX']; this.curMoveItem.x = this.curMoveItem['baseX'];
this.curMoveItem.y = this.curMoveItem['baseY']; this.curMoveItem.y = this.curMoveItem['baseY'];
} }
templateArr = [];
initIframe() { initIframe() {
this.templateArr = this.data.contentObj.templateArr; this.templateArr = this.data.contentObj.templateArr;
...@@ -2366,7 +2400,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2366,7 +2400,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const c = window['courseware']; const c = window['courseware'];
if (!c) { if (!c) {
console.error('not found window.courseware') console.error('not found window.courseware');
return; return;
} }
...@@ -2375,13 +2409,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2375,13 +2409,13 @@ export class PlayComponent implements OnInit, OnDestroy {
const addPlayUrl = (name, index) => { const addPlayUrl = (name, index) => {
c.getTemplateUrl(name, (data) => { c.getTemplateUrl(name, (data) => {
console.log('name~: ', name) console.log('name~: ', name);
const urlData = JSON.parse(data) const urlData = JSON.parse(data);
console.log('data~~:' , data) console.log('data~~:' , data);
console.log('urlData~~:' , urlData) console.log('urlData~~:' , urlData);
console.log('i~~:' , index) console.log('i~~:' , index);
this.templateArr[index].playUrl = this.sanitizer.bypassSecurityTrustResourceUrl(urlData.play_url + `?key=${index+1}`); this.templateArr[index].playUrl = this.sanitizer.bypassSecurityTrustResourceUrl(urlData.play_url + `?key=${index + 1}`);
this.appRef.tick(); this.appRef.tick();
index ++; index ++;
...@@ -2389,8 +2423,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2389,8 +2423,8 @@ export class PlayComponent implements OnInit, OnDestroy {
const {name, last_version, play_url} = this.templateArr[index].template; const {name, last_version, play_url} = this.templateArr[index].template;
addPlayUrl(name, index); addPlayUrl(name, index);
} }
}) });
} };
const {name, last_version, play_url} = this.templateArr[0].template; const {name, last_version, play_url} = this.templateArr[0].template;
addPlayUrl(name, 0); addPlayUrl(name, 0);
...@@ -2434,7 +2468,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2434,7 +2468,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const arr = this.templateArr; const arr = this.templateArr;
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 = '0vw'; arr[i].leftOff = '0vw';
} }
arr[index].leftOff = '100vw'; arr[index].leftOff = '100vw';
...@@ -2453,10 +2487,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2453,10 +2487,6 @@ export class PlayComponent implements OnInit, OnDestroy {
this.appRef.tick(); this.appRef.tick();
} }
iframeArr;
readyObj;
initWindowListener() { initWindowListener() {
...@@ -2481,10 +2511,10 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2481,10 +2511,10 @@ export class PlayComponent implements OnInit, OnDestroy {
window.addEventListener('message', (e) => { window.addEventListener('message', (e) => {
let msgData = e.data; const msgData = e.data;
if (msgData.action === "getData") { if (msgData.action === 'getData') {
console.log('msgData.urlParams: ', msgData); console.log('msgData.urlParams: ', msgData);
...@@ -2504,7 +2534,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2504,7 +2534,7 @@ export class PlayComponent implements OnInit, OnDestroy {
const saveData = this.templateArr[index].data; const saveData = this.templateArr[index].data;
console.log("getData e: ", e); console.log('getData e: ', e);
...@@ -2516,7 +2546,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2516,7 +2546,7 @@ 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(' in temp_send_result');
console.log('msgData.urlParams: ', msgData); console.log('msgData.urlParams: ', msgData);
...@@ -2525,7 +2555,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2525,7 +2555,7 @@ export class PlayComponent implements OnInit, OnDestroy {
key = '4-3'; key = '4-3';
} }
console.log("key: ", key); console.log('key: ', key);
this.serverSendAnswer(key, JSON.parse( msgData.data )); this.serverSendAnswer(key, JSON.parse( msgData.data ));
...@@ -2538,7 +2568,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2538,7 +2568,7 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log('in temp_send_result __ msgData: ', msgData); console.log('in temp_send_result __ msgData: ', msgData);
} }
if (msgData.action === "temp_show_more") { if (msgData.action === 'temp_show_more') {
console.log(' in temp_show_more'); console.log(' in temp_show_more');
this.checkShowSubTemplateOne(); this.checkShowSubTemplateOne();
...@@ -2546,7 +2576,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2546,7 +2576,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (msgData.action == 'course-ready') { if (msgData.action == 'course-ready') {
console.log(' in course-ready msgData: ', msgData) console.log(' in course-ready msgData: ', msgData);
console.log('msgData.urlParams: ', msgData); console.log('msgData.urlParams: ', msgData);
const key = this.getQueryVariable(msgData.urlParams, 'key'); const key = this.getQueryVariable(msgData.urlParams, 'key');
...@@ -2574,17 +2604,14 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2574,17 +2604,14 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
getQueryVariable(url, variable) { getQueryVariable(url, variable) {
var query = url.substring(1); const query = url.substring(1);
var vars = query.split("&"); const vars = query.split('&');
for (var i=0;i<vars.length;i++) { for (let i = 0; i < vars.length; i++) {
var pair = vars[i].split("="); const pair = vars[i].split('=');
if(pair[0] == variable){return pair[1];} if (pair[0] == variable) {return pair[1]; }
} }
return(false); return(false);
} }
serverResultObj;
serverSendAnswer(key, data) { serverSendAnswer(key, data) {
const c = window['courseware']; const c = window['courseware'];
if (!c) { if (!c) {
...@@ -2601,13 +2628,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2601,13 +2628,6 @@ export class PlayComponent implements OnInit, OnDestroy {
console.log(' sendAnswer : ', this.serverResultObj); console.log(' sendAnswer : ', this.serverResultObj);
console.log(' sendAnswer : ' + JSON.stringify( this.serverResultObj )); console.log(' sendAnswer : ' + JSON.stringify( this.serverResultObj ));
} }
isUpdateStop = false;
update() { update() {
if (this.isUpdateStop) { if (this.isUpdateStop) {
...@@ -2656,9 +2676,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2656,9 +2676,6 @@ export class PlayComponent implements OnInit, OnDestroy {
arr[i].update(this); arr[i].update(this);
} }
} }
maskBg;
initHotZone() { initHotZone() {
...@@ -2679,7 +2696,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2679,7 +2696,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// const arr = this.data.contentObj.imgItemArr; // const arr = this.data.contentObj.imgItemArr;
this.hotZoneArr = []; this.hotZoneArr = [];
const arr = this.data.contentObj.hotZoneItemArr; const arr = this.data.contentObj.hotZoneItemArr;
if (!arr) return; if (!arr) { return; }
console.log('arr: ', arr); console.log('arr: ', arr);
...@@ -2687,7 +2704,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2687,7 +2704,7 @@ export class PlayComponent implements OnInit, OnDestroy {
maskBg.setSize(this.canvasWidth, this.canvasHeight); maskBg.setSize(this.canvasWidth, this.canvasHeight);
// maskBg.x = curBgRect.x; // maskBg.x = curBgRect.x;
// maskBg.y = curBgRect.y; // maskBg.y = curBgRect.y;
maskBg.fillColor = "#000000" maskBg.fillColor = '#000000';
this.maskBg = maskBg; this.maskBg = maskBg;
this.renderArr.push(maskBg); this.renderArr.push(maskBg);
...@@ -2715,9 +2732,6 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2715,9 +2732,6 @@ export class PlayComponent implements OnInit, OnDestroy {
} }
} }
openBtn;
getHotZoneItem(data) { getHotZoneItem(data) {
console.log(' item data: ', data); console.log(' item data: ', data);
...@@ -2725,7 +2739,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2725,7 +2739,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (data.gIdx == '0') { if (data.gIdx == '0') {
//遮照 // 遮照
const pic = new MySprite(); const pic = new MySprite();
pic.init(this.images.get(data.pic_url)); pic.init(this.images.get(data.pic_url));
pic.scaleX = saveRect.width / pic.width; pic.scaleX = saveRect.width / pic.width;
...@@ -2734,17 +2748,17 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -2734,17 +2748,17 @@ export class PlayComponent implements OnInit, OnDestroy {
pic.y = saveRect.y + saveRect.height / 2; pic.y = saveRect.y + saveRect.height / 2;
pic['data'] = data; pic['data'] = data;
this.maskBg.setMaskType("destination-out"); this.maskBg.setMaskType('destination-out');
this.maskBg.addMaskSpr(pic); this.maskBg.addMaskSpr(pic);
return pic; return pic;
} else { } else {
//open按钮 // open按钮
const openBtn = new MySprite(); const openBtn = new MySprite();
openBtn.init(this.images.get("open")) openBtn.init(this.images.get('open'));
openBtn.x = saveRect.x + saveRect.width / 2; openBtn.x = saveRect.x + saveRect.width / 2;
openBtn.y = saveRect.y + saveRect.height / 2; openBtn.y = saveRect.y + saveRect.height / 2;
...@@ -3076,9 +3090,9 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -3076,9 +3090,9 @@ export class PlayComponent implements OnInit, OnDestroy {
preloadAudio(url) { preloadAudio(url) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const audio = new Audio(); const audio = new Audio();
resolve({}) resolve({});
audio.oncanplay = (a) => { audio.oncanplay = (a) => {
//resolve(); // resolve();
}; };
audio.onerror = () => { audio.onerror = () => {
reject(); reject();
...@@ -3097,7 +3111,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -3097,7 +3111,7 @@ export class PlayComponent implements OnInit, OnDestroy {
checkClickTargetSv(target) { checkClickTargetSv(target) {
let tmpRect = target.getBoundingBox(); const tmpRect = target.getBoundingBox();
// rect.x /= 2; // rect.x /= 2;
// rect.y /= 2; // rect.y /= 2;
...@@ -3158,7 +3172,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -3158,7 +3172,7 @@ export class PlayComponent implements OnInit, OnDestroy {
getWorlRect(target) { getWorlRect(target) {
let rect = target.getBoundingBox(); const rect = target.getBoundingBox();
if (target.parent) { if (target.parent) {
......
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