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
27fbf538
Commit
27fbf538
authored
Jun 24, 2024
by
haiyoucuv
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
整理一下代码
parent
264623b2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
54 additions
and
60 deletions
+54
-60
InvitePanel.ts
assets/Scripts/Panels/InvitePanel.ts
+1
-1
PrizePanel.ts
assets/Scripts/Panels/PrizePanel.ts
+1
-1
HomeScene.ts
assets/Scripts/Scenes/HomeScene.ts
+1
-5
ShareCenter.ts
assets/Scripts/ShareCenter.ts
+51
-53
No files found.
assets/Scripts/Panels/InvitePanel.ts
View file @
27fbf538
...
@@ -20,7 +20,7 @@ export default class InvitePanel extends Panel {
...
@@ -20,7 +20,7 @@ export default class InvitePanel extends Panel {
/** 送惊喜 立即分享 */
/** 送惊喜 立即分享 */
async
shareHandle
()
{
async
shareHandle
()
{
ShareCenter
.
ins
.
doShare
(
SHARE_TYPE
.
SURPRISE
)
ShareCenter
.
ins
.
doShare
()
}
}
}
}
assets/Scripts/Panels/PrizePanel.ts
View file @
27fbf538
...
@@ -59,7 +59,7 @@ export default class PrizePanel extends Panel {
...
@@ -59,7 +59,7 @@ export default class PrizePanel extends Panel {
onShare
=
()
=>
{
onShare
=
()
=>
{
// 去炫耀 分享
// 去炫耀 分享
ShareCenter
.
ins
.
doShare
(
SHARE_TYPE
.
FLAUNT
)
ShareCenter
.
ins
.
doShare
()
}
}
}
}
assets/Scripts/Scenes/HomeScene.ts
View file @
27fbf538
...
@@ -210,11 +210,7 @@ export class HomeScene extends Scene {
...
@@ -210,11 +210,7 @@ export class HomeScene extends Scene {
/** 返回 */
/** 返回 */
clickShare
=
async
()
=>
{
clickShare
=
async
()
=>
{
if
(
!
this
.
checkActStatus
())
return
false
;
if
(
!
this
.
checkActStatus
())
return
false
;
ShareCenter
.
ins
.
getInviteCode
();
await
ShareCenter
.
ins
.
doShare
();
await
appShare
(
store
.
frontVariable
.
shareInfo
);
}
}
}
}
...
...
assets/Scripts/ShareCenter.ts
View file @
27fbf538
...
@@ -2,68 +2,66 @@ import { showToast } from "../Module/UIFast";
...
@@ -2,68 +2,66 @@ import { showToast } from "../Module/UIFast";
import
{
getUrlParam
}
from
"./Utils/Utils"
;
import
{
getUrlParam
}
from
"./Utils/Utils"
;
import
{
getWebData
,
sendWebNetWithToken
,
WebNetName
}
from
"./Utils/WebNet/WebNet"
;
import
{
getWebData
,
sendWebNetWithToken
,
WebNetName
}
from
"./Utils/WebNet/WebNet"
;
import
{
SHARE_TYPE
}
from
"./const"
;
import
{
SHARE_TYPE
}
from
"./const"
;
import
{
appShare
}
from
"../AppTool"
;
import
store
from
"../store/store"
;
export
default
class
ShareCenter
{
export
default
class
ShareCenter
{
private
static
_ins
:
ShareCenter
=
null
;
private
static
_ins
:
ShareCenter
=
null
;
public
static
get
ins
()
{
public
static
get
ins
()
{
!
ShareCenter
.
_ins
&&
(
ShareCenter
.
_ins
=
new
ShareCenter
());
!
ShareCenter
.
_ins
&&
(
ShareCenter
.
_ins
=
new
ShareCenter
());
return
ShareCenter
.
_ins
;
return
ShareCenter
.
_ins
;
}
}
shareUrl
=
`/projectx/
${
location
.
pathname
.
split
(
'/'
)[
2
]}
/share.html?appID=
${
getUrlParam
(
"appID"
)}
`
shareUrl
=
`/projectx/
${
location
.
pathname
.
split
(
'/'
)[
2
]}
/share.html?appID=
${
getUrlParam
(
"appID"
)}
`
inviteCode
=
''
inviteCode
=
''
async
getInviteCode
()
{
async
getInviteCode
()
{
if
(
this
.
inviteCode
)
return
this
.
inviteCode
if
(
this
.
inviteCode
)
return
this
.
inviteCode
const
{
success
,
data
}
=
await
sendWebNetWithToken
(
WebNetName
.
getInviteCode
,
null
,
null
,
null
,
false
);
const
{
success
,
data
}
=
await
sendWebNetWithToken
(
WebNetName
.
getInviteCode
,
null
,
null
,
null
,
false
);
if
(
success
)
{
if
(
success
)
{
this
.
inviteCode
=
data
?.
inviteCode
||
''
this
.
inviteCode
=
data
?.
inviteCode
||
''
}
}
return
''
;
return
''
;
}
}
/**
/**
* 分享
* 分享
* @param type 分享类型
* @param type 分享类型
*/
*/
async
doShare
(
type
:
string
)
{
async
doShare
(
type
?
:
string
)
{
await
this
.
getInviteCode
();
const
inviteCode
=
await
this
.
getInviteCode
();
if
(
!
this
.
inviteCode
)
return
false
if
(
inviteCode
)
return
false
const
{
shareInfo
,
appKey
,
shareOrigin
}
=
getWebData
(
WebNetName
.
getFrontVariable
).
data
const
{
shareInfo
,
appKey
,
shareOrigin
}
=
getWebData
(
WebNetName
.
getFrontVariable
).
data
let
shareData
=
shareInfo
?
JSON
.
parse
(
shareInfo
)
:
{}
let
shareData
=
shareInfo
?
JSON
.
parse
(
shareInfo
)
:
{}
let
shareParams
=
{
let
shareParams
=
{
title
:
shareData
.
title
,
title
:
shareData
.
title
,
content
:
shareData
.
content
,
content
:
shareData
.
content
,
thumbnail
:
shareData
.
thumbnail
,
thumbnail
:
shareData
.
thumbnail
,
url
:
`
${
shareOrigin
||
location
.
origin
}${
this
.
shareUrl
}
&appKey=
${
appKey
}
&openBs=openbs&inviteCode=
${
this
.
inviteCode
}
&channel=
${
getUrlParam
(
"channel"
)}
`
url
:
`
${
shareOrigin
||
location
.
origin
}${
this
.
shareUrl
}
&appKey=
${
appKey
}
&openBs=openbs&inviteCode=
${
this
.
inviteCode
}
&channel=
${
getUrlParam
(
"channel"
)}
`
}
}
// 游戏去炫耀 不同的分享信息
// 游戏去炫耀 不同的分享信息
if
(
type
===
SHARE_TYPE
.
FLAUNT
)
{
if
(
type
===
SHARE_TYPE
.
FLAUNT
)
{
shareParams
.
title
=
shareData
.
game_title
shareParams
.
title
=
shareData
.
game_title
shareParams
.
content
=
shareData
.
game_content
shareParams
.
content
=
shareData
.
game_content
shareParams
.
thumbnail
=
shareData
.
game_thumbnail
shareParams
.
thumbnail
=
shareData
.
game_thumbnail
}
}
console
.
info
(
'shareParams'
,
shareParams
);
// app分享
await
appShare
(
shareParams
);
}
// app分享
// 助力
const
{
url
,
title
,
content
,
thumbnail
}
=
shareParams
;
async
doAssist
()
{
const
ThirdApp
=
window
[
'ThirdApp'
];
const
inviteCode
=
getUrlParam
(
"inviteCode"
)
ThirdApp
.
wxShare
(
title
,
content
,
url
,
thumbnail
,
'WX,PYQ'
,
'WebPage'
);
if
(
!
inviteCode
)
return
false
;
}
const
{
success
}
=
await
sendWebNetWithToken
(
WebNetName
.
doAssist
,
{
inviteCode
},
null
,
null
,
false
);
if
(
success
)
{
// 助力
showToast
(
`已成功为您的好友助力\n您也得到1次挑战次数哦~`
)
async
doAssist
()
{
}
const
inviteCode
=
getUrlParam
(
"inviteCode"
)
history
.
replaceState
({},
''
,
location
.
href
.
replace
(
new
RegExp
(
`[?&]inviteCode=[^&]*`
),
''
));
if
(
!
inviteCode
)
return
false
;
}
const
{
success
}
=
await
sendWebNetWithToken
(
WebNetName
.
doAssist
,
{
inviteCode
},
null
,
null
,
false
);
if
(
success
)
{
showToast
(
`已成功为您的好友助力\n您也得到1次挑战次数哦~`
)
}
history
.
replaceState
({},
''
,
location
.
href
.
replace
(
new
RegExp
(
`[?&]inviteCode=[^&]*`
),
''
));
}
}
}
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