Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
ym-3-29
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
template admin
ym-3-29
Commits
a7e92ed4
Commit
a7e92ed4
authored
Jan 21, 2020
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update template
parent
c915a859
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
637 additions
and
1262 deletions
+637
-1262
form.component.html
src/app/form/form.component.html
+230
-140
form.component.scss
src/app/form/form.component.scss
+0
-46
form.component.ts
src/app/form/form.component.ts
+30
-144
Unit.ts
src/app/play/Unit.ts
+11
-8
play.component.scss
src/app/play/play.component.scss
+0
-10
play.component.ts
src/app/play/play.component.ts
+363
-828
resources.js
src/app/play/resources.js
+3
-7
config.service.spec.ts
src/app/services/config.service.spec.ts
+0
-12
config.service.ts
src/app/services/config.service.ts
+0
-67
No files found.
src/app/form/form.component.html
View file @
a7e92ed4
This diff is collapsed.
Click to expand it.
src/app/form/form.component.scss
View file @
a7e92ed4
...
...
@@ -5,50 +5,4 @@
width
:
100%
;
height
:
100%
;
.item-box
{
width
:
100%
;
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
flex-direction
:
column
;
padding
:
10px
;
padding-bottom
:
5vw
;
padding-top
:
5vw
;
}
.pic-sound-box
{
width
:
50%
;
display
:
flex
;
//align-items: center;
flex-direction
:
column
}
.add-btn-box
{
display
:
flex
;
align-items
:
center
;
justify-content
:
center
;
//width: 180px;
height
:
20vw
;
//background: #FFDC00;
padding
:
10px
;
padding-top
:
5vw
;
}
}
src/app/form/form.component.ts
View file @
a7e92ed4
...
...
@@ -9,30 +9,10 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
picArr
=
[];
_item
:
any
;
KEY
=
'
hw_000
'
;
// @Input()
set
item
(
item
)
{
this
.
_item
=
item
;
// this.init();
}
get
item
()
{
return
this
.
_item
;
}
@
Output
()
update
=
new
EventEmitter
();
// 储存数据用
saveKey
=
"
test_0011
"
;
// 储存对象
item
;
constructor
(
private
appRef
:
ApplicationRef
)
{
...
...
@@ -43,162 +23,68 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit
()
{
this
.
item
=
{};
this
.
item
.
contentObj
=
{};
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
)
=>
{
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
if
(
data
)
{
this
.
item
=
data
;
}
else
{
this
.
item
=
{};
}
if
(
!
this
.
item
.
contentObj
)
{
this
.
item
.
contentObj
=
{};
}
console
.
log
(
'
~data:
'
,
data
);
this
.
init
();
this
.
refresh
();
},
this
.
KEY
);
},
this
.
saveKey
);
// this.initData();
}
ngOnChanges
()
{
}
ngOnDestroy
()
{
}
init
()
{
if
(
this
.
item
.
contentObj
.
picArr
)
{
this
.
picArr
=
this
.
item
.
contentObj
.
picArr
;
}
else
{
this
.
picArr
=
this
.
getDefaultPicArr
();
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
}
console
.
log
(
'
item:
'
,
this
.
item
);
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
// console.log('this.item:;', this.picArr);
ngOnChanges
()
{
}
getDefaultPicArr
()
{
const
arr
=
[];
// for (let i = 0; i < 4; i ++) {
// const data = {};
// data['pic_url'] = '';
//
// const soundArr = [];
// for (let i = 0; i < 3; i++) {
// const tmpData = {};
// tmpData['answer'] = false;
// tmpData['audio_url'] = '';
// soundArr.push(tmpData);
// }
// data['soundArr'] = soundArr;
//
// arr.push(data);
// }
return
arr
;
ngOnDestroy
()
{
}
initData
()
{
}
deleteItem
(
data
)
{
const
index
=
this
.
picArr
.
indexOf
(
data
);
if
(
index
!==
-
1
)
{
this
.
picArr
.
splice
(
index
,
1
);
}
init
()
{
// this.update.emit(this.item);
this
.
save
();
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
onImageUploadSuccessByItem
(
e
,
item
,
id
=
null
)
{
if
(
id
!=
null
)
{
item
[
id
+
'
_pic_url
'
]
=
e
.
url
;
}
else
{
item
.
pic_url
=
e
.
url
;
}
this
.
save
();
// this.update.emit(this.item);
// console.log('this.item: ', this.item);
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
onAudioUploadSuccessByItem
(
e
,
item
,
id
=
null
)
{
if
(
id
!=
null
)
{
item
[
id
+
'
_audio_url
'
]
=
e
.
url
;
}
else
{
item
.
audio_url
=
e
.
url
;
}
// this.update.emit(this.item);
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
addPic
()
{
this
.
picArr
.
push
({
pic_url
:
''
,
audio_url
:
''
,
// text: '',
// radioValue: 'A'
});
this
.
saveItem
();
}
radioClick
(
it
,
radioValue
)
{
it
.
radioValue
=
radioValue
;
this
.
saveItem
();
}
clickCheckBox
()
{
console
.
log
(
'
in clickCheckBox
'
);
this
.
saveItem
();
}
saveItem
()
{
// this.update.emit(this.item);
this
.
save
();
}
/**
* 储存数据
*/
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
KEY
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
this
.
refresh
();
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
...
...
src/app/play/Unit.ts
View file @
a7e92ed4
...
...
@@ -359,7 +359,7 @@ export class ColorSpr extends MySprite {
g
=
0
;
b
=
0
;
createGSCanvas
(){
createGSCanvas
()
{
if
(
!
this
.
img
)
{
return
;
...
...
@@ -1327,6 +1327,16 @@ export function removeItemFromArr(arr, item) {
export
function
getPosDistance
(
sx
,
sy
,
ex
,
ey
)
{
const
_x
=
ex
-
sx
;
const
_y
=
ey
-
sy
;
const
len
=
Math
.
sqrt
(
Math
.
pow
(
_x
,
2
)
+
Math
.
pow
(
_y
,
2
)
);
return
len
;
}
...
...
@@ -1370,13 +1380,6 @@ export function circleMove(item, x0, y0, time = 2, addR = 360, xPer = 1, yPer =
}
export
function
getPosDistance
(
sx
,
sy
,
ex
,
ey
)
{
const
_x
=
ex
-
sx
;
const
_y
=
ey
-
sy
;
const
len
=
Math
.
sqrt
(
Math
.
pow
(
_x
,
2
)
+
Math
.
pow
(
_y
,
2
)
);
return
len
;
}
export
function
delayCall
(
callback
,
second
)
{
const
tween
=
new
TWEEN
.
Tween
(
this
)
...
...
src/app/play/play.component.scss
View file @
a7e92ed4
.game-container
{
width
:
100%
;
height
:
100%
;
//background-image: url("/assets/listen-read-circle/bg.jpg");
background
:
#ffffff
;
background-repeat
:
no-repeat
;
background-size
:
cover
;
}
...
...
@@ -19,11 +17,3 @@
src
:
url("../../assets/font/BRLNSDB.TTF")
;
}
//
//
//@font-face
//{
// font-family: 'RoundedBold';
// src: url("../../assets/font/ArialRoundedBold.otf") ;
//}
src/app/play/play.component.ts
View file @
a7e92ed4
This diff is collapsed.
Click to expand it.
src/app/play/resources.js
View file @
a7e92ed4
const
res
=
[
[
'
bg
'
,
"
assets/play/bg.jpg
"
],
//
['bg', "assets/play/bg.jpg"],
[
'
btn_left
'
,
"
assets/play/btn_left.png
"
],
[
'
btn_right
'
,
"
assets/play/btn_right.png
"
],
[
'
text_bg
'
,
"
assets/play/text_bg.png
"
],
// ['text_bg', "assets/play/text_bg.png"],
];
...
...
@@ -12,10 +11,7 @@ const res = [
const
resAudio
=
[
// ['click', "assets/play/music/click.mp3"],
[
'
click
'
,
"
assets/play/music/click.mp3
"
],
];
...
...
src/app/services/config.service.spec.ts
deleted
100644 → 0
View file @
c915a859
import
{
TestBed
}
from
'
@angular/core/testing
'
;
import
{
ConfigService
}
from
'
./config.service
'
;
describe
(
'
ConfigService
'
,
()
=>
{
beforeEach
(()
=>
TestBed
.
configureTestingModule
({}));
it
(
'
should be created
'
,
()
=>
{
const
service
:
ConfigService
=
TestBed
.
get
(
ConfigService
);
expect
(
service
).
toBeTruthy
();
});
});
src/app/services/config.service.ts
deleted
100644 → 0
View file @
c915a859
import
{
Injectable
}
from
'
@angular/core
'
;
import
{
HttpClient
}
from
"
@angular/common/http
"
;
import
{
Observable
}
from
"
rxjs
"
;
@
Injectable
({
providedIn
:
'
root
'
})
export
class
ConfigService
{
configUrl
=
'
proxy.conf.json
'
;
constructor
(
private
http
:
HttpClient
)
{
}
getConfig
()
{
return
this
.
http
.
get
(
this
.
configUrl
)
.
pipe
(
);
}
showConfig
()
{
this
.
getConfig
()
.
subscribe
((
data
)
=>
{
console
.
log
(
'
data:
'
,
data
);
});
}
test
(
data
)
{
// return new Promise<any> {
// return new Promise((resolve, reject) => {
// this.http.get(url).subscribe((res) => {
// resolve(res);
// }, reject);
// });
//
return
this
.
get
(
'
/api/login
'
);
// return this.http.post('/login', data);
}
get
(
url
:
string
):
Promise
<
any
>
{
return
new
Promise
((
resolve
,
reject
)
=>
{
this
.
http
.
get
(
url
).
subscribe
((
res
)
=>
{
resolve
(
res
);
},
reject
);
});
}
// login(user): Observable<any> {
//
//
// return this.http.post('/login', user).pipe(
// tap((data => {
// console.log('login', data)
// localStorage.setItem('token', _.get(data, 'token'));
// delete data['token'];
// localStorage.setItem('info', JSON.stringify(data));
// this.getInfoPromise = this.load('/user/getInfo');
// }))
// );
// }
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment