UserSocial-9b767bdf.js 2.7 KB

1
  1. import{az as u,d as N,r as h,$ as x,b as B,w as P,o as m,A as $,B as d,f as i,C as v,G as j,c as w,F as U,E as g,a as z,X as A,Y as E,__tla as F}from"./index-e8bff8cb.js";import{_ as G,__tla as L}from"./XTextButton-9dc8dc8d.js";import{S as C}from"./constants-c811e5ff.js";import{g as X,__tla as Y}from"./profile-d2a945c4.js";import{u as D,__tla as H}from"./useMessage-de42a595.js";import{__tla as J}from"./XTextButton.vue_vue_type_style_index_0_scoped_7561ab3f_lang-04ea9e1b.js";import"./_plugin-vue_export-helper-1b428a4d.js";let k,K=Promise.all([(()=>{try{return F}catch{}})(),(()=>{try{return L}catch{}})(),(()=>{try{return Y}catch{}})(),(()=>{try{return H}catch{}})(),(()=>{try{return J}catch{}})()]).then(async()=>{let _,y;_=["src"],y={class:"mr-5"},k=N({name:"UserSocial",__name:"UserSocial",props:{activeName:{}},emits:["update:activeName"],setup(M,{emit:b}){const f=D(),c=h([]),l=h(),n=x(),R=b,S=()=>{const t=(e="type",new URL(decodeURIComponent(location.href)).searchParams.get(e)??"");var e;const a=n.query.code,s=n.query.state;a&&((o,r,p)=>u.post({url:"/system/social-user/bind",data:{type:o,code:r,state:p}}))(t,a,s).then(()=>{f.success("\u7ED1\u5B9A\u6210\u529F"),R("update:activeName","userSocial")})},q=t=>{const e=location.origin+"/user/profile?"+encodeURIComponent(`type=${t.type}`);((a,s)=>u.get({url:"/system/auth/social-auth-redirect?type="+a+"&redirectUri="+s}))(t.type,encodeURIComponent(e)).then(a=>{window.location.href=a})},I=async t=>{var e,a;await(e=t.type,a=t.openid,u.delete({url:"/system/social-user/unbind",data:{type:e,openid:a}}))&&(t.openid=void 0),f.success("\u89E3\u7ED1\u6210\u529F")};return B(async()=>{await(async()=>{var e;c.value=[];const t=await X();l.value=t;for(const a in C){const s={...C[a]};if(c.value.push(s),(e=l.value)==null?void 0:e.socialUsers){for(const o in l.value.socialUsers)if(s.type===l.value.socialUsers[o].type){s.openid=l.value.socialUsers[o].openid;break}}}})()}),P(()=>n,()=>{S()},{immediate:!0}),(t,e)=>{const a=A,s=G,o=E;return m(),$(o,{data:z(c),"show-header":!1},{default:d(()=>[i(a,{fixed:"left",title:"\u5E8F\u53F7",type:"seq",width:"60"}),i(a,{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,j(r.title),1)]),_:1}),i(a,{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:p=>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:p=>q(r)},null,8,["onClick"])],64))]),_:1})]),_:1},8,["data"])}}})});export{K as __tla,k as default};