import{ar as p,d as R,r as h,K as N,m as P,M as z,o as m,x as j,w as d,g as i,h as v,t as D,c as w,F as U,q as g,a as F,H,I as K,_ as L,__tla as M}from"./index-7d5b26d3.js";import{_ as T,__tla as $}from"./XTextButton-895a4200.js";import{S as k}from"./constants-d55a3460.js";import{g as A,__tla as B}from"./profile-d2740243.js";import{u as E,__tla as G}from"./useMessage-c81eaa5b.js";import{__tla as J}from"./XTextButton.vue_vue_type_style_index_0_scoped_bd4a9e34_lang-f375926f.js";let C,O=Promise.all([(()=>{try{return M}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return B}catch{}})(),(()=>{try{return G}catch{}})(),(()=>{try{return J}catch{}})()]).then(async()=>{let _,y;_=["src"],y={class:"mr-5"},C=L(R({name:"UserSocial",__name:"UserSocial",props:{activeName:{type:String,required:!0}},emits:["update:activeName"],setup(Q,{emit:b}){const f=E(),n=h([]),o=h(),c=N(),S=b,q=()=>{const a=(t="type",new URL(decodeURIComponent(location.href)).searchParams.get(t)??"");var t;const e=c.query.code,s=c.query.state;e&&((l,r,u)=>p.post({url:"/system/social-user/bind",data:{type:l,code:r,state:u}}))(a,e,s).then(()=>{f.success("\u7ED1\u5B9A\u6210\u529F"),S("update:activeName","userSocial")})},x=a=>{const t=location.origin+"/user/profile?"+encodeURIComponent(`type=${a.type}`);((e,s)=>p.get({url:"/system/auth/social-auth-redirect?type="+e+"&redirectUri="+s}))(a.type,encodeURIComponent(t)).then(e=>{window.location.href=e})},I=async a=>{var t,e;await(t=a.type,e=a.openid,p.delete({url:"/system/social-user/unbind",data:{type:t,openid:e}}))&&(a.openid=void 0),f.success("\u89E3\u7ED1\u6210\u529F")};return P(async()=>{await(async()=>{var t;n.value=[];const a=await A();o.value=a;for(const e in k){const s={...k[e]};if(n.value.push(s),(t=o.value)==null?void 0:t.socialUsers){for(const l in o.value.socialUsers)if(s.type===o.value.socialUsers[l].type){s.openid=o.value.socialUsers[l].openid;break}}}})()}),z(()=>c,()=>{q()},{immediate:!0}),(a,t)=>{const e=H,s=T,l=K;return m(),j(l,{data:F(n),"show-header":!1},{default:d(()=>[i(e,{fixed:"left",title:"\u5E8F\u53F7",type:"seq",width:"60"}),i(e,{align:"left",label:"\u793E\u4EA4\u5E73\u53F0",width:"120"},{default:d(({row:r})=>[v("img",{src:r.img,alt:"",class:"h-5 align-middle"},null,8,_),v("p",y,D(r.title),1)]),_:1}),i(e,{align:"center",label:"\u64CD\u4F5C"},{default:d(({row:r})=>[r.openid?(m(),w(U,{key:0},[g(" \u5DF2\u7ED1\u5B9A "),i(s,{class:"mr-5",title:"(\u89E3\u7ED1)",type:"primary",onClick:u=>I(r)},null,8,["onClick"])],64)):(m(),w(U,{key:1},[g(" \u672A\u7ED1\u5B9A "),i(s,{class:"mr-5",title:"(\u7ED1\u5B9A)",type:"primary",onClick:u=>x(r)},null,8,["onClick"])],64))]),_:1})]),_:1},8,["data"])}}}),[["__file","D:/zx/mall-newfeifan-zx-business/src/views/Profile/components/UserSocial.vue"]])});export{O as __tla,C as default};
