var M=Object.defineProperty,b=Object.defineProperties;var X=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var F=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var A=(t,o,e)=>o in t?M(t,o,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[o]=e,R=(t,o)=>{for(var e in o||(o={}))F.call(o,e)&&A(t,e,o[e]);if(L)for(var e of L(o))W.call(o,e)&&A(t,e,o[e]);return t},S=(t,o)=>b(t,X(o));var D=(t,o,e)=>new Promise((r,p)=>{var m=s=>{try{_(e.next(s))}catch(E){p(E)}},I=s=>{try{_(e.throw(s))}catch(E){p(E)}},_=s=>s.done?r(s.value):Promise.resolve(s.value).then(m,I);_((e=e.apply(t,o)).next())});import{_ as H,R as G,x as T,y as Y,z,E as O,C as J,J as Q,D as Z,S as $,e as U,w as u,L as K,o as w,l as j,Q as i,T as q,s as ee,f as c,k as g,t as y,U as oe,i as te,H as d,V as ae,W as ne,X as se,M as le,Y as ue,Z as ie}from"./index-HMVh0NrB.js";var ce={VITE_APP_TITLE:"高校体育应用中心",VITE_APP_PORT:"8000",VITE_UNI_APPID:"",VITE_WX_APPID:"",VITE_APP_PUBLIC_BASE:"./",VITE_LOGIN_URL:"/pages/login/login",VITE_SERVER_BASEURL:"http://172.16.21.200/api",VITE_UPLOAD_BASEURL:"http://172.16.21.200/api/upload",VITE_APP_PROXY:"false",VITE_APP_PROXY_PREFIX:"/api",VITE_APP_STATIC_BASEURL:"http://172.16.21.200/cdn",VITE_DELETE_CONSOLE:"true",VITE_SHOW_SOURCEMAP:"false",VITE_APP_BUILD_MODE:"hk",VITE_CJS_IGNORE_WARNING:"true",VITE_DEV_SERVER_URL:"http://localhost:3344/",VITE_PUBLIC:"D:\\desktop\\CODE\\electron-example\\electron-vite-vue\\public",VITE_ROOT_DIR:"D:\\desktop\\huaZhong\\uniapp-huazhong-center",VITE_USER_NODE_ENV:"production",BASE_URL:"./",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const re={__name:"login",setup(t){const o="高校体育应用中心",e=G({account:"",domain:"",captcha_value:"",session_id:"",type:"",password:""}),r=T(!1),p=T(""),m=Y(),I="production",_="production",{menuList:s,authMenuList:E}=z(),B=O(()=>m.isLogin);O(()=>e.account.trim()&&e.password.trim()&&!r.value);const h=l=>{p.value=l.currentTarget.dataset.name},v=()=>{p.value=""},x=()=>D(this,null,function*(){if(!e.account.trim()){d({title:"请输入账号",icon:"none"});return}if(!e.password.trim()){d({title:"请输入密码",icon:"none"});return}r.value=!0;try{let l=location.host.indexOf("localhost")===-1?location.host:ce.VITE_APP_BASE_DOMAIN;{const n=yield ae(location.host);n.code===0?l=n.data.domain:l=location.host}const a=yield ne(S(R({},e),{password:se(e.password),domain:l,type:"HKWX"}));if(a.code===200){d({title:"登录成功",icon:"success"}),m.setUserInfo(a.data);const n=le(s.value,_),f=yield ue({accountId:a.data.account_id,tmpMenu:n,authMenuList:E.value,sourceMode:_});f==="home"?ie({url:"/pages/home/index"}):f==="login"&&(m.removeToken(),d({title:"暂无权限,请联系管理员",icon:"none"}))}else d({title:a.msg||"登录失败",icon:"none"})}catch(l){d({title:"登录失败，请稍后重试",icon:"none"})}finally{r.value=!1}}),k=T(!1),V=T(!1);return J(()=>{B.value&&Q({url:"/pages/home/index"});const l=Z();V.value=I==="test",l.debug&&(V.value=!0),setTimeout(()=>{var a;((a=$())==null?void 0:a.length)<5&&k.value},1e3)}),(l,a)=>{const n=ee,f=oe,C=te,N=K("layout-default-uni");return w(),U(N,null,{default:u(()=>[!i(q)()&&i(V)?(w(),U(n,{key:0,class:"login-container"},{default:u(()=>[c(n,{class:"login-form"},{default:u(()=>[c(n,{class:"form-title"},{default:u(()=>[g(y(i(o)),1)]),_:1}),c(n,{class:"input-group"},{default:u(()=>[c(n,{class:"input-label"},{default:u(()=>[g("账号")]),_:1}),c(f,{type:"text",modelValue:i(e).account,"onUpdate:modelValue":a[0]||(a[0]=P=>i(e).account=P),placeholder:"请输入账号",class:"input-field",onFocus:h,onBlur:v},null,8,["modelValue"])]),_:1}),c(n,{class:"input-group"},{default:u(()=>[c(n,{class:"input-label"},{default:u(()=>[g("密码")]),_:1}),c(f,{type:"password",modelValue:i(e).password,"onUpdate:modelValue":a[1]||(a[1]=P=>i(e).password=P),placeholder:"请输入密码",class:"input-field",onFocus:h,onBlur:v},null,8,["modelValue"])]),_:1}),c(C,{class:"login-button",onClick:x,disabled:i(r)},{default:u(()=>[g(y(i(r)?"登录中...":"登录"),1)]),_:1},8,["disabled"])]),_:1})]),_:1})):j("",!0)]),_:1})}}},pe=H(re,[["__scopeId","data-v-b8a413b0"]]);export{pe as default};
