分享问题修复

This commit is contained in:
2026-01-29 14:36:32 +08:00
parent 37fe706d6a
commit c0e277fd8f
2 changed files with 21 additions and 15 deletions

View File

@@ -94,34 +94,37 @@
} }
const config = reactive({}) const config = reactive({})
async function getData(id) { async function getData(id) {
const shopId = id||uni.cache.get('shopId') const pages = getCurrentPages();
const currentPage = pages[pages.length - 1];
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
const path = `/${currentPath}`;
const shopId = id||currentOptions.shopId||uni.cache.get('shopId')
// console.log('分享组件挂载完毕:shopId',shopId);
if (!shopId) { if (!shopId) {
return return
} }
shareConfig({ shareConfig({
shopId shopId
}).then(res => { }).then(res => {
// console.log('分享组件挂载完毕:shareConfig',res);
// console.log('分享组件挂载完毕:currentOptions',currentOptions);
if(res){ if(res){
Object.assign(config,res) Object.assign(config,res)
if(res.sharedUserCouponId&&res.sharedUserCouponNum&&res.isSharedUserPopup){ const pTag = returnPageTags(path)
const pages = getCurrentPages(); if(pTag&&currentOptions.fromUserId&&res.isSharedUserPopup){
const currentPage = pages[pages.length - 1]; show.value=true
const currentPath = currentPage.route;
const currentOptions = currentPage.options;
const path = `/${currentPath}`;
const pTag = returnPageTags(path)
if(pTag&&currentOptions.fromUserId){
show.value=true
}
} }
// if(res.sharedUserCouponId&&res.sharedUserCouponNum){
// }
} }
}) })
} }
watch(()=>userStore.shopInfo.id,(newval)=>{ watch(()=>userStore.shopInfo.id,(newval)=>{
if(newval){ if(newval){
// getData()
shareConfig({ shareConfig({
shopId:newval shopId:newval
}).then(res => { }).then(res => {

View File

@@ -2588,10 +2588,13 @@
const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath) const pTag=returnPageTags(shareSwiperItem.value.jumpPagePath)
let query = jsonToUrl(queryJson) let query = jsonToUrl(queryJson)
query +=('&'+shareSwiperItem.value.extendParam) query +=('&'+shareSwiperItem.value.extendParam)
const shopName = uni.cache.get('shopInfo').shopName || ''
const path=shareSwiperItem.value.jumpPagePath?shareSwiperItem.value.jumpPagePath:'/pages/product/index?type=beforehand'
console.log('path',path);
const json={ const json={
imageUrl:shareSwiperItem.value.imageUrl, imageUrl:shareSwiperItem.value.imageUrl,
path: shareSwiperItem.value.jumpPagePath+'&'+query, path: path+'&'+query,
title:shareSwiperItem.value.name, title:shareSwiperItem.value.name+ (shopName ? `-${shopName}` : ''),
} }
if(pTag==='pp-detail'){ if(pTag==='pp-detail'){
json.path=json.path.replace('goodsId','id') json.path=json.path.replace('goodsId','id')