Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hzlh-beautifulFunFestival-snake-20241222
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
hzlh-beautifulFunFestival-snake-20241222
Commits
56007b4b
Commit
56007b4b
authored
Dec 25, 2024
by
俞嘉婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 微信分享
parent
43600382
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
13 deletions
+97
-13
ShareCenter.ts
...lFunFestival-snake-20241222/assets/Scripts/ShareCenter.ts
+7
-13
Share.ts
...lFunFestival-snake-20241222/assets/Scripts/Utils/Share.ts
+78
-0
Share.ts.meta
...estival-snake-20241222/assets/Scripts/Utils/Share.ts.meta
+9
-0
Start.ts
...beautifulFunFestival-snake-20241222/assets/Start/Start.ts
+3
-0
No files found.
hzlh-beautifulFunFestival-snake-20241222/assets/Scripts/ShareCenter.ts
View file @
56007b4b
import
{
showPanel
,
showToast
}
from
"../Module/UIFast"
;
import
{
wxShare
}
from
"./Utils/Share"
;
import
{
getUrlParam
}
from
"./Utils/Utils"
;
import
{
WebNetName
,
getWebData
,
sendWebNet
,
sendWebNetWithToken
,
getProjectId
}
from
"./Utils/WebNet/WebNet"
;
import
{
UIMgr
}
from
"db://assets/Module/UIMgr"
;
...
...
@@ -34,21 +35,14 @@ export default class ShareCenter {
const
inviteInfo
=
shareInfo
.
filter
(
item
=>
item
.
type
==
type
)[
0
]
if
(
this
.
isWeChat
())
{
UIMgr
.
ins
.
showShare
();
// FISH_TODO
// onUpdateShare({
// title: inviteInfo?.title,
// content: inviteInfo?.content,
// url: url,
// thumbnail: inviteInfo?.thumbnail,
// });
wxShare
({
title
:
inviteInfo
?.
title
,
content
:
inviteInfo
?.
content
,
url
:
url
,
thumbnail
:
inviteInfo
?.
thumbnail
,
});
return
;
}
console
.
info
({
title
:
inviteInfo
?.
title
,
content
:
inviteInfo
?.
content
,
url
:
url
,
thumbnail
:
inviteInfo
?.
thumbnail
,
});
if
(
type
==
'main'
)
return
;
//初始化拦截
// @ts-ignore
MFS
.
share
({
...
...
hzlh-beautifulFunFestival-snake-20241222/assets/Scripts/Utils/Share.ts
0 → 100644
View file @
56007b4b
// 更新分享
export
function
wxShare
(
shareOpt
)
{
const
{
title
,
content
,
url
,
thumbnail
}
=
shareOpt
||
{};
let
share
=
{
title
,
desc
:
content
,
link
:
url
,
imgUrl
:
thumbnail
};
console
.
info
(
'wxShare分享信息'
,
share
)
// @ts-ignore
wx
.
onMenuShareTimeline
({
title
:
share
.
title
,
desc
:
share
.
desc
,
link
:
share
.
link
,
imgUrl
:
share
.
imgUrl
,
success
:
function
()
{
},
cancel
:
function
()
{
}
});
// @ts-ignore
wx
.
onMenuShareAppMessage
({
title
:
share
.
title
,
desc
:
share
.
desc
,
link
:
share
.
link
,
imgUrl
:
share
.
imgUrl
,
success
:
function
()
{
},
cancel
:
function
()
{
}
});
}
// 初始化微信分享
export
function
initWx
(
url
=
location
.
href
)
{
return
new
Promise
(
function
(
resolve
)
{
$
.
ajax
({
type
:
'get'
,
url
:
'/wechatShare/getShareInfo/v2'
,
data
:
{
wxdebug
:
false
,
url
:
url
},
cache
:
false
,
dataType
:
'json'
,
success
:
function
(
res
)
{
if
(
!
res
.
success
)
{
resolve
(
false
)
return
;
}
// @ts-ignore
wx
.
config
({
debug
:
false
,
appId
:
res
.
wxappid
,
timestamp
:
res
.
wxtimestamp
,
nonceStr
:
res
.
wxnonceStr
,
signature
:
res
.
wxsignature
,
jsApiList
:
[
'checkJsApi'
,
'onMenuShareTimeline'
,
'onMenuShareAppMessage'
]
});
// @ts-ignore
wx
.
error
(
function
(
res
)
{
console
.
error
(
"wx error"
,
res
);
resolve
(
false
)
});
// @ts-ignore
wx
.
ready
(
function
()
{
resolve
(
true
)
});
},
error
:
function
(
err
)
{
resolve
(
false
)
}
});
})
}
hzlh-beautifulFunFestival-snake-20241222/assets/Scripts/Utils/Share.ts.meta
0 → 100644
View file @
56007b4b
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "9ffc1043-7bca-400a-b14b-1a81a5c8c1b2",
"files": [],
"subMetas": {},
"userData": {}
}
hzlh-beautifulFunFestival-snake-20241222/assets/Start/Start.ts
View file @
56007b4b
...
...
@@ -21,6 +21,7 @@ import store from '../Scripts/store/store';
import
{
getPreLoadList
,
preload
}
from
"../Scripts/Utils/LoaderTools"
;
import
{
runMainPage
}
from
"../Scripts/Scenes/runMain/runMainPage"
;
import
ShareCenter
from
"../Scripts/ShareCenter"
;
import
{
initWx
}
from
"../Scripts/Utils/Share"
;
const
{
ccclass
,
property
}
=
_decorator
;
...
...
@@ -67,6 +68,8 @@ export class Start extends Component {
window
.
location
.
href
=
"https://wechat.urcb.com/store/index"
// window.location.href = "https://wxyhtst.urcb.com/store/index"
}
await
initWx
();
ShareCenter
.
ins
.
doShare
(
'main'
);
}
...
...
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