var V=(l,r,a)=>new Promise((I,n)=>{var h=i=>{try{u(a.next(i))}catch(_){n(_)}},s=i=>{try{u(a.throw(i))}catch(_){n(_)}},u=i=>i.done?I(i.value):Promise.resolve(i.value).then(h,s);u((a=a.apply(l,r)).next())});import{_ as R,d as j,a as Q,r as d,b as O,o as A,c as w,e as U,f as P,g as t,h as M,n as S,w as x,v as y,u as N,t as E,i as m,j as g,k as z,l as D,m as H,p as J,q as K,s as W,x as X}from"./index.2939355b.js";import{d as F}from"./index.7c7dd05f.js";import{s as T,g as Y}from"./auth.028d614f.js";const Z=l=>(K("data-v-45258083"),l=l(),W(),l),ee={key:0,class:"mainBox"},oe={class:"loginBox"},te=Z(()=>t("div",{class:"text"},null,-1)),se={class:"loginTab"},ae={class:"mt-50 flex justify-center"},ie={class:"qrcodeBox"},ne={class:"qrcode"},le=["src"],re={class:"bottom"},ce={class:"verificationCode"},de=j({beforeRouteEnter(l,r,a){Q.get("token")?a("/home"):a()}}),ue=Object.assign(de,{__name:"index",setup(l){const{proxy:r}=X(),a="\u4E13\u6709\u9489\u9489",I="https://login.dg-work.cn/oauth2/auth.htm?response_type=code&client_id=ls-rebuild_dingoa&redirect_uri=http://ls-rebuild.ningdatech.com/login&scope=get_user_info&authType=QRCODE&embedMode=true",n=d(!0),h=o=>{n.value=o},s=O({}),u=d(),i=O({phoneNum:[{required:!0,message:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7",trigger:"blur"}],verifyCode:[{required:!0,message:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801",trigger:"blur"}]}),_=o=>V(this,null,function*(){!o||(yield o.validate((e,c)=>{e?T({credential:s.verifyCode,identifier:s.phoneNum,loginType:"PHONE_VERIFICATION_CODE_LOGIN"}).then(v=>{v.code===200?(b.value=!0,D.replace("/")):r.$message.error(v.respMsg)}):console.log("error submit!",c)}))}),b=d(!1),B=d(!0),L=()=>{F?F.getAuthCode({}).then(o=>{o&&(o.code||o.auth_code)&&T({credential:o.code||o.auth_code,identifier:"",loginType:"DING_MD_LOGIN"}).then(e=>{e.code===200?(b.value=!0,D.replace("/")):r.$message.error(e.respMsg)})}).catch(()=>{B.value=!1,(()=>{window.addEventListener("message",function(e){!b.value&&e.data.code&&T({credential:e.data.code,identifier:"",loginType:"DING_QR_LOGIN"}).then(c=>{c.code===200?(b.value=!0,D.replace("/")):r.$message.error(c.respMsg)})})})()}):console.log("\u672A\u627E\u5230ddApi")},f=d(""),k=d(null),C=d(!0),$=()=>V(this,null,function*(){if((yield Y({mobile:s.phoneNum,verificationType:"LOGIN"})).code===200){r.$message.success("\u9A8C\u8BC1\u7801\u5DF2\u53D1\u9001");const e=60;k.value||(f.value=e,C.value=!1,k.value=setInterval(()=>{f.value>0&&f.value<=e?f.value--:(C.value=!0,clearInterval(this.timer),k.value=null)},1e3))}});return A(()=>{var o=navigator.userAgent.toLowerCase();/ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test(o)?window.location.href="http://lsmobile.ningdatech.com/":L()}),(o,e)=>{const c=w("el-input"),v=w("el-form-item"),q=w("el-form"),G=w("el-button");return B.value?M("v-if",!0):(U(),P("div",ee,[t("div",oe,[M(` <div class="text">
        <p>\u6B22\u8FCE\u4F7F\u7528</p>
        <p>\u4E3D\u6C34\u5E02\u653F\u5E9C\u6295\u8D44\u4FE1\u606F\u5316\u9879\u76EE\u7BA1\u7406\u7CFB\u7EDF</p>
      </div> `),te,t("div",se,[t("div",ae,[t("span",{class:S(["tabItem mr-20",{itemBlue:n.value}]),onClick:e[0]||(e[0]=p=>h(!0))},"\u626B\u7801\u767B\u5F55",2),t("span",{class:S(["tabItem",{itemBlue:n.value===!1}]),onClick:e[1]||(e[1]=p=>h(!1))},"\u9A8C\u8BC1\u7801\u767B\u5F55",2)]),x(t("div",ie,[t("div",ne,[t("iframe",{width:"200",height:"430",src:N(I),frameborder:"0"},null,8,le)]),t("p",re,"\u8BF7\u4F7F\u7528"+E(N(a))+"\u626B\u63CF\u4E8C\u7EF4\u7801\u767B\u9646",1)],512),[[y,n.value]]),x(t("div",ce,[m(q,{ref_key:"ruleFormRef",ref:u,model:s,rules:i,"label-width":"atuo",class:"demo-ruleForm","status-icon":""},{default:g(()=>[m(v,{label:"",prop:"phoneNum"},{default:g(()=>[m(c,{modelValue:s.phoneNum,"onUpdate:modelValue":e[2]||(e[2]=p=>s.phoneNum=p),"prefix-icon":N(H),placeholder:"\u8BF7\u8F93\u5165\u624B\u673A\u53F7"},null,8,["modelValue","prefix-icon"])]),_:1}),m(v,{label:"",prop:"verifyCode"},{default:g(()=>[m(c,{modelValue:s.verifyCode,"onUpdate:modelValue":e[3]||(e[3]=p=>s.verifyCode=p),"prefix-icon":N(J),placeholder:"\u8BF7\u8F93\u5165\u9A8C\u8BC1\u7801"},{suffix:g(()=>[x(t("span",{class:"itemBlue",onClick:$}," \u83B7\u53D6\u9A8C\u8BC1\u7801",512),[[y,C.value]]),x(t("span",{class:"itemBlue"},E(f.value),513),[[y,!C.value]])]),_:1},8,["modelValue","prefix-icon"])]),_:1})]),_:1},8,["model","rules"]),m(G,{class:"w-full mt-50",type:"primary",onClick:e[4]||(e[4]=p=>_(u.value))},{default:g(()=>[z(" \u767B\u5F55 ")]),_:1})],512),[[y,!n.value]])])])]))}}}),ve=R(ue,[["__scopeId","data-v-45258083"],["__file","/Users/chenlixin/Documents/work/NDKJ/MyProject/ls-project-v2.0/src/pages/login/index.vue"]]);export{ve as default};
