| 1 |
- import{g as e,s,n as t,a as o,b as a,h as i,r as n,u as l,c as r,d as c,l as d,e as h,f as m,i as u,j as g,m as f,k as p,o as k,p as C,w as y,q as A,t as b,v as w,x as I,y as U,z as _,A as x,B as L,C as F,D,F as P,E as T,G as v,H as j,I as V}from"./index-P0fyQ2Em.js";import{_ as E}from"./u-image.RNxpLaRU.js";import{r as N}from"./uni-app.es.DOtS5Ldl.js";import{_ as B}from"./u-input.Cp2bygnN.js";import{_ as R,a as J}from"./u-form.B1LWETT2.js";import{_ as S}from"./u-checkbox.Cy_cnskM.js";import{_ as q}from"./u-button.Chh1-6a-.js";import{_ as Y}from"./u-divider.BoeCb7vx.js";import{_ as G}from"./u-popup.CXrq2y3n.js";import{_ as O}from"./_plugin-vue_export-helper.BCo6x5W8.js";import"./u-icon.wXcRZHbn.js";import"./emitter.DrjJCwnj.js";const K="/assets/logo-9WO4x6w_.png";const M=O({data:()=>({remember:!1,logoImg:K,imgUrl:"",loading:!1,formData:{account:"",password:"",code:"",origin:"password"},needCode:!1,codeLength:4,isCode:!1,rules:{account:[{required:!0,message:"请输入账号",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]},sysConfigInfo:{},appIcon:"",sysName:"",copyright:"",socialsList:[],show:!1,tenantUserInfo:[],ssoLoading:!0,isSso:!1,ssoTicket:"",ssoUrl:"",preUrl:"",ticketParams:"",loginCode:"",isKeyUp:!0}),watch:{remember:{handler(t){let o=e("rememberAccount");o||(o={account:"",password:""}),o.remember=t,s("rememberAccount",o)},deep:!0}},computed:{baseURL(){return this.define.baseURL}},onReady(){this.$refs.dataForm.setRules(this.rules)},onLoad(s){(null==s?void 0:s.JNPF_TICKET)&&(this.ssoTicket=s.JNPF_TICKET,t({url:`/pages/login/otherLogin?ssoTicket=${this.ssoTicket}`})),this.ssoTicket=e("ssoTicket"),this.sysConfigInfo=e("sysConfigInfo"),this.appIcon=this.sysConfigInfo.appIcon?this.baseURL+this.sysConfigInfo.appIcon:K,this.sysName=this.sysConfigInfo.companyName?this.sysConfigInfo.sysName:"JNPF快速开发平台",this.copyright=this.sysConfigInfo.copyright?this.sysConfigInfo.copyright:this.define.copyright,o({title:this.sysName});let a=e("app_loginNeedCode");this.isCode=a,this.changeCode(),this.getLoginConfig(),this.formData.password="",s.data&&(this.tenantUserInfo=JSON.parse(s.data),this.tenantUserInfo&&(this.show=!0)),this.initAccount()},methods:{initAccount(){let s=e("rememberAccount");s&&s.remember&&(s.account&&(this.formData.account=this.jnpf.aesEncryption.decrypt(s.account)),s.password&&(this.formData.password=this.jnpf.aesEncryption.decrypt(s.password))),this.remember=s.remember},rememberAccount(){if(this.remember){let e={remember:!0};e.account=this.jnpf.aesEncryption.encrypt(this.formData.account),e.password=this.jnpf.aesEncryption.encrypt(this.formData.password),s("rememberAccount",e)}},loginHandel(){a({title:"登录中"}),userStore.getCurrentUser().then((e=>{i(),n({url:"/pages/index/index"})})).catch((()=>{i(),n({url:"/pages/login/index"})}))},loginToken(e){if(l().setToken(e.data.value),2!=e.data.status){if(1==e.data.status)return this.loginHandel();6==e.data.status?(this.tenantUserInfo=JSON.parse(e.data.value),1==this.tenantUserInfo.length?this.loginHandel():this.show=!0):(this.show=!1,this.ssoUrl="",r({title:e.data.value||"操作超时,请重新点击登录",icon:"none"}))}},wechatLogin(){},qqOtherlogin(){c().then((e=>{this.ssoTicket=e.data,d({provider:"qq",success:e=>{uni.getUserInfo({provider:"qq",success:e=>{let s={source:"qq",jnpf_ticket:this.ssoTicket,socialName:e.userInfo.nickName,uuid:e.userInfonickName.unionid};h(s).then((e=>{this.loginToken(e)})).catch((e=>{}))}})}})}))},socailsLogin(e){const s=l();e.tenantLogin=!0,h(e).then((e=>{200==e.code&&(a({title:"登录中"}),s.setToken(e.data.token),s.getCurrentUser().then((e=>{i(),m({url:"/pages/index/index"}),this.show=!1})).catch((()=>{i(),m({url:"/pages/login/index"})})))})).catch((()=>{i(),m({url:"/pages/login/index"})}))},otherslogin(e,o){"wechat_open"===e?this.wechatLogin():c().then((e=>{this.ssoTicket=e.data,o=o.replace("JNPF_TICKET",this.ssoTicket),s("ssoUrl",o),t({url:"/pages/login/otherLogin?ssoTicket="+this.ssoTicket})})).catch((()=>{}))},onFocus(e){this.getCodeConfig(e)},onBlur(e){this.getCodeConfig(e)},getLoginConfig(){u().then((e=>{this.isSso=e.data.redirect,this.preUrl=e.data.url,this.ticketParams=e.data.ticketParams;let s=e.data.socialsList||[];this.socialsList=s.filter((e=>e.latest&&"github"!=e.enname&&"wechat_enterprise"!=e.enname)),this.ssoLoading=!1})).catch((()=>{this.isSso=!1,this.ssoLoading=!1}))},getCodeConfig(e){e&&g(e).then((e=>{this.needCode=!!e.data.enableVerificationCode,this.needCode&&(this.codeLength=e.data.verificationCodeNumber||4,this.changeCode())}))},changeCode(){let e=Math.random();this.timestamp=e,this.imgUrl=`/api/oauth/ImageCode/${this.codeLength||4}/${e}`},login(){const e=l();this.$refs.dataForm.validate((s=>{if(s){this.loading=!0;const s=f.md5(this.formData.password),t=this.jnpf.aesEncryption.encrypt(s);let o={account:this.formData.account,password:t,timestamp:this.timestamp,code:this.formData.code,origin:this.formData.origin,jnpf_ticket:this.ssoTicket,grant_type:"password"};p(o).then((s=>{let t=s.data.token;e.setToken(t),this.rememberAccount(),setTimeout((()=>{e.getCurrentUser().then((e=>{this.loading=!1,m({url:"/pages/index/index"})})).catch((()=>{this.loading=!1}))}),1e3)})).catch((e=>{r({title:e,icon:"none"}),this.getCodeConfig(this.formData.account),this.formData.code="",this.changeCode(),this.loading=!1}))}}))},ssoLogin(){c().then((e=>{this.ssoTicket=e.data,this.ssoUrl=this.preUrl+"?"+this.ticketParams+"="+this.ssoTicket,s("ssoUrl",this.ssoUrl),t({url:`/pages/login/otherLogin?ssoTicket=${this.ssoTicket}`})}))}}},[["render",function(e,s,t,o,a,i){const n=v,l=N(k("u-image"),E),r=A,c=N(k("u-input"),B),d=N(k("u-form-item"),R),h=N(k("u-form"),J),m=N(k("u-checkbox"),S),u=N(k("u-button"),q),g=N(k("u-divider"),Y),f=V,p=N(k("u-popup"),G);return b(),C(r,{class:"logo-v"},{default:y((()=>[w(r,{class:"login-bg"},{default:y((()=>[w(n,{src:"/assets/login-bg-bnqDDdo_.jpg",mode:"widthFix"}),w(r,{class:"logoImg"},{default:y((()=>[w(l,{src:a.appIcon,mode:"widthFix","border-radius":20,width:"160",height:"160"},{error:y((()=>[w(l,{src:a.logoImg,mode:"widthFix",width:"160",height:"160"},null,8,["src"])])),_:1},8,["src"])])),_:1}),w(r,{class:"login-version"},{default:y((()=>[w(r,{class:"login-version-text"},{default:y((()=>[I(U(a.sysConfigInfo.sysVersion||e.define.sysVersion),1)])),_:1})])),_:1})])),_:1}),w(r,{class:"logo-hd u-flex-col"},{default:y((()=>[w(r,{class:"loginSwitch u-flex-col"},{default:y((()=>[_(w(r,{class:"loginInputBox u-flex-col"},{default:y((()=>[w(h,{model:a.formData,rules:a.rules,ref:"dataForm",errorType:["toast"],"label-position":"left","label-width":"150","label-align":"left"},{default:y((()=>[w(d,{prop:"account",borderBottom:!1},{default:y((()=>[w(c,{"input-align":"left",modelValue:a.formData.account,"onUpdate:modelValue":s[0]||(s[0]=e=>a.formData.account=e),placeholder:"请输入帐号",onFocus:i.onFocus,onBlur:i.onBlur,border:"","border-color":"#F0F1F3","placeholder-style":"#9D9D9D"},null,8,["modelValue","onFocus","onBlur"])])),_:1}),w(d,{prop:"password","border-bottom":!1},{default:y((()=>[w(c,{"input-align":"left",modelValue:a.formData.password,"onUpdate:modelValue":s[1]||(s[1]=e=>a.formData.password=e),type:"password",placeholder:"请输入密码",border:"","border-color":"#F0F1F3","placeholder-style":"#9D9D9D"},null,8,["modelValue"])])),_:1}),a.needCode?(b(),C(d,{key:0,prop:"code",required:""},{default:y((()=>[w(r,{class:"u-flex code-box"},{default:y((()=>[w(c,{modelValue:a.formData.code,"onUpdate:modelValue":s[2]||(s[2]=e=>a.formData.code=e),placeholder:"验证码","input-align":"left"},null,8,["modelValue"]),w(r,{class:"code-img-box"},{default:y((()=>[w(l,{showLoading:!0,src:i.baseURL+a.imgUrl,width:"130px",height:"38px",onClick:i.changeCode},null,8,["src","onClick"])])),_:1})])),_:1})])),_:1})):L("",!0)])),_:1},8,["model","rules"]),w(r,{class:"remember-wrap"},{default:y((()=>[w(m,{modelValue:a.remember,"onUpdate:modelValue":s[3]||(s[3]=e=>a.remember=e)},{default:y((()=>[F("span",{class:"remember-text"},"记住账号密码")])),_:1},8,["modelValue"])])),_:1}),w(r,{class:"loginBtnBox"},{default:y((()=>[w(u,{onClick:i.login,type:"primary",loading:a.loading},{default:y((()=>[I(U(a.loading?"登录中...":"登录"),1)])),_:1},8,["onClick","loading"])])),_:1}),a.socialsList.length?(b(),D(P,{key:0},[w(g,{"margin-top":"40","margin-bottom":"40","half-width":"100%"},{default:y((()=>[I("其他登录方式")])),_:1}),w(r,{class:"other-list"},{default:y((()=>[(b(!0),D(P,null,T(a.socialsList,((e,t)=>(b(),D(P,{key:t},["wechat_open"===e.enname?(b(),C(r,{key:0,class:"other-item",title:e.name,onClick:s[4]||(s[4]=e=>i.wechatLogin())},{default:y((()=>[w(f,{class:j(e.icon)},null,8,["class"])])),_:2},1032,["title"])):"qq"===e.enname?(b(),C(r,{key:1,class:"other-item",title:e.name,onClick:s=>i.otherslogin(e.enname,e.renderUrl)},{default:y((()=>[w(f,{class:j(e.icon)},null,8,["class"])])),_:2},1032,["title","onClick"])):(b(),C(r,{key:2,class:"other-item",title:e.name,onClick:s=>i.otherslogin(e.enname,e.renderUrl)},{default:y((()=>[w(f,{class:j(e.icon)},null,8,["class"])])),_:2},1032,["title","onClick"]))],64)))),128))])),_:1})],64)):L("",!0)])),_:1},512),[[x,!a.isSso&&!a.ssoLoading]]),_(w(r,{class:"sso-login-btn"},{default:y((()=>[w(u,{onClick:i.ssoLogin,type:"primary",loading:a.loading},{default:y((()=>[I(U(a.loading?"登录中...":"登录"),1)])),_:1},8,["onClick","loading"])])),_:1},512),[[x,a.isSso&&!a.ssoLoading]])])),_:1})])),_:1}),w(p,{modelValue:a.show,"onUpdate:modelValue":s[5]||(s[5]=e=>a.show=e),mode:"left",width:"90%",height:"100%"},{default:y((()=>[w(r,{class:"mian"},{default:y((()=>[w(r,{class:"top"},{default:y((()=>[w(r,{class:"img-box"},{default:y((()=>[w(n,{class:"img",src:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAMAAABHPGVmAAAAsVBMVEUAAAAoeP8mdf8oeP8oeP8oeP8oef8oef8oeP8oeP8oev8neP8meP8oeP8oeP8oeP8neP8fef8pef8oeP8oef8oef8oef8neP8mef8neP8lef8gd/8oef8neP8kef8oeP8neP8nev8oeP8oef8oef8oeP8oef8pef////+UvP9fm//y9/9Rkv96rP/K3v9so/+vzf82gf+ixP/k7v/Y5v+91f9Eiv/l7//J3f+HtP+GtP+0Y6GRAAAAJ3RSTlMA+xThjj/z67mpWWc1zcB1WwrIsXqYb2JQSCkPoYgb15tBIPFkPMqM6kSfAAADa0lEQVRo3u2a2XKiUBCGEURwC+57YtZpFgHBNXn/B5sqAzOJffoswEzlwu8SS3+6T280ajdu3KiSh7fWqP7YtO3mY33UenuoXKDj2A24omE7neoUFnULCKz6ogqF/nQAXAbTflmJtgFCjHYpCccCKYxJYWs6A5BmUCwG9BUosdILZMUAFBkoZ45pgTKWqabRqkEBai0VjVcoiEIwO1AYR1ajByXoyWk81aAEtSepFGxAKRoSaakbUBJDnJV3wGGTnveuuz+nG+BwJ9KoA024c/+wC4HmXtCfarQVuUQu49OHvyjorNBF0MbY3GoCFJ7LIAUKXn1ZA0GMBPi2rAsYcgzcjIMX+97Wzdmom9IFgm0ucYQLSX7hDAS/KI05GVjuJ+84DsgQmxMiQyBIGef8ntkGBEOioJA58pkhe/hGdLkYkLnCLi4Tgbdi+IYv8NdE7dh99j2fLpc9IBiwNJaCRIzgiogvAksNM1MV2QpEZmT9pUX2qpbU6SOhawqKOYFIV8M0gH/wbkzEHMUL1ngGmiArIaxSkwDJs7im4N+LGT48AA2eWtsAIn8Fmy/OCvJcpJkikRFwOGQqH9c9LAIOIyRyDxjcT3YfG0j8dEf0E9E8MQaEuDO+A48xEmkCly1LIwIuKzWRxHOZ7EPg0FRyVxy4FOejwF2yB0+YgeJafPAjqeOIUi/2Qy86EXORIIRfxRpRnHwZvf/qbKST0RT5KvKvPwkEHjNlC6TPSYnkkAcZVSARL8zYDbKb9SlX0kNxQ7ZpeQK3p9nnR7JpidvvUfiQENHjal1ykEiFTSPJgsyXGySWZEsMEgDRw9FWMBLldKkf8IDHiRhXu5Jj6hYbggmJY5tIDtw77AlMgvzFG7i1IfvrMfDZMxNySC3S2NmeAB+POfuZkg/YIbpFXmv2JbcSJnvQFrBhiZiCXYGqCCAR/nqlUysgkmCRGncdNcYiOxDgY5GxxkO3cNgIRVChtnT5/WOMyjgv5VX2kCt0i6FUnpzwUEfTX0NJ1n1NyKLsonPxU1a2/275LF6AVL+sbxf11et/eLUx15QwDVDGMDVFlk1QpLnU1Om9gAJWTyvEg4IxQ10rysyQPI3ZD38te2FqA5e7llYFettuEMVwONW16ngb2dZVOA2djlY9+tzJ/77gzHXtxo0bVfIbv+lDdo9C3mIAAAAASUVORK5CYII=",mode:"widthFix"})])),_:1}),w(r,{class:"title"},{default:y((()=>[I(" 请选择登录账号 ")])),_:1})])),_:1}),(b(!0),D(P,null,T(a.tenantUserInfo,((e,s)=>(b(),C(r,{key:s},{default:y((()=>[w(r,{class:"info",onClick:s=>i.socailsLogin(e)},{default:y((()=>[w(r,{class:"user-name"},{default:y((()=>[I(U(e.socialName),1)])),_:2},1024),w(r,{class:"user-tenancy"},{default:y((()=>[I(" 租户名称: "+U(e.tenantName),1)])),_:2},1024),w(r,{class:"user-tenancy"},{default:y((()=>[I(" 租户id:"+U(e.tenantId),1)])),_:2},1024),w(r,{class:"user-tenancy"},{default:y((()=>[I(" 账号:"+U(e.accountName),1)])),_:2},1024)])),_:2},1032,["onClick"])])),_:2},1024)))),128))])),_:1})])),_:1},8,["modelValue"]),a.isKeyUp?(b(),C(r,{key:0,class:"copyright"},{default:y((()=>[I(U(a.copyright),1)])),_:1})):L("",!0)])),_:1})}],["__scopeId","data-v-eaf48956"]]);export{M as default};
|