import{_ as e,u as o,s as a,a as l,b as s,g as n,c as t,r as i,U as r,d,e as u,f as m,h as c,w as g,i as f,o as p,j as w,k as N,l as h,n as y,t as _,m as b,p as v,q as x}from"./index-BiZOcPG_.js";import{_ as F,a as V,b as k}from"./uni-forms.Cb3LtJ7S.js";import"./uni-icons.BKTssli-.js";const D=e({data:()=>({loginForm:{terminal:1,userName:"",password:"",uuid:o().deviceUuid},rules:{userName:{rules:[{required:!0,errorMessage:"请输入用户名"}]},password:{rules:[{required:!0,errorMessage:"请输入密码"}]}},key:"636778cc92cd1d2a948e69b03c5f0d78",loginWay:2,codeNum:60,formData:{userName:"",code:"",terminal:"0"},btnText:"获取验证码",rules1:{userName:{rules:[{required:!0,errorMessage:"请输入手机号"}]},code:{rules:[{required:!0,errorMessage:"请输入验证码"}]}},showdownLine:!1,downloadNum:0}),mounted(){window.onDownloadProgress=e=>{-1===e?(this.showdownLine=!1,this.downloadNum=null,a({title:"下载失败",icon:"none"})):100===e?(this.showdownLine=!1,this.downloadNum=null,a({title:"下载完成",icon:"success"})):(this.showdownLine=!0,this.downloadNum=e,console.log("下载进度: "+e+"%"))}},methods:{onUploadImageBefore(e){console.log(e),l({content:e})},onUploadImageSuccess(e,o){console.log(e,o),l({content:JSON.stringify(o)})},onUploadImageFail(e,o){console.log(e,o),l({content:JSON.stringify(o)})},downLoadFun(){var e;const o="http://218.92.207.242:9000/box-im/file/20251014/1760410587367.doc";l({content:o+((null==(e=null==window?void 0:window.AndroidBridge)?void 0:e.downloadFile)||888),success(){window.AndroidBridge.downloadFile(o)}})},submit(){let e=this;e.$http({url:1==e.loginWay?"/login":"/loginBySMS",data:1==e.loginWay?e.loginForm:e.formData,method:"POST"}).then((o=>{console.log("登录成功,自动跳转到聊天页面...",e.loginForm),1==e.loginWay?(s("userName",e.loginForm.userName),s("password",e.loginForm.password)):s("phone",e.formData.userName),s("loginInfo",o),n().$vm.init(),t({url:"/pages/chat/chat"})}))},async getCode(){let e=this;if(""===e.formData.userName)return void a({title:"请输入手机号",icon:"none"});if(!uni.$u.test.mobile(e.formData.userName))return void a({icon:"none",title:"请输入正确的手机号"});if(e.codeNum<60&&0!==e.codeNum)return void a({icon:"none",title:"请稍后点击"});let o=60;i({url:r.BASE_URL+"/base/SySMSLoginMsg?mobiles="+e.formData.userName,method:"GET",success(l){var s,n,t;if(200!==(null==(s=null==l?void 0:l.data)?void 0:s.code))return void a({icon:"none",title:(null==(n=null==l?void 0:l.data)?void 0:n.message)||"短信发送失败！"});let i=setInterval((function(){e.codeNum=o,e.codeNum--,e.btnText=--o+"s",e.is_none="none",0===o&&(e.btnText="获取验证码",e.is_none="",e.codeNum=60,clearInterval(i))}),1e3);a({icon:"none",title:null==(t=null==l?void 0:l.data)?void 0:t.message})}})}},onLoad(){this.loginForm.userName=d("userName"),this.loginForm.password=d("password"),this.formData.userName=d("phone")},onReady(){}},[["render",function(e,o,a,l,s,n){const t=f,i=u(m("uni-easyinput"),F),r=u(m("uni-forms-item"),V),d=b,D=v,S=u(m("uni-forms"),k),U=x;return p(),c(t,{class:"page login"},{default:g((()=>[w(t,{class:"title"},{default:g((()=>[N("通讯助手")])),_:1}),1===s.loginWay?(p(),c(S,{key:0,class:"form",modelValue:s.loginForm,rules:s.rules,"validate-trigger":"bind"},{default:g((()=>[w(r,{name:"userName"},{default:g((()=>[w(i,{type:"text",modelValue:s.loginForm.userName,"onUpdate:modelValue":o[0]||(o[0]=e=>s.loginForm.userName=e),"prefix-icon":"person",placeholder:"请输入用户名"},null,8,["modelValue"])])),_:1}),w(r,{name:"password"},{default:g((()=>[w(i,{type:"password",modelValue:s.loginForm.password,"onUpdate:modelValue":o[1]||(o[1]=e=>s.loginForm.password=e),"prefix-icon":"locked",placeholder:"请输入密码"},null,8,["modelValue"])])),_:1}),w(t,{class:"login_code"},{default:g((()=>[w(d,{onClick:o[2]||(o[2]=e=>s.loginWay=2)},{default:g((()=>[N("短信验证码登录")])),_:1})])),_:1}),w(D,{class:"btn-submit",onClick:n.submit,type:"primary"},{default:g((()=>[N("登录")])),_:1},8,["onClick"])])),_:1},8,["modelValue","rules"])):h("",!0),2===s.loginWay?(p(),c(S,{key:1,class:"form",modelValue:s.formData,rules:s.rules1,"validate-trigger":"bind"},{default:g((()=>[w(r,{name:"userName"},{default:g((()=>[w(i,{type:"text",modelValue:s.formData.userName,"onUpdate:modelValue":o[3]||(o[3]=e=>s.formData.userName=e),"prefix-icon":"person",placeholder:"请输入手机号"},null,8,["modelValue"])])),_:1}),w(r,{name:"code"},{default:g((()=>[w(t,{class:"code-box"},{default:g((()=>[w(i,{type:"text",modelValue:s.formData.code,"onUpdate:modelValue":o[4]||(o[4]=e=>s.formData.code=e),"prefix-icon":"locked",placeholder:"请输入验证码",clearable:!1},null,8,["modelValue"]),w(U,{onClick:o[5]||(o[5]=e=>n.getCode()),class:"btnText",style:y({color:60===s.codeNum?"#999":"#496bc3"})},{default:g((()=>[N(_(s.btnText),1)])),_:1},8,["style"])])),_:1})])),_:1}),w(t,{class:"login_code"},{default:g((()=>[w(d,{onClick:o[6]||(o[6]=e=>s.loginWay=1)},{default:g((()=>[N("用户名/密码登录")])),_:1})])),_:1}),w(D,{class:"btn-submit",onClick:n.submit,type:"primary"},{default:g((()=>[N("登录")])),_:1},8,["onClick"])])),_:1},8,["modelValue","rules"])):h("",!0)])),_:1})}],["__scopeId","data-v-af14fede"]]);export{D as default};
