1 line
10 KiB
JavaScript
1 line
10 KiB
JavaScript
"use strict";(self["webpackChunkscui"]=self["webpackChunkscui"]||[]).push([[2077],{23986:function(e,t,a){a.r(t),a.d(t,{default:function(){return de}});var i=a(66252),s=a(3577);const n=e=>((0,i.dD)("data-v-66b315de"),e=e(),(0,i.Cn)(),e),o={class:"bindBxo"},l=n((()=>(0,i._)("div",{class:"title"},"账号绑定",-1))),c={class:"boxView"},d={class:"leftImg"},r={key:0,class:"leftIcon wechat"},u={class:"el-icon"},h={key:1,class:"leftIcon"},g={class:"nameBox"},p={key:0,class:"titleName nameRed"},m={key:1,class:"titleName"},w=n((()=>(0,i._)("div",{class:"msg"},"绑定微信,用于账号登录,客服咨询及其它消息提醒。",-1))),_={class:"rightBtn"},y=(0,i.Uk)("绑定"),k=(0,i.Uk)("解除"),v={class:"boxView"},f={class:"leftImg"},b={key:0,class:"leftIcon alipay"},I={class:"el-icon"},L={key:1,class:"leftIcon"},C={class:"nameBox"},T={key:0,class:"titleName nameRed"},S={key:1,class:"titleName"},W=n((()=>(0,i._)("div",{class:"msg"},"绑定钉钉,用于账号登录。",-1))),V={class:"rightBtn"},A=(0,i.Uk)("绑定"),D=(0,i.Uk)("解除"),U=n((()=>(0,i._)("div",{class:"title"},"安全登录",-1))),x={class:"boxView boxViewCenter"},P=n((()=>(0,i._)("div",{class:"leftBox"},"允许多地登录",-1))),N={class:"rightBox"},B=(0,i.Uk)("允许多地"),O=(0,i.Uk)("限制单设备"),$={class:"boxView boxViewCenter bandTime"},R=n((()=>(0,i._)("div",{class:"leftBox"},"系统超时安全自动退出时间",-1))),E={class:"rightBox"},K={class:"boxInput"},G=(0,i.Uk)("分钟"),j=n((()=>(0,i._)("div",{class:"tip"},"光标移出自动更新退出时间。",-1))),J=n((()=>(0,i._)("div",{class:"title"},"使用Passkey",-1))),q={class:"boxView boxViewCenter"},M={class:"nameBox passkeyView"},H=(0,i.Uk)("添加Passkey"),z=n((()=>(0,i._)("div",{class:"msg"},"借助 Passkey,你可以使用自己的指纹、面孔、屏锁设置或实体安全密钥登录你的账号。请仅在你自有的设备上设置 Passkey。",-1))),F={class:"boxView boxViewCenter"},Y={class:"itemMain"},Z={class:"icon"},Q={class:"name"},X={class:"qrCodeLogin"},ee={class:"code_container"},te=["data"],ae={key:0,class:"error"},ie=n((()=>(0,i._)("p",{class:"msg"}," 请使用微信扫一扫绑定 ",-1))),se={key:1,class:"qrCodeLogin-result"};function ne(e,t,a,n,ne,oe){const le=(0,i.up)("sc-icon-WechartRound"),ce=(0,i.up)("el-avatar"),de=(0,i.up)("el-button"),re=(0,i.up)("sc-icon-DingTalk"),ue=(0,i.up)("el-radio"),he=(0,i.up)("el-radio-group"),ge=(0,i.up)("el-input"),pe=(0,i.up)("sc-icon-Fingerprint"),me=(0,i.up)("el-card"),we=(0,i.up)("el-result"),_e=(0,i.up)("el-dialog");return(0,i.wg)(),(0,i.iD)(i.HY,null,[(0,i.Wm)(me,{shadow:"never",header:"账户安全"},{default:(0,i.w5)((()=>[(0,i._)("div",o,[l,(0,i._)("div",c,[(0,i._)("div",d,[""==ne.wechat.open_id||""==ne.wechat.avatar?((0,i.wg)(),(0,i.iD)("div",r,[(0,i._)("i",u,[(0,i.Wm)(le)])])):((0,i.wg)(),(0,i.iD)("div",h,[(0,i.Wm)(ce,{size:38,src:ne.wechat.avatar},null,8,["src"])])),(0,i._)("div",g,[""==ne.wechat.open_id?((0,i.wg)(),(0,i.iD)("div",p,"绑定微信")):((0,i.wg)(),(0,i.iD)("div",m,(0,s.toDisplayString)(""==ne.wechat.nick_name?"-":ne.wechat.nick_name),1)),w])]),(0,i._)("div",_,[""==ne.wechat.open_id?((0,i.wg)(),(0,i.j4)(de,{key:0,type:"primary",onClick:oe.bindWechat},{default:(0,i.w5)((()=>[y])),_:1},8,["onClick"])):((0,i.wg)(),(0,i.j4)(de,{key:1,type:"primary",plain:"",onClick:t[0]||(t[0]=e=>oe.secureDingTalk(1))},{default:(0,i.w5)((()=>[k])),_:1}))])]),(0,i._)("div",v,[(0,i._)("div",f,[""==ne.dingTalk.open_id||""==ne.dingTalk.avatar?((0,i.wg)(),(0,i.iD)("div",b,[(0,i._)("i",I,[(0,i.Wm)(re)])])):((0,i.wg)(),(0,i.iD)("div",L,[(0,i.Wm)(ce,{size:38,src:ne.dingTalk.avatar},null,8,["src"])])),(0,i._)("div",C,[""==ne.dingTalk.open_id?((0,i.wg)(),(0,i.iD)("div",T,"绑定钉钉")):((0,i.wg)(),(0,i.iD)("div",S,(0,s.toDisplayString)(""==ne.dingTalk.nick_name?"-":ne.dingTalk.nick_name),1)),W])]),(0,i._)("div",V,[""==ne.dingTalk.open_id?((0,i.wg)(),(0,i.j4)(de,{key:0,type:"primary",onClick:oe.bindDingTalk},{default:(0,i.w5)((()=>[A])),_:1},8,["onClick"])):((0,i.wg)(),(0,i.j4)(de,{key:1,type:"primary",plain:"",onClick:t[1]||(t[1]=e=>oe.secureDingTalk(2))},{default:(0,i.w5)((()=>[D])),_:1}))])]),U,(0,i._)("div",x,[P,(0,i._)("div",N,[(0,i.Wm)(he,{modelValue:ne.multipleLocation,"onUpdate:modelValue":t[2]||(t[2]=e=>ne.multipleLocation=e),onChange:oe.multipleLocationSet},{default:(0,i.w5)((()=>[(0,i.Wm)(ue,{label:!0},{default:(0,i.w5)((()=>[B])),_:1}),(0,i.Wm)(ue,{label:!1},{default:(0,i.w5)((()=>[O])),_:1})])),_:1},8,["modelValue","onChange"])])]),(0,i._)("div",$,[R,(0,i._)("div",E,[(0,i._)("div",K,[(0,i.Wm)(ge,{onkeyup:"value=value.replace(/[^\\d]/g,'')",onChange:oe.loginTime,"controls-position":"right",modelValue:ne.timeout,"onUpdate:modelValue":t[3]||(t[3]=e=>ne.timeout=e),placeholder:"请输入时间",style:{width:"260px"}},{suffix:(0,i.w5)((()=>[G])),_:1},8,["onChange","modelValue"])]),j])]),J,(0,i._)("div",q,[(0,i._)("div",M,[(0,i.Wm)(de,{type:"primary",onClick:oe.createPasskey},{default:(0,i.w5)((()=>[H])),_:1},8,["onClick"]),z])]),(0,i._)("div",F,[(0,i._)("div",Y,[((0,i.wg)(!0),(0,i.iD)(i.HY,null,(0,i.Ko)(ne.passKeyList,(e=>((0,i.wg)(),(0,i.iD)("div",{class:"boxCom",key:e},[(0,i._)("i",Z,[(0,i.Wm)(pe)]),(0,i._)("span",Q,[(0,i.Wm)(ge,{modelValue:e.alias,"onUpdate:modelValue":t=>e.alias=t,onChange:t=>oe.passKeyAlias(e),placeholder:"请输入"},null,8,["modelValue","onUpdate:modelValue","onChange"])])])))),128))])])])])),_:1}),(0,i.Wm)(_e,{modelValue:ne.showWechatLogin,"onUpdate:modelValue":t[4]||(t[4]=e=>ne.showWechatLogin=e),title:"微信绑定",width:500,"destroy-on-close":""},{default:(0,i.w5)((()=>[(0,i._)("div",X,[(0,i._)("div",ee,[(0,i._)("object",{data:ne.WechatLoginCode,width:"430",height:"430",type:"text/html"},null,8,te)]),""!=ne.bind_wechat_error?((0,i.wg)(),(0,i.iD)("p",ae,(0,s.toDisplayString)(ne.bind_wechat_error)+",请先解绑原账号绑定",1)):(0,i.kq)("",!0),ie,ne.isWechatLoginResult?((0,i.wg)(),(0,i.iD)("div",se,[(0,i.Wm)(we,{icon:"success",title:"绑定成功","sub-title":"您可以使用微信扫码登录了"})])):(0,i.kq)("",!0)])])),_:1},8,["modelValue"])],64)}a(23767),a(8585),a(68696),a(82801);var oe={data(){return{wechat:{avatar:"",nick_name:"",open_id:""},dingTalk:{avatar:"",nick_name:"",open_id:""},WechatLoginCode:"",showWechatLogin:!1,isWechatLoginResult:!1,bind_wechat_error:"",multipleLocation:!1,timeout:"10",userInfo:{},passKeyList:[]}},created(){window.addEventListener("storage",this.wechatStorageChange)},mounted(){const e=this.$TOOL.data.get("USER_INFO");this.userInfo=e,this.getUserInfo(),this.getSso(),this.getTimeOut(),this.getPassKeyList(),this.$socketApi.getSock(this.getWsResult)},beforeUnmount(){window.removeEventListener("storage",this.wechatStorageChange)},watch:{},methods:{async getTimeOut(){const e=await this.$API.user.timeoutGet.post();200==e.code&&(this.timeout=e.data.options&&e.data.options.timeout?e.data.options.timeout:this.timeout)},async loginTime(e){const t=await this.$API.user.timeoutConfig.post({timeout:e});200==t.code&&this.$message.success("设置成功")},async getSso(){const e=await this.$API.system.sso.get.post();200==e.code&&e.data.options&&(this.multipleLocation=e.data.options.is_sso_login)},async multipleLocationSet(){const e=await this.$API.system.sso.setup.post({is_sso_login:this.multipleLocation});200==e.code&&this.$message.success("配置成功")},getWsResult(e){7==e.type&&(this.isWechatLoginResult=!0,setTimeout((()=>{this.showWechatLogin=!1,this.getUserInfo()}),2e3)),12==e.type&&(this.bind_wechat_error=e.msg)},async bindWechat(){this.isWechatLoginResult=!1;const e=await this.$API.auth.bindWechat.post();if(200==e.code){const t=JSON.parse(JSON.stringify(e.data.qrcode));localStorage.setItem("bindWechat","2"),this.WechatLoginCode=t,this.showWechatLogin=!0}},async bindDingTalk(){const e=await this.$API.auth.bindDingTalk.post();if(200==e.code){const t=JSON.parse(JSON.stringify(e.data.redirect));localStorage.setItem("bindDingTalk","2"),window.open(t)}},wechatStorageChange(e){let t=localStorage.getItem("bindDingTalk"),a=localStorage.getItem("bindWechat");"DINGTALK_LOGIN_MESSAGE"==e.key&&(2==t&&"string"==typeof e.newValue&&""!=e.newValue&&this.dingTalkBind(e.newValue),localStorage.removeItem("DINGTALK_LOGIN_MESSAGE")),"WECHAT_LOGIN_MESSAGE"==e.key&&(2==a&&"string"==typeof e.newValue&&""!=e.newValue&&this.wechatBind(e.newValue),localStorage.removeItem("WECHAT_LOGIN_MESSAGE"))},wechatBind(){},async dingTalkBind(e){let t=JSON.parse(e),a={code:t.code,state:t.state};const i=await this.$API.auth.bindDingTalkUser.post(a);200==i.code&&await this.getUserInfo()},async secureDingTalk(e){let t={app_type:e};const a=await this.$API.auth.unbindUser.post(t);200==a.code&&await this.getUserInfo()},async getUserInfo(){const e=await this.$API.user.getInfo.post();200==e.code&&(this.wechat={avatar:"",nick_name:"",open_id:""},this.dingTalk={avatar:"",nick_name:"",open_id:""},e.data&&e.data.length&&e.data.forEach((e=>{1==e.app_type&&(this.wechat=e),2==e.app_type&&(this.dingTalk=e)})))},async getPassKeyList(){const e=await this.$API.system.user.publishList.post();200==e.code&&(this.passKeyList=e.data)},async passKeyAlias(e){let t={id:e.id,alias:e.alias};await this.$API.system.user.renameAlias.post(t)},async createPasskey(){try{const e=await this.$API.system.user.generateRegistration.post(),t={challenge:Uint8Array.from(e.data.challenge),rp:{name:e.data.rp.name,id:e.data.rp.id},user:{id:Uint8Array.from(e.data.user.id),name:e.data.user.name,displayName:e.data.user.displayName},pubKeyCredParams:e.data.pubKeyCredParams,authenticatorSelection:{authenticatorAttachment:"",userVerification:e.data.authenticatorSelection.userVerification},timeout:e.data.timeout,attestation:e.data.attestation},a=await navigator.credentials.create({publicKey:t});await this.storeCredential(a)}catch(e){this.$message.warning("创建通行秘钥失败")}},async storeCredential(e){const t={id:e.id,rawId:this.bufferToBase64URL(e.rawId),type:e.type,response:{clientDataJSON:this.bufferToBase64URL(e.response.clientDataJSON),attestationObject:this.bufferToBase64URL(e.response.attestationObject)},authenticatorAttachment:e.authenticatorAttachment},a=await this.$API.system.user.verifyResponse.post(t);console.log(a,55)},bufferToBase64URL(e){return btoa(String.fromCharCode.apply(null,new Uint8Array(e))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}}},le=a(83744);const ce=(0,le.Z)(oe,[["render",ne],["__scopeId","data-v-66b315de"]]);var de=ce}}]); |