Commit 697d9600 by 李伟康

修改分享方法

1 parent 0a6f5abe
...@@ -56,7 +56,7 @@ Page({ ...@@ -56,7 +56,7 @@ Page({
/** /**
* 用户点击右上角分享 * 用户点击右上角分享
*/ */
// onShareAppMessage() {}, onShareAppMessage() {},
checkLoginBtn(disabled = false) { checkLoginBtn(disabled = false) {
const { const {
loginType loginType
......
/** 分享
* @param {*} shareTitle 分享标题
* @param {*} sharePath 分享页面路径 不传默认当前页
* @param {*} shareImage 分享图片 不传默认当前页面截图
* @param {*} shareQuery 分享页面参数
* @param {*} noPageAuth 分享页面是否需要登录拦截
* @returns
*/
class Share { class Share {
constructor() { constructor() {
console.log('---------------- 分享初始化 ----------------') console.log('---------------- 分享初始化 ----------------')
...@@ -23,16 +31,16 @@ class Share { ...@@ -23,16 +31,16 @@ class Share {
shareTitle, shareTitle,
sharePath, sharePath,
shareImage, shareImage,
shareQuery shareQuery,
} = this noPageAuth
if (!sharePath) { } = this,
let url = `/${this.route}` path = `/${this.route}`
if (shareQuery) url += `?${shareQuery}` if (sharePath) path = `/${sharePath}`
sharePath = `login/loading/loading?url=${encodeURIComponent(url)}` if (shareQuery) path += `?${shareQuery}`
} if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
return { return {
path,
title: shareTitle, title: shareTitle,
path: `/${sharePath}`,
imageUrl: shareImage imageUrl: shareImage
} }
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!