Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
TianGongKaiWu-20251203
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
SparkProjects
TianGongKaiWu-20251203
Commits
a5fb3b41
Commit
a5fb3b41
authored
Dec 18, 2025
by
天马流星拳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(myQradesPage): 修改查找receiveStatus元素的索引逻辑
将查找第一个包含receiveStatus属性的元素改为查找最后一个,以解决默认选中项不正确的问题
parent
b893f5cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
myqradespage.jsx
src/pages/myQradesPage/myqradespage.jsx
+3
-3
No files found.
src/pages/myQradesPage/myqradespage.jsx
View file @
a5fb3b41
...
...
@@ -76,10 +76,10 @@ class Myqradespage extends React.Component {
return
existing
?
{
...
month
,
...
existing
}
:
month
;
});
// 找到
第
一个包含receiveStatus属性的元素索引
const
firstReceiveStatusIndex
=
mergedMonthInfo
.
findIndex
(
item
=>
item
.
hasOwnProperty
(
'receiveStatus'
));
// 找到
最后
一个包含receiveStatus属性的元素索引
const
reversedIndex
=
mergedMonthInfo
.
slice
().
reverse
()
.
findIndex
(
item
=>
item
.
hasOwnProperty
(
'receiveStatus'
));
// 如果找到符合条件的元素,则使用其索引,否则使用默认索引0
const
targetIndex
=
firstReceiveStatusIndex
!==
-
1
?
firstReceiveStatusIndex
:
0
;
const
targetIndex
=
reversedIndex
!==
-
1
?
(
mergedMonthInfo
.
length
-
1
-
reversedIndex
)
:
0
;
// 更新状态并在回调中执行后续操作
this
.
setState
({
...
...
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