Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
ww_reading
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
ww_reading
Commits
5acc4793
Commit
5acc4793
authored
Aug 14, 2020
by
liujiaxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
www
parent
e6c4dce0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
13 deletions
+24
-13
form.component.html
src/app/form/form.component.html
+7
-6
form.component.ts
src/app/form/form.component.ts
+17
-7
No files found.
src/app/form/form.component.html
View file @
5acc4793
...
@@ -36,11 +36,11 @@
...
@@ -36,11 +36,11 @@
*
ngFor=
"let part of cropperParts;let i = index"
*
ngFor=
"let part of cropperParts;let i = index"
class=
"part-item"
>
class=
"part-item"
>
<div
class=
"part-item-wrap"
style=
"margin-right: 2.5rem;"
>
<div
class=
"part-item-wrap"
style=
"margin-right: 2.5rem;"
>
<
i
class=
"anticon anticon-edit
"
<
div
*
ngIf=
"currentEditPartIndex !== i
"
nz-tooltip
nzTitle=
"edit mode"
nz-tooltip
nzTitle=
"edit mode"
(
click
)="
editPart
($
event
,
i
)"
>
*
ngIf=
"currentEditPartIndex !== i"
<i
class=
"anticon anticon-edit"
></i>
(
click
)="
editPart
(
i
)"
></i
>
</div
>
<i
class=
"anticon anticon-close-square dynamic-delete-button"
<i
class=
"anticon anticon-close-square dynamic-delete-button"
nz-popconfirm
nz-popconfirm
...
@@ -57,7 +57,8 @@
...
@@ -57,7 +57,8 @@
<div
class=
"part-view"
<div
class=
"part-view"
(
click
)="
previewUserSelectPart
(
i
)"
(
click
)="
previewUserSelectPart
(
i
)"
[
ngStyle
]="
part
.
previewCss
"
>
[
ngStyle
]="
part
.
previewCss
"
>
<img
*
ngIf=
"currentEditPartIndex !== i"
<!-- *ngIf="currentEditPartIndex !== i"-->
<img
[
ngStyle
]="
part
.
imgCss
"
[
ngStyle
]="
part
.
imgCss
"
(
load
)="
initPart
($
event
,
i
)"
(
load
)="
initPart
($
event
,
i
)"
[
src
]="
picId
"
>
[
src
]="
picId
"
>
...
...
src/app/form/form.component.ts
View file @
5acc4793
...
@@ -266,6 +266,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -266,6 +266,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
// }
// }
// return;
// return;
// }
// }
if
(
this
.
cropperParts
.
length
===
this
.
colors
.
length
)
{
if
(
this
.
cropperParts
.
length
===
this
.
colors
.
length
)
{
this
.
nzMessageService
.
info
(
'
you can only add seven parts.
'
);
this
.
nzMessageService
.
info
(
'
you can only add seven parts.
'
);
return
;
return
;
...
@@ -289,6 +290,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -289,6 +290,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
});
});
this
.
currentEditPartIndex
=
this
.
cropperParts
.
length
-
1
;
this
.
currentEditPartIndex
=
this
.
cropperParts
.
length
-
1
;
// this.angularCropper.cropper.reset();
// this.angularCropper.cropper.reset();
console
.
log
(
123123
);
this
.
focusUserInput
();
this
.
focusUserInput
();
this
.
save
();
this
.
save
();
}
}
...
@@ -300,7 +302,10 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -300,7 +302,10 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
}
}
},
10
);
},
10
);
}
}
editPart
(
idx
)
{
editPart
(
evt
,
idx
)
{
const
img
=
evt
.
currentTarget
.
parentNode
.
parentNode
.
querySelector
(
'
img
'
)
console
.
log
(
'
editPart
'
);
this
.
currentEditPartIndex
=
idx
;
this
.
currentEditPartIndex
=
idx
;
const
obj
=
this
.
cropperParts
[
idx
];
const
obj
=
this
.
cropperParts
[
idx
];
this
.
angularCropper
.
cropper
.
setData
(
obj
.
data
);
this
.
angularCropper
.
cropper
.
setData
(
obj
.
data
);
...
@@ -309,6 +314,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -309,6 +314,7 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
this
.
_tmpEditWord
=
obj
.
word
;
this
.
_tmpEditWord
=
obj
.
word
;
this
.
_tmpEditData
=
Object
.
assign
({},
obj
.
data
);
this
.
_tmpEditData
=
Object
.
assign
({},
obj
.
data
);
this
.
focusUserInput
();
this
.
focusUserInput
();
this
.
initPart
(
img
,
idx
);
}
}
confirmRemovePart
(
idx
,
evt
)
{
confirmRemovePart
(
idx
,
evt
)
{
this
.
removePart
(
idx
,
evt
);
this
.
removePart
(
idx
,
evt
);
...
@@ -322,6 +328,8 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -322,6 +328,8 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
}
}
}
}
exitEditPart
(
evt
,
idx
)
{
exitEditPart
(
evt
,
idx
)
{
console
.
log
(
'
exitEditPart
'
)
// if( !this.cropperParts[idx].word) {
// if( !this.cropperParts[idx].word) {
// const el = this.partConfigBoxes.toArray()[idx].nativeElement.querySelector('.part-word');
// const el = this.partConfigBoxes.toArray()[idx].nativeElement.querySelector('.part-word');
// if (!el.classList.contains('err')) {
// if (!el.classList.contains('err')) {
...
@@ -344,8 +352,9 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -344,8 +352,9 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
const
cropper
:
any
=
this
.
angularCropper
.
cropper
;
const
cropper
:
any
=
this
.
angularCropper
.
cropper
;
cropper
.
previews
=
[];
cropper
.
previews
=
[];
}
}
savePart
(
evt
,
idx
)
{
savePart
(
evt
,
idx
)
{
// const el = this.partConfigBoxes.toArray()[idx].nativeElement.querySelector('.part-word');
// const el = this.partConfigBoxes.toArray()[idx].nativeElement.querySelector('.part-word');
// if (!el.value) {
// if (!el.value) {
...
@@ -357,16 +366,17 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -357,16 +366,17 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
// if (el && el.classList.contains('err')) {
// if (el && el.classList.contains('err')) {
// return;
// return;
// }
// }
console
.
log
(
evt
);
const
img
=
evt
.
currentTarget
.
parentNode
.
parentNode
.
parentNode
.
querySelector
(
'
img
'
)
this
.
currentEditPartIndex
=
this
.
cropperParts
.
length
-
1
;
this
.
currentEditPartIndex
=
this
.
cropperParts
.
length
-
1
;
this
.
currentEditPartIndex
=
-
1
;
this
.
currentEditPartIndex
=
-
1
;
// const origin = this.cropperParts[idx];
// const origin = this.cropperParts[idx];
const
data
=
this
.
angularCropper
.
cropper
.
getData
();
const
data
=
this
.
angularCropper
.
cropper
.
getData
();
this
.
cropperParts
[
idx
].
data
=
data
;
this
.
cropperParts
[
idx
].
data
=
{...
data
}
;
const
cropper
:
any
=
this
.
angularCropper
.
cropper
;
const
cropper
:
any
=
this
.
angularCropper
.
cropper
;
cropper
.
previews
=
[];
cropper
.
previews
=
[];
this
.
initPart
(
img
,
idx
);
this
.
save
();
this
.
save
();
}
}
previewUserSelectPart
(
idx
)
{
previewUserSelectPart
(
idx
)
{
...
@@ -374,9 +384,9 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
...
@@ -374,9 +384,9 @@ export class FormComponent implements OnInit, OnChanges, AfterViewInit, OnDestro
this
.
angularCropper
.
cropper
.
setData
(
part
.
data
);
this
.
angularCropper
.
cropper
.
setData
(
part
.
data
);
}
}
initPart
(
evt
,
idx
)
{
initPart
(
evt
,
idx
)
{
//
console.log('initPart', evt);
console
.
log
(
'
initPart
'
,
evt
);
const
part
=
this
.
cropperParts
[
idx
];
const
part
=
this
.
cropperParts
[
idx
];
const
img
=
evt
.
target
;
const
img
=
evt
.
target
||
evt
;
const
preview
=
img
.
parentNode
;
const
preview
=
img
.
parentNode
;
if
(
!
preview
)
{
if
(
!
preview
)
{
return
;
return
;
...
...
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