import{a as e,aI as a,ai as t,aJ as i,i as o,aK as s,u as r}from"./index-90c12cc1.js";import{u as l}from"./useShearPlate.4a901d40.js";import{u as n}from"./useInterface.bd4f041a.js";import{a as u}from"./utils.80a0ac72.js";const{setData:c}=l(),{toast:I}=n(),d={HOME:"h",GOODS_DETAIL:"g",DISTRIBUTION_GOODS:"dg",INVITATION_USER:"u",DISTRIBUTION_USER:"d",GROUP_BY:"gb"},g={[d.HOME]:"/pages/home/home",[d.GOODS_DETAIL]:"/pages/goodsDetail/goodsDetail",[d.DISTRIBUTION_GOODS]:"/pages/goodsDetail/goodsDetail",[d.INVITATION_USER]:"/pages/login/index",[d.DISTRIBUTION_USER]:"/views/distribution/center/index",[d.GROUP_BY]:"/views/activity/groupBy/detail"};function p(){const s=e({title:a,path:"pages/share/index",imageUrl:"",query:"",pathQuery:"pages/share/index"}),r=e=>{s.value.query=e,s.value.pathQuery=`${s.value.path}?${e}`},l=(e,a)=>{const t=i({t:e,...a});return console.log(t),`${t}`};return{shareInfo:s,shareH5:(e=1)=>{t(),m(s.value)},setQuery:r,shareAppMessage:()=>Promise.resolve({title:s.value.title,path:s.value.pathQuery,imageUrl:s.value.imageUrl}),shareTimeline:()=>({title:s.value.title,path:s.value.pathQuery,imageUrl:s.value.imageUrl}),packageParameter:l,defaultShare:()=>{o(s).title=a,o(s).imageUrl="",r(l(d.HOME,{}))},goodsDetailShare:e=>{o(s).title=e.storeName,o(s).imageUrl=e.image,console.log(s),r(l(d.GOODS_DETAIL,{id:e.id}))},distributionGoodsDetailShare:(e,a)=>{o(s).title=e.storeName,o(s).imageUrl=e.image,r(l(d.DISTRIBUTION_GOODS,{id:e.id,uid:a}))},distributionShare:e=>(o(s).title="您的好友邀请您使用YShop",o(s).imageUrl="https://b2c-pro-static-dev.zkthink.com/static/icon/logo.png",r(l(d.DISTRIBUTION_USER,{id:e})),s.value),userInvitationShare:e=>(o(s).title="您的好友邀请您使用YShop",o(s).imageUrl="https://b2c-pro-static-dev.zkthink.com/static/icon/logo.png",r(l(d.INVITATION_USER,{code:e})),s.value),groupByInvitationShare:e=>{var a,t,i;const n=(null==(i=null==(t=null==(a=null==e?void 0:e.cartInfo)?void 0:a[0])?void 0:t.productInfo)?void 0:i.image)||"https://b2c-pro-static-dev.zkthink.com/static/icon/logo.png";return o(s).title="您的好友邀请您参与拼团",o(s).imageUrl=n,r(l(d.GROUP_BY,{id:e.teamworkId})),s.value}}}const h=()=>{const{push:a,pushToTab:t}=r(),i=e({t:""});return{params:i,analysisParams:async function(e){console.log("分享参数----",e),e.scene?i.value=u(decodeURIComponent(e.scene)):i.value=e,await async function(){switch(o(i).t){case d.GOODS_DETAIL:case d.INVITATION_USER:case d.DISTRIBUTION_GOODS:case d.DISTRIBUTION_USER:case d.GROUP_BY:!function(){const e=g[o(i).t];e&&a({url:e},{data:o(i),type:"redirectTo"})}();break;default:t({url:"/root/index/index"})}}()}}},m=async(e,a=1)=>{const t=`${s}${e.pathQuery}`;await c(t),I({title:"已复制，快去分享链接分享给小伙伴吧~"})};export{d as S,h as a,p as u};
