login.723c1070.js 8.2 KB

1
  1. import{E as ce,__tla as me}from"./el-input.26169bdd.js";import{a as _e,E as pe,__tla as de}from"./el-form.401432c4.js";import{_ as fe,__tla as ye}from"./index.vue.d45f596b.js";import{E as he,__tla as ve}from"./el-button.b9902edf.js";import{_ as ge,__tla as be}from"./nuxt-link.d06878a3.js";import{E as xe,__tla as ke}from"./el-image.bbfa5f50.js";import{f as we,h as Ve,j as y,k as Ce,a3 as De,a4 as Pe,J as F,a7 as je,l as p,u as l,m as o,F as Te,t as qe,x as r,w as c,v as d,X as x,ab as Le,aj as Ue,o as f,q as Ae,a8 as I,a9 as z,a6 as t,aa as k,A as Ee,B as Re,ae as Fe,af as Ie,e as ze,ac as Be,ad as Je,__tla as Se}from"./entry.7ac74952.js";import{__tla as Xe}from"./el-image-viewer.6b094d65.js";import{t as Ge}from"./test.b3688895.js";import{b as He}from"./browser.a1ac24ac.js";import{_ as Ke}from"./_plugin-vue_export-helper.c27b6911.js";import"./event.9519ab40.js";import{__tla as Me}from"./index.4e8000c9.js";import{__tla as Ne}from"./use-form-item.d93b2d81.js";import{__tla as Oe}from"./index.06247adb.js";import"./error.78e43d3e.js";import"./isNil.c75b1b34.js";import{__tla as Qe}from"./castArray.c7b38e0a.js";import{__tla as We}from"./el-dialog.8638bbbd.js";import{__tla as Ye}from"./el-overlay.6c5efcf9.js";import{__tla as Ze}from"./vnode.47700175.js";import{__tla as $e}from"./scroll.6ddd597d.js";import{__tla as ea}from"./focus-trap.fbc9f3cd.js";import{__tla as aa}from"./index.623d89cd.js";import{__tla as ta}from"./throttle.87b285fc.js";let B,la=Promise.all([(()=>{try{return me}catch{}})(),(()=>{try{return de}catch{}})(),(()=>{try{return ye}catch{}})(),(()=>{try{return ve}catch{}})(),(()=>{try{return be}catch{}})(),(()=>{try{return ke}catch{}})(),(()=>{try{return Se}catch{}})(),(()=>{try{return Xe}catch{}})(),(()=>{try{return Me}catch{}})(),(()=>{try{return Ne}catch{}})(),(()=>{try{return Oe}catch{}})(),(()=>{try{return Qe}catch{}})(),(()=>{try{return We}catch{}})(),(()=>{try{return Ye}catch{}})(),(()=>{try{return Ze}catch{}})(),(()=>{try{return $e}catch{}})(),(()=>{try{return ea}catch{}})(),(()=>{try{return aa}catch{}})(),(()=>{try{return ta}catch{}})()]).then(async()=>{const P=v=>(Ee("data-v-f91ea484"),v=v(),Re(),v),J={class:"w-full h-full bg-page flex items-center justify-center"},S={key:0,class:"bg-white"},X={key:0,class:"bg-white w-[380px] p-[30px] h-[424px]"},G={class:"flex items-end my-[30px]"},H=["onClick"],K={class:"flex justify-between leading-none"},M={key:0,class:"text-xs py-[50rpx] flex justify-center w-full"},N={class:"text-primary"},O={class:"text-primary"},Q={key:1,class:"mt-[20px] flex justify-center"},W={key:1,class:"flex flex-col items-center w-[380px] py-[60px] h-[424px]"},Y=P(()=>o("div",{class:"title font-bold text-xl"},"\u6253\u5F00\u624B\u673A\u5FAE\u4FE1",-1)),Z=P(()=>o("div",{class:"tips text-sm mt-[5px]"},"\u70B9\u51FB\u53F3\u4E0A\u89D2\u6253\u5F00\u626B\u4E00\u626B",-1)),$={class:"qrcode p-[10px] mt-[30px] border h-[120px] leading-none box-content"},ee={class:"relative"},ae={key:0,class:"flex flex-col justify-center items-center absolute inset-0 bg-gray-50"},te={class:"text-xs text-gray-600"},le=we({__name:"login",setup(v){let w=Ve(),g=y(!0),V=null;const j=()=>{g.value=!g.value,g.value?clearTimeout(V):q()};Ce(()=>w.currentRoute.value.path,e=>{e!="/auth/login"&&clearTimeout(V)},{immediate:!0,deep:!0});const T=e=>{Fe({key:e}).then(a=>{let n=a.data;switch(n.status){case"wait":V=setTimeout(()=>{T(u.value.key)},1e3);break;case"success":n.login_data.token?(U.setToken(n.login_data.token),w.push({path:"/"})):(Ie("openId").value=n.login_data.openid,ze("/auth/bind"));break;case"fail":u.value.pastDueContent=n.fail_reason,u.value.pastDue=!0;break}}).catch(a=>{u.value.pastDue=!0,u.value.pastDueContent=a.msg})},u=y({url:"",key:"",pastDue:!1,pastDueContent:"\u4E8C\u7EF4\u7801\u751F\u6210\u5931\u8D25"}),q=async()=>{let e=await(await Le()).data;u.value.key=e.key,He.toDataURL(e.url,{errorCorrectionLevel:"L",margin:0,width:100}).then(a=>{u.value.url=a}),u.value.pastDue=!1,setTimeout(()=>{T(u.value.key)},1e3)};let L=y(!1);Ue().then(e=>{L.value=e.data});const U=De(),b=Pe();b.getLoginConfig();const A=F(()=>{const e=[];return b.login.is_username&&e.push({type:"username",title:t("usernameLogin")}),b.login.is_mobile&&e.push({type:"mobile",title:t("mobileLogin")}),m.value=e[0]?e[0].type:"",e}),h=y(!1),m=y(""),i=je({username:"",password:"",mobile:"",mobile_code:"",mobile_key:""}),C=y(),re=F(()=>({username:{required:m.value=="username",message:t("usernamePlaceholder"),trigger:["blur","change"]},password:{required:m.value=="username",message:t("passwordPlaceholder"),trigger:["blur","change"]},mobile:[{required:m.value=="mobile",message:t("mobilePlaceholder"),trigger:["blur","change"]},{validator(e,a,n){return m.value!="mobile"?!0:Ge.mobile(a)},message:t("mobileError"),trigger:["blur"]}],mobile_code:{required:m.value=="mobile",message:t("codePlaceholder"),trigger:["change"]}})),se=async()=>{var e;await((e=C.value)==null?void 0:e.validate(async(a,n)=>{if(a){if(h.value)return;h.value=!0,(m.value=="username"?Be:Je)(i).then(async _=>{await U.setToken(_.data.token),w.push({path:"/"})}).catch(()=>{h.value=!1})}}))},E=y(null),oe=async()=>{var e;await((e=C.value)==null?void 0:e.validateField("mobile",async(a,n)=>{var _;a&&((_=E.value)==null||_.send())}))};return(e,a)=>{const n=ce,_=pe,ie=fe,R=he,D=ge,ne=_e,ue=xe;return f(),p("div",J,[l(A).length?(f(),p("div",S,[l(g)?(f(),p("div",X,[o("div",G,[(f(!0),p(Te,null,qe(l(A),s=>(f(),p("div",{class:Ae(["mr-[20px] text-base cursor-pointer leading-none",{"font-bold":m.value==s.type}]),onClick:ra=>m.value=s.type},d(s.title),11,H))),256))]),r(ne,{model:i,ref_key:"formRef",ref:C,rules:l(re),"validate-on-rule-change":!1},{default:c(()=>[I(o("div",null,[r(_,{prop:"username"},{default:c(()=>[r(n,{modelValue:i.username,"onUpdate:modelValue":a[0]||(a[0]=s=>i.username=s),placeholder:("t"in e?e.t:l(t))("usernamePlaceholder"),clearable:"","inline-message":!0},null,8,["modelValue","placeholder"])]),_:1}),r(_,{prop:"password"},{default:c(()=>[r(n,{modelValue:i.password,"onUpdate:modelValue":a[1]||(a[1]=s=>i.password=s),placeholder:("t"in e?e.t:l(t))("passwordPlaceholder"),type:"password",clearable:"","show-password":!0},null,8,["modelValue","placeholder"])]),_:1})],512),[[z,m.value=="username"]]),I(o("div",null,[r(_,{prop:"mobile"},{default:c(()=>[r(n,{modelValue:i.mobile,"onUpdate:modelValue":a[2]||(a[2]=s=>i.mobile=s),placeholder:("t"in e?e.t:l(t))("mobilePlaceholder"),clearable:""},null,8,["modelValue","placeholder"])]),_:1}),r(_,{prop:"mobile_code"},{default:c(()=>[r(n,{modelValue:i.mobile_code,"onUpdate:modelValue":a[4]||(a[4]=s=>i.mobile_code=s),placeholder:("t"in e?e.t:l(t))("codePlaceholder")},{suffix:c(()=>[r(ie,{mobile:i.mobile,type:"login",modelValue:i.mobile_key,"onUpdate:modelValue":a[3]||(a[3]=s=>i.mobile_key=s),onClick:oe,ref_key:"smsCodeRef",ref:E},null,8,["mobile","modelValue"])]),_:1},8,["modelValue","placeholder"])]),_:1})],512),[[z,m.value=="mobile"]]),o("div",K,[r(D,{to:"/auth/register"},{default:c(()=>[r(R,{type:"primary",link:""},{default:c(()=>[k(d(("t"in e?e.t:l(t))("noAccount"))+"\uFF0C"+d(("t"in e?e.t:l(t))("toRegister")),1)]),_:1})]),_:1})]),r(_,null,{default:c(()=>[r(R,{type:"primary",class:"mt-[20px] w-full",size:"large",onClick:se,loading:h.value},{default:c(()=>[k(d(h.value?("t"in e?e.t:l(t))("logining"):("t"in e?e.t:l(t))("login")),1)]),_:1},8,["loading"])]),_:1}),l(b).login.agreement_show?(f(),p("div",M,[k(d(("t"in e?e.t:l(t))("agreeTips"))+" ",1),r(D,{to:"/auth/agreement?key=service"},{default:c(()=>[o("span",N,d(("t"in e?e.t:l(t))("userAgreement")),1)]),_:1}),k(" "+d(("t"in e?e.t:l(t))("and"))+" ",1),r(D,{to:"/auth/agreement?key=privacy"},{default:c(()=>[o("span",O,d(("t"in e?e.t:l(t))("privacyAgreement")),1)]),_:1})])):x("",!0),l(L)?(f(),p("div",Q,[o("span",{class:"iconfont icon-weixin1 text-[#1AAD19] !text-[24px] cursor-pointer",onClick:j})])):x("",!0)]),_:1},8,["model","rules"])])):(f(),p("div",W,[Y,Z,o("div",$,[o("div",ee,[r(ue,{src:u.value.url,class:"w-[120px]"},null,8,["src"]),u.value.pastDue?(f(),p("div",ae,[o("span",te,d(u.value.pastDueContent),1),o("span",{onClick:a[5]||(a[5]=s=>q()),class:"text-xs cursor-pointer text-color mt-2"},"\u70B9\u51FB\u5237\u65B0")])):x("",!0)])]),o("div",{class:"mt-[60px] text-base cursor-pointer leading-none",onClick:j},"\u8D26\u53F7\u767B\u5F55")]))])):x("",!0)])}}});B=Ke(le,[["__scopeId","data-v-f91ea484"]])});export{la as __tla,B as default};