Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
business-assistant
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit d065a67c
authored
Oct 12, 2022
by
李伟康
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
增加全局分享
1 parent
f9dfabb8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
4 deletions
app.js
login/index/index.js
utils/share.js
app.js
View file @
d065a67
...
...
@@ -25,6 +25,7 @@ promisifyAll()
import
{
Storage
}
from
'./utils/cache/storage'
const
$Storage
=
new
Storage
()
import
'./utils/share'
App
({
onLaunch
(
options
)
{
/**挂载到wx对象 */
...
...
login/index/index.js
View file @
d065a67
...
...
@@ -56,9 +56,7 @@ Page({
/**
* 用户点击右上角分享
*/
// onShareAppMessage() {
// },
// onShareAppMessage() {},
checkLoginBtn
(
disabled
=
false
)
{
const
{
loginType
...
...
@@ -76,5 +74,5 @@ Page({
this
.
setData
({
disabled
:
!
disabled
})
}
,
}
})
\ No newline at end of file
utils/share.js
0 → 100644
View file @
d065a67
class
Share
{
constructor
()
{
console
.
log
(
'---------------- 分享初始化 ----------------'
)
this
.
initPageProxy
()
}
/**全局注册事件 */
initPageProxy
()
{
let
thisPage
=
Page
let
_this
=
this
Page
=
function
(
el
)
{
try
{
el
||
(
el
=
{}),
_this
.
pageLeaveProxy
(
el
),
thisPage
.
apply
(
this
,
arguments
)
}
catch
(
el
)
{
thisPage
.
apply
(
this
,
arguments
)
}
}
}
/**设置全局分享 */
pageLeaveProxy
(
page
)
{
if
(
page
.
onShareAppMessage
)
{
page
.
onShareAppMessage
=
function
()
{
let
{
shareTitle
,
sharePath
,
shareImage
,
shareQuery
}
=
this
if
(
!
sharePath
)
{
let
url
=
`/
${
this
.
route
}
`
if
(
shareQuery
)
url
+=
`?
${
shareQuery
}
`
sharePath
=
`login/loading/loading?url=
${
encodeURIComponent
(
url
)}
`
}
return
{
title
:
shareTitle
,
path
:
`/
${
sharePath
}
`
,
imageUrl
:
shareImage
}
}
}
}
}
wx
.
$share
=
new
Share
()
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment