封装分享功能

This commit is contained in:
2026-01-21 09:40:31 +08:00
parent a125995808
commit c60a2115ea
7 changed files with 1423 additions and 945 deletions

View File

@@ -749,7 +749,7 @@
useCartStore
} from '@/stores/order.js';
import {
computed, provide
computed, provide, reactive
} from 'vue';
const cartStore = useCartStore();
/**
@@ -2436,28 +2436,51 @@
}
});
}
import {
shareMixin,
handleMixinOnLoad,returnQuery
} from '@/utils/share.js'
defineOptions({
mixins: [shareMixin],
});
onShareAppMessage((res)=>{
let query=returnQuery()
query+='&type=beforehand'
return {
...res,
...query,
path: '/pages/product/index' + '?' + query,
query,
}
})
const pageOptions=reactive({})
onLoad(async (e) => {
Object.assign(pageOptions,e)
if (e.type) {
orderType.value = e.type;
}
//获取用户信息
const userInfo = await APIshopUserInfo({
shopId: uni.cache.get('shopId')
})
//获取店铺信息
const shopInfoRes = await APIusershopInfodetail({
shopId: uni.cache.get('shopId')
});
await handleMixinOnLoad(e)
const userInfo= userStore.userInfo
const shopInfoRes=userStore.shopInfo
// //获取用户信息
// const userInfo = await APIshopUserInfo({
// shopId: uni.cache.get('shopId')
// })
// //获取店铺信息
// const shopInfoRes = await APIusershopInfodetail({
// shopId: uni.cache.get('shopId')
// });
if (shopInfoRes && shopInfoRes.shopInfo) {
Object.assign(shopInfo, shopInfoRes.shopInfo);
uni.cache.set('shopInfo', shopInfoRes.shopInfo)
}
if (userInfo && typeof userInfo === 'object') {
shopUserInfo.value = userInfo
uni.cache.set('shopUserInfo', userInfo)
}
await productqueryProduct();