UnisKB/static/admin/chat/assets/index-CIxGgO1f.js

3 lines
9.9 KiB
JavaScript
Raw Normal View History

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dingtalkQrCode-DxNyAQS1.js","./logo_dingtalk-CyDPr22R.js","./chat-GejDyFYU.js","./chat-azucZSIg.css","./dingtalkQrCode-CulsC8mV.css","./larkQrCode-CxK5lKHc.js","./logo_lark-DULIW3z6.js","./wecomQrCode-BnEL34Fj.js","./wecomQrCode-DezZNILo.css"])))=>i.map(i=>d[i]);
import{ay as Y,aA as Z,aB as r,br as ee,aD as R,aE as $,aF as i,aG as f,bf as C,bh as te,bm as y,cp as se,cq as re,bg as q,cr as F,az as ie,cs as ue,b8 as N,aC as b,bV as G,b7 as ce,bs as de,bt as pe,aH as h,aI as k,aJ as Q,ct as fe,aK as H,bn as J,by as me,cn as W,cu as ge,c6 as ve,cv as he,c7 as _e,ce as be}from"./chat-GejDyFYU.js";import{_ as ye,a as we,f as M,d as ke}from"./index-DSf0vfF8.js";import{L as Ce,a as xe}from"./LoginContainer-SXg_pOy9.js";import{a as X}from"./auth-setting-F_h5eEPg.js";const Le={key:0,class:"text-center mt-16"},Ae=Y({__name:"QrCodeTab",props:{tabs:{},defaultTab:{}},setup(U){const{login:x}=Z(),p=U,u=r(""),A=r([]),S=r({app_key:"",app_secret:""});async function c(){try{return await x.getQrSource()}catch{return[]}}ee(async()=>{p.tabs.length>0&&(u.value=p.tabs[0].key),A.value=await c(),T(u.value),console.log(p.defaultTab),p.defaultTab&&D(p.defaultTab)});const T=m=>{const g=A.value.find(I=>I.auth_type===m);g&&g.config&&(S.value=g.config)},D=m=>{u.value=m,T(m)};return(m,g)=>{const I=R("el-tab-pane"),s=R("el-tabs");return i(),$(s,{modelValue:u.value,"onUpdate:modelValue":g[0]||(g[0]=w=>u.value=w),onTabChange:D},{default:f(()=>[(i(!0),C(q,null,te(U.tabs,w=>(i(),$(I,{key:w.key,label:w.value,name:w.key},{default:f(()=>[w.key===u.value?(i(),C("div",Le,[(i(),$(se(re(()=>ye(Object.assign({"./dingtalkQrCode.vue":()=>F(()=>import("./dingtalkQrCode-DxNyAQS1.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"./larkQrCode.vue":()=>F(()=>import("./larkQrCode-CxK5lKHc.js"),__vite__mapDeps([5,6,2,3]),import.meta.url),"./wecomQrCode.vue":()=>F(()=>import("./wecomQrCode-BnEL34Fj.js"),__vite__mapDeps([7,2,3,8]),import.meta.url)}),`./${w.key}QrCode.vue`,2))),{config:S.value},null,8,["config"]))])):y("",!0)]),_:2},1032,["label","name"]))),128))]),_:1},8,["modelValue"])}}}),$e={key:0,class:"mb-24"},De={key:1},Ie={class:"mb-24"},Ee={class:"mb-24"},Re={key:0,class:"mb-24"},Se={class:"flex-between w-full"},Ve=["src"],Oe={class:"operate-container flex-between mt-12"},Pe={key:2},Qe={key:3,class:"login-gradient-divider lighter mt-24"},Te={class:"text-center mt-16"},Ue=Y({__name:"index",setup(U){const x=ie(),{login:p,user:u,theme:A}=Z(),{locale:S}=ue({useScope:"global"}),c=r(!1),T=N(),D=r(""),m=r(),g=r(null),I=r(""),s=r({username:"",password:"",captcha:""}),w=r({username:[{required:!0,message:b("views.login.loginForm.username.requiredMessage"),trigger:"blur"}],password:[{required:!0,message:b("views.login.loginForm.password.requiredMessage"),trigger:"blur"}],captcha:[{required:!1,message:b("views.login.loginForm.captcha.requiredMessage"),trigger:"blur"}]}),K=()=>{m.value&&m.value.validate(t=>{if(t)if(c.value=!0,L.value==="LDAP")p.asyncLdapLogin(s.value).then(()=>{S.value=localStorage.getItem("MaxKB-locale")||W()||"en-US",x.push({name:"home"})}).catch(()=>{c.value=!1});else{const e=M.pki.publicKeyFromPem(u.rasKey),a=JSON.stringify(s.value),o=M.util.encodeUtf8(a),_=e.encrypt(o,"RSAES-PKCS1-V1_5"),n=M.util.encode64(_);p.asyncLogin({encryptedData:n,username:s.value.username}).then(()=>{S.value=localStorage.getItem("MaxKB-locale")||W()||"en-US",localStorage.setItem("workspace_id","default"),x.push({name:"home"})}).catch(()=>{const v=s.value.username;c.value=!1,B(v)})}})};function B(t){ge.getCaptcha(t).then(e=>{e&&e.data&&e.data.captcha&&(D.value=e.data.captcha)}).catch(e=>{console.error("Failed to get captcha:",e)})}function ae(t){B(t)}G(()=>{u.asyncGetProfile().then(t=>{u.isPE()||u.isEE()?X.getLoginAuthSetting().then(e=>{if(Object.keys(e.data).length>0?g.value=e.data:g.value={max_attempts:1,default_value:"LOCAL"},T.query.login_mode!=="manual"){const o=g.value.default_value;["lark","wecom","dingtalk"].includes(o)?(O("QR_CODE",!1),I.value=o):O(o,!1)}}):g.value={max_attempts:1,default_value:"LOCAL"}})});const E=r([""]),j=r([""]),L=r(""),V=r(!1),z=r([]);function oe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}const le=ce(()=>{var e,a,o;return!((e=A.themeInfo)!=null&&e.slogan)||"融合AI-RAG技术的智能知识问答及思维导图综<EFBFBD><EFBFBD>