"use strict";const e=require("../../common/vendor.js"),t=require("../../api/common.js"),i={data:()=>({ticket:"",expired:!1}),onLoad(e){this.init(e.id||"")},methods:{init(e){this.ticket=e,this.expired=!1,t.setCodeCertificateStatus(e,"1")},goBack(){t.setCodeCertificateStatus(this.ticket,"-1").then((t=>{e.index.navigateBack()}))},reScan(){e.index.scanCode({success:e=>{if(this.isJSON(e.result.trim())){const t=JSON.parse(e.result.trim());"login"===t.t&&this.init(t.id||"")}}})},isJSON(e){try{var t=JSON.parse(e);return!("object"!=typeof t||!t)}catch(i){return!1}},handelConfirmLogin(){t.confirmLogin(this.ticket).then((t=>{if(-1===t.data.status)return e.index.showToast({title:"二维码已失效,请重新扫码登录",icon:"none"}),void(this.expired=!0);2===t.data.status&&e.index.showToast({title:"登录成功",icon:"none",complete:()=>{setTimeout((()=>{e.index.navigateBack()}),1500)}})}))}}};if(!Array){e.resolveComponent("u-button")()}Math;const n=e._export_sfc(i,[["render",function(t,i,n,r,o,s){return e.e({a:!o.expired},o.expired?{}:{b:e.o(s.handelConfirmLogin),c:e.p({type:"primary"})},{d:o.expired},o.expired?{e:e.o(s.reScan),f:e.p({type:"primary"})}:{},{g:e.o((e=>s.goBack()))})}]]);wx.createPage(n);