var P=Object.defineProperty,W=Object.defineProperties;var q=Object.getOwnPropertyDescriptors;var A=Object.getOwnPropertySymbols;var G=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var B=(i,t,a)=>t in i?P(i,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):i[t]=a,F=(i,t)=>{for(var a in t||(t={}))G.call(t,a)&&B(i,a,t[a]);if(A)for(var a of A(t))O.call(t,a)&&B(i,a,t[a]);return i},E=(i,t)=>W(i,q(t));var g=(i,t,a)=>new Promise((T,o)=>{var c=r=>{try{y(a.next(r))}catch(f){o(f)}},m=r=>{try{y(a.throw(r))}catch(f){o(f)}},y=r=>r.done?T(r.value):Promise.resolve(r.value).then(c,m);y((a=a.apply(i,t)).next())});import{d as z,f as u,o as Y,a2 as k,a3 as x,a4 as l,k as M,ac as L,u as n,a5 as U,V as S,a6 as H}from"./vue-vendor-CxLCUzY4.js";import{j as J,k as K,l as Q}from"./UserSetting.api-B2NdllNJ.js";import{C as R,ab as X,aY as Z,u as ee}from"./index-Cy4uayzW.js";import{bm as se,bn as te,M as ae,bc as ne}from"./antd-vue-vendor-CahNzUUa.js";import"./vxe-table-vendor-Cdi8WfTx.js";const ie={class:"account-row-item"},le={key:0,class:"gray-75",style:{"margin-left":"8px"}},oe={class:"account-row-item"},re={key:0,class:"gray-75",style:{"margin-left":"8px"}},ce=z({name:"we-chat-ding-setting"}),ve=z(E(F({},ce),{setup(i){const{prefixCls:t}=R("j-user-tenant-setting-container"),a=se({scriptUrl:"//at.alicdn.com/t/font_2316098_umqusozousr.js"}),T=X(),o=u({}),c=u({}),m=u({}),y=Z(),r=u(""),f=u(""),de=u({}),{createMessage:p}=ee(),v=u(""),h=u("");function D(){return g(this,null,function*(){let e=yield J({thirdType:"wechat_open,dingtalk,wechat_enterprise"});if(o.value="",c.value="",m.value="",e&&e.result){let s=e.result;for(let d=0;d<s.length;d++)C(s[d])}})}function ue(){let e=n(m);e.sysUserId?_({sysUserId:e.sysUserId,id:e.id},"企业微信"):b("wechat_enterprise")}function V(){let e=n(c);e.sysUserId?_({sysUserId:e.sysUserId,id:e.id},"钉钉"):b("dingtalk")}function $(){let e=n(o);e.sysUserId?_({sysUserId:e.sysUserId,id:e.id},"微信"):b("wechat_open")}function b(e){let s=`${y.uploadUrl}/sys/thirdLogin/render/${e}`;n(v)&&(v.value.close(),window.removeEventListener("message",n(h),!1)),v.value=window.open(s,`login ${e}`,"height=500, width=500, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, resizable=no,location=n o, status=no"),r.value=e,h.value=function(d){return g(this,null,function*(){let w=d.data;if(typeof w=="string")if(w==="登录失败")I();else if(w.includes("绑定手机号")){let N=w.split(",");f.value=N[1],yield j()}else w&&p.warning("该敲敲云账号已被其它第三方账号绑定,请解绑或绑定其它敲敲云账号");else I();window.removeEventListener("message",n(h),!1),v.value=""})},window.addEventListener("message",n(h),!1)}function j(){return g(this,null,function*(){if(!n(f)){I();return}let e={thirdUserUuid:n(f),thirdType:n(r)};yield K(e).then(s=>{s.success?s.result&&C(s.result):p.warning(s.message)}).catch(s=>{p.warning(s.message)})})}function I(){p.warning("第三方账号绑定异常")}function C(e){let s=e.thirdType;s=="wechat_open"?o.value=e:s=="dingtalk"?c.value=e:s=="wechat_enterprise"&&(m.value=e)}function _(e,s){return g(this,null,function*(){ae.confirm({title:"解绑"+s,content:"确定要解绑吗",okText:"确认",cancelText:"取消",onOk:()=>g(this,null,function*(){yield Q(e).then(d=>{d.success?(D(),p.success(d.message)):p.warning(d.message)})})})})}return Y(()=>{D()}),(e,s)=>(k(),x("div",{class:H([`${n(t)}`])},[s[4]||(s[4]=l("div",{class:"my-account"},"第三方APP",-1)),l("div",ie,[s[1]||(s[1]=l("div",{class:"account-label gray-75"},"钉钉绑定",-1)),l("span",null,[M(n(te),{style:L(c.value.sysUserId?{color:"#007FFF"}:{color:"#9e9e9e"}),class:"item-icon"},null,8,["style"]),s[0]||(s[0]=l("span",{class:"gray-75",style:{"margin-left":"12px"}},"钉钉",-1)),c.value.realname?(k(),x("span",le,U("已绑定："+c.value.realname),1)):S("",!0),l("span",{class:"blue-e5 pointer",style:{"margin-left":"24px"},onClick:V},U(c.value.sysUserId?"解绑":"绑定"),1)])]),l("div",oe,[s[3]||(s[3]=l("div",{class:"account-label gray-75"},"账号绑定",-1)),l("span",null,[M(n(ne),{style:L(o.value.sysUserId?{color:"#1ec563"}:{color:"#9e9e9e"}),class:"item-icon"},null,8,["style"]),s[2]||(s[2]=l("span",{class:"gray-75",style:{"margin-left":"12px"}},"微信",-1)),o.value.realname?(k(),x("span",re,U("已绑定："+o.value.realname),1)):S("",!0),l("span",{class:"blue-e5 pointer",style:{"margin-left":"24px"},onClick:$},U(o.value.sysUserId?"解绑":"绑定"),1)])])],2))}}));export{ve as default};
