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
ac2287ff
Commit
ac2287ff
authored
Sep 26, 2023
by
liujiangnan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 删除无用节点
parent
ec8bddf8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
262 additions
and
13951 deletions
+262
-13951
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+262
-13128
frontpage.ts
assets/middleLayer_for_kyxq/script/frontpage.ts
+0
-436
frontpage.ts.meta
assets/middleLayer_for_kyxq/script/frontpage.ts.meta
+0
-9
userPage——.ts
assets/middleLayer_for_kyxq/script/userPage——.ts
+0
-368
userPage——.ts.meta
assets/middleLayer_for_kyxq/script/userPage——.ts.meta
+0
-10
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
ac2287ff
This source diff could not be displayed because it is too large. You can
view the blob
instead.
assets/middleLayer_for_kyxq/script/frontpage.ts
deleted
100644 → 0
View file @
ec8bddf8
import
{
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
playLocalAudio
,
playAudioByUrl
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
Label
)
nickName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
bookItem
:
cc
.
Node
=
null
;
@
property
(
cc
.
ScrollView
)
bookList
:
cc
.
ScrollView
=
null
;
@
property
(
cc
.
Node
)
content
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
levelPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
ScrollView
)
levelList
:
cc
.
ScrollView
=
null
;
@
property
(
cc
.
Node
)
levelContent
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
levelItem
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
userPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
deepPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
ScrollView
)
deepList
:
cc
.
ScrollView
=
null
;
@
property
(
cc
.
Node
)
deepContent
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
deepItem
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
// onLoad () {}
_canTouch
=
false
;
async
start
()
{
this
.
loading
.
active
=
true
;
let
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/info`
,
{});
if
(
res
.
code
==
'
200
'
)
{
this
.
nickName
.
string
=
res
.
data
.
name
||
"
阅读达人
"
;
}
else
{
this
.
nickName
.
string
=
'
点击登录
'
;
}
await
this
.
drawBookList
();
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
async
clickHeader
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
this
.
userPage
.
active
=
true
;
const
userPageScript
=
this
.
userPage
.
getComponent
(
'
userPage
'
);
await
userPageScript
.
showUserInfo
();
this
.
_canTouch
=
true
;
}
async
clickInputActiveCode
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
let
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/info`
,
{});
if
(
res
.
code
==
'
200
'
)
{
this
.
userPage
.
active
=
true
;
const
userPageScript
=
this
.
userPage
.
getComponent
(
'
userPage
'
);
await
userPageScript
.
showActiveDialog
();
}
else
{
global
.
middleLayer
.
showTips
(
`请先登录`
);
}
this
.
_canTouch
=
true
;
}
async
drawBookList
()
{
let
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/videbooks`
,
{});
if
(
res
.
code
!=
200
)
{
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/videbooks`
,
{});
if
(
res
.
code
!=
200
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
return
;
}
}
const
rows
=
res
.
rows
;
this
.
content
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
dt
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
bookItem
);
itemClone
.
parent
=
this
.
content
;
itemClone
.
active
=
true
;
if
(
dt
.
has_courseware
==
1
&&
dt
.
locked
==
true
)
{
cc
.
find
(
`mask/lock`
,
itemClone
).
active
=
true
;
}
itemClone
.
attr
({
book_id
:
dt
.
id
,
book_type
:
'
book
'
,
has_courseware
:
dt
.
has_courseware
,
is_lock
:
dt
.
locked
});
getSpriteFrimeByUrl
(
dt
.
cover
,
(
spriteFrame
)
=>
{
const
coverNode
=
cc
.
find
(
`mask/cover`
,
itemClone
);
coverNode
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
spriteFrame
;
const
sx
=
315
/
coverNode
.
width
;
const
sy
=
375
/
coverNode
.
height
;
coverNode
.
scale
=
Math
.
max
(
sx
,
sy
);
});
}
}
levelDeeps
=
[];
async
goLevelPage
(
evt
:
cc
.
Event
)
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
const
nd
=
evt
.
currentTarget
;
if
(
nd
.
has_courseware
==
0
)
{
this
.
levelPage
.
attr
({
book_id
:
nd
.
book_id
});
this
.
levelPage
.
active
=
true
;
this
.
loading
.
active
=
true
;
await
this
.
drawLevelList
(
nd
.
book_id
);
this
.
loading
.
active
=
false
;
}
else
{
if
(
nd
.
is_lock
)
{
global
.
middleLayer
.
showTips
(
`未解锁,请先购买激活码`
);
this
.
_canTouch
=
true
;
return
;
}
this
.
loading
.
active
=
true
;
const
courseId
=
nd
.
book_id
;
let
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v2/
${
courseId
}
/list`
,
{});
rows
=
rows
.
filter
(
item
=>
item
.
template_name
==
'
jj_library
'
);
if
(
rows
.
length
==
0
)
{
global
.
middleLayer
.
showTips
(
`未配置资源跳转页面(jj_library)`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
let
{
code
,
msg
,
data
}
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v1/getdata`
,
{
courseid
:
rows
[
0
].
id
});
if
(
code
!=
200
)
{
global
.
middleLayer
.
showTips
(
msg
);
return
;
}
try
{
rows
=
JSON
.
parse
(
data
).
folderArr
;
}
catch
(
error
)
{
global
.
middleLayer
.
showTips
(
`未配置表单数据或表单数据配置错误`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
const
deepId
=
rows
[
0
].
id
;
if
(
!
deepId
)
{
global
.
middleLayer
.
showTips
(
`未配置表单数据`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
let
tempRes
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/course/type`
,
{
id
:
deepId
});
let
type
=
tempRes
.
type
;
if
(
type
==
'
courseware
'
)
{
this
.
loading
.
active
=
false
;
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
deepId
,
null
,
(
flag
)
=>
{
this
.
_canTouch
=
true
;
this
.
node
.
active
=
!
flag
;
});
return
;
}
// 进入Deep界面
this
.
goDeepPage
(
deepId
);
}
this
.
_canTouch
=
true
;
}
async
drawLevelList
(
pid
)
{
const
bookid
=
this
.
levelPage
[
"
book_id
"
];
let
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/video/levels`
,
{
pid
,
bookid
});
if
(
res
.
code
!=
200
)
{
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/video/levels`
,
{
pid
});
}
const
rows
=
res
.
rows
;
this
.
levelContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
dt
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
levelItem
);
itemClone
.
width
=
500
;
itemClone
.
height
=
661
;
itemClone
.
parent
=
this
.
levelContent
;
itemClone
.
active
=
true
;
itemClone
.
attr
({
level_id
:
dt
.
id
,
level_pid
:
pid
,
book_type
:
'
level
'
,
is_lock
:
dt
.
locked
,
has_courseware
:
dt
.
has_courseware
});
if
(
dt
.
has_courseware
==
1
&&
dt
.
locked
==
true
)
{
cc
.
find
(
`suo`
,
itemClone
).
active
=
true
;
}
getSpriteFrimeByUrl
(
dt
.
cover
,
(
spriteFrame
)
=>
{
itemClone
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
spriteFrame
;
});
}
}
async
goLevelDown
(
evt
:
cc
.
Event
)
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
const
nd
=
evt
.
currentTarget
;
if
(
nd
.
has_courseware
==
1
&&
nd
.
is_lock
)
{
global
.
middleLayer
.
showTips
(
`未解锁,请先购买激活码`
);
this
.
_canTouch
=
true
;
return
;
}
this
.
loading
.
active
=
true
;
if
(
nd
.
has_courseware
==
0
)
{
this
.
levelDeeps
.
push
(
nd
.
level_pid
);
await
this
.
drawLevelList
(
nd
.
level_id
);
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
return
;
}
const
courseId
=
nd
.
level_id
;
let
{
rows
}
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v2/
${
courseId
}
/list`
,
{});
rows
=
rows
.
filter
(
item
=>
item
.
template_name
==
'
jj_library
'
);
if
(
rows
.
length
==
0
)
{
global
.
middleLayer
.
showTips
(
`未配置资源跳转页面(jj_library)`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
let
{
code
,
msg
,
data
}
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v1/getdata`
,
{
courseid
:
rows
[
0
].
id
});
if
(
code
!=
200
)
{
global
.
middleLayer
.
showTips
(
msg
);
return
;
}
try
{
rows
=
JSON
.
parse
(
data
).
folderArr
;
}
catch
(
error
)
{
global
.
middleLayer
.
showTips
(
`未配置表单数据或表单数据配置错误`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
const
deepId
=
rows
[
0
].
id
;
if
(
!
deepId
)
{
global
.
middleLayer
.
showTips
(
`未配置表单数据`
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
let
tempRes
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/course/type`
,
{
id
:
deepId
});
let
type
=
tempRes
.
type
;
if
(
type
==
'
courseware
'
)
{
this
.
loading
.
active
=
false
;
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
deepId
,
null
,
(
flag
)
=>
{
this
.
_canTouch
=
true
;
this
.
node
.
active
=
!
flag
;
});
return
;
}
// 进入Deep界面
this
.
goDeepPage
(
deepId
);
}
async
goLevelUp
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
this
.
loading
.
active
=
true
;
playLocalAudio
(
'
btn
'
);
const
[
pid
]
=
this
.
levelDeeps
.
splice
(
-
1
);
if
(
pid
)
{
await
this
.
drawLevelList
(
pid
);
}
else
{
// 返回上一层
this
.
levelContent
.
removeAllChildren
();
this
.
levelPage
.
attr
({
book_id
:
""
});
this
.
levelPage
.
active
=
false
;
}
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
deeps
=
[];
async
goDeepPage
(
deepId
)
{
this
.
levelPage
.
active
=
false
;
this
.
deepPage
.
active
=
true
;
await
this
.
drawDeepList
(
deepId
);
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
async
drawDeepList
(
pid
)
{
let
tempRes
=
await
asyncCallNetworkApiGet
(
`/api/syllabus/v1/list`
,
{
pid
});
let
rows
=
tempRes
.
rows
;
if
(
rows
&&
rows
.
length
>
0
)
{
this
.
deepContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
dt
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
deepItem
);
itemClone
.
parent
=
this
.
deepContent
;
itemClone
.
active
=
true
;
itemClone
.
width
=
500
;
itemClone
.
height
=
661
;
itemClone
.
attr
({
deep_pid
:
pid
,
deep_id
:
dt
.
id
,
book_type
:
'
deep
'
,
course_index
:
i
+
1
,
has_courseware
:
dt
.
has_courseware
});
const
cover
=
dt
.
cover
;
getSpriteFrimeByUrl
(
cover
,
(
spriteFrame
)
=>
{
itemClone
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
spriteFrame
;
});
}
}
else
{
tempRes
=
await
asyncCallNetworkApiGet
(
`/api/courseware/v2/
${
pid
}
/list`
,
{});
rows
=
tempRes
.
rows
;
this
.
deepContent
.
removeAllChildren
();
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
dt
=
rows
[
i
];
const
itemClone
=
cc
.
instantiate
(
this
.
deepItem
);
itemClone
.
parent
=
this
.
deepContent
;
itemClone
.
active
=
true
;
itemClone
.
width
=
500
;
itemClone
.
height
=
661
;
itemClone
.
attr
({
deep_pid
:
pid
,
courseware_id
:
dt
.
id
,
book_type
:
'
courseware
'
,
course_index
:
i
+
1
});
const
cover
=
dt
.
cw_cover
||
dt
.
cover
;
getSpriteFrimeByUrl
(
cover
,
(
spriteFrame
)
=>
{
itemClone
.
getComponent
(
cc
.
Sprite
).
spriteFrame
=
spriteFrame
;
});
}
}
}
async
goDeepDown
(
evt
:
cc
.
Event
)
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
this
.
loading
.
active
=
true
;
playLocalAudio
(
'
btn
'
);
const
nd
=
evt
.
currentTarget
;
if
(
nd
.
book_type
==
'
courseware
'
)
{
this
.
loading
.
active
=
false
;
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
nd
.
deep_pid
,
nd
.
course_index
,
(
flag
)
=>
{
this
.
_canTouch
=
true
;
this
.
node
.
active
=
!
flag
;
});
return
;
}
let
tempRes
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/course/type`
,
{
id
:
nd
.
deep_id
});
let
type
=
tempRes
.
type
;
if
(
type
==
'
courseware
'
)
{
this
.
loading
.
active
=
false
;
global
.
middleLayer
.
backPageNode
=
this
.
node
;
global
.
middleLayer
.
loadOnlineCourseWare
(
nd
.
deep_id
,
null
,
(
flag
)
=>
{
this
.
_canTouch
=
true
;
this
.
node
.
active
=
!
flag
;
});
return
;
}
this
.
deeps
.
push
(
nd
.
deep_pid
);
await
this
.
drawDeepList
(
nd
.
deep_id
);
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
async
goDeepUp
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
this
.
loading
.
active
=
true
;
playLocalAudio
(
'
btn
'
);
const
[
pid
]
=
this
.
deeps
.
splice
(
-
1
);
if
(
pid
)
{
await
this
.
drawDeepList
(
pid
);
}
else
{
// 返回上层界面
this
.
deepContent
.
removeAllChildren
();
if
(
this
.
levelPage
[
"
book_id
"
])
{
this
.
levelPage
.
active
=
true
;
}
this
.
deepPage
.
active
=
false
;
}
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/script/frontpage.ts.meta
deleted
100644 → 0
View file @
ec8bddf8
{
"ver": "1.0.8",
"uuid": "c8c0868e-acc0-4cfa-96d3-0039d17a7bf6",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/script/userPage——.ts
deleted
100644 → 0
View file @
ec8bddf8
import
{
asyncCallNetworkApiGet
,
asyncCallNetworkApiPost
,
getSpriteFrimeByUrl
,
playLocalAudio
}
from
"
./util
"
;
const
{
ccclass
,
property
}
=
cc
.
_decorator
;
@
ccclass
export
default
class
NewClass
extends
cc
.
Component
{
@
property
(
cc
.
Node
)
loginPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
EditBox
)
phone
:
cc
.
EditBox
=
null
;
@
property
(
cc
.
EditBox
)
sms
:
cc
.
EditBox
=
null
;
@
property
(
cc
.
Label
)
djs
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
checked
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
userInfo
:
cc
.
Node
=
null
;
@
property
(
cc
.
Label
)
version
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
infoPhone
:
cc
.
Label
=
null
;
@
property
(
cc
.
Label
)
nickName
:
cc
.
Label
=
null
;
@
property
(
cc
.
Node
)
saveUserName
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
btnEditUserName
:
cc
.
Node
=
null
;
@
property
(
cc
.
EditBox
)
userNameEdit
:
cc
.
EditBox
=
null
;
@
property
(
cc
.
Node
)
nickNameNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
nameEditNode
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
activeDialog
:
cc
.
Node
=
null
;
@
property
(
cc
.
EditBox
)
activeCode
:
cc
.
EditBox
=
null
;
@
property
(
cc
.
Node
)
loading
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
frontPage
:
cc
.
Node
=
null
;
@
property
(
cc
.
Node
)
webNode
:
cc
.
Node
=
null
;
// onLoad () {}
start
()
{
}
onDisable
()
{
this
.
loginPage
.
active
=
false
;
this
.
userInfo
.
active
=
false
;
this
.
activeDialog
.
active
=
false
;
this
.
phone
.
string
=
""
;
this
.
sms
.
string
=
""
;
this
.
checked
.
active
=
false
;
this
.
activeCode
.
string
=
""
;
this
.
isUserInterActive
=
false
;
this
.
_canTouch
=
false
;
}
async
showUserInfo
()
{
this
.
loading
.
active
=
true
;
let
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/info`
,
{});
if
(
res
.
code
==
'
200
'
)
{
this
.
userInfo
.
active
=
true
;
const
engine
=
await
global
.
middleLayer
.
getEngineInfo
();
this
.
version
.
string
=
engine
.
version
;
this
.
infoPhone
.
string
=
res
.
data
.
phone
;
this
.
nickName
.
string
=
res
.
data
.
name
||
'
阅读达人
'
;
}
else
{
this
.
loginPage
.
active
=
true
;
}
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
_canTouch
=
false
;
async
sendCode
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
const
phone
=
this
.
phone
.
string
;
if
(
!
this
.
checkPhone
(
phone
))
{
global
.
middleLayer
.
showTips
(
'
请输入正确的手机号码
'
);
this
.
_canTouch
=
true
;
return
;
}
const
disNode
=
cc
.
find
(
`smscode/btn_send/disable`
,
this
.
loginPage
);
disNode
.
active
=
true
;
await
asyncCallNetworkApiPost
(
'
/api/jj/v1/sendcode
'
,
{
phone
:
phone
});
let
countDown
=
60
;
const
tween
=
cc
.
tween
(
this
.
djs
)
.
call
(()
=>
{
this
.
djs
.
string
=
`
${
countDown
}
`
;
if
(
countDown
==
0
)
{
disNode
.
active
=
false
;
tween
.
stop
();
this
.
scheduleOnce
(()
=>
{
this
.
djs
.
string
=
'
60
'
;
},
0
);
}
countDown
--
;
})
.
delay
(
1
)
.
union
()
.
repeatForever
()
.
start
();
this
.
_canTouch
=
true
;
}
checkPhone
(
phone
)
{
const
test
=
/^
[
1
]([
3-9
])[
0-9
]{9}
$/
;
if
(
!
test
.
test
(
phone
))
{
return
false
;
}
return
true
;
}
async
choseAgree
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
if
(
this
.
checked
.
active
==
true
)
{
this
.
checked
.
active
=
false
;
}
else
{
this
.
checked
.
active
=
true
;
}
this
.
_canTouch
=
true
;
}
handleEditUserName
()
{
console
.
log
(
"
KK
"
)
this
.
nickNameNode
.
active
=
false
;
this
.
btnEditUserName
.
active
=
false
;
this
.
nameEditNode
.
active
=
true
;
this
.
saveUserName
.
active
=
true
;
this
.
userNameEdit
.
string
=
this
.
nickName
.
string
;
}
async
handleClickSaveUserName
()
{
if
(
this
.
userNameEdit
.
string
==
""
)
{
global
.
middleLayer
.
showTips
(
'
昵称不能为空
'
);
return
;
}
this
.
nickNameNode
.
active
=
true
;
this
.
btnEditUserName
.
active
=
true
;
this
.
nameEditNode
.
active
=
false
;
this
.
saveUserName
.
active
=
false
;
let
res
=
await
asyncCallNetworkApiPost
(
`/api/jj/v1/user/info`
,
{
name
:
this
.
userNameEdit
.
string
+
""
,
sex
:
""
,
province
:
""
,
city
:
""
,
age
:
""
,
grade
:
""
,
});
if
(
res
.
code
==
'
200
'
)
{
global
.
middleLayer
.
showTips
(
'
修改成功
'
);
this
.
nickName
.
string
=
this
.
userNameEdit
.
string
;
cc
.
find
(
`middleLayer/frontpage/bg_name/nick_name`
).
getComponent
(
cc
.
Label
).
string
=
this
.
userNameEdit
.
string
;
}
else
{
global
.
middleLayer
.
showTips
(
'
修改失败
'
);
}
}
cancelEditUserName
()
{
if
(
this
.
nameEditNode
.
active
)
{
this
.
nickNameNode
.
active
=
true
;
this
.
btnEditUserName
.
active
=
true
;
this
.
nameEditNode
.
active
=
false
;
this
.
saveUserName
.
active
=
false
;
}
}
loginPageClose
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
this
.
node
.
active
=
false
;
this
.
cancelEditUserName
();
}
async
login
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
const
phone
=
this
.
phone
.
string
;
if
(
!
this
.
checkPhone
(
phone
))
{
global
.
middleLayer
.
showTips
(
'
请输入正确的手机号码
'
);
this
.
_canTouch
=
true
;
return
;
}
if
(
!
this
.
checked
.
active
)
{
global
.
middleLayer
.
showTips
(
'
请勾选下方协议
'
);
this
.
_canTouch
=
true
;
return
;
}
this
.
loading
.
active
=
true
;
let
res
=
await
asyncCallNetworkApiPost
(
'
/api/jj/v1/login
'
,
{
phone
:
phone
,
sms_code
:
this
.
sms
.
string
});
if
(
res
.
code
!=
'
200
'
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
this
.
_canTouch
=
true
;
this
.
loading
.
active
=
false
;
return
;
}
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
data
.
token
);
this
.
node
.
active
=
false
;
res
=
await
asyncCallNetworkApiGet
(
`/api/jj/v1/user/info`
,
{});
if
(
res
.
code
==
'
200
'
)
{
cc
.
find
(
`middleLayer/frontpage/bg_name/nick_name`
).
getComponent
(
cc
.
Label
).
string
=
res
.
data
.
name
||
'
阅读达人
'
;
}
await
this
.
frontPage
.
getComponent
(
'
frontpage
'
).
drawBookList
();
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
async
exitAccount
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
this
.
loading
.
active
=
true
;
this
.
cancelEditUserName
();
await
asyncCallNetworkApiPost
(
`/api/jj/v1/logout`
,
{});
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
""
);
await
this
.
frontPage
.
getComponent
(
'
frontpage
'
).
drawBookList
();
cc
.
find
(
`middleLayer/frontpage/bg_name/nick_name`
).
getComponent
(
cc
.
Label
).
string
=
`点击登录`
;
this
.
node
.
active
=
false
;
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
showActiveDialog
()
{
this
.
activeDialog
.
active
=
true
;
this
.
_canTouch
=
true
;
}
isUserInterActive
=
false
;
clickOpenActiveDialog
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
this
.
isUserInterActive
=
true
;
this
.
userInfo
.
active
=
false
;
this
.
activeDialog
.
active
=
true
;
this
.
_canTouch
=
true
;
}
closeActiveDialog
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
if
(
this
.
isUserInterActive
)
{
this
.
userInfo
.
active
=
true
;
this
.
activeDialog
.
active
=
false
;
}
else
{
this
.
node
.
active
=
false
;
}
this
.
isUserInterActive
=
false
;
this
.
_canTouch
=
true
;
}
async
clickActiveBtn
()
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
playLocalAudio
(
'
btn
'
);
if
(
!
this
.
activeCode
.
string
)
{
global
.
middleLayer
.
showTips
(
`请输入激活码`
);
this
.
_canTouch
=
true
;
return
;
}
this
.
loading
.
active
=
true
;
let
res
=
await
asyncCallNetworkApiPost
(
`/api/jj/v1/user/bind`
,
{
book_code
:
`jj||
${
this
.
activeCode
.
string
}
`
});
if
(
res
.
code
==
'
200
'
)
{
global
.
middleLayer
.
showTips
(
`兑换成功`
);
if
(
this
.
isUserInterActive
)
{
this
.
userInfo
.
active
=
true
;
this
.
activeDialog
.
active
=
false
;
}
else
{
this
.
node
.
active
=
false
;
await
this
.
frontPage
.
getComponent
(
'
frontpage
'
).
drawBookList
();
}
}
else
{
global
.
middleLayer
.
showTips
(
`兑换失败:请确认激活码输入是否正确`
);
}
this
.
loading
.
active
=
false
;
this
.
_canTouch
=
true
;
}
openWeb
(
evt
:
cc
.
Event
,
data
)
{
if
(
!
this
.
_canTouch
)
{
return
;
}
this
.
_canTouch
=
false
;
this
.
webNode
.
active
=
true
;
cc
.
find
(
`
${
data
}
_web`
,
this
.
webNode
).
active
=
true
;
this
.
_canTouch
=
true
;
}
closeWeb
()
{
this
.
webNode
.
active
=
false
;
cc
.
find
(
`policy_web`
,
this
.
webNode
).
active
=
false
;
cc
.
find
(
`privacy_web`
,
this
.
webNode
).
active
=
false
;
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/script/userPage——.ts.meta
deleted
100644 → 0
View file @
ec8bddf8
{
"ver": "1.0.8",
"uuid": "8149136f-1b38-490f-ba2b-210c8d887592",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ 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