Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
JJ_Game_Parent_Child
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
JJ_Game_Parent_Child
Commits
9fe8bdf3
Commit
9fe8bdf3
authored
Apr 09, 2025
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: debug
parent
ab98d901
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
194 deletions
+57
-194
form.component.ts
form/src/app/form/form.component.ts
+57
-194
No files found.
form/src/app/form/form.component.ts
View file @
9fe8bdf3
...
...
@@ -426,188 +426,38 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
getBookTextList
()
{
// let resData1 = {
// let resData1 =
// {
// "msg": "success",
// "data": [
// {
// "number": 4,
// "text": "Hank Hammer"
// },
// {
// "number": 5,
// "text": "MEET THE TOOL TEAM"
// "number": 3,
// "text": "Mara the Mermaid Meets a Sea Turtle"
// },
// {
// "number": 5,
// "text": "Tia Tape Measure"
// },
// {
// "number": 5,
// "text": "Hank Hammer"
// },
// {
// "number": 6,
// "text": "Sammy Saw"
// "text": "I see a sea turtle!"
// },
// {
// "number": 6,
// "text": "Sophie Screwdriver"
// },
// {
// "number": 7,
// "text": "Today is the big contest. Hank is very excited! He jumps out of bed."
// "text": "I see one green sea turtle, and one brown sea turtle."
// },
// {
// "number": 8,
// "text": "He brushes his teeth and gets ready."
// },
// {
// "number": 9,
// "text": "\"Have a fun day,\" his mom says."
// },
// {
// "number": 9,
// "text": "“Good luck at the contest.\""
// "text": "I see four long flippers."
// },
// {
// "number": 10,
// "text": "\"Thanks, Mom,\" Hank says as he rushes out the door."
// },
// {
// "number": 11,
// "text": "\"Hi, everyone! Are you ready for the big contest?\" asks Hank."
// "text": "I see one big shell."
// },
// {
// "number": 12,
// "text": "\"We're ready!\" they yell."
// },
// {
// "number": 13,
// "text": "\"I have the wood,\" says Sammy."
// },
// {
// "number": 13,
// "text": "\"I have the nails,\" says Tia."
// "text": "I see many little eggs."
// },
// {
// "number": 14,
// "text": "“I have the red paint and the blue paint,\"says Sophie."
// },
// {
// "number": 15,
// "text": "“And I have the plans,\" says Hank."
// },
// {
// "number": 16,
// "text": "“We are going to build the best birdhouse!\"says Sammy."
// },
// {
// "number": 17,
// "text": "\"It's time to start,\"says Sophie."
// },
// {
// "number": 17,
// "text": "\"What do we do?\" asks Tia."
// },
// {
// "number": 18,
// "text": "“Just follow my plan,\" says Hank."
// },
// {
// "number": 18,
// "text": "“I have everything mapped out right here.\""
// },
// {
// "number": 19,
// "text": "“First, we measure everything,\""
// },
// {
// "number": 19,
// "text": "says Hank."
// },
// {
// "number": 20,
// "text": "\"That's my job,\" says Tia."
// },
// {
// "number": 20,
// "text": "“Great!\"says Hank."
// },
// {
// "number": 21,
// "text": "\"Next, we cut the wood,\""
// },
// {
// "number": 21,
// "text": "says Hank."
// },
// {
// "number": 22,
// "text": "\"That's my job,\" says Sammy."
// },
// {
// "number": 22,
// "text": "\"Great!\" says Hank."
// },
// {
// "number": 23,
// "text": "\"Then, we put the house together,\""
// },
// {
// "number": 23,
// "text": "says Hank."
// },
// {
// "number": 24,
// "text": "“I'll hold the nails. You can pound them in,\"says Sophie."
// },
// {
// "number": 24,
// "text": "\"Great!\"says Hank."
// },
// {
// "number": 25,
// "text": "\"Now we paint it,\" says Hank."
// },
// {
// "number": 26,
// "text": "\"We can all do that,\" says Sophie."
// },
// {
// "number": 26,
// "text": "\"Great!\" says Hank."
// },
// {
// "number": 27,
// "text": "The birdhouse is done. The tool team sets it on the table next to the other ones."
// },
// {
// "number": 28,
// "text": "\"It's prefect,\"says Hank."
// },
// {
// "number": 29,
// "text": "“I think we built the best one,\""
// },
// {
// "number": 29,
// "text": "says Sammy."
// },
// {
// "number": 30,
// "text": "\"And we did it together,\" says Tia."
// },
// {
// "number": 31,
// "text": "\"I have one more thing to add,\""
// },
// {
// "number": 31,
// "text": "says Hank."
// },
// {
// "number": 32,
// "text": "\"Now it's perfect,\" says Sammy."
// "text": "I see a sea turtle eating seaweed!"
// }
// ]
// }
...
...
@@ -617,6 +467,9 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// this.bookTextList = this.filterDuplicateText( this.bookTextList);
// console.log('this.bookTextList: ', this.bookTextList);
// return;
console
.
log
(
'
in getBookTextList
'
);
...
...
@@ -654,18 +507,28 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
}
// 计算需要返回的数组长度(原数组长度减4,并确保是双数)
let
target
Length
=
arr
.
length
-
4
;
if
(
target
Length
%
2
!==
0
)
{
target
Length
--
;
// 确保是双数
}
let
startMax
Length
=
arr
.
length
-
4
;
// if (startMax
Length % 2 !== 0) {
// startMax
Length--; // 确保是双数
//
}
// // 计算可以开始截取的最大起始位置
// const maxStartIndex = arr.length - targetLength;
// 随机选择一个起始位置
const
startIndex
=
Math
.
floor
(
Math
.
random
()
*
targetLength
);
const
startIndex
=
Math
.
floor
(
Math
.
random
()
*
startMaxLength
);
const
minEndIndex
=
startIndex
+
4
;
const
maxEndIndex
=
arr
.
length
;
const
endIndex
=
Math
.
floor
(
Math
.
random
()
*
(
maxEndIndex
-
minEndIndex
))
+
minEndIndex
;
// 截取数组
return
arr
.
slice
(
startIndex
,
startIndex
+
targetLength
);
// return arr.slice(startIndex, startIndex + startMaxLength);
const
randomArr
=
arr
.
slice
(
startIndex
,
endIndex
+
1
);
console
.
log
(
'
randomArr:
'
,
randomArr
);
if
(
randomArr
.
length
%
2
!==
0
)
{
randomArr
.
length
--
;
// 确保是双数
}
return
randomArr
;
}
}
\ 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