Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
boardgame_yyh
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
boardgame_yyh
Commits
ba4a6665
Commit
ba4a6665
authored
Jul 29, 2022
by
杨一航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
表单调整
parent
fd9d8cc4
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
107 deletions
+115
-107
form.component.css
form_angular/src/app/form/form.component.css
+4
-31
form.component.html
form_angular/src/app/form/form.component.html
+26
-53
form.component.ts
form_angular/src/app/form/form.component.ts
+85
-23
No files found.
form_angular/src/app/form/form.component.css
View file @
ba4a6665
...
@@ -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
;
}
}
...
@@ -33,30 +33,3 @@
...
@@ -33,30 +33,3 @@
padding
:
10px
;
padding
:
10px
;
margin
:
10px
;
margin
:
10px
;
}
}
\ No newline at end of file
.button-right
{
border-style
:
dotted
;
border-color
:
rgb
(
42
,
142
,
72
);
width
:
100px
;
height
:
50px
;
color
:
rgb
(
42
,
142
,
72
);
background-color
:
white
;
}
.button-wrong
{
border-style
:
dotted
;
border-color
:
rgb
(
180
,
0
,
0
);
width
:
100px
;
height
:
50px
;
color
:
rgb
(
180
,
0
,
0
);
background-color
:
white
;
}
.button-disable
{
border-style
:
dotted
;
border-color
:
black
;
width
:
100px
;
height
:
50px
;
color
:
black
;
background-color
:
white
;
}
\ No newline at end of file
form_angular/src/app/form/form.component.html
View file @
ba4a6665
<div
class=
"model-content"
>
<div
class=
"model-content"
>
<div
style=
"padding: 10px;"
>
<div
class=
"border"
style=
"padding: 50px;"
>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
style=
"margin-bottom: 20px;"
>
<textarea
style=
"width: 955px; height: 300px;"
(
blur
)="
load
()"
#
itemTextarea
>
{{itemStr}}
</textarea>
<span
style=
"font-size: 20px;"
>
开始音频:
</span>
<button
(
click
)="
copyData
();"
>
Copy
</button>
<app-audio-recorder
[
audioUrl
]="
item
.
gameStartAudio
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
gameStartAudio
')"
>
</app-audio-recorder>
</div>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
style=
"margin-bottom: 20px;"
>
<span
style=
"font-size: 20px;"
>
标题:
</span>
<span
style=
"font-size: 20px;"
>
加载音频:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
>
<app-audio-recorder
[
audioUrl
]="
item
.
gameLoadingAudio
"
<span
style=
"font-size: 20px;"
>
题目说明:
</span>
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
gameLoadingAudio
')"
>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
questionText
"
(
blur
)="
save
()"
>
</app-audio-recorder>
<span
style=
"font-size: 20px;"
>
题目说明音频:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
questionTextAudio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questionTextAudio
')"
[
_audioName
]="
item
.
audioFileName
"
(
audioName
)="
saveAudioFileName
($
event
)"
></app-audio-recorder>
</div>
</div>
<div
class=
"border"
style=
"width: 1000px;"
>
<div
style=
"margin-bottom: 20px;"
>
<div
*
ngFor=
"let question of item.questions; let i = index"
>
<span
style=
"font-size: 20px;"
>
猫咪
<b>
转盘
</b>
待机音频:
</span>
<div
class=
"border"
style=
"width: 950px;"
>
<app-audio-recorder
[
audioUrl
]="
item
.
waitingWheel
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
waitingWheel
')"
>
<span
style=
"font-size: 20px;"
>
选项类型:
</span>
</app-audio-recorder>
<div
*
ngIf=
"question.type=='img'"
>
<button
class=
"button-right"
>
图片
</button>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'txt'
;
save
();"
>
文字
</button>
</div>
<div
*
ngIf=
"question.type=='txt'"
>
<button
class=
"button-disable"
(
click
)="
question
.
type=
'img'
;
save
();"
>
图片
</button>
<button
class=
"button-right"
>
文字
</button>
</div>
</div>
<div
*
ngIf=
"question.type=='img'"
>
<div
style=
"margin-bottom: 20px;"
>
图片:
<span
style=
"font-size: 20px;"
>
猫咪
<b>
走棋
</b>
待机音频:
</span>
<div
style=
"width: 300px;"
>
<app-audio-recorder
[
audioUrl
]="
item
.
waitingPiece
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
waitingPiece
')"
>
<app-upload-image-with-preview
[
picUrl
]="
question
.
image
"
(
imageUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
image
')"
>
</app-upload-image-with-preview>
</div>
</div>
<span>
音频:
</span>
<app-audio-recorder
[
audioUrl
]="
question
.
audio
"
(
audioUploaded
)="
onAssetUploadSuccess
($
event
,
'
questions
',
i
,
'
audio
')"
>
</app-audio-recorder>
</app-audio-recorder>
<div
*
ngIf=
"question.type=='txt'"
>
<span>
文本:
</span>
<input
type=
"text"
nz-input
[(
ngModel
)]="
question
.
text
"
(
blur
)="
save
()"
>
</div>
<br>
<button
style=
"width: 900px; height: 30px; color: red;"
(
click
)="
removeQuestion
(
i
)"
>
删除题目
</button>
</div>
</div>
<div
class=
"border"
style=
"width: 950px;"
>
<button
style=
"width: 900px; height: 100px;"
(
click
)="
addQuestion
()"
>
增加题目
</button>
</div>
</div>
<div
style=
"margin-bottom: 20px;"
>
<span
style=
"font-size: 20px;"
>
猫咪
<b>
对方轮次
</b>
待机音频:
</span>
<app-audio-recorder
[
audioUrl
]="
item
.
waitingTurn
"
(
audioUploaded
)="
onAudioUploadSuccess
($
event
,
'
waitingTurn
')"
>
</app-audio-recorder>
</div>
</div>
</div>
</div>
</div>
</div>
\ No newline at end of file
form_angular/src/app/form/form.component.ts
View file @
ba4a6665
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
Component
,
EventEmitter
,
Input
,
OnDestroy
,
OnChanges
,
OnInit
,
Output
,
ApplicationRef
,
ChangeDetectorRef
}
from
'
@angular/core
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
JsonPipe
}
from
'
@angular/common
'
;
import
{
ComponentBase
}
from
'
./ComponentBase
'
;
@
Component
({
@
Component
({
...
@@ -8,36 +7,99 @@ import { ComponentBase } from './ComponentBase';
...
@@ -8,36 +7,99 @@ import { ComponentBase } from './ComponentBase';
templateUrl
:
'
./form.component.html
'
,
templateUrl
:
'
./form.component.html
'
,
styleUrls
:
[
'
./form.component.css
'
]
styleUrls
:
[
'
./form.component.css
'
]
})
})
export
class
FormComponent
extends
ComponentBase
implements
OnInit
,
OnChanges
,
OnDestroy
{
export
class
FormComponent
implements
OnInit
,
OnChanges
,
OnDestroy
{
// 储存数据用
// 储存数据用
saveKey
=
"
card_machine
"
;
saveKey
=
"
test_001
"
;
// 储存对象
// 储存对象
item
:
any
=
{
item
;
title
:
''
,
questionText
:
''
,
constructor
(
private
appRef
:
ApplicationRef
,
private
changeDetectorRef
:
ChangeDetectorRef
)
{
questionTextAudio
:
''
,
audioFileName
:
''
,
}
questions
:
[],
ngOnInit
()
{
this
.
item
=
{
gameStartAudio
:
''
,
gameLoadingAudio
:
''
,
waitingWheel
:
''
,
waitingPiece
:
''
,
waitingTurn
:
''
,
};
};
addQuestion
()
{
// 获取存储的数据
this
.
item
.
questions
.
push
({
(
<
any
>
window
).
courseware
.
getData
((
data
)
=>
{
type
:
'
img
'
,
audio
:
''
,
if
(
data
)
{
text
:
''
,
this
.
item
=
data
;
image
:
''
}
});
this
.
init
();
this
.
changeDetectorRef
.
markForCheck
();
this
.
changeDetectorRef
.
detectChanges
();
this
.
refresh
();
},
this
.
saveKey
);
}
ngOnChanges
()
{
}
ngOnDestroy
()
{
}
init
()
{
}
/**
* 储存图片数据
* @param e
*/
onImageUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
}
/**
* 储存音频数据
* @param e
*/
onAudioUploadSuccess
(
e
,
key
)
{
this
.
item
[
key
]
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
removeQuestion
(
idx
)
{
onWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
questions
.
splice
(
idx
,
1
)
;
this
.
item
.
wordList
[
idx
].
audio
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
saveAudioFileName
(
name
)
{
onBackWordAudioUploadSuccess
(
e
,
idx
)
{
this
.
item
.
audioFileName
=
name
;
this
.
item
.
wordList
[
idx
].
backWordAudio
=
e
.
url
;
this
.
save
();
this
.
save
();
}
}
/**
* 储存数据
*/
save
()
{
(
<
any
>
window
).
courseware
.
setData
(
this
.
item
,
null
,
this
.
saveKey
);
this
.
refresh
();
console
.
log
(
'
this.item =
'
+
JSON
.
stringify
(
this
.
item
));
}
/**
* 刷新 渲染页面
*/
refresh
()
{
setTimeout
(()
=>
{
this
.
appRef
.
tick
();
},
1
);
}
}
}
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