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
be6f2eaf
Commit
be6f2eaf
authored
Nov 07, 2023
by
李维
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加用户IOS审核账号和游客登录
parent
69379332
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
5047 additions
and
3364 deletions
+5047
-3364
middleLayer_for_kyxq.fire
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
+4807
-3322
HomePage.ts
assets/middleLayer_for_kyxq/script/HomePage.ts
+25
-34
LoginPage.ts
assets/middleLayer_for_kyxq/script/LoginPage.ts
+59
-7
userPage.ts
assets/middleLayer_for_kyxq/script/userPage.ts
+48
-1
bg_tip_delete.png
.../middleLayer_for_kyxq/textures/HomePage/bg_tip_delete.png
+0
-0
bg_tip_delete.png.meta
...leLayer_for_kyxq/textures/HomePage/bg_tip_delete.png.meta
+36
-0
btn_cancel.png
assets/middleLayer_for_kyxq/textures/HomePage/btn_cancel.png
+0
-0
btn_cancel.png.meta
...iddleLayer_for_kyxq/textures/HomePage/btn_cancel.png.meta
+36
-0
btn_delete.png
assets/middleLayer_for_kyxq/textures/HomePage/btn_delete.png
+0
-0
btn_delete.png.meta
...iddleLayer_for_kyxq/textures/HomePage/btn_delete.png.meta
+36
-0
No files found.
assets/middleLayer_for_kyxq/scene/middleLayer_for_kyxq.fire
View file @
be6f2eaf
This diff is collapsed.
Click to expand it.
assets/middleLayer_for_kyxq/script/HomePage.ts
View file @
be6f2eaf
...
...
@@ -31,12 +31,16 @@ export default class NewClass extends cc.Component {
// 点击用户中心
handleClickUserCenter
()
{
this
.
userPage
.
active
=
true
;
this
.
refreshUserPage
();
}
// 点击左上角登录
handleClickLogin
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LoginPage
"
,
"
leftIn
"
)
}
userPagePanel
;
userPageName
;
userPagePhone
;
...
...
@@ -80,7 +84,6 @@ export default class NewClass extends cc.Component {
// 点击课程
handleClickCourseItem
(
pid
,
pData
)
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
unitPage
.
attr
({
syllabus_pid
:
pid
});
vc
.
unitPage
.
attr
({
pData
:
pData
});
...
...
@@ -91,7 +94,7 @@ export default class NewClass extends cc.Component {
async
getCourseList
()
{
this
.
SvContent
.
removeAllChildren
();
this
.
loading
.
active
=
true
;
const
userInfo
=
await
global
.
middleLayer
.
getUserInfo
()
;
const
userInfo
=
this
.
userInfo
;
const
{
rows
}
=
await
asyncCallNetworkApiGet
(
'
/api/kyxq/v1/user/jclist
'
,
{
jc_arr
:
userInfo
.
jc_arr
,
});
...
...
@@ -106,7 +109,6 @@ export default class NewClass extends cc.Component {
let
loadEndCount
=
0
;
for
(
let
i
=
0
;
i
<
rows
.
length
;
i
++
)
{
const
row
=
rows
[
i
];
const
ci
=
cc
.
instantiate
(
this
.
CourseItem
);
cc
.
find
(
`progressText`
,
ci
).
getComponent
(
cc
.
Label
).
string
=
`学习进度:
${
row
.
process
}
`
;
...
...
@@ -119,8 +121,6 @@ export default class NewClass extends cc.Component {
cc
.
find
(
`progress`
,
ci
).
getComponent
(
cc
.
ProgressBar
).
progress
=
Math
.
floor
(
a
/
b
*
10
)
/
10
;
}
// console.log("row.cover: ", row.cover);
getSprNodeByUrl
(
row
.
cover
,
async
(
resSpr
)
=>
{
// getSpriteFrimeByUrl(row.cover, async (spriteFrame) => {
const
coverNode
=
cc
.
find
(
`bg`
,
ci
);
...
...
@@ -138,7 +138,6 @@ export default class NewClass extends cc.Component {
ci
.
active
=
true
;
ci
.
attr
({
syllabus_id
:
row
.
id
});
ci
.
on
(
"
click
"
,
()
=>
{
console
.
log
(
'
row:
'
,
row
);
this
.
handleClickCourseItem
(
ci
[
`syllabus_id`
],
row
);
})
...
...
@@ -164,12 +163,11 @@ export default class NewClass extends cc.Component {
ci
.
height
*=
scale
;
ci
.
scale
=
scale
;
this
.
SvContent
.
addChild
(
ci
);
}
console
.
log
(
"
this.canvas.width:
"
,
cc
.
find
(
"
Canvas
"
).
width
)
// 防止在没有数据情况下 加载动画不消失
if
(
rows
.
length
==
0
)
{
this
.
loading
.
active
=
false
;
}
// this.loading.active = false;
}
...
...
@@ -178,22 +176,19 @@ export default class NewClass extends cc.Component {
userInfo
;
async
getUserInfo
()
{
this
.
userInfo
=
await
global
.
middleLayer
.
getUserInfo
();
console
.
log
(
"
userInfo:
"
,
this
.
userInfo
);
this
.
initTopUserPanel
();
global
.
userInfo
=
{
phone
:
this
.
userInfo
.
phone
,
isIOSReview
:
this
.
userInfo
.
phone
==
"
15500000001
"
,
isAnonymous
:
this
.
userInfo
.
phone
==
"
15500000002
"
,
detail
:
this
.
userInfo
}
// 如果是匿名登录 隐藏右上角头像按钮
cc
.
find
(
"
/UserInfo
"
,
this
.
node
).
active
=
global
.
userInfo
.
isAnonymous
?
false
:
true
;
cc
.
find
(
"
/UserLogin
"
,
this
.
node
).
active
=
global
.
userInfo
.
isAnonymous
?
true
:
false
;
// const token = cc.sys.localStorage.getItem('token');
// if (!token) {
// console.log('token not exist!');
// return;
// } else {
// console.log('token: ', token);
// }
// const resData = await asyncCallNetworkApiGet('/api/kyxq/v1/user/info', {token});
// console.log("userInfo: ", resData);
// this.userInfo = resData;
this
.
initTopUserPanel
();
}
nameLabel
;
...
...
@@ -237,26 +232,22 @@ export default class NewClass extends cc.Component {
_canTouch
=
false
;
async
start
()
{
this
.
initBg
();
await
this
.
getCourseList
();
await
this
.
getUserInfo
();
await
this
.
getCourseList
();
this
.
initTopUserPanel
();
this
.
_canTouch
=
true
;
this
.
_inited
=
true
;
}
async
onEnable
()
{
this
.
_canTouch
=
false
;
this
.
initTopUserPanel
();
if
(
this
.
_inited
)
{
// await this.getCourseList();
await
this
.
getUserInfo
();
await
this
.
getCourseList
();
this
.
initTopUserPanel
();
this
.
_canTouch
=
true
;
}
}
...
...
assets/middleLayer_for_kyxq/script/LoginPage.ts
View file @
be6f2eaf
...
...
@@ -49,15 +49,16 @@ export default class NewClass extends cc.Component {
this
.
initData
();
this
.
initListener
();
this
.
initAnonymous
();
}
initData
()
{
this
.
yellowBtn
=
cc
.
find
(
"
yellow
"
,
this
.
btnNode
);
this
.
greyBtn
=
cc
.
find
(
"
grey
"
,
this
.
btnNode
);
}
initListener
()
{
this
.
editBox
.
on
(
'
text-changed
'
,
(
editBox
)
=>
{
// console.log('文本改变1:', editBox.string);
this
.
phoneNum
=
editBox
.
string
;
...
...
@@ -69,6 +70,16 @@ export default class NewClass extends cc.Component {
});
}
initAnonymous
()
{
const
anyBtn
=
cc
.
find
(
"
/anonymousLoginBtn
"
,
this
.
panelNode
);
anyBtn
.
active
=
true
;
// cc.sys.os == cc.sys.OS_IOS;
// 是否开启审查模式,true: 将会判断设备类型和登录账号 false: 关闭审查模式
// const openReview = true;
// IOS设备 并且 手机号是15500000001 或者为空(未登录状态) - 判定为IOS审查状态
// global.iosReviewMode = openReview && cc.sys.os == cc.sys.OS_IOS && (global.userInfo.phone == "15500000001" || global.userInfo.phone == "");
}
clickAgreement
()
{
this
.
isAgreement
=
!
this
.
isAgreement
;
const
icon
=
cc
.
find
(
"
/agreementSection/icon_agree
"
,
this
.
panelNode
);
...
...
@@ -106,6 +117,27 @@ export default class NewClass extends cc.Component {
cc
.
find
(
`
${
data
}
_web`
,
this
.
webNode
).
active
=
true
;
}
async
clickAnonymousLoginBtn
()
{
const
defaultPhone
=
"
15500000002
"
const
res
=
await
asyncCallNetworkApiPost
(
'
/api/kyxq/v1/login
'
,
{
phone
:
defaultPhone
,
});
if
(
res
.
code
!=
'
200
'
)
{
global
.
middleLayer
.
showTips
(
res
.
msg
);
this
.
showEnterFail
();
return
;
}
global
.
userInfo
=
{
phone
:
defaultPhone
,
isAnonymous
:
true
,
isIOSReview
:
false
,
}
global
.
middleLayer
.
isLogin
=
true
;
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
data
.
token
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
defaultPhone
);
this
.
showEnterSuccess
(
false
);
}
async
enterBtnClick
()
{
const
phone
=
this
.
phoneNum
;
if
(
!
this
.
checkPhone
(
phone
))
{
...
...
@@ -129,18 +161,30 @@ export default class NewClass extends cc.Component {
return
}
const
localDelPhone
=
cc
.
sys
.
localStorage
.
getItem
(
'
_del-phone-number
'
);
if
(
localDelPhone
==
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
;
global
.
userInfo
=
{
phone
:
phone
,
isAnonymous
:
false
,
isIOSReview
:
phone
,
}
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
res
.
data
.
token
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
phone
);
this
.
showEnterSuccess
();
this
.
showEnterSuccess
(
true
);
...
...
@@ -159,15 +203,25 @@ export default class NewClass extends cc.Component {
return
true
;
}
showEnterSuccess
()
{
cleanValueStatus
()
{
// 清除勾选状态
this
.
isAgreement
=
false
;
cc
.
find
(
"
/agreementSection/icon_agree
"
,
this
.
panelNode
).
active
=
this
.
isAgreement
;
this
.
editBox
.
getComponent
(
cc
.
EditBox
).
string
=
""
this
.
phoneNum
=
""
this
.
showGreyBtn
();
}
showEnterSuccess
(
showSuccess
=
true
)
{
this
.
panelNode
.
active
=
false
;
this
.
successNode
.
active
=
true
;
this
.
successNode
.
active
=
showSuccess
;
this
.
cleanValueStatus
();
setTimeout
(()
=>
{
if
(
this
.
isDestroy
)
{
return
;
}
this
.
showHomePage
();
},
1000
);
},
showSuccess
?
1000
:
1
);
}
showEnterFail
()
{
...
...
@@ -198,8 +252,6 @@ export default class NewClass extends cc.Component {
this
.
yellowBtn
.
active
=
false
;
}
showHomePage
()
{
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
HomePage
"
,
"
rightIn
"
)
...
...
assets/middleLayer_for_kyxq/script/userPage.ts
View file @
be6f2eaf
...
...
@@ -24,11 +24,16 @@ export default class NewClass extends cc.Component {
_canTouch
=
false
;
async
start
()
{
this
.
_canTouch
=
true
;
this
.
initDeleteAccoutBtn
();
}
protected
onEnable
():
void
{
this
.
initDeleteAccoutBtn
();
}
closeBtnClick
()
{
this
.
node
.
active
=
false
;
}
}
exitBtnClick
()
{
this
.
infoPanel
.
active
=
false
;
...
...
@@ -44,10 +49,52 @@ export default class NewClass extends cc.Component {
exitOkClick
()
{
this
.
exitCancelClick
();
this
.
node
.
active
=
false
;
this
.
logout
();
}
initDeleteAccoutBtn
()
{
const
delBtn
=
cc
.
find
(
"
btn_delAccount
"
,
this
.
node
)
delBtn
.
active
=
global
.
userInfo
.
isIOSReview
?
true
:
false
;
}
logout
()
{
global
.
middleLayer
.
isLogin
=
false
;
global
.
userInfo
=
{
phone
:
""
,
isAnonymous
:
false
,
isIOSReview
:
false
,
}
// 清空信息
cc
.
sys
.
localStorage
.
setItem
(
'
token
'
,
""
);
cc
.
sys
.
localStorage
.
setItem
(
'
phone
'
,
""
);
// 跳转登录页面
const
vc
=
this
.
Viewer
.
getComponent
(
"
PageViewer
"
);
vc
.
toView
(
"
LoginPage
"
,
"
leftIn
"
)
}
clickPopupAccountModal
()
{
cc
.
find
(
"
/confirmDelAccount
"
,
this
.
node
).
active
=
true
;
cc
.
find
(
"
/user_info
"
,
this
.
node
).
active
=
false
;
}
clickDelAccount
()
{
cc
.
find
(
"
/confirmDelAccount
"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"
/user_info
"
,
this
.
node
).
active
=
true
;
// 本地存储删除的手机号 - 在登录的时候进行判断
const
phone
=
cc
.
sys
.
localStorage
.
getItem
(
'
phone
'
);
cc
.
sys
.
localStorage
.
setItem
(
'
_del-phone-number
'
,
phone
);
// 登出
this
.
logout
();
this
.
exitCancelClick
();
this
.
node
.
active
=
false
;
}
clickCancelDelAccount
()
{
cc
.
find
(
"
/confirmDelAccount
"
,
this
.
node
).
active
=
false
;
cc
.
find
(
"
/user_info
"
,
this
.
node
).
active
=
true
;
}
// update (dt) {}
}
assets/middleLayer_for_kyxq/textures/HomePage/bg_tip_delete.png
0 → 100644
View file @
be6f2eaf
15.3 KB
assets/middleLayer_for_kyxq/textures/HomePage/bg_tip_delete.png.meta
0 → 100644
View file @
be6f2eaf
{
"ver": "2.3.5",
"uuid": "0cd87cba-6ef8-48dc-afb1-c1babae27068",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 755,
"height": 377,
"platformSettings": {},
"subMetas": {
"bg_tip_delete": {
"ver": "1.0.4",
"uuid": "6e47f5e9-7e9b-4495-b94b-853de5bf4c21",
"rawTextureUuid": "0cd87cba-6ef8-48dc-afb1-c1babae27068",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 755,
"height": 377,
"rawWidth": 755,
"rawHeight": 377,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/HomePage/btn_cancel.png
0 → 100644
View file @
be6f2eaf
5.86 KB
assets/middleLayer_for_kyxq/textures/HomePage/btn_cancel.png.meta
0 → 100644
View file @
be6f2eaf
{
"ver": "2.3.5",
"uuid": "0593980d-982d-4179-9aec-b6893c7b36b4",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 404,
"height": 150,
"platformSettings": {},
"subMetas": {
"btn_cancel": {
"ver": "1.0.4",
"uuid": "964ac0b1-fde8-48df-b7f1-84165f80e41a",
"rawTextureUuid": "0593980d-982d-4179-9aec-b6893c7b36b4",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 3,
"trimY": 3,
"width": 398,
"height": 143,
"rawWidth": 404,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
assets/middleLayer_for_kyxq/textures/HomePage/btn_delete.png
0 → 100644
View file @
be6f2eaf
2.59 KB
assets/middleLayer_for_kyxq/textures/HomePage/btn_delete.png.meta
0 → 100644
View file @
be6f2eaf
{
"ver": "2.3.5",
"uuid": "1203bc85-7b67-48c6-a8c3-d5bed28e2578",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 404,
"height": 150,
"platformSettings": {},
"subMetas": {
"btn_delete": {
"ver": "1.0.4",
"uuid": "c3ec3e53-9b63-4179-9239-1745797453d1",
"rawTextureUuid": "1203bc85-7b67-48c6-a8c3-d5bed28e2578",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0.5,
"trimX": 3,
"trimY": 3,
"width": 398,
"height": 143,
"rawWidth": 404,
"rawHeight": 150,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"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