Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dfzx_cocos_pinjuzi
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
dfzx_cocos_pinjuzi
Commits
a9a08389
Commit
a9a08389
authored
Mar 23, 2021
by
Li MingZhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 首次提交
parent
a70e61d2
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10654 additions
and
168 deletions
+10654
-168
package-lock.json
form/package-lock.json
+641
-146
package.json
form/package.json
+1
-1
audio-recorder.component.html
...c/app/common/audio-recorder/audio-recorder.component.html
+2
-1
audio-recorder.component.ts
...src/app/common/audio-recorder/audio-recorder.component.ts
+19
-1
form.component.html
form/src/app/form/form.component.html
+125
-4
form.component.ts
form/src/app/form/form.component.ts
+46
-15
yarn.lock
form/yarn.lock
+9820
-0
No files found.
form/package-lock.json
View file @
a9a08389
This diff is collapsed.
Click to expand it.
form/package.json
View file @
a9a08389
...
...
@@ -55,4 +55,4 @@
"tslint"
:
"~5.18.0"
,
"typescript"
:
"~3.7.5"
}
}
\ No newline at end of file
}
form/src/app/common/audio-recorder/audio-recorder.component.html
View file @
a9a08389
...
...
@@ -35,7 +35,8 @@
<ng-template
#
truthyTemplate
>
<div
class=
"btn-delete"
(
click
)="
onBtnDeleteAudio
()"
>
<fa-icon
icon=
"close"
></fa-icon>
<!-- <fa-icon icon="close"></fa-icon> -->
<i
nz-icon
nzType=
"close"
nzTheme=
"outline"
></i>
</div>
</ng-template>
...
...
form/src/app/common/audio-recorder/audio-recorder.component.ts
View file @
a9a08389
...
...
@@ -26,7 +26,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
uploadData
;
@
Input
()
needRemove
=
fals
e
;
needRemove
=
tru
e
;
@
Input
()
audioItem
:
any
=
null
;
...
...
@@ -62,8 +62,25 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
this
.
uploadUrl
=
url
;
this
.
uploadData
=
data
;
};
this
.
setUploadUrl
();
}
setUploadUrl
()
{
if
(
!
this
.
uploadUrl
)
{
this
.
uploadUrl
=
(
<
any
>
window
).
courseware
.
uploadUrl
();
this
.
uploadData
=
(
<
any
>
window
).
courseware
.
uploadData
();
setTimeout
(()
=>
{
this
.
setUploadUrl
();
},
500
);
}
}
init
()
{
this
.
playIcon
=
'
play
'
;
this
.
isPlaying
=
false
;
...
...
@@ -157,6 +174,7 @@ export class AudioRecorderComponent implements OnInit, OnChanges, OnDestroy {
onBtnDeleteAudio
()
{
this
.
audioUrl
=
null
;
this
.
audioUploaded
.
emit
({});
this
.
audioRemoved
.
emit
();
}
...
...
form/src/app/form/form.component.html
View file @
a9a08389
<div
class=
"model-content"
>
<div
style=
"padding: 10px;"
>
<div
style=
"width: 300px;"
align=
'center'
>
<div
style=
"padding: 10px; width: 800px;"
>
<div
*
ngFor=
"let it of item.groupArr; let i = index"
style=
"border: 1px solid #ccc; border-radius: 10px; margin-top: 50px; display: flex; align-items: center; flex-direction: column;"
>
<div
style=
"display: flex; align-items: center; justify-content: center; padding: 10px;"
>
<div
style=
"font-weight: 700; font-size: 22px; margin-right: 10px;"
>
题-{{i+1}}
</div>
<button
nz-button
nzType=
"danger"
(
click
)="
onBtnDeleteGroup
(
i
)"
>
<!-- <i nz-icon nzType="close" nzTheme="outline"></i> -->
删除题
</button>
</div>
<div
style=
"display: flex; align-items: center; justify-content: center; width: 700px;"
>
<h4
style=
"width: 80px; text-align: right;"
>
题干:
</h4>
<app-audio-recorder
style=
"margin: 10px"
[
audioUrl
]="
it
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
',
it
)"
></app-audio-recorder>
<!-- <input type="text" nz-input [(ngModel)]="it.ques" style="width: 80%" (blur)="save()"> -->
</div>
<div
style=
"display: flex; justify-content: center; width: 100%;"
>
<app-upload-image-with-preview
style=
"width: 50%"
[
picUrl
]="
it
.
pic_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
pic_url
',
it
)"
>
</app-upload-image-with-preview>
</div>
<div
style=
"display: flex; align-items: center; justify-content: center; margin-top: 20px; font-size: 15px; font-weight: 500;"
>
<span
style=
"margin-right: 5px"
>
句子:
</span>
<div
*
ngFor=
"let op of it.optionArr"
>
{{op.text}}
</div>
<!-- <input style="width: 220px; margin-left: 10px;" type="text" nz-input [(ngModel)]="it.word" (blur)="save()"> -->
</div>
<app-audio-recorder
style=
"margin-left: 5px;"
[
audioUrl
]="
it
.
word_audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
word_audio_url
',
it
)"
></app-audio-recorder>
<nz-divider></nz-divider>
<div
style=
"width: 100%; margin-top: 10px"
>
<button
nz-button
nzType=
"dashed"
(
click
)="
addOptionBtnClick
(
it
)"
style=
"margin-top: 10px; margin-left: 30px;"
>
<i
nz-icon
nzType=
"plus-circle"
nzTheme=
"outline"
></i>
添加句子单词
</button>
<div
style=
"display: flex; align-items: center; justify-content: center; flex-wrap: wrap; margin: 10px; margin-bottom: 20px;"
>
<div
*
ngFor=
"let op of it.optionArr; let j = index"
style=
"margin: 5px; border: 1px solid #ccc; border-radius: 5px; padding: 5px; display: flex; align-items: center; flex-direction: column;"
>
<div
style=
"display: flex; align-items: center;"
>
<input
style=
"width: 70px;"
type=
"text"
nz-input
[(
ngModel
)]="
op
.
text
"
(
blur
)="
save
()"
>
<label
nz-checkbox
[(
ngModel
)]="
op
.
isEmpty
"
(
ngModelChange
)="
save
()"
style=
"margin-left: 5px;"
>
挖空
</label>
<button
nz-button
nzType=
"danger"
(
click
)="
onBtnDeleteOption
(
j
,
it
.
optionArr
)"
>
X
</button>
</div>
<div
style=
"margin-top: 5px"
>
<app-audio-recorder
[
audioUrl
]="
op
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
',
op
)"
></app-audio-recorder>
</div>
</div>
</div>
<button
nz-button
nzType=
"dashed"
(
click
)="
addWrongBtnClick
(
it
)"
style=
"margin-top: 10px; margin-left: 30px;"
>
<i
nz-icon
nzType=
"plus-circle"
nzTheme=
"outline"
></i>
添加干扰单词
</button>
<div
style=
"display: flex; align-items: center; justify-content: center; flex-wrap: wrap; margin: 10px; margin-bottom: 20px;"
>
<div
*
ngFor=
"let op of it.wrongArr; let j = index"
style=
"margin: 5px; border: 1px solid #ccc; border-radius: 5px; padding: 2px;"
>
<div
style=
"display: flex; align-items: center;"
>
<input
style=
"width: 80px; margin-right: 5px;"
type=
"text"
nz-input
[(
ngModel
)]="
op
.
text
"
(
blur
)="
save
()"
>
<div
style=
"margin-right: 5px;"
>
<app-audio-recorder
[
audioUrl
]="
op
.
audio_url
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
audio_url
',
op
)"
></app-audio-recorder>
</div>
<button
nz-button
nzType=
"danger"
(
click
)="
onBtnDeleteOption
(
j
,
it
.
wrongArr
)"
>
X
</button>
</div>
</div>
</div>
</div>
</div>
<button
nz-button
nzType=
"dashed"
(
click
)="
addGroupBtnClick
()"
style=
"width: 150px; height: 55px; margin: 50px;"
>
<i
nz-icon
nzType=
"plus-circle"
nzTheme=
"outline"
></i>
添加题
</button>
<!-- <div style="width: 300px;" align='center'>
<span>图1: </span>
<app-upload-image-with-preview
[picUrl]="item.pic_url"
...
...
@@ -29,7 +150,7 @@
[audioUrl]="item.audio_url"
(audioUploaded)="onAudioUploadSuccess($event, 'audio_url')"
></app-audio-recorder>
</div>
</div>
-->
</div>
...
...
form/src/app/form/form.component.ts
View file @
a9a08389
...
...
@@ -10,7 +10,7 @@ import { JsonPipe } from '@angular/common';
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
saveKey
=
"
test_001
"
;
saveKey
=
"
dfzx_cocos_pinjuzi
"
;
// 储存对象
item
;
...
...
@@ -60,6 +60,36 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init
()
{
console
.
log
(
'
this.item:
'
,
this
.
item
);
if
(
!
this
.
item
.
groupArr
)
{
this
.
item
.
groupArr
=
[];
}
}
addGroupBtnClick
()
{
this
.
item
.
groupArr
.
push
({
ques
:
''
,
optionArr
:
[],
wrongArr
:
[],
})
this
.
save
();
}
onBtnDeleteGroup
(
i
)
{
this
.
item
.
groupArr
.
splice
(
i
,
1
);
this
.
save
();
}
addOptionBtnClick
(
group
)
{
group
.
optionArr
.
push
({})
this
.
save
();
}
addWrongBtnClick
(
group
)
{
group
.
wrongArr
.
push
({})
this
.
save
();
}
...
...
@@ -67,9 +97,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
onImageUploadSuccess
(
e
,
key
,
it
)
{
this
.
item
[
key
]
=
e
.
url
;
it
[
key
]
=
e
.
url
;
this
.
save
();
}
...
...
@@ -77,18 +107,8 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
onWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
wordList
[
idx
].
audio
=
e
.
url
;
this
.
save
();
}
onBackWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
wordList
[
idx
].
backWordAudio
=
e
.
url
;
onAudioUploadSuccess
(
e
,
key
,
it
)
{
it
[
key
]
=
e
.
url
;
this
.
save
();
}
...
...
@@ -102,6 +122,17 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
}
radioChange
(
e
,
option
,
key
)
{
option
[
key
]
=
e
;
this
.
save
();
}
onBtnDeleteOption
(
i
,
arr
)
{
arr
.
splice
(
i
,
1
);
this
.
save
();
}
/**
* 刷新 渲染页面
*/
...
...
form/yarn.lock
0 → 100644
View file @
a9a08389
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