Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
forms_for_developers
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
forms_for_developers
Commits
c3c69987
Commit
c3c69987
authored
Feb 23, 2022
by
范雪寒
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:
parent
d4c5cd1b
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
731 additions
and
232 deletions
+731
-232
.DS_Store
.DS_Store
+0
-0
angular.json
form_angular/angular.json
+5
-2
package-lock.json
form_angular/package-lock.json
+641
-146
package.json
form_angular/package.json
+1
-1
form.component.css
form_angular/src/app/form/form.component.css
+4
-4
form.component.html
form_angular/src/app/form/form.component.html
+32
-30
form.component.ts
form_angular/src/app/form/form.component.ts
+48
-49
No files found.
.DS_Store
View file @
c3c69987
No preview for this file type
form_angular/angular.json
View file @
c3c69987
...
@@ -128,5 +128,8 @@
...
@@ -128,5 +128,8 @@
}
}
}
}
},
},
"defaultProject"
:
"ng-template-generator"
"defaultProject"
:
"ng-template-generator"
,
}
"cli"
:
{
"analytics"
:
false
}
}
\ No newline at end of file
form_angular/package-lock.json
View file @
c3c69987
This diff is collapsed.
Click to expand it.
form_angular/package.json
View file @
c3c69987
...
@@ -55,4 +55,4 @@
...
@@ -55,4 +55,4 @@
"tslint"
:
"~5.18.0"
,
"tslint"
:
"~5.18.0"
,
"typescript"
:
"~3.7.5"
"typescript"
:
"~3.7.5"
}
}
}
}
\ No newline at end of file
form_angular/src/app/form/form.component.css
View file @
c3c69987
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
border-style
:
dashed
;
border-style
:
dashed
;
padding
:
20px
;
padding
:
20px
;
margin
:
20px
;
margin
:
20px
;
/*width: 500px; */
width
:
500px
;
/*//border-radius: 20px;*/
border-radius
:
20px
;
/*//border-width: 2px;*/
border-width
:
2px
;
/*//border-color: #000000;*/
border-color
:
#000000
;
}
}
...
...
form_angular/src/app/form/form.component.html
View file @
c3c69987
<div
class=
"model-content"
>
<div
class=
"model-content"
>
<div
style=
"padding: 10px;"
>
<div
style=
"width: 300px;"
align=
'center'
>
<span>
图1:
</span>
<app-upload-image-with-preview
[
picUrl
]="
item
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
')"
>
</app-upload-image-with-preview>
</div>
<div
style=
"width: 300px; margin-top: 5px;"
align=
'center'
>
<span>
图2:
</span>
<app-upload-image-with-preview
[
picUrl
]="
item
.
pic_url_2
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url_2
')"
>
</app-upload-image-with-preview>
</div>
<div
style=
"width: 300px; margin-top: 15px;"
>
<div
class=
"border"
style=
"width: 800px;"
>
<span>
文本:
</span>
<div
*
ngFor=
"let question of item.questions; let i = index"
>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
text
"
(
blur
)="
save
()"
>
<div
class=
"border"
style=
"width: 700px;"
>
</div>
<span
style=
"font-size: 20px;"
>
第{{i + 1}}题:
</span>
<br>
<input
type=
"text"
style=
"width: 200px;"
nz-input
[(
ngModel
)]="
question
.
text
"
(
blur
)="
save
()"
>
<app-audio-recorder
[
audioUrl
]="
question
.
audio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
question
)"
>
</app-audio-recorder>
<app-upload-dragon-bone
[
btnName
]="[['配置骨骼动画']]"
[
animaNames
]="[[['
normal
']]]"
[
skeJsonData
]=
question
.
dragonBoneData
.
skeJsonData
[
texJsonData
]=
question
.
dragonBoneData
.
texJsonData
[
texPngData
]=
question
.
dragonBoneData
.
texPngData
(
save
)="
saveAnima
($
event
,
question
.
dragonBoneData
)"
(
refreshEmitter
)="
refresh
()"
>
</app-upload-dragon-bone>
<div
style=
"margin-top: 5px"
>
<button
(
click
)="
deleteQuestion
(
i
);"
>
delete question
</button>
<span>
音频:
</span>
</div>
<app-audio-recorder
[
audioUrl
]="
item
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
')"
></app-audio-recorder>
</div>
</div>
<button
(
click
)="
addQuestion
();"
>
add question
</button>
</div>
</div>
</div>
<!-- <div style="position: absolute; left: 200px; top: 100px; width: 800px;">
<input type="text" nz-input [(ngModel)]="item.text" (blur)="save()">
<app-upload-image-with-preview
[picUrl]="item.pic_url"
(imageUploaded)="onImageUploadSuccess($event, 'pic_url')"
></app-upload-image-with-preview>
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
<app-custom-hot-zone></app-custom-hot-zone>
<app-upload-video></app-upload-video>
<app-lesson-title-config></app-lesson-title-config>
</div> -->
</div>
\ No newline at end of file
form_angular/src/app/form/form.component.ts
View file @
c3c69987
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
import
{
JsonPipe
}
from
'
@angular/common
'
;
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
,
}
from
"
@angular/core
"
;
@
Component
({
@
Component
({
selector
:
'
app-form
'
,
selector
:
"
app-form
"
,
templateUrl
:
'
./form.component.html
'
,
templateUrl
:
"
./form.component.html
"
,
styleUrls
:
[
'
./form.component.css
'
]
styleUrls
:
[
"
./form.component.css
"
],
})
})
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
// 储存数据用
saveKey
=
"
test_001
"
;
saveKey
=
"
developer_test
"
;
// 储存对象
// 储存对象
item
;
item
;
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
constructor
(
private
appRef
:
ApplicationRef
,
}
private
changeDetectorRef
:
ChangeDetectorRef
)
{}
createShell
()
{
this
.
item
.
wordList
.
push
({
word
:
''
,
audio
:
''
,
backWord
:
''
,
backWordAudio
:
''
,
});
this
.
save
();
}
removeShell
(
idx
)
{
this
.
item
.
wordList
.
splice
(
idx
,
1
);
this
.
save
();
}
ngOnInit
()
{
ngOnInit
()
{
this
.
item
=
{
this
.
item
=
{};
questions
:
[],
};
// 获取存储的数据
// 获取存储的数据
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
if
(
data
)
{
if
(
data
)
{
this
.
item
=
data
;
this
.
item
=
data
;
}
}
...
@@ -48,27 +41,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -48,27 +41,20 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
this
.
refresh
();
},
this
.
saveKey
);
},
this
.
saveKey
);
}
}
ngOnChanges
()
{
ngOnChanges
()
{}
}
ngOnDestroy
()
{
}
init
()
{
ngOnDestroy
()
{}
}
init
()
{}
/**
/**
* 储存图片数据
* 储存图片数据
* @param e
* @param e
*/
*/
onImageUploadSuccess
(
e
,
key
)
{
onImageUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
...
@@ -77,18 +63,33 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -77,18 +63,33 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据
* 储存音频数据
* @param e
* @param e
*/
*/
onAudioUploadSuccess
(
e
,
key
)
{
onAudioUploadSuccess
(
e
,
question
)
{
this
.
item
[
key
]
=
e
.
url
;
question
.
audio
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
onWordAudioUploadSuccess
(
e
,
idx
)
{
addQuestion
()
{
this
.
item
.
wordList
[
idx
].
audio
=
e
.
url
;
this
.
item
.
questions
.
push
({
text
:
""
,
audio
:
""
,
dragonBoneData
:
{
skeJsonData
:
{},
texJsonData
:
{},
texPngData
:
{},
},
});
this
.
save
();
}
deleteQuestion
(
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
);
this
.
save
();
this
.
save
();
}
}
onBackWordAudioUploadSuccess
(
e
,
idx
)
{
saveAnima
(
event
,
data
)
{
this
.
item
.
wordList
[
idx
].
backWordAudio
=
e
.
url
;
data
.
skeJsonData
=
event
.
skeJsonData
;
data
.
texJsonData
=
event
.
texJsonData
;
data
.
texPngData
=
event
.
texPngData
;
this
.
save
();
this
.
save
();
}
}
...
@@ -97,9 +98,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -97,9 +98,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
*/
*/
save
()
{
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
console
.
log
(
JSON
.
stringify
(
this
.
item
));
this
.
refresh
();
this
.
refresh
();
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
}
}
/**
/**
...
@@ -110,5 +110,4 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
...
@@ -110,5 +110,4 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this
.
appRef
.
tick
();
this
.
appRef
.
tick
();
},
1
);
},
1
);
}
}
}
}
\ No newline at end of file
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