import{I as t,J as s,K as a,L as i,e,q as n,c as o,w as c,i as r,o as l,t as d,v as u,A as p,H as f}from"./index-DL8B2Mxu.js";import{_ as m}from"./u-button.D-oh2uo-.js";import{r as _}from"./uni-app.es.BSVEa1f2.js";import{_ as h}from"./_plugin-vue_export-helper.BCo6x5W8.js";const k=h({data:()=>({ticket:"",expired:!1}),onLoad(t){this.init(t.id||"")},methods:{init(s){this.ticket=s,this.expired=!1,t(s,"1")},goBack(){t(this.ticket,"-1").then((t=>{s()}))},reScan(){a({success:t=>{if(this.isJSON(t.result.trim())){const s=JSON.parse(t.result.trim());"login"===s.t&&this.init(s.id||"")}}})},isJSON(t){try{var s=JSON.parse(t);return!("object"!=typeof s||!s)}catch(a){return!1}},handelConfirmLogin(){i(this.ticket).then((t=>{if(-1===t.data.status)return e({title:"二维码已失效，请重新扫码登录",icon:"none"}),void(this.expired=!0);2===t.data.status&&e({title:"登录成功",icon:"none",complete:()=>{setTimeout((()=>{s()}),1500)}})}))}}},[["render",function(t,s,a,i,e,h){const k=r,g=_(n("u-button"),m),y=f;return l(),o(k,{class:"scanLogin-v"},{default:c((()=>[d(k,{class:"scanLogin-icon"},{default:c((()=>[d(k,{class:"icon-ym icon-ym-pc"})])),_:1}),d(k,{class:"title"},{default:c((()=>[u("登录确认")])),_:1}),d(k,{class:"tip"},{default:c((()=>[u("请确认是否本人操作")])),_:1}),d(k,{class:"tip"},{default:c((()=>[u("并确保二维码来源安全")])),_:1}),d(k,{class:"scanLogin-actions"},{default:c((()=>[e.expired?p("",!0):(l(),o(g,{key:0,class:"buttom-btn",type:"primary",onClick:h.handelConfirmLogin},{default:c((()=>[u("确认登录")])),_:1},8,["onClick"])),e.expired?(l(),o(g,{key:1,class:"buttom-btn",type:"primary",onClick:h.reScan},{default:c((()=>[u("重新扫码登录")])),_:1},8,["onClick"])):p("",!0),d(y,{class:"goBackText",onClick:s[0]||(s[0]=t=>h.goBack())},{default:c((()=>[u("取消")])),_:1})])),_:1})])),_:1})}],["__scopeId","data-v-fddda0a5"]]);export{k as default};
