1/// <reference path="config.js" /> 2 3ShipxyLogin = { 4 loginBox: 1, 5 wxGuid: '', 6 openId: '', 7 resetLoginState: function () { 8 var _ = this; 9 //èªå¨ç»éè¡¥å é»è¾ï¼è¿åç»éç¶æ Aalon 10 _.autoLoginRember().then(function (u) { 11 // åç»å¤ç页é¢é»è¾ 12 if (u && u.user && $("#userName").length) { 13 $("#userName").val(u && u.user || ''); 14 $("#password").val(u && u.pass || ''); 15 $("#userPWD").val(u && u.pass || ''); 16 //忢å°ç»éæ¡ 17 //_.showKeyLogin(); 18 } 19 }) 20 }, 21 loginForm: function (returnUrl) { 22 var url = '/home/login'; 23 if (returnUrl) { 24 url += '?ReturnUrl=' + returnUrl; 25 } 26 location.href = url; 27 return; 28 var _ = this; 29 var str = ''; 30 str += `<div class="login_title"> 31 <p class="p1" >Sign In to ShipFinder</p > 32 <p class="p2">Log in to track vessels worldwide</p> 33 <a href="javascript:void(0)" class="closebtn_360" onclick="layer.close(ShipxyLogin.loginBox)"><i class="layui-icon layui-icon-close"></i></a> 34 </div >`; 35 str += '<div class="login_box"> '; 36 str += ` 37 <p class="login_google"><a href="/Home/ExternalLogin"><img src="/Content/images/g_logo.png" />Sign in with Google</a></p> 38 <p class="or_line_box"><span>Or sign in with email</span></p> 39 ` 40 str += ' <p class="warn_message" style="position: absolute;top: 72px;" id="warnMessage"></p><div style="clear:both;margin-top:22px"></div>'; 41 str += ' <div class="write_input login_form">'; 42 str += ' <p class="login_label">Email or Username</p>'; 43 str += ' <p><input type="text" id="userName" placeholder="Enter your email or username" class="login_input_box" /></p> '; 44 str += ' <p class="login_label mt_16">Password</p>'; 45 str += ' <p class=""><input type="password" id="userPWD" placeholder="Enter your password" class="login_input_box" /></p> '; 46 str += ' <p id="logincode_p" style="margin-top: 20px; text-align: left; padding-left: 32px; display: none;"><span>'; 47 str += ' <input id="logincode" type="text" style="width: 80px;margin-right:5px;" placeholder="' + $.common.lang.code + '" /></span><span><img id="imgCode" src="/Home/GetCode?mode=3" alt=' + $.common.lang.code + ' />' 48 str += ' </span><span><a href="javascript:ShipxyLogin.ChangeCode()" class="verCode">' + $.common.lang.invisibility + 'ï¼' + $.common.lang.changeone + '</a></span></p>' 49 str += ' </div>'; 50 str += ' <p class="ta_l other_btns" style="margin-top:24px;"><span class="fl_r"><a onclick="openPasswordLayer()" style="cursor:pointer;" class="c_blue">Forgot passwordï¼</a></span><span><input type="checkbox" checked="checked" id="autologin" />Keep me signed in</span></p>'; 51 str += ' <p class="mt_16 ta_c"><a href="javascript:void(0)" class="login_btn blue_btn" id="loginBtn" onclick="ShipxyLogin.checkForm()">Sign in</a></p> '; 52 str += " <p class='ta_c mt_20'>Don't have an account? <a class='c_blue register_click' onclick='layer.close(ShipxyLogin.loginBox);openRegisterLayer()' style='cursor:pointer;'>Create an account</a></p>"; 53 str += '</div> '; 54 55 str += ' <div class="login_box pos_a login_box1 login_box_weixin_binding" style="display: none;right:0;top:0;"> ' 56 str += ' ' 57 str += ' <p class="mt_30 ta_c"><a href="javascript:ShipxyLogin.wxBindUser();" class="login_btn blue_btn" id="">' + $.common.lang.bindaccount + '</a></p> ' 58 str += ' <p class="ta_c fz_16 c_999 mt_30">' + $.common.lang.noaccount + '<a href="javascript:ShipxyLogin.wxBindRegister()" class="c_blue a_underline">å¼å§æ³¨å</a>æ<a style="color:#2770d4" href="javascript:ShipxyLogin.findPWD()" class="c_blue_login ml_5">' + $.common.lang.keyback + '</a></p> '
59 str += ' </div>' 60 _.loginBox = layer.open({ 61 skin: 'login_skin', 62 title: '', 63 content: str, 64 closeBtn: 0, 65 area: ['420px', '546px'], 66 shade: [0.3, '#000'], 67 zIndex: _.getLayerIndexLogin() 68 } 69 ) 70 71 $(".login_input_box").bind("keyup", function (e) { 72 var e = (e || event) 73 var key = e.keyCode; 74 if (key == 13) { 75 $("#loginBtn").click(); 76 } 77 }) 78 //ShipxyLogin.loadWxLoginImg(); 79 ShipxyLogin.resetLoginState(); 80 }, 81 getLayerIndexLogin: function () { 82 var n = $(".layui-layer"); 83 var max = $(n[0]).css('z-index'); 84 if (max != undefined) { 85 for (var i = 0; i < n.length; i++) { 86 if ($(n[i]).css('z-index') > max) { 87 max = $(n[i]).css('z-index'); 88 } 89 } 90 max = max * 1 + 1; 91 layer.zIndex = max; 92 } else { 93 max = layer.zIndex * 1 + 1; 94 } 95 max = isNaN(max) ? 1000 : max; 96 return max; 97 }, 98 checkForm: function () { 99 var userName = $("#userName").val(); 100 var userPWD = $("#userPWD").val(); 101 var autoLogin = $("#autologin").is(':checked'); 102 var logincode = $("#logincode").val(); 103 if (userName == '') { 104 $("#warnMessage").html($.common.lang.usernameempty); 105 } else if (userPWD == '') { 106 $("#warnMessage").html($.common.lang.passwordempty); 107 } else { 108 $("#loginBtn").html($.common.lang.loginin + "...").css('background-color', '#ccc'); 109 this.params['username'] = userName; 110 this.params['password'] = userPWD; 111 this.params['autologin'] = autoLogin 112 this.params['authCode'] = logincode 113 this.submitForm(); 114 115 } 116 }, 117 params: {}, 118 submitForm: function () { 119 var _ = this; 120 doPost('/Home/Login', this.params, function (d) { 121 if (d && d.status == 0) { 122 if (ShipxyLogin.loginBox != 1) { layer.close(ShipxyLogin.loginBox); } 123 config.isLogin = true; 124 ShipxyLogin.loginSuccess(); 125 //ç»éæåä¿åç»éä¿¡æ¯ 126 _.autoLoginRember({ 127 user: _.params.username, 128 pass: _.params.password, 129 autologin: '' 130 }); 131 _.loginUType = d.data.UserType || 0; 132 _.redirectToIndex(); 133 134 135 //$(".login_box1").css('height', '483px'); 136 } 137 else { 138 if (d && d.data && d.data.code == 1) { 139 $("#logincode_p").show(); 140 $(".login_box1").css('height', '400px'); 141 //layer.style(ShipxyLogin.loginBox, { height: '538px' }); 142 143 } 144 layer.error(d.msg); 145 } 146 147 $("#loginBtn").html($.common.lang.signin).css('background-color', '#2770d4'); 148 }, true) 149 }, 150 loginSuccess: function () { 151 152 153 }, 154 ChangeCode: function () { 155 $("#imgCode").attr("src", "/Home/GetCode?mode=3&" + Math.random()); 156 157 }, 158 showKeyLogin: function () { 159 $("#loginBoxWeixin").hide(); 160 $("#keyLoginBox").show(); 161 if ($("#logincode_p").css('display') == "block") { 162 $(".login_box1").css('height', '400px'); 163 //layer.style(ShipxyLogin.loginBox, { height: '538px' }); 164 } 165 }, 166 ewmLoginShow: function () { 167 $(".login_box1").css('height', '483px'); 168 //layer.style(ShipxyLogin.loginBox, { height: '483px' }); 169 $("#keyLoginBox").hide(); 170 $("#loginBoxWeixin").show(); 171 172 }, 173 //è¯·æ±æ¬¡æ° 174 intervalCount: 0, 175 //ç»å½ä»¥åçutype /è´¦å·åå¨é®é¢ 1 ç¨æ·åæ¯å«äººææºå· 2 ææºå·æ¯å«äººçç¨æ·å 3 ææºå·ç»å®å¤ä¸ªè´¦å· 4 æªç»å®ææºå· 176 loginUType: 0, 177 wxLogin: function () { 178 var _ = this; 179 var finsh = true; 180 setInterval(function () { 181 if ($("#loginBoxWeixin").css('display') != "block") return; 182 if (finsh && _.intervalCount < 200) { 183 finsh = false; 184 $.ajax({
185 url: '/Home/WxLogin', 186 data: { wxguid: _.wxGuid, _t: new Date().getTime(), keep: $("#autologin").is(':checked') }, 187 success: function (d) { 188 _.intervalCount++; 189 d = JSON.parse(d); 190 if (d && d.status == 0) { 191 config.isLogin = true; 192 ShipxyLogin.loginSuccess(); 193 _.loginUType = d.data.UserType || 0; 194 _.redirectToIndex(); 195 } 196 else if (d && d.status == 3 && d.data) { 197 //location.href = '/Home/WxBind?wiguid=' + d.openid 198 _.openId = d.data.openid; 199 if (_.openId) { 200 $(".login_box_weixin_binding").show() 201 } 202 else { 203 finsh = true; 204 } 205 } 206 else { 207 finsh = true; 208 return; 209 } 210 } 211 }); 212 } 213 }, 1600); 214 }, 215 loadWxLoginImg: function () { 216 var _ = this; 217 $.ajax({
218 url: "/Home/GetWxGuidImg", 219 type: 'GET' 220 }).done(function (d) { 221 d = JSON.parse(d); 222 if (d && d.status == 0) { 223 _.wxGuid = d.wxid; 224 _.wxLogin(); 225 //å¾çèµå¼ 226 $("#wxCodeDive img").attr("src", d.data); 227 } 228 else { 229 layer.error("çæç»éäºç»´ç 失败"); 230 } 231 232 }); 233 }, 234 wxBindRegister: function () { 235 var _ = this; 236 237 //location.href = '/Home/Register?openid=' + _.openId; 238 window.parent.location.href = '/Home/Register?openid=' + _.openId; 239 }, 240 wxBindUser: function () { 241 var _ = this; 242 var username = $("#username_wxbind").val(); 243 var pwd = $("#pwd_wxbind").val(); 244 $.ajax({ 245 url: '/Home/WxBindUser', 246 data: { username: username, pwd: pwd, openid: _.openId }, 247 success: function (d) { 248 d = JSON.parse(d); 249 if (d && d.status == 0) { 250 //location.href = '/Ship/Index' 251 window.parent.location.href = '/Ship/Index'; 252 } 253 else { 254 layer.error(d.msg); 255 } 256 } 257 }); 258 }, 259 findPWD: function () { 260 var _ = this; 261 262 //location.href = '/Home/Register?openid=' + _.openId; 263 window.parent.location.href = '/home/password'; 264 }, 265 getQueryString: function (s) { 266 var reg = new RegExp("(^|&)" + s + "=([^&]*)(&|$)"); 267 var r = window.location.search.substr(1).match(reg); 268 if (r != null) return r[2]; return ""; 269 }, 270 redirectToIndex: function () { 271 var _ = this, returl = this.getQueryString("ReturnUrl") + ""; 272 if (returl != "") { 273 window.location.href = decodeURIComponent(returl); 274 } 275 else { 276 location.reload(); 277 localStorage.setItem('isShowOtherUserInfo', true); 278 } 279 }, 280 281 //ç¨æ·ä¸å¿ç»å½ 282 loginUserCenter: function () { 283 var _rtn = '0'; 284 $.ajax({
285 url: '/Home/LoginUC', 286 data: {}, 287 type: 'post', 288 async: false, 289 success: function (d) { 290 d = JSON.parse(d); 291 _rtn = d; 292 } 293 }); 294 }, 295 autoLoginRember: function (o) { 296 var u = {}, 297 defer = $.Deferred(); 298 function encode(str) { 299 return window.btoa(encodeURIComponent(str)) 300 } 301 302 function decode(str) { 303 return decodeURIComponent(window.atob(str)); 304 } 305 var user = window.btoa('user'), 306 pass = window.btoa('pass'); 307 o && o.user && (window.localStorage[user] = encode(o.user)); 308 o && o.pass && (window.localStorage[pass] = encode(o.pass)); 309 if (window.localStorage[user]) u.user = decode(window.localStorage[user]) 310 if (window.localStorage[pass]) u.pass = decode(window.localStorage[pass]) 311 return defer.resolve(u); 312 }, 313 314}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.