import{o as e,h as t,w as a,k as l,F as s,l as o,A as n,W as r,i,j as u,t as d,y as c,z as p,r as f,e as m,f as _,g,a as y,av as h,x as v,aP as b,a1 as x,b as C,E as w,a9 as k,Q as V,T as I,ac as j,N as T,H,aQ as U,aR as A,v as S,aK as O,O as E,ak as F,aS as N,al as z,P as L,aO as P,aw as K,a3 as Q,a4 as R,a5 as $,aM as B,aL as M}from"./index-B3cqKsI_.js";import{_ as W}from"./_plugin-vue_export-helper.BCo6x5W8.js";import{_ as J}from"./uni-easyinput.CqN2D7tl.js";import{_ as X,a as Y}from"./uni-forms.BnHLrfH7.js";import{_ as Z}from"./login-bg.DI0uwli1.js";import{_ as q}from"./uni-nav-bar.xE5Um1Eb.js";import{_ as D}from"./uni-popup.CmxZKYwY.js";import{a as G,b as ee}from"./useVerifyCode.Bz5RnOqO.js";import"./uni-icons.EqO7jntL.js";/* empty css *//* empty css */import"./uni-forms.vue_vue_type_style_index_0_scoped_a2a9907e_lang.DijPs27m.js";/* empty css */import"./uni-popup.vue_vue_type_style_index_0_scoped_90b62717_lang.CCBXdA0U.js";const te=W({name:"UniSegmentedControl",emits:["clickItem"],props:{current:{type:Number,default:0},values:{type:Array,default:()=>[]},activeColor:{type:String,default:"#2979FF"},inActiveColor:{type:String,default:"transparent"},styleType:{type:String,default:"button"}},data:()=>({currentIndex:0}),watch:{current(e){e!==this.currentIndex&&(this.currentIndex=e)}},computed:{},created(){this.currentIndex=this.current},methods:{_onClick(e){this.currentIndex!==e&&(this.currentIndex=e,this.$emit("clickItem",{currentIndex:e}))}}},[["render",function(f,m,_,g,y,h){const v=c,b=p;return e(),t(b,{class:n([["text"===_.styleType?"segmented-control--text":"segmented-control--button"],"segmented-control"]),style:r({borderColor:"text"===_.styleType?"":_.activeColor})},{default:a((()=>[(e(!0),l(s,null,o(_.values,((l,s)=>(e(),t(b,{class:n([["text"===_.styleType?"":"segmented-control__item--button",0===s&&"button"===_.styleType?"segmented-control__item--button--first":"",s===_.values.length-1&&"button"===_.styleType?"segmented-control__item--button--last":""],"segmented-control__item"]),key:s,style:r({backgroundColor:s===y.currentIndex&&"button"===_.styleType?_.activeColor:"button"===_.styleType?_.inActiveColor:"transparent",borderColor:s===y.currentIndex&&"text"===_.styleType||"button"===_.styleType?_.activeColor:_.inActiveColor}),onClick:e=>h._onClick(s)},{default:a((()=>[i(b,null,{default:a((()=>[i(v,{style:r({color:s===y.currentIndex?"text"===_.styleType?_.activeColor:"#fff":"text"===_.styleType?"#000":_.activeColor}),class:n(["segmented-control__text","text"===_.styleType&&s===y.currentIndex?"segmented-control__item--text":""])},{default:a((()=>[u(d(l),1)])),_:2},1032,["style","class"])])),_:2},1024)])),_:2},1032,["class","style","onClick"])))),128))])),_:1},8,["class","style"])}],["__scopeId","data-v-754001e5"]]),ae=W({__name:"index",setup(l,{expose:s}){const o=f(null);let{text:r,disabled:C}=G(),{getKeyVerify:w}=ee(),k=m({phone:"",password:"",password_confirm:"",verification_code:""}),V=f(!1),I=f(!1);const j=()=>{o.value.close()},T=e=>{V.value=h.test(e)},H=()=>{if(!V.value)return!1;w(k.phone)},U=()=>{if(k.phone&&!h.test(k.phone))return v.error("电话号码不合法"),!1;k.password_confirm=k.password,I.value=!0,b(k).then((e=>{I.value=!1,v.success(e.message),j(),k.phone="",k.verification_code="",k.password="",k.password_confirm=""})).catch((e=>{I.value=!1,v.error(e.message)}))};return s({popupOpen:()=>{o.value.open()}}),(l,s)=>{const f=p,m=_(g("uni-nav-bar"),q),h=c,v=_(g("uni-easyinput"),J),b=_(g("uni-forms-item"),X),w=_(g("uni-forms"),Y),A=x,S=_(g("uni-popup"),D);return e(),t(f,{class:"forget"},{default:a((()=>[i(S,{ref_key:"popupRef",ref:o,type:"right",backgroundColor:"#fff","mask-click":!1},{default:a((()=>[i(f,{class:"forget-content"},{default:a((()=>[i(f,{class:"status_bar"}),i(m,{"left-icon":"left",border:!1,title:"",onClickLeft:j}),i(f,{class:"pl10 forget-title"},{default:a((()=>[u("忘记密码")])),_:1}),i(f,{class:"form plr10"},{default:a((()=>[i(w,{ref:"forms",modelValue:y(k),"label-position":"top"},{default:a((()=>[i(b,null,{label:a((()=>[i(f,{class:"uni-forms-item__label"},{default:a((()=>[i(h,{class:"label-item"},{default:a((()=>[u("手机号码")])),_:1}),i(h,{class:"iconfont"},{default:a((()=>[u("*")])),_:1})])),_:1})])),default:a((()=>[i(v,{maxlength:11,modelValue:y(k).phone,"onUpdate:modelValue":s[0]||(s[0]=e=>y(k).phone=e),onInput:T,clearable:!1,styles:{borderColor:"transparent"},placeholder:"请输入手机号码"},null,8,["modelValue"])])),_:1}),i(b,{class:"forms-item-text",label:"验证码"},{label:a((()=>[i(f,{class:"uni-forms-item__label"},{default:a((()=>[i(h,{class:"label-item"},{default:a((()=>[u("验证码")])),_:1}),i(h,{class:"iconfont"},{default:a((()=>[u("*")])),_:1})])),_:1})])),default:a((()=>[i(v,{maxlength:6,modelValue:y(k).verification_code,"onUpdate:modelValue":s[1]||(s[1]=e=>y(k).verification_code=e),clearable:!1,styles:{borderColor:"transparent"},placeholder:"请输入验证码"},null,8,["modelValue"]),i(h,{class:n(["item-text",y(V)&&!y(C)?"default-color":"default-text-color-four"]),onClick:H},{default:a((()=>[u(d(y(r)),1)])),_:1},8,["class"])])),_:1}),i(b,{class:"forms-item-text"},{label:a((()=>[i(f,{class:"uni-forms-item__label"},{default:a((()=>[i(h,{class:"label-item"},{default:a((()=>[u("密码")])),_:1}),i(h,{class:"iconfont"},{default:a((()=>[u("*")])),_:1})])),_:1})])),default:a((()=>[i(v,{modelValue:y(k).password,"onUpdate:modelValue":s[2]||(s[2]=e=>y(k).password=e),clearable:!1,type:"password",styles:{borderColor:"transparent"},placeholder:"请输入密码"},null,8,["modelValue"])])),_:1})])),_:1},8,["modelValue"]),i(A,{class:"preserve",type:"primary",loading:y(I),disabled:!(y(V)&&y(k).verification_code.length>=4&&y(k).password.length>=6),onClick:U},{default:a((()=>[u("提交")])),_:1},8,["loading","disabled"])])),_:1})])),_:1})])),_:1},512)])),_:1})}}},[["__scopeId","data-v-096ee93c"]]),le=W({__name:"index",setup(o){let{text:r,disabled:b}=G(),{getKeyVerify:W}=ee(),q=C(),D=f(null),le=w("serverConfigInfo")||[],se=w("chooseEnterprise")||[],oe=m(["密码登录","手机登录"]),ne=f(0),re=f(!1),ie=f(!1),ue=m({phone:"",password:"",verificationCode:"",agreeArr:[]});const de=m({type:0,hidshow:!0,docmHeight:0,showHeight:0});function ce(e){ne.value=e.currentIndex}k((e=>{de.hidshow=!0,de.docmHeight=document.documentElement.clientHeight,de.showHeight=document.documentElement.clientHeight,de.type=e.type||0})),f("color: #303133"),V((()=>{window.onresize=()=>{de.showHeight=document.body.clientHeight}})),I((()=>[de.showHeight]),(e=>{de.docmHeight>e[0]?de.hidshow=!1:de.hidshow=!0}));const pe=()=>{if(!ie.value||b.value)return!1;W(ue.phone)},fe=()=>{D.value.popupOpen()},me=e=>{ie.value=h.test(e)},_e=e=>{ue.agreeArr=e.detail.value},ge=()=>{if(!ue.phone)return v.error("电话号码不能为空"),!1;if(0===ne.value&&ue.phone&&!h.test(ue.phone))return v.error("电话号码不合法"),!1;if(0===ne.value&&!ue.password)return v.error("密码不能为空"),!1;if(1===ne.value&&!ue.verificationCode)return v.error("验证码不能为空"),!1;if(ue.agreeArr.length<=0)return v.error("请阅读用户协议"),!1;if(0===ne.value){const e={account:ue.phone,password:ue.password};ve(e)}else if(1===ne.value){const e={phone:ue.phone,verification_code:ue.verificationCode};he(e)}H("titleList",JSON.stringify([]))},ye=f(!1),he=e=>{ye.value=!0,U(e).then((e=>{if(ye.value=!1,200===e.status){const t=e.data;q.commit("login",t),v.success("登录成功"),be()}})).catch((e=>{ye.value=!1,v.error(e.message)}))},ve=e=>{ye.value=!0,A(e).then((e=>{if(ye.value=!1,200===e.status){const t=e.data;q.commit("login",t),v.success("登录成功"),be()}})).catch((e=>{ye.value=!1,v.error(e.message)}))},be=async()=>{await(async()=>{const e=await P();q.commit("loginInfo",e.data)})(),await(async()=>{const e=await K();q.commit("loginMenu",e.data)})(),Q().then((e=>{let t=e.data,a=0;t.map((e=>{a+=Number(e.count)})),0===a?R({index:1}):$({index:1,text:a>99?"99+":a})}));let e=q.state.app.loginBackUrl||"/pages/index/index";-1!==e.indexOf("/pages/users/login/index")&&(e="/pages/index/index"),q.commit("setLoginBackUrl",""),O(),e="/pages/index/index",await S({url:e});let t=q.state.app.token;new B(`${M}/ws?type=ent&token=${t}`,10).initSocket()};return(o,f)=>{const m=E,h=c,v=p,C=_(g("uni-segmented-control"),te),w=_(g("uni-easyinput"),J),k=_(g("uni-forms-item"),X),V=_(g("uni-forms"),Y),I=F,H=N,U=z,A=L,O=x;return e(),t(v,{class:"content"},{default:a((()=>[i(m,{class:"login-image",src:Z}),y(le).length>1?(e(),t(v,{key:0,class:"enterprise",onClick:f[0]||(f[0]=e=>{S({url:"/pages/users/login/enterprise"+"?type="+de.type})})},{default:a((()=>[j("i",{class:"iconfont icon-yunwenjiandanchuang-fuzhizhi"}),i(h,null,{default:a((()=>[u("切换企业")])),_:1})])),_:1})):T("",!0),i(v,{class:"content-login p-l-r30"},{default:a((()=>{var t;return[i(m,{class:"logo",src:(null==(t=y(se))?void 0:t.logo)||"../../../static/image/logo.png"},null,8,["src"]),i(v,{class:"title"},{default:a((()=>{var e;return[u(d((null==(e=y(se))?void 0:e.short_name)||"登录陀螺匠 · 企业助手"),1)]})),_:1}),i(C,{current:y(ne),values:y(oe),onClickItem:ce,styleType:"text",activeColor:"#1890FF"},null,8,["current","values"]),i(v,{class:"form"},{default:a((()=>[i(V,{ref:"forms",modelValue:y(ue),"label-position":"top"},{default:a((()=>[0===y(ne)?(e(),l(s,{key:0},[i(k,{label:"手机号"},{default:a((()=>[i(w,{modelValue:y(ue).phone,"onUpdate:modelValue":f[1]||(f[1]=e=>y(ue).phone=e),maxlength:11,clearable:!1,onInput:me,"adjust-position":!1,styles:{borderColor:"transparent"},placeholder:"请输入手机号码"},null,8,["modelValue"])])),_:1}),i(k,{class:"forms-item-text",label:"密码"},{default:a((()=>[i(w,{modelValue:y(ue).password,"onUpdate:modelValue":f[2]||(f[2]=e=>y(ue).password=e),clearable:!1,type:"password","adjust-position":!1,styles:{borderColor:"transparent"},placeholder:"请输入密码"},null,8,["modelValue"]),i(h,{class:"default-color item-text",onClick:fe},{default:a((()=>[u("忘记密码")])),_:1})])),_:1})],64)):T("",!0),1===y(ne)?(e(),l(s,{key:1},[i(k,{label:"手机号"},{default:a((()=>[i(w,{modelValue:y(ue).phone,"onUpdate:modelValue":f[3]||(f[3]=e=>y(ue).phone=e),clearable:!1,maxlength:11,"adjust-position":!1,onInput:me,styles:{borderColor:"transparent"},placeholder:"请输入手机号码"},null,8,["modelValue"])])),_:1}),i(k,{class:"forms-item-text",label:"验证码"},{default:a((()=>[i(w,{modelValue:y(ue).verificationCode,"onUpdate:modelValue":f[4]||(f[4]=e=>y(ue).verificationCode=e),maxlength:6,clearable:!1,"adjust-position":!1,styles:{borderColor:"transparent"},placeholder:"请输入验证码"},null,8,["modelValue"]),i(h,{class:n(["item-text",y(ie)&&!y(b)?"default-color":"default-text-color-four"]),onClick:pe},{default:a((()=>[u(d(y(r)),1)])),_:1},8,["class"])])),_:1})],64)):T("",!0)])),_:1},8,["modelValue"])])),_:1}),i(v,{class:"display-align agree-content"},{default:a((()=>[i(U,{onChange:_e},{default:a((()=>[i(H,null,{default:a((()=>[i(I,{style:{transform:"scale(0.7)"},value:"1",checked:y(re)},null,8,["checked"]),u(" 我已阅读并同意 ")])),_:1})])),_:1}),i(A,{url:"/pages/users/login/service","animation-type":"slide-in-right",class:"default-color"},{default:a((()=>[u("《服务协议》 ")])),_:1}),u(" 和 "),i(A,{url:"/pages/users/login/privacy","animation-type":"slide-in-right",class:"default-color"},{default:a((()=>[u("《隐私协议》 ")])),_:1})])),_:1}),i(O,{class:"preserve",type:"primary",loading:y(ye),disabled:!(1===ne.value&&ie.value&&ue.verificationCode.length>=4||0===ne.value&&ie.value&&ue.password.length>=6),onClick:ge},{default:a((()=>[u("登 录")])),_:1},8,["loading","disabled"]),i(v,{class:"login-text"},{default:a((()=>[u(d(y(ne)?"未注册手机号登录时会自动创建新账号":"未注册用户请使用短信登录"),1)])),_:1})]})),_:1}),i(ae,{ref_key:"forgotPasswordRef",ref:D},null,512)])),_:1})}}},[["__scopeId","data-v-904d9ba1"]]);export{le as default};