测试思路
Posted 钢锅
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了测试思路相关的知识,希望对你有一定的参考价值。
认证页:
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" /> <script src="js/jquery.js" type="text/javascript"></script> <script src="js/encode.js" type="text/javascript"></script> <script type="text/javascript"> //首先js判断是不是有cookies,没有则强制跳转到云平台www.wmdfw.com //有cookies则自行下面 var time_out=2; var weburl=""; var save_time=72; function aC(_n,_v){ var str = _n + "=" + escape(_v); if(save_time > 0){ var date = new Date(); var ms = save_time*3600*1000; date.setTime(date.getTime() + ms); str += "; expires=" + date.toGMTString(); } document.cookie = str; } function gC(_n){ var arrStr = document.cookie.split("; "); for(var i = 0;i < arrStr.length;i ++){ var temp = arrStr[i].split("="); if(temp[0] == _n) return unescape(temp[1]); } return ""; } function dC(name){ var date = new Date(); date.setTime(date.getTime() - 10000); document.cookie = name + "=a; expires=" + date.toGMTString(); } var ld=""; var init=0; $(function(){ init = 1; cWH(); setInterval(cWH,200); ld=get_ld(); var _v=gC("save"); if (_v){ $("#usr").val(gC("usr")); $("#pwd").val(gC("pwd")); $("#save")[0].checked=true; _v=gC("auto"); if (_v == "true" ){ $("#auto")[0].checked=true; if (time_out>0) setTimeout(autologin,time_out*1000); else login(); }else{ time_out = -1; } } $("#usr").focus(); }); function autologin(){ if (time_out>=0) login(); } function login(){ //var usr=$("#usr").val(); //var pwd=$("#pwd").val(); var str="auth.asp?usr="+usr+"&pwd="+pwd; if ($("#save")[0].checked){ aC("usr", usr); aC("pwd", pwd); aC("save", true); aC("auto", $("#auto")[0].checked); } var data_str=encodeToGB2312(str); $.ajax({ type: "GET", url: data_str, success: post_fun, error: null, timeout: 10000, dataType: "json", cache: false }); } function post_fun(msg){ var url = ""; if(msg.ret==0){ aC("ip", msg.i); url = msg.l; if(url.length <= 7) url = get_ld(); if(msg.e == \'0\') url = ""; if(weburl=="") weburl="userinfo.htm?u="+ $("#usr").val()+"&i="+msg.i+"&l="+url; alert(\'您已经登陆成功!\'); window.location.replace(weburl); }else{ $("#usr").focus(); alert(msg.msg); //window.location.replace(\'http://www.wmdfw.com/\'); } } function get_ld(){ var tmp = window.location.href.split("ld="); return tmp.length==2 ? tmp[1] : ""; } function val_edit(obj){ if(init>0) time_out=-1; } function save_ck(obj){ val_edit(); if(!obj.checked){ $("#auto")[0].checked=false; dC("usr"); dC("pwd"); dC("save"); dC("auto"); } } //获取来自云平台数据 function GetQueryString(name) { var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)","i"); var r = window.location.search.substr(1).match(reg); if (r!=null) return (r[2]); return null; } var usr = GetQueryString("usr"); if(usr!=null) { var usr = decodeURIComponent(usr); //alert(usr_); } var pwd = GetQueryString("pwd"); if(pwd!=null) { var pwd = decodeURIComponent(pwd); //alert(pwd_); } var i = GetQueryString("i"); if(i!=null) { var i = decodeURIComponent(i); //alert(i_); } var _ = GetQueryString("_"); if(_!=null) { var _ = decodeURIComponent(_); } var tel_num = GetQueryString("tel_num"); if(tel_num!=null) { var pwd = decodeURIComponent(tel_num); var usr = decodeURIComponent(tel_num); } //销毁cookies </script> </head> <body onLoad="login();"> <div style="visibility: hidden;" id="main"> <div class="top">上网认证登录</div> <table> <tr> <td class="tit">账号:</td> <td><input id="usr" type="text" maxlength="31" placeholder="请输入账号" /></td> </tr> <tr> <td class="tit">密码:</td> <td><input id="pwd" type="password" maxlength="31" placeholder="请输入密码" /></td> </tr> <tr> <td class="tit"></td> <td> <input id="save" type="checkbox" onClick="save_ck(this)" /><span>记住信息</span> </td> </tr> </table> <div class="bottom"> <input type="button" value="登录" onClick="login()"> </div> </div> </body> </html>
下面加是cookies判断
<html> <head> <script type="text/javascript"> //;~ 小部分AutoHotkey源代码片段测试模板2019年10月9日.ahktypescript Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming/angular-2/
typescript Angular最终版本的Angular 2测试片段。代码库https://developers.livechatinc.com/blog/category/programming