Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
ssy003
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
ssy003
Commits
fda77d27
Commit
fda77d27
authored
Apr 18, 2020
by
邵世尧
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交
parent
d381f1ce
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
629 additions
and
647 deletions
+629
-647
form.component.html
src/app/form/form.component.html
+4
-4
form.component.ts
src/app/form/form.component.ts
+93
-125
play.component.ts
src/app/play/play.component.ts
+532
-518
No files found.
src/app/form/form.component.html
View file @
fda77d27
<div
class=
"model-content"
>
<div
class=
"model-content"
>
<div
style=
"position: absolute;left: 100px;top:20px;width: 500px;"
>
<div
style=
"position: absolute;left: 100px;top:20px;width: 500px;"
>
<nz-radio-group
[(
ngModel
)]="
side
"
>
<nz-radio-group
[(
ngModel
)]="
side
"
(
ngModelChange
)="
sidec
()"
>
<label
nz-radio
nzValue=
"A"
(
click
)="
sideB
()"
>
默认背面
</label>
<label
nz-radio
nzValue=
"A"
>
默认背面
</label>
<label
nz-radio
nzValue=
"B"
(
click
)="
sideA
()"
>
默认正面
</label>
<label
nz-radio
nzValue=
"B"
>
默认正面
</label>
</nz-radio-group>
</nz-radio-group>
<div
*
ngFor=
"let it of picArr; let i = index"
class=
"card-item"
style=
"padding: 0.5vw;"
>
<div
*
ngFor=
"let it of picArr; let i = index"
class=
"card-item"
style=
"padding: 0.5vw;"
>
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
<div
*
ngIf=
"it.optionTypeA == 'A'"
style=
"width: 60%"
>
<div
*
ngIf=
"it.optionTypeA == 'A'"
style=
"width: 60%"
>
<input
style=
"width: 80%; margin-bottom: 0.5vw"
type=
"text"
nz-input
placeholder=
""
[(
ngModel
)]="
it
.
title
"
(
blur
)="
save
Item
()"
>
<input
style=
"width: 80%; margin-bottom: 0.5vw"
type=
"text"
nz-input
placeholder=
""
[(
ngModel
)]="
it
.
title
"
(
blur
)="
save
()"
>
</div>
</div>
...
...
src/app/form/form.component.ts
View file @
fda77d27
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
,
ViewChild
,
ElementRef
}
from
'
@angular/core
'
;
import
{
NzMessageService
}
from
'
ng-zorro-antd
'
;
...
@@ -8,194 +9,162 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
...
@@ -8,194 +9,162 @@ import {Component, EventEmitter, Input, OnDestroy, OnChanges, OnInit, Output, Ap
styleUrls
:
[
'
./form.component.css
'
]
styleUrls
:
[
'
./form.component.css
'
]
})
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// @Input()
item
;
@
ViewChild
(
'
videoContainer
'
)
videoContainer
:
ElementRef
;
@
ViewChild
(
'
videoNode
'
)
videoNode
:
ElementRef
;
@
Output
()
update
=
new
EventEmitter
();
picArr
=
[];
intervalId
;
_item
:
any
;
saveKey
=
'
ssy003
'
;
picArr
;
radioValue
;
side
side
saveKey
=
'
ssy003
'
;
// @Input()
set
item
(
item
)
{
this
.
_item
=
item
;
// this.init();
}
get
item
()
{
return
this
.
_item
;
}
@
Output
()
constructor
(
private
nzMessageService
:
NzMessageService
,
update
=
new
EventEmitter
();
private
appRef
:
ApplicationRef
,
public
changeDetectorRef
:
ChangeDetectorRef
)
{
}
ngOnChanges
()
{
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
}
}
ngOnInit
()
{
ngOnInit
()
{
this
.
item
=
{};
this
.
item
.
contentObj
=
{};
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
const
getData
=
(
<
any
>
window
).
courseware
.
getData
;
getData
((
data
)
=>
{
getData
((
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
item
=
data
;
this
.
item
=
data
;
}
else
{
}
else
{
this
.
item
=
{};
this
.
item
=
{};
}
if
(
!
this
.
item
.
contentObj
)
{
this
.
item
.
contentObj
=
{};
this
.
item
.
contentObj
=
{};
}
if
(
this
.
item
.
sideA
==
1
){
this
.
side
=
'
B
'
;
}
else
if
(
this
.
item
.
sideB
==
1
){
this
.
side
=
'
A
'
;
}
}
console
.
log
(
'
~data:
'
,
data
);
this
.
init
();
this
.
initDefaultData
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
// this.initDefaultData(
);
console
.
log
(
'
data:
'
,
data
);
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
},
this
.
saveKey
);
},
this
.
saveKey
);
// this.initData();
}
ngOnChanges
()
{
}
ngOnDestroy
()
{
}
}
sidec
(){
if
(
this
.
side
==
"
A
"
){
this
.
item
.
sideA
=
0
;
this
.
item
.
sideB
=
1
;
}
init
()
{
if
(
this
.
side
==
"
B
"
){
this
.
item
.
sideA
=
1
;
this
.
item
.
sideB
=
0
;
if
(
this
.
item
.
contentObj
.
picArr
)
{
}
this
.
picArr
=
this
.
item
.
contentObj
.
picArr
;
this
.
save
();
}
else
{
this
.
picArr
=
this
.
getDefaultPicArr
();
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
}
}
console
.
log
(
'
item:
'
,
this
.
item
);
initDefaultData
()
{
// this.picArr = this.getDefaultPicArr();
// this.item.contentObj.picArr = this.picArr;
// console.log('this.item:;', this.picArr);
}
cardItemData
(){
const
picArr
=
this
.
item
.
contentObj
.
picArr
;
return
{
if
(
!
picArr
)
{
title
:
""
,
pic_url
:
""
,
audio_url
:
""
};
const
picArr
=
[];
for
(
let
i
=
0
;
i
<
6
;
i
++
)
{
picArr
.
push
({
pic_url
:
''
,
audio_url
:
''
,
title
:
''
,
sideA
:
''
,
sideB
:
''
});
}
}
sideA
(){
this
.
item
.
sideA
=
1
;
this
.
item
.
sideB
=
0
;
this
.
picArr
=
[];
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
for
(
let
i
=
0
;
i
<
6
;
i
++
){
this
.
item
.
contentObj
.
picArr
=
picArr
;
let
item
=
this
.
cardItemData
();
this
.
picArr
.
push
(
item
);
}
}
this
.
saveItem
();
}
}
sideB
(){
this
.
item
.
sideB
=
1
;
this
.
item
.
sideA
=
0
;
this
.
picArr
=
[];
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
for
(
let
i
=
0
;
i
<
6
;
i
++
){
let
item
=
this
.
cardItemData
();
this
.
picArr
.
push
(
item
);
}
this
.
saveItem
();
console
.
log
(
'
init~data:
'
,
this
.
picArr
);
}
getDefaultPicArr
()
{
ngOnDestroy
()
{
let
arr
=
[];
console
.
log
(
'
in ngOnDestory
'
);
return
arr
;
}
}
init
()
{
this
.
picArr
=
this
.
item
.
contentObj
.
picArr
||
[];
addItem6
()
{
this
.
picArr
=
[];
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
this
.
item
.
contentObj
.
picArr
=
this
.
picArr
;
for
(
let
i
=
0
;
i
<
6
;
i
++
){
let
item
=
this
.
cardItemData
();
this
.
picArr
.
push
(
item
);
}
}
this
.
saveItem
();
console
.
log
(
'
init~data:
'
,
this
.
picArr
);
}
onImageUploadSuccessByItem
(
e
,
item
)
{
onImageUploadSuccessByItem
(
e
,
item
,
id
=
null
)
{
if
(
id
!=
null
)
{
item
[
id
+
'
_pic_url
'
]
=
e
.
url
;
}
else
{
item
.
pic_url
=
e
.
url
;
item
.
pic_url
=
e
.
url
;
this
.
save
();
}
}
onAudioUploadSuccessByItem
(
e
,
item
)
{
item
.
audio_url
=
e
.
url
;
this
.
save
();
this
.
save
();
}
// this.update.emit(this.item);
radioClick
(
it
,
radioValue
)
{
it
.
radioValue
=
radioValue
;
this
.
saveItem
(
);
// console.log('this.item: ', this.item
);
}
}
clickCheckBox
()
{
console
.
log
(
'
in clickCheckBox
'
);
this
.
saveItem
();
}
saveItem
(
)
{
onAudioUploadSuccessByItem
(
e
,
item
,
id
=
null
)
{
console
.
log
(
'
in saveItem
'
);
if
(
id
!=
null
)
{
item
[
id
+
'
_audio_url
'
]
=
e
.
url
;
}
else
{
item
.
audio_url
=
e
.
url
;
}
// this.update.emit(this.item);
// this.update.emit(this.item);
this
.
save
();
this
.
save
();
}
}
save
()
{
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
console
.
log
(
'
side
'
+
this
.
item
);
this
.
refresh
();
this
.
refresh
();
}
}
...
@@ -203,8 +172,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -203,8 +172,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
setTimeout
(()
=>
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
this
.
appRef
.
tick
();
},
1
);
},
1
);
console
.
log
(
"
===========================================================================================
"
);
}
}
}
}
src/app/play/play.component.ts
View file @
fda77d27
This diff is collapsed.
Click to expand it.
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