Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
saas_plus
/
store-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 39d4ccbc
authored
Oct 20, 2022
by
前端
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge branch 'zq_dev_3.0' into 'v3.0'
Zq dev 3.0 See merge request
!45
2 parents
839bbbb9
f20e3e17
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
7 deletions
pages/checkProduct/checkProduct.js
pages/checkProduct/checkProduct.wxml
router/router.js
utils/share.js
pages/checkProduct/checkProduct.js
View file @
39d4ccb
...
@@ -171,14 +171,18 @@ Page({
...
@@ -171,14 +171,18 @@ Page({
});
});
},
},
onRoute
(
options
)
{
onRoute
(
options
)
{
console
.
log
(
"options: "
,
options
);
wx
.
nextTick
(()
=>
{
let
{
actNum
,
activeNavIdx
,
fromLocal
}
=
options
let
{
actNum
,
activeNavIdx
,
fromLocal
}
=
this
.
options
this
.
shareQuery
=
`actNum=
${
actNum
}
&activeNavIdx=
${
activeNavIdx
}
`
console
.
log
(
" this.options: "
,
this
.
options
);
this
.
setData
({
this
.
setData
({
actNum
,
actNum
,
activeNavIdx
,
activeNavIdx
,
fromLocal
fromLocal
})
})
this
.
createImg
()
this
.
createImg
()
})
},
},
noPageAuth
:
true
,
noPageAuth
:
true
,
...
@@ -186,7 +190,7 @@ Page({
...
@@ -186,7 +190,7 @@ Page({
* 生命周期函数--监听页面加载
* 生命周期函数--监听页面加载
*/
*/
onLoad
(
options
)
{
onLoad
(
options
)
{
console
.
log
(
options
,
'onLoad'
)
},
},
/**
/**
...
@@ -198,6 +202,7 @@ Page({
...
@@ -198,6 +202,7 @@ Page({
* 生命周期函数--监听页面显示
* 生命周期函数--监听页面显示
*/
*/
onShow
(
options
)
{},
onShow
(
options
)
{},
onShareTimeline
()
{},
/**
/**
* 生命周期函数--监听页面隐藏
* 生命周期函数--监听页面隐藏
...
...
pages/checkProduct/checkProduct.wxml
View file @
39d4ccb
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<product actNum="{{actNum}}" navIdx="{{activeNavIdx}}" senceData="{{senceData}}" isShare="{{true}}"/>
<!-- 分享弹框 -->
<!-- 分享弹框 -->
<view class="share-wrap" wx:if="{{isShow}}">
<view class="share-wrap" wx:if="{{isShow
&& fromLocal==1
}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
<view class="img-wrap" wx:if="{{posterUrl}}">
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" bindload="onloadFn" />
<image class="img" style="height:{{imgH}}rpx" src="{{posterUrl}}" bindload="onloadFn" />
<!-- <block wx:for="{{imgList}}" wx:key="*this">
<!-- <block wx:for="{{imgList}}" wx:key="*this">
...
...
router/router.js
View file @
39d4ccb
...
@@ -15,8 +15,8 @@ class Router {
...
@@ -15,8 +15,8 @@ class Router {
wx
.
onAppRoute
(
e
=>
{
wx
.
onAppRoute
(
e
=>
{
let
thisPage
=
this
.
getPageInstance
()
let
thisPage
=
this
.
getPageInstance
()
if
(
thisPage
)
{
if
(
thisPage
)
{
thisPage
.
options
=
this
[
_query
]
thisPage
.
setData
({
IMGURL
:
IMG_URL
})
thisPage
.
setData
({
IMGURL
:
IMG_URL
})
if
(
Object
.
keys
(
this
[
_query
]).
length
)
thisPage
.
options
=
this
[
_query
]
this
.
setNavigationBarTitleText
(
thisPage
)
this
.
setNavigationBarTitleText
(
thisPage
)
let
onRoute
=
thisPage
.
onRoute
let
onRoute
=
thisPage
.
onRoute
typeof
onRoute
===
'function'
&&
onRoute
(
this
[
_query
])
typeof
onRoute
===
'function'
&&
onRoute
(
this
[
_query
])
...
...
utils/share.js
View file @
39d4ccb
...
@@ -4,8 +4,16 @@
...
@@ -4,8 +4,16 @@
* @param {*} shareImage 分享图片 不传默认当前页面截图
* @param {*} shareImage 分享图片 不传默认当前页面截图
* @param {*} shareQuery 分享页面参数
* @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @param {*} shareFun 分享页面
* @param {*} shareTrackData 分享埋点数据
* @param {*} onViewTrack 开启浏览埋点
* @returns
* @returns
*/
*/
// import {
// reportData
// } from '~/api/index.js'
// import USERAPI from '~/api/usersApi/index'
class
Share
{
class
Share
{
constructor
()
{
constructor
()
{
console
.
log
(
'---------------- 分享初始化 ----------------'
)
console
.
log
(
'---------------- 分享初始化 ----------------'
)
...
@@ -23,22 +31,31 @@ class Share {
...
@@ -23,22 +31,31 @@ class Share {
}
}
}
}
}
}
/**设置全局分享 */
/**设置全局分享 */
pageLeaveProxy
(
page
)
{
pageLeaveProxy
(
page
)
{
const
onLoad
=
page
.
onLoad
,
that
=
this
if
(
page
.
onShareAppMessage
)
{
if
(
page
.
onShareAppMessage
)
{
const
that
=
this
page
.
onShareAppMessage
=
function
()
{
page
.
onShareAppMessage
=
function
()
{
let
{
let
{
shareTitle
,
shareTitle
,
sharePath
,
sharePath
,
shareImage
,
shareImage
,
shareQuery
,
shareQuery
,
noPageAuth
=
true
noPageAuth
,
shareFun
,
shareTrackData
}
=
this
,
}
=
this
,
path
=
`/
${
this
.
route
}
`
path
=
`/
${
this
.
route
}
`
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
if
(
sharePath
)
path
=
`/
${
sharePath
}
`
// path += that.setCommonShareQuery()
if
(
shareQuery
)
path
+=
`?
${
shareQuery
}
`
if
(
shareQuery
)
path
+=
`?
${
shareQuery
}
`
console
.
log
(
'::'
,
path
)
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
if
(
!
noPageAuth
)
path
=
`/login/loading/loading?url=
${
encodeURIComponent
(
path
)}
`
console
.
log
(
path
)
if
(
shareFun
)
shareFun
()
// if (shareTrackData) that.reportShareData(shareTrackData)
return
{
return
{
path
,
path
,
title
:
shareTitle
,
title
:
shareTitle
,
...
@@ -46,7 +63,62 @@ class Share {
...
@@ -46,7 +63,62 @@ class Share {
}
}
}
}
}
}
if
(
page
.
onShareTimeline
)
{
page
.
onShareTimeline
=
function
()
{
let
{
shareTitle
,
shareImage
,
shareQuery
,
shareFun
,
shareTrackData
}
=
this
if
(
shareFun
)
shareFun
()
// if (shareTrackData) that.reportShareData(shareTrackData)
// shareQuery = that.setCommonShareQuery(shareQuery)
console
.
log
(
shareQuery
)
return
{
query
:
shareQuery
,
title
:
shareTitle
,
imageUrl
:
shareImage
}
}
}
}
}
getCommonData
()
{
const
WXUSERINFO
=
wx
.
$storage
.
get
(
'wx_user_info'
),
USERINFO
=
wx
.
$storage
.
get
(
'userInfo'
)
return
{
WXUSERINFO
,
USERINFO
}
}
setCommonShareQuery
(
query
)
{
const
{
WXUSERINFO
,
USERINFO
}
=
this
.
getCommonData
()
query
=
`
${
query
?
`?
${
query
}
&`
:
'?'
}
merchantId=
${
USERINFO
.
merchantId
}
&shareOpenId=
${
WXUSERINFO
.
openId
}
`
if
(
USERINFO
.
phone
)
query
+=
`&sharePhone=
${
USERINFO
.
phone
}
`
return
query
}
reportShareData
(
shareTrackData
)
{
const
{
WXUSERINFO
,
USERINFO
}
=
this
.
getCommonData
(),
thisPage
=
wx
.
$router
.
getPageInstance
()
reportData
({
openId
:
WXUSERINFO
.
openId
||
''
,
unionId
:
WXUSERINFO
.
unionId
||
''
,
nickName
:
WXUSERINFO
.
nickName
||
''
,
avatar
:
WXUSERINFO
.
avatarUrl
||
''
,
phone
:
USERINFO
.
phone
||
''
,
merchantId
:
thisPage
.
merchantId
||
USERINFO
.
merchantId
||
''
,
shareOpenId
:
thisPage
.
shareOpenId
||
WXUSERINFO
.
openId
||
''
,
sharePhone
:
thisPage
.
sharePhone
||
USERINFO
.
phone
||
''
,
...
shareTrackData
})
}
}
}
new
Share
()
new
Share
()
\ No newline at end of file
\ 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