Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
middleLayer_for_kyxq
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
middleLayer_for_kyxq
Commits
77236077
Commit
77236077
authored
Nov 09, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复匿名登录仍然显示用户名的Bug
parent
cae7f496
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
6 deletions
+3
-6
HomePage.ts
assets/middleLayer_for_kyxq/script/HomePage.ts
+3
-6
No files found.
assets/middleLayer_for_kyxq/script/HomePage.ts
View file @
77236077
...
@@ -174,17 +174,17 @@ export default class NewClass extends cc.Component {
...
@@ -174,17 +174,17 @@ export default class NewClass extends cc.Component {
userInfo
;
userInfo
;
async
getUserInfo
()
{
async
getUserInfo
()
{
const
userInfo
=
await
this
.
Viewer
.
getComponent
(
"
PageViewer
"
).
getUserInfo
();
const
userInfo
=
await
this
.
Viewer
.
getComponent
(
"
PageViewer
"
).
getUserInfo
();
console
.
log
(
userInfo
)
this
.
userInfo
=
userInfo
.
detail
;
this
.
userInfo
=
userInfo
.
detail
;
// 如果是匿名登录 隐藏右上角头像按钮
// 如果是匿名登录 隐藏右上角头像按钮
cc
.
find
(
"
/UserInfo
"
,
this
.
node
).
active
=
this
.
userInfo
.
isAnonymous
?
false
:
tru
e
;
cc
.
find
(
"
/UserInfo
"
,
this
.
node
).
active
=
this
.
userInfo
.
isAnonymous
?
true
:
fals
e
;
cc
.
find
(
"
/UserLogin
"
,
this
.
node
).
active
=
this
.
userInfo
.
isAnonymous
?
true
:
fals
e
;
cc
.
find
(
"
/UserLogin
"
,
this
.
node
).
active
=
this
.
userInfo
.
isAnonymous
?
false
:
tru
e
;
this
.
initTopUserPanel
();
this
.
initTopUserPanel
();
}
}
nameLabel
;
nameLabel
;
goldLabel
;
goldLabel
;
initTopUserPanel
()
{
initTopUserPanel
()
{
if
(
!
this
.
userInfo
)
{
if
(
!
this
.
userInfo
)
{
return
;
return
;
}
}
...
@@ -192,21 +192,18 @@ export default class NewClass extends cc.Component {
...
@@ -192,21 +192,18 @@ export default class NewClass extends cc.Component {
if
(
!
this
.
nameLabel
)
{
if
(
!
this
.
nameLabel
)
{
const
nameLabelNode
=
cc
.
find
(
"
userName
"
,
this
.
topUserPanel
);
const
nameLabelNode
=
cc
.
find
(
"
userName
"
,
this
.
topUserPanel
);
const
goldLabelNode
=
cc
.
find
(
"
userPoints/gold
"
,
this
.
topUserPanel
);
const
goldLabelNode
=
cc
.
find
(
"
userPoints/gold
"
,
this
.
topUserPanel
);
this
.
nameLabel
=
nameLabelNode
.
getComponent
(
cc
.
Label
);
this
.
nameLabel
=
nameLabelNode
.
getComponent
(
cc
.
Label
);
this
.
goldLabel
=
goldLabelNode
.
getComponent
(
cc
.
Label
);
this
.
goldLabel
=
goldLabelNode
.
getComponent
(
cc
.
Label
);
}
}
this
.
nameLabel
.
string
=
this
.
userInfo
.
nick_name
;
this
.
nameLabel
.
string
=
this
.
userInfo
.
nick_name
;
this
.
goldLabel
.
string
=
this
.
userInfo
.
golds
;
this
.
goldLabel
.
string
=
this
.
userInfo
.
golds
;
}
}
formatDate
(
date
)
{
formatDate
(
date
)
{
const
year
=
date
.
getFullYear
();
const
year
=
date
.
getFullYear
();
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'
0
'
);
// 月份从0开始,需要加1并且补零
const
month
=
String
(
date
.
getMonth
()
+
1
).
padStart
(
2
,
'
0
'
);
// 月份从0开始,需要加1并且补零
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'
0
'
);
// 补零
const
day
=
String
(
date
.
getDate
()).
padStart
(
2
,
'
0
'
);
// 补零
return
`
${
year
}
/
${
month
}
/
${
day
}
/加入`
;
return
`
${
year
}
/
${
month
}
/
${
day
}
/加入`
;
}
}
...
...
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