OpenWrt_Luci_Lua/Mi_Lua/luci/view/web/init/hello.htm

81 lines
2.5 KiB
HTML
Raw Normal View History

2015-05-09 10:48:46 +00:00
<%
local ver = require("xiaoqiang.XQVersion").webVersion
local sys = require("xiaoqiang.util.XQSysUtil")
if sys.getInitInfo() then
luci.http.redirect(luci.dispatcher.build_url("web", "home"))
else
sys.setSysPasswordDefault()
end
%>
<%include ("web/inc/head")%>
<title>初始化引导 - 小米路由器</title>
<link rel="stylesheet" href="<%=resource%>/web/css/page.init.css?v=<%=ver%>">
<script>
if (window.self != window.top) {
window.top.location.reload(true);
}
</script>
</head>
<body id="page-hello">
<div id="doc">
<%include ("web/inc/header")%>
<div id="bd">
<div class="mod-hello">
<div class="agreement">
<label class="js-checkbox"><span class="input-checkbox input-checkbox-checked"><input name="agree" id="agree" type="checkbox" checked="checked"></span> 阅读并同意</label> <a href="<%=luci.dispatcher.build_url("web", "init","agreement")%>" target="_blank">小米路由器用户协议</a>
</div>
<a class="start-use" id="agreenment" href="#">开始体验</a>
</div>
</div>
<%include ("web/inc/footermini")%>
</div>
<!-- <form id="prelogin" name="prelogin" method="post" action="<%=luci.dispatcher.build_url("web", "init","guide")%>" style="display:none;">
<input type="hidden" name="logtype" value="2">
<input type="hidden" name="username" value="admin">
<input type="hidden" name="password" value="admin">
</form> -->
<%include ("web/inc/g.js.base")%>
<script>
$(function(){
$('#agreenment').on('click', function(e){
e.preventDefault();
if ($('#agree').prop('checked')) {
// $('#prelogin').submit();
global_event.crypto.init();
var oldPwd = global_event.crypto.oldPwd('admin');
var nonce = global_event.crypto.nonce;
var data = {
username: 'admin',
logtype: 2,
password: oldPwd,
nonce: nonce,
init: 1
}
$.post('<%=luci.dispatcher.build_url("api", "xqsystem", "login")%>', data, function(rsp){
var rsp = $.parseJSON(rsp);
if (rsp.code == 0) {
window.location.href = rsp.url;
}
});
}
});
$('#agree').on('ionchange', function(e){
if (this.checked) {
$('#agreenment').removeClass('start-use-disable');
}else{
$('#agreenment').addClass('start-use-disable');
}
});
});
(function(){
var keys = document.cookie.match(/[^ =;]+(?=\=)/g);
if (keys) {
for (var i = keys.length; i--;){
document.cookie=keys[i]+'=0;path=/;expires=' + new Date(0).toUTCString();
}
}
}());
</script>
</body>
</html>