1 |
- import{ap as u,d as N,r as h,I as x,k as P,K as j,o as m,q as B,w as d,f as i,g as v,t as D,c as w,F as U,m as g,a as F,D as G,G as K,__tla as L}from"./index-2eab2d23.js";import{_ as $,__tla as z}from"./XTextButton-caeba438.js";import{S as k}from"./constants-40f13f5e.js";import{g as A,__tla as E}from"./profile-b4eca64a.js";import{u as H,__tla as J}from"./useMessage-171aa63e.js";import{__tla as M}from"./XTextButton.vue_vue_type_style_index_0_scoped_7561ab3f_lang-e264c7bf.js";import"./_plugin-vue_export-helper-1b428a4d.js";let C,O=Promise.all([(()=>{try{return L}catch{}})(),(()=>{try{return z}catch{}})(),(()=>{try{return E}catch{}})(),(()=>{try{return J}catch{}})(),(()=>{try{return M}catch{}})()]).then(async()=>{let _,y;_=["src"],y={class:"mr-5"},C=N({name:"UserSocial",__name:"UserSocial",props:{activeName:{}},emits:["update:activeName"],setup(Q,{emit:b}){const f=H(),c=h([]),l=h(),n=x(),q=b,I=()=>{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"),q("update:activeName","userSocial")})},R=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})},S=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 P(async()=>{await(async()=>{var e;c.value=[];const t=await A();l.value=t;for(const a in k){const s={...k[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}}}})()}),j(()=>n,()=>{I()},{immediate:!0}),(t,e)=>{const a=G,s=$,o=K;return m(),B(o,{data:F(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,D(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=>S(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=>R(r)},null,8,["onClick"])],64))]),_:1})]),_:1},8,["data"])}}})});export{O as __tla,C as default};
|