!function(){var e=require("nw.gui"),t=require("os");console.log(e);var o=e.Window.get(),i=localStorage.getItem("mobile_number");/^1\d{10}$/.test(i)||(i="");var n=localStorage.getItem("token");n&&n.length>0&&e.Window.open("./main.html",{position:"center",width:1390,height:700,min_width:1390,min_height:700},function(e){console.log("new window loaded"),o.close()});const r=axios.create();r.interceptors.request.use(e=>(e.headers.x_platform="PC_HELPER",e));var s=new Vue({el:"#root",data:{mobile:i||"",timeout:"获取验证码",timeoutTime:60,code:"",errMsg:"",tip:"",MODE_VCODE:0,MODE_PSW:1,mode:0},methods:{closeWindow:function(){o.close()},getVcode:function(){s.errMsg="","获取验证码"===this.timeout&&(s.timeoutTime=60,myTimer=setInterval(function(){s.timeoutTime--,s.timeout=s.timeoutTime+"秒后重试",s.timeoutTime<=0&&(clearInterval(myTimer),s.timeout="获取验证码",s.timeoutTime=60)},1e3),s.tip="正在发送...",r.post("https://int.xxpie.com/api/photographer/mine/sendSMSVerificationCode",{mobile:s.mobile,district:"+86",type:"PHOTOGRAPHER_SIGN_IN"}).then(function(e){console.log("验证码已发送"),s.tip="验证码已发送",window.setTimeout(()=>{s.tip=""},1e3)}).catch(function(e){s.tip="验证码发送失败",window.setTimeout(()=>{s.tip=""},1e3),s.timeoutTime=0,clearInterval(myTimer),s.timeout="获取验证码"}))},login:function(){if(s.errMsg="",""!=s.mobile&&""!=s.code)if(s.code.length<4)s.errMsg="验证码最少为4位！";else{var t={username:this.mobile,platform:"PC_HELPER"};s.mode===s.MODE_VCODE?t.verificationCode=this.code:t.password=md5(this.code),r.post(s.mode===s.MODE_VCODE?"https://int.xxpie.com/api/photographer/mine/signInV4":"https://int.xxpie.com/api/photographer/mine/signInByPassword",t).then(function(t){200===t.status?(user=t.data,localStorage.setItem("icon_photo_key",user.icon_photo_key),localStorage.setItem("icon_photo_url",user.icon_photo_url),localStorage.setItem("mobile_number",user.mobile_number),localStorage.setItem("nick_name",user.nick_name),localStorage.setItem("sys_user_id",user.sys_user_id),localStorage.setItem("token",user.token),e.Window.open("./main.html",{position:"center",width:1390,height:700,min_width:1390,min_height:700},function(e){console.log("new window loaded"),o.close()})):(code="",t&&t.errMsg?s.errMsg=t.errMsg:s.errMsg="登录失败, 请检查"+(s.mode===s.MODE_VCODE?"验证码":"密码")+"是否正确")}).catch(function(e){code="",e.response&&e.response.errMsg?s.errMsg=err.response.errMsg:s.errMsg="登录失败, 请检查"+(s.mode===s.MODE_VCODE?"验证码":"密码")+"是否正确"})}else s.errMsg="手机号和验证码不能为空！"}}});if("Windows_NT"==t.type){global.tip={title:"提示",msg:"由于本应用下载及上传需操作大量文件, 可能会被安全卫士或WindowsDefender误报并拦截, 请您在发生此情况时选择允许本助手执行操作, 感谢您的理解",showCancel:!1,confirmText:"好"};e.Window.open("./tipwindow.html",{position:"center",width:420,height:165,min_width:420,min_height:165,max_width:420,max_height:165,id:"tip"},function(e){tip.disAllowDismiss&&e.on("closed",function(){o.close(!0)})})}}();