海报:完善商品海报分享
This commit is contained in:
@@ -19,7 +19,6 @@ const getShareInfo = (
|
||||
title: '', // 自定义分享标题
|
||||
desc: '', // 自定义描述
|
||||
image: '', // 自定义分享图片
|
||||
path: '', // 页面基础路径,不要以 / 开头
|
||||
params: {}, // 自定义分享参数
|
||||
},
|
||||
poster = {
|
||||
@@ -46,6 +45,8 @@ const getShareInfo = (
|
||||
|
||||
// 配置分享链接地址
|
||||
shareInfo.link = buildSpmLink(query, shareConfig.linkAddress);
|
||||
// 配置页面地址带参数
|
||||
shareInfo.path = buildSpmPath(query);
|
||||
|
||||
// 配置转发参数
|
||||
if (shareConfig.methods.includes('forward')) {
|
||||
@@ -59,8 +60,7 @@ const getShareInfo = (
|
||||
shareInfo.desc = scene.desc || shareConfig.forwardInfo.subtitle;
|
||||
shareInfo.path = buildSpmPath(scene.path, query);
|
||||
}
|
||||
shareInfo.path = scene.path;
|
||||
console.log('shareInfo', shareInfo);
|
||||
|
||||
return shareInfo;
|
||||
};
|
||||
|
||||
@@ -70,7 +70,6 @@ const buildSpmQuery = (params) => {
|
||||
let shareId = '0'; // 设置分享者用户ID
|
||||
if (typeof params.shareId === 'undefined') {
|
||||
if (user.isLogin) {
|
||||
// todo @芋艿 id为空
|
||||
shareId = user.userInfo.id;
|
||||
}
|
||||
}
|
||||
@@ -91,9 +90,11 @@ const buildSpmQuery = (params) => {
|
||||
return `spm=${shareId}.${page}.${query}.${platform}.${from}`;
|
||||
};
|
||||
|
||||
// 构造页面分享参数
|
||||
const buildSpmPath = (path, query) => {
|
||||
return `/${path}?${query}`;
|
||||
// 构造页面分享参数: 所有的分享都先到首页进行 spm 参数解析
|
||||
const buildSpmPath = (query) => {
|
||||
// 默认是主页,页面 page,例如 pages/index/index,根路径前不要填加 /,
|
||||
// 不能携带参数(参数请放在scene字段里),如果不填写这个字段,默认跳主页面。scancode_time为系统保留参数,不允许配置
|
||||
return `pages/index/index`;
|
||||
};
|
||||
|
||||
// 构造分享链接
|
||||
|
||||
Reference in New Issue
Block a user