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