feat(分享): 添加新闻详情页的微信小程序分享功能
在indexNewsInfo.vue中添加微信小程序分享功能,包含用户类型、手机号和ID等信息。同时注释掉index.html中重复的分享代码以避免冲突。
This commit is contained in:
parent
b492406f7b
commit
11fdfc16c6
16
index.html
16
index.html
|
|
@ -19,14 +19,14 @@
|
||||||
console.log("🚀 ~ window.location.href:", window.location.href);
|
console.log("🚀 ~ window.location.href:", window.location.href);
|
||||||
|
|
||||||
const urlParams = parseUrlParams();
|
const urlParams = parseUrlParams();
|
||||||
wx.miniProgram.postMessage({
|
// wx.miniProgram.postMessage({
|
||||||
data: {
|
// data: {
|
||||||
type: "share_info",
|
// type: "share_info",
|
||||||
userType: urlParams?.userType || null,
|
// userType: urlParams?.userType || null,
|
||||||
phone: urlParams?.phone || null,
|
// phone: urlParams?.phone || null,
|
||||||
id: urlParams?.id || null,
|
// id: urlParams?.id || null,
|
||||||
},
|
// },
|
||||||
});
|
// });
|
||||||
|
|
||||||
// const currentRoute = getCurrentRoute();
|
// const currentRoute = getCurrentRoute();
|
||||||
// console.log("当前纯路由地址:", currentRoute); // 输出:/pages/detail/indexNewsInfo
|
// console.log("当前纯路由地址:", currentRoute); // 输出:/pages/detail/indexNewsInfo
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,19 @@ onLoad(async (option: any) => {
|
||||||
columnName.value = res.data.columnName1;
|
columnName.value = res.data.columnName1;
|
||||||
newList(res.data.columnId1);
|
newList(res.data.columnId1);
|
||||||
wxShare();
|
wxShare();
|
||||||
|
|
||||||
|
wx.miniProgram.postMessage({
|
||||||
|
data: {
|
||||||
|
type: "share_info",
|
||||||
|
userType: option?.userType || null,
|
||||||
|
phone: option?.phone || null,
|
||||||
|
id: option?.id || null,
|
||||||
|
|
||||||
|
path: "https://cankao.cs.com.cn/jnh/#/pages/detail/indexNewsInfo",
|
||||||
|
title: data.value.title,
|
||||||
|
imageUrl: "",
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (option?.phone) {
|
if (option?.phone) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue