You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
2.0 KiB
JavaScript

import{o as b,r as p,c as x,d as c,e as m,q as _,f as v,w as n,i as f,l as I,g as i,E as k,k as N,h as B,F as L,t as R,j as T,v as U,C as E}from"./index-fe49e5b0.js";const F={style:{"word-break":"break-all"}},j={class:"dialog-footer"},O={__name:"CasLogin",setup(J){let d=i([]),l=i(!1),w=i(!1),a=i(""),s=i("");const h=()=>{if(a.value=="")return k.error("请选择科室"),!1;w.value=!0,E({deptid:a.value}).then(t=>{t.status?(s.value=t.data.token,sessionStorage.setItem("token",s.value),sessionStorage.setItem("refreshToken",t.data.refresh_token),setTimeout(()=>{S()},300)):k.error(t.msg)})},S=()=>{var t=sessionStorage.getItem("token");console.log(t),t!=null&&t==s.value?(sessionStorage.setItem("LoginType","CasLogin"),window.location.href="./#/dashboard"):k.error("登录失败")};b(()=>{s.value=g("access_token");let t=g("refresh_token"),e=g("dept_arr");if(sessionStorage.setItem("token",s.value),sessionStorage.setItem("refreshToken",t),e)try{d.value=JSON.parse(decodeURIComponent(e)),console.log(d.value)}catch{console.error("JSON 解析失败")}d.value.length>1?l.value=!0:S()});function g(t,e){e||(e=decodeURIComponent(window.location.href)),t=t.replace(/[\[\]]/g,"\\$&");var u=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)"),r=u.exec(e);return r?r[2]?decodeURIComponent(r[2].replace(/\+/g," ")):"":null}return(t,e)=>{const u=p("el-radio"),r=p("el-radio-group"),C=p("el-button"),V=p("el-dialog"),y=x("loading");return c(),m("view",null,[e[4]||(e[4]=_(" cas登录 ",-1)),v(V,{modelValue:f(l),"onUpdate:modelValue":e[2]||(e[2]=o=>I(l)?l.value=o:l=o),title:"请选择要登录的科室",width:"40%"},{footer:n(()=>[N("div",j,[v(C,{type:"primary",onClick:e[1]||(e[1]=o=>h())},{default:n(()=>[...e[3]||(e[3]=[_(" 确定 ",-1)])]),_:1})])]),default:n(()=>[B((c(),m("div",F,[v(r,{modelValue:f(a),"onUpdate:modelValue":e[0]||(e[0]=o=>I(a)?a.value=o:a=o)},{default:n(()=>[(c(!0),m(L,null,R(f(d),(o,D)=>(c(),T(u,{key:D,label:o.deptId},{default:n(()=>[_(U(o.deptName),1)]),_:2},1032,["label"]))),128))]),_:1},8,["modelValue"])])),[[y,f(w)]])]),_:1},8,["modelValue"])])}}};export{O as default};