var _this; new Vue({ el: '#app', data: function() { return { userName: "", userPwd: "", codeImg: "", userCode:"", uuId: "", logining: false } }, created() { _this = this; if(location.search != ""){ let dh = location.search.indexOf("android"); if(dh != -1){ localStorage.setItem("ptType", "android"); } } _this.getCodeImg(); if (getCookie("ylToken") != "null" && getCookie("ylToken") != null) { top.location.href = staticUrl + (IsPC()?"/view/main.html":"/view/mainPh.html"); } else { clearStor(); } }, methods: { getCodeImg(){ let _opts = { url: baseUrl + "/captchaImage", type:"GET" }; getAxios(_opts, {}, {}).then((res) => { if(res.code == 200){ _this.uuId = res.uuid; _this.codeImg = "data:image/jpg;base64,"+res.img; } }) }, logIn(){ if(_this.userName == ""){ _this.$message({ message: '请填写用户账号!', type: 'warning' }); return; } if(_this.userPwd == ""){ _this.$message({ message: '请填写用户密码!', type: 'warning' }); return; } if(_this.userCode == ""){ _this.$message({ message: '请填写验证码!', type: 'warning' }); return; } _this.logining = true; let _opts = { url: baseUrl + "/login", type:"POST" }; let _hea = { "Content-Type": 'application/json; charset=UTF-8' }; let _data = JSON.stringify({ code: _this.userCode, password: _this.userPwd, username: _this.userName, uuid: _this.uuId }); postAxios(_opts, _data, _hea).then((res) => { if (res.code == "200"){ delCookie("Admin-Token"); setCookie("Admin-Token",res.token); _this.getEzviz(); }else{ _this.$message({ message: "错误原因:"+res.msg+"!", type: 'warning' }); _this.getCodeImg(); _this.logining = false; } }) }, getEzviz(){ let _opts = { url: ys7Url + "/api/lapp/token/get", type:"POST" }; let _data = { appKey:"443b2b196905436dbdf1ad6f30b0ac0d", appSecret:"08d8c3401a809115d442108883735c70" }; let _hea = {}; postAxios(_opts, _data, _hea).then((res) => { if(res.code == 200){ delCookie("ylToken"); setCookie("ylToken",res.data.accessToken); _this.getHTok(); }else{ if(res.code == "10017"){ _this.$message({ message: '用户账号错误!', type: 'warning' }); }else if(res.code == "10030"){ _this.$message({ message: '用户密码错误!', type: 'warning' }); } _this.getCodeImg(); _this.logining = false; } }) }, getHTok(){ let _opts = { url: helUrl + "/index.php?ctl=tool&act=get_token", type:"POST" }; let _data = { user_name: "易站智联", pkey: "e7d7cbe91171c493e8022a418d16bb7d" }; let _hea = {}; postAxios(_opts, _data, _hea).then((res) => { if(res.status){ delCookie("hemlTok"); setCookie("hemlTok",res.token); _this.getZTok(); // top.location.href = staticUrl + (IsPC()?"/view/main.html":"/view/mainPh.html"); }else{ _this.getCodeImg(); } _this.logining = false; }) }, getZTok(){ let _opts = { url: "https://hsws.enstation.com/radar_war/login", type:"POST" }; let _data = JSON.stringify({ username: "n5cMa8laaQm+x24QXdu2+A==", password: "n/kedxFbY0pPAAbTPfIbZg==", code: null, uuid: "f53582934d844429a52be829a9291789" }); let _hea = { "Content-Type": "application/json" }; postAxios(_opts, _data, _hea).then((res) => { if(res.code == 200){ delCookie("tzToken"); setCookie("tzToken", res.token); top.location.href = staticUrl + (IsPC()?"/view/main.html":"/view/mainPh.html"); }else{ _this.getCodeImg(); } _this.logining = false; }) }, keyDown(ev){ console.log(ev) } } })