UserSocial-5eda4a28.js 2.7 KB

1
  1. import{ar as u,d as R,r as h,K as N,l as P,M as z,o as m,x as j,w as d,g as i,h as v,t as B,c as w,F as U,n as g,a as D,H as F,I as H,_ as K,__tla as L}from"./index-52b99925.js";import{_ as M,__tla as $}from"./XTextButton-a516e36a.js";import{S as k}from"./constants-637baed6.js";import{g as A,__tla as E}from"./profile-291e4f74.js";import{u as G,__tla as J}from"./useMessage-c41e583e.js";import{__tla as O}from"./XTextButton.vue_vue_type_style_index_0_scoped_bd4a9e34_lang-b6494012.js";let C,Q=Promise.all([(()=>{try{return L}catch{}})(),(()=>{try{return $}catch{}})(),(()=>{try{return E}catch{}})(),(()=>{try{return J}catch{}})(),(()=>{try{return O}catch{}})()]).then(async()=>{let _,y;_=["src"],y={class:"mr-5"},C=K(R({name:"UserSocial",__name:"UserSocial",props:{activeName:{type:String,required:!0}},emits:["update:activeName"],setup(T,{emit:b}){const f=G(),n=h([]),o=h(),c=N(),S=b,x=()=>{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,p)=>u.post({url:"/system/social-user/bind",data:{type:l,code:r,state:p}}))(a,e,s).then(()=>{f.success("\u7ED1\u5B9A\u6210\u529F"),S("update:activeName","userSocial")})},q=a=>{const t=location.origin+"/user/profile?"+encodeURIComponent(`type=${a.type}`);((e,s)=>u.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,u.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,()=>{x()},{immediate:!0}),(a,t)=>{const e=F,s=M,l=H;return m(),j(l,{data:D(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,B(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: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"])}}}),[["__file","D:/zx/mall-newfeifan-zx-admin/src/views/Profile/components/UserSocial.vue"]])});export{Q as __tla,C as default};