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
ec8bddf8
Commit
ec8bddf8
authored
Sep 26, 2023
by
limingzhe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: d登陆
parent
5b8390ac
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
10 deletions
+41
-10
.DS_Store
.DS_Store
+0
-0
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+1
-1
LoginPage.ts
assets/middleLayer_for_kyxq/script/LoginPage.ts
+36
-5
bg_tip.png.meta
assets/middleLayer_for_kyxq/textures/middle/bg_tip.png.meta
+4
-4
No files found.
.DS_Store
View file @
ec8bddf8
No preview for this file type
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ec8bddf8
...
...
@@ -35541,7 +35541,7 @@
"_spriteFrame": {
"__uuid__": "297c6c6f-c675-4606-bb8a-11e4fea0eba0"
},
"_type":
0
,
"_type":
1
,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
...
...
assets/middleLayer_for_kyxq/script/LoginPage.ts
View file @
ec8bddf8
...
...
@@ -5,6 +5,8 @@
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import
{
asyncCallNetworkApiPost
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
...
...
@@ -66,13 +68,42 @@ export default class NewClass extends cc.Component {
}
enterBtnClick
()
{
async
enterBtnClick
()
{
if
(
Math
.
random
()
<
0.5
)
{
this
.
showEnterSuccess
();
}
else
{
const
phone
=
this
.
phoneNum
;
if
(
!
this
.
checkPhone
(
phone
))
{
global
.
middleLayer
.
showTips
(
'
请输入正确的手机号码
'
);
return
;
}
const
res
=
await
asyncCallNetworkApiPost
(
'
/api/kyxq/v1/login
'
,
{
phone
:
phone
,
});
if
(
res
.
code
!=
'
200
'
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
this
.
showEnterFail
();
return
;
}
global
.
middleLayer
.
isLogin
=
true
;
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
token
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
phone
);
this
.
showEnterSuccess
();
// if (Math.random() < 0.5) {
// this.showEnterSuccess();
// } else {
// this.showEnterFail();
// }
}
checkPhone
(
phone
)
{
const
test
=
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
;
if
(
!
test
.
test
(
phone
))
{
return
false
;
}
return
true
;
}
showEnterSuccess
()
{
...
...
assets/middleLayer_for_kyxq/textures/middle/bg_tip.png.meta
View file @
ec8bddf8
...
...
@@ -26,10 +26,10 @@
"height": 172,
"rawWidth": 398,
"rawHeight": 172,
"borderTop":
0
,
"borderBottom":
0
,
"borderLeft": 0,
"borderRight": 0,
"borderTop":
74
,
"borderBottom":
79
,
"borderLeft":
19
0,
"borderRight":
19
0,
"subMetas": {}
}
}
...
...
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