Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
ZheShangBank_TaoQuan_20240612
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
ZheShangBank_TaoQuan_20240612
Commits
d2746184
Commit
d2746184
authored
Jul 30, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理一下代码
parent
8d883218
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
53 deletions
+80
-53
AppTool.ts
assets/AppTool.ts
+9
-9
MainGame.scene
assets/Bundles/MainGame/MainGame.scene
+11
-11
WebNet.ts
assets/Scripts/Utils/WebNet/WebNet.ts
+56
-29
Start.ts
assets/Start/Start.ts
+4
-4
No files found.
assets/AppTool.ts
View file @
d2746184
...
...
@@ -43,14 +43,14 @@ export function isLogin() {
}
export
function
appJump
(
url
,
hideNavbar
=
false
,
data
=
{})
{
sendWebNet
(
"/autoLogin/tempSaveCookie"
,
null
,
null
,
true
)
.
then
((
res
)
=>
{
if
(
res
?.
data
)
{
localStorage
.
setItem
(
"db_zheshang_cookie"
,
res
.
data
);
setCookieId
(
res
.
data
);
}
})
.
finally
(()
=>
{
//
sendWebNet("/autoLogin/tempSaveCookie", null, null, true)
//
.then((res) => {
//
if (res?.data) {
//
localStorage.setItem("db_zheshang_cookie", res.data);
//
setCookieId(res.data);
//
}
//
})
//
.finally(() => {
window
[
"MarsJSBridge"
].
invoke
(
"pushPage"
,
{
uri
:
url
,
data
,
...
...
@@ -58,7 +58,7 @@ export function appJump(url, hideNavbar = false, data = {}) {
hideNavbar
,
}
});
})
//
})
}
export
function
appJumpToMini
(
username
,
path
,
type
=
"0"
)
{
...
...
assets/Bundles/MainGame/MainGame.scene
View file @
d2746184
...
...
@@ -1482,7 +1482,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 375
.00000000000006
,
"x": 375,
"y": 812,
"z": 0
},
...
...
@@ -1698,7 +1698,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -117.5
0000000000006
,
"x": -117.5,
"y": -110,
"z": 0
},
...
...
@@ -1982,7 +1982,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 15
3.9999999999999
4,
"x": 154,
"y": -110,
"z": 0
},
...
...
@@ -2397,7 +2397,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 31
3.9999999999999
4,
"x": 314,
"y": -109,
"z": 0
},
...
...
@@ -3391,7 +3391,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": -334
.00000000000006
,
"x": -334,
"y": -109,
"z": 0
},
...
...
@@ -3571,7 +3571,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 750
.0000000000001
,
"width": 750,
"height": 0
},
"_anchorPoint": {
...
...
@@ -3645,7 +3645,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 29
1.99999999999994
,
"x": 29
2
,
"y": -404,
"z": 0
},
...
...
@@ -6780,7 +6780,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 750
.0000000000001
,
"width": 750,
"height": 1624
},
"_anchorPoint": {
...
...
@@ -7064,7 +7064,7 @@
"_prefab": null,
"_lpos": {
"__type__": "cc.Vec3",
"x": 17
2.99999999999994
,
"x": 17
3
,
"y": -481.5,
"z": 0
},
...
...
@@ -7194,7 +7194,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 750
.0000000000001
,
"width": 750,
"height": 1624
},
"_anchorPoint": {
...
...
@@ -7246,7 +7246,7 @@
"__prefab": null,
"_contentSize": {
"__type__": "cc.Size",
"width": 750
.0000000000001
,
"width": 750,
"height": 1624
},
"_anchorPoint": {
...
...
assets/Scripts/Utils/WebNet/WebNet.ts
View file @
d2746184
...
...
@@ -4,6 +4,7 @@ import { changeScene, showToast } from "db://assets/Module/UIFast";
import
{
PREVIEW
}
from
'cc/env'
;
import
{
resetBackCookie
}
from
"../../../AppTool"
;
import
{
LimitedPage
}
from
"../../Scenes/LimitedPage"
;
import
{
getUrlParam
}
from
"../Utils"
;
// import { isFromShare, newUser } from 'duiba-utils';
...
...
@@ -186,6 +187,19 @@ let dataRecord: {
[
name
:
string
]:
any
}
=
{};
let
paramJson
=
null
;
if
(
getUrlParam
(
"params"
))
{
const
params
=
decodeURIComponent
(
getUrlParam
(
"params"
));
const
paramArr
=
params
.
split
(
"&"
);
const
paramObj
=
{};
paramArr
.
forEach
(
item
=>
{
const
arr
=
item
.
split
(
"="
);
paramObj
[
arr
[
0
]]
=
arr
[
1
];
});
paramJson
=
encodeURIComponent
(
JSON
.
stringify
(
paramObj
));
}
/**
* 发送接口
* @param netName
...
...
@@ -201,7 +215,7 @@ export function sendWebNet(
callback
?:
(
success
:
boolean
,
res
?:
dataOut
)
=>
void
,
hideMsg
:
boolean
=
false
,
isGet
:
boolean
=
true
,
//这两个参数基本不设置,放后面吧
headers
?:
any
,
headers
=
{}
,
):
Promise
<
dataOut
>
{
//处理下参数
// 统一加上渠道参数
...
...
@@ -268,19 +282,23 @@ export function sendWebNet(
}
// const duibaTempCookieId = localStorage.getItem("db_zheshang_cookie");
const
duibaTempCookieId
=
tempCookieId
||
localStorage
.
getItem
(
"db_zheshang_cookie"
);
if
(
duibaTempCookieId
)
{
localStorage
.
removeItem
(
"db_zheshang_cookie"
);
tempCookieId
=
""
;
const
res
=
await
sendWebNet
(
"userLogin.check"
)
.
catch
(
async
()
=>
{
await
resetBackCookie
(
duibaTempCookieId
);
});
if
(
!
res
||
!
res
.
success
)
{
await
resetBackCookie
(
duibaTempCookieId
);
}
// const duibaTempCookieId = tempCookieId || localStorage.getItem("db_zheshang_cookie");
//
// if (duibaTempCookieId) {
// localStorage.removeItem("db_zheshang_cookie");
// tempCookieId = "";
//
// const res = await sendWebNet("userLogin.check")
// .catch(async () => {
// await resetBackCookie(duibaTempCookieId);
// });
// if (!res || !res.success) {
// await resetBackCookie(duibaTempCookieId);
// }
// }
if
(
paramJson
)
{
headers
[
"identityKey"
]
=
paramJson
;
}
//网络请求
...
...
@@ -297,7 +315,7 @@ export function sendWebNet(
})
}
export
function
sendWebNetWithToken
(
export
async
function
sendWebNetWithToken
(
netName
:
WebNetName
,
parameter
?:
any
,
callback
?:
(
success
:
boolean
,
res
?:
dataOut
)
=>
void
,
...
...
@@ -305,22 +323,31 @@ export function sendWebNetWithToken(
isGet
:
boolean
=
true
,
//这两个参数基本不设置,放后面吧
headers
?:
any
,
):
Promise
<
dataOut
>
{
return
new
Promise
(
async
r
=>
{
const
token
=
await
getPxTokenSave
();
// getPxToken(async (msg, token) => {
if
(
!
token
)
{
showToast
(
DEFAULF_ERROR
);
r
({
success
:
false
})
return
;
}
const
res
=
await
sendWebNet
(
netName
,
{
token
,
...
parameter
},
callback
,
hideMsg
,
isGet
,
headers
);
r
(
res
);
// })
})
return
await
sendWebNet
(
netName
,
{...
parameter
},
callback
,
hideMsg
,
isGet
,
headers
);
}
// export function sendWebNetWithToken(
// netName: WebNetName,
// parameter?: any,
// callback?: (success: boolean, res?: dataOut) => void,
// hideMsg: boolean = false,
// isGet: boolean = true,//这两个参数基本不设置,放后面吧
// headers?: any,
// ): Promise<dataOut> {
// return new Promise(async r => {
// const token = await getPxTokenSave();
// // getPxToken(async (msg, token) => {
// if (!token) {
// showToast(DEFAULF_ERROR);
// r({success: false})
// return;
// }
// const res = await sendWebNet(netName, {token, ...parameter}, callback, hideMsg, isGet, headers);
// r(res);
// // })
// });
// }
/**
* 获取数据
...
...
assets/Start/Start.ts
View file @
d2746184
...
...
@@ -55,10 +55,10 @@ export class Start extends Component {
this
.
keepLive
();
},
1000
*
60
*
5
);
this
.
tempSaveCookie
();
setInterval
(()
=>
{
this
.
tempSaveCookie
();
},
5
*
1000
);
//
this.tempSaveCookie();
//
setInterval(() => {
//
this.tempSaveCookie();
//
}, 5 * 1000);
}
...
...
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