import{_ as M}from"./logo-BgPjzjuy.js";import{_ as N,a as S,u as U,g as q,d as F,b as I,r as R,C as h,B as T,e as n,c as _,o as u,b7 as $,h as w,i as o,j as s,m as l,E as y,n as V}from"./index-D7n5ZNak.js";const j={class:"setting"},O={key:0,class:"content"},z={key:1,class:"flex"},A={class:"buttons"},D={__name:"login",setup(G){S(),U();const{proxy:v}=q(),f=F(),k=(p,e,a)=>{e===""?a(new Error("请再次输入密码")):e!==t.value.password?a(new Error("两次密码不一致")):a()},i=I(()=>f.name),r=R(!1),x=h({form:{username:"",password:"",checkPass:"",rememberMe:!1},rules:{username:[{required:!0,message:"登录名称不能为空",trigger:"blur"}],password:[{required:!0,message:"密码不能为空",trigger:"blur"}],checkPass:[{validator:k,trigger:"blur"}]}}),{queryParams:H,form:t,rules:C}=T(x);function B(){v.$refs.settingForm.validate(p=>{if(p){r.value=!0;const e={loginType:"namepass",username:t.value.username,password:t.value.password};f.login(e).then(()=>{v.$modal.notifySuccess("配置成功"),r.value=!1}).catch(a=>{r.value=!1})}})}function P(){r.value=!0,f.logOut().then(()=>{r.value=!1,location.reload()})}return(p,e)=>{const a=n("el-input"),g=n("el-form-item"),m=n("el-col"),c=n("el-row"),E=n("el-form"),b=n("el-button");return u(),_("div",j,[e[6]||(e[6]=$('<div class="top" data-v-ed42fa3b><img src="'+M+'" alt="" class="img_logo" data-v-ed42fa3b><div class="top_title" data-v-ed42fa3b>办公助手</div><div class="top_desc" data-v-ed42fa3b>请在此设置办公助手平台的账号密码，用于使用线上功能和文件同步等。</div></div><div class="form_title" data-v-ed42fa3b>设置</div>',2)),i.value==""?(u(),_("div",O,[o(E,{ref:"settingForm",model:l(t),rules:l(C)},{default:s(()=>[o(c,{gutter:10},{default:s(()=>[o(m,{span:24,offset:0},{default:s(()=>[o(g,{label:"",prop:"username"},{default:s(()=>[o(a,{modelValue:l(t).username,"onUpdate:modelValue":e[0]||(e[0]=d=>l(t).username=d),modelModifiers:{trim:!0},placeholder:"设置账号"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1}),o(c,{gutter:10},{default:s(()=>[o(m,{span:24,offset:0},{default:s(()=>[o(g,{label:"",prop:"password"},{default:s(()=>[o(a,{modelValue:l(t).password,"onUpdate:modelValue":e[1]||(e[1]=d=>l(t).password=d),modelModifiers:{trim:!0},type:"password","auto-complete":"off","show-password":"",placeholder:"设置密码"},null,8,["modelValue"])]),_:1})]),_:1})]),_:1})]),_:1},8,["model","rules"])])):(u(),_("div",z,[e[3]||(e[3]=w("div",null,"当前用户：",-1)),o(a,{modelValue:i.value,"onUpdate:modelValue":e[2]||(e[2]=d=>i.value=d),modelModifiers:{trim:!0},placeholder:"",disabled:""},null,8,["modelValue"])])),w("div",A,[o(c,{gutter:10},{default:s(()=>[i.value==""?(u(),y(m,{key:0,span:24,offset:0},{default:s(()=>[o(b,{type:"primary",loading:l(r),onClick:B},{default:s(()=>e[4]||(e[4]=[V("确认")])),_:1},8,["loading"])]),_:1})):(u(),y(m,{key:1,span:24,offset:0},{default:s(()=>[o(b,{type:"primary",loading:l(r),onClick:P},{default:s(()=>e[5]||(e[5]=[V("退出登录")])),_:1},8,["loading"])]),_:1}))]),_:1})])])}}},L=N(D,[["__scopeId","data-v-ed42fa3b"]]);export{L as default};
