Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
hw_online_008
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
hw_online_008
Commits
d4dde87d
Commit
d4dde87d
authored
Feb 25, 2020
by
Dumplings X
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
55d8ec14
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1866 additions
and
757 deletions
+1866
-757
form.component.html
src/app/form/form.component.html
+169
-245
form.component.ts
src/app/form/form.component.ts
+206
-32
Unit.ts
src/app/play/Unit.ts
+240
-108
play.component.ts
src/app/play/play.component.ts
+1249
-372
resources.js
src/app/play/resources.js
+2
-0
arrow.png
src/assets/play/teacher/arrow.png
+0
-0
right.png
src/assets/play/teacher/right.png
+0
-0
No files found.
src/app/form/form.component.html
View file @
d4dde87d
This diff is collapsed.
Click to expand it.
src/app/form/form.component.ts
View file @
d4dde87d
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
...
...
@@ -9,13 +19,40 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
test_0011
"
;
// 储存对象
item
;
picArr
=
[];
_item
:
any
;
constructor
(
private
appRef
:
ApplicationRef
)
{
KEY
=
'
hw_online_008
'
;
// @Input()
set
item
(
item
)
{
this
.
_item
=
item
;
// this.init();
}
get
item
()
{
return
this
.
_item
;
}
@
Output
()
update
=
new
EventEmitter
();
bgItem
;
hotZoneItemArr
;
constructor
(
private
appRef
:
ApplicationRef
,
public
changeDetectorRef
:
ChangeDetectorRef
)
{
}
...
...
@@ -23,68 +60,205 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
ngOnInit
()
{
this
.
item
=
{};
this
.
item
.
contentObj
=
{};
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
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
.
saveKey
);
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
}
this
.
refresh
();
},
this
.
KEY
);
// 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
;
}
this
.
bgItem
=
this
.
item
.
contentObj
.
bgItem
||
{};
this
.
hotZoneItemArr
=
this
.
item
.
contentObj
.
hotZoneItemArr
||
[];
console
.
log
(
'
item:
'
,
this
.
item
);
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
// console.log('this.item:;', this.picArr);
}
getDefaultPicArr
()
{
const
arr
=
[];
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
return
arr
;
}
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
changeOptions
(
data
)
{
console
.
log
(
'
data:
'
,
data
);
this
.
save
();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
getOptions
()
{
const
options
=
[];
const
arr
=
this
.
hotZoneItemArr
;
for
(
let
i
=
0
;
i
<
arr
.
length
;
i
++
)
{
const
data
=
{};
data
[
'
key
'
]
=
arr
[
i
][
'
key
'
];
data
[
'
index
'
]
=
arr
[
i
][
'
index
'
];
data
[
'
label
'
]
=
'
item-
'
+
(
arr
[
i
][
'
index
'
]
+
1
);
data
[
'
value
'
]
=
arr
[
i
][
'
index
'
];
options
.
push
(
data
);
}
return
options
;
}
refreshOptions
()
{
const
picArr
=
this
.
picArr
;
for
(
let
i
=
0
;
i
<
picArr
.
length
;
i
++
)
{
picArr
[
i
].
options
=
this
.
getOptions
();
}
}
deleteItem
(
data
,
arr
=
null
)
{
if
(
!
arr
)
{
arr
=
this
.
picArr
;
}
const
index
=
arr
.
indexOf
(
data
);
if
(
index
!==
-
1
)
{
arr
.
splice
(
index
,
1
);
}
// this.update.emit(this.item);
// this.refreshOptions();
this
.
save
();
}
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);
}
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
.
save
();
}
/**
* 储存数据
*/
addPic
()
{
this
.
picArr
.
push
({
pic_url
:
''
,
audio_url
:
''
,
text
:
''
,
options
:
this
.
getOptions
()
// text: '',
// radioValue: 'A'
});
// this.refreshOptions();
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
();
}
saveData
(
e
)
{
console
.
log
(
'
savedata e:
'
,
e
);
this
.
bgItem
=
e
.
bgItem
;
this
.
hotZoneItemArr
=
e
.
hotZoneItemArr
;
this
.
item
.
contentObj
.
bgItem
=
this
.
bgItem
;
this
.
item
.
contentObj
.
hotZoneItemArr
=
this
.
hotZoneItemArr
;
this
.
refreshOptions
();
this
.
save
();
}
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
KEY
);
this
.
refresh
();
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
...
...
src/app/play/Unit.ts
View file @
d4dde87d
This diff is collapsed.
Click to expand it.
src/app/play/play.component.ts
View file @
d4dde87d
This diff is collapsed.
Click to expand it.
src/app/play/resources.js
View file @
d4dde87d
...
...
@@ -12,6 +12,8 @@ const res = [
[
'
petal_2
'
,
"
assets/default/petal_2.png
"
],
[
'
petal_3
'
,
"
assets/default/petal_3.png
"
],
[
'
t_right
'
,
"
assets/play/teacher/right.png
"
],
[
'
t_arrow
'
,
"
assets/play/teacher/arrow.png
"
],
];
...
...
src/assets/play/teacher/arrow.png
0 → 100644
View file @
d4dde87d
32.4 KB
src/assets/play/teacher/right.png
0 → 100644
View file @
d4dde87d
68.3 KB
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