Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JM_4-1
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
JM_4-1
Commits
67869a71
Commit
67869a71
authored
Aug 25, 2021
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 添加遮罩
parent
302f5456
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
4 deletions
+55
-4
form.component.html
src/app/form/form.component.html
+14
-0
play.component.ts
src/app/play/play.component.ts
+41
-4
No files found.
src/app/form/form.component.html
View file @
67869a71
...
...
@@ -3,12 +3,26 @@
<div
style=
"padding: 20px;"
>
<h2
style=
"margin-top: 20px;"
>
封面图
</h2>
<div
style=
"width: 300px; margin-bottom: 50px;"
>
<app-upload-image-with-preview
[
picUrl
]="
item
.
bg_url
"
(
imageUploaded
)="
onImageUploadSuccess
($
event
,
'
bg_url
')"
>
</app-upload-image-with-preview>
</div>
<div
style=
"width: 400px; display: flex; justify-content: center;"
>
<h2
style=
"width: 60px;"
>
标题:
</h2>
<input
type=
"text"
nz-input
[(
ngModel
)]="
item
.
title
"
(
blur
)="
save
()"
style=
"margin-left: 15px"
>
</div>
<div
*
ngFor=
"let s of item.sentenceArr; let i = index"
style=
" margin-bottom: 10px; display: flex;"
>
<input
type=
"text"
nz-input
[(
ngModel
)]="
s
.
text
"
(
blur
)="
save
()"
style=
"width: 500px;"
>
<input
type=
"text"
nz-input
[(
ngModel
)]="
s
.
answer
"
(
blur
)="
save
()"
style=
"margin-left: 15px; width: 120px;"
>
...
...
src/app/play/play.component.ts
View file @
67869a71
...
...
@@ -434,8 +434,8 @@ export class PlayComponent implements OnInit, OnDestroy {
};
addPicUrl
(
contentObj
.
bg_url
);
// addPicUrl(contentObj.bgItem.url);
}
...
...
@@ -515,8 +515,11 @@ export class PlayComponent implements OnInit, OnDestroy {
if
(
this
.
isTeacher
)
{
this
.
sentBtn
.
visible
=
false
;
this
.
sentBtn
.
shadowSpr
.
visible
=
false
;
this
.
maskPic
.
visible
=
true
;
}
else
{
this
.
changeBtnOn
();
this
.
maskPic
.
visible
=
false
;
}
}
...
...
@@ -550,6 +553,7 @@ export class PlayComponent implements OnInit, OnDestroy {
initView
()
{
this
.
initBg
();
...
...
@@ -562,8 +566,14 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
initIframe
();
this
.
initWindowListener
();
this
.
initMaskPic
();
this
.
relink
();
}
relink
()
{
...
...
@@ -597,11 +607,38 @@ export class PlayComponent implements OnInit, OnDestroy {
this
.
checkShowSubTemplateOne
();
return
;
}
}
maskPic
;
initMaskPic
()
{
const
bgUrl
=
this
.
data
.
contentObj
.
bg_url
;
console
.
log
(
'
bgUrl
'
,
bgUrl
);
const
maskPic
=
this
.
getMySprite
(
bgUrl
);
const
sx
=
this
.
canvasWidth
/
maskPic
.
width
;
const
sy
=
this
.
canvasHeight
/
maskPic
.
height
;
const
s
=
Math
.
max
(
sx
,
sy
);
maskPic
.
setScaleXY
(
s
);
maskPic
.
x
=
this
.
canvasWidth
/
2
;
maskPic
.
y
=
this
.
canvasHeight
/
2
;
if
(
this
.
isTeacher
)
{
maskPic
.
visible
=
false
;
}
this
.
maskPic
=
maskPic
;
}
getMySprite
(
resName
,
isSetScale
=
true
)
{
const
spr
=
new
MySprite
();
spr
.
init
(
this
.
images
.
get
(
resName
))
if
(
isSetScale
)
{
spr
.
setScaleXY
(
this
.
mapScale
);
}
return
spr
;
}
...
...
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