mirror of
https://gitee.com/beecue/fastbee.git
synced 2025-12-20 09:55:54 +08:00
添加智能灯固件代码
This commit is contained in:
198
firmware/esp-idf/wumei-smart-firmware/main/www/home.html
Normal file
198
firmware/esp-idf/wumei-smart-firmware/main/www/home.html
Normal file
@@ -0,0 +1,198 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>物美智能设备AP配置</title>
|
||||
<style type="text/css">
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#all{
|
||||
margin: 20px auto;
|
||||
position: relative;
|
||||
width:320px;
|
||||
text-align:center;
|
||||
}
|
||||
#all #tab li{
|
||||
list-style: none;
|
||||
float: left;
|
||||
width: 94px;
|
||||
line-height: 40px;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
color:#fff;
|
||||
margin-left:10px;
|
||||
}
|
||||
#tab{
|
||||
height:40px;
|
||||
}
|
||||
#all .con{
|
||||
border:1px solid #ddd;
|
||||
padding:10px;
|
||||
margin:15px 10px;
|
||||
}
|
||||
.group{
|
||||
line-height:50px;
|
||||
}
|
||||
.group .btn{
|
||||
padding:4px 14px;
|
||||
background:#f56c6c;
|
||||
color:#fff;
|
||||
border:1px solid #ddd;
|
||||
border-radius:6px;
|
||||
width:190px;
|
||||
}
|
||||
.group span{
|
||||
width:85px;
|
||||
display:inline-block;
|
||||
font-size:14px;
|
||||
}
|
||||
.group input{
|
||||
line-height:24px;
|
||||
width:180px;
|
||||
}
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
window.onload = function(){
|
||||
var tab = document.getElementById("tab");
|
||||
var lis = tab.getElementsByTagName('li');//获得标签li的数组
|
||||
var cons = document.getElementsByClassName('con');//获得下面内容div的数组
|
||||
for(var i=0;i<lis.length;i++){
|
||||
lis[i].num = i;//给对象添加属性,赋值用于标记
|
||||
lis[i].onclick = function(){
|
||||
if(this.num==2){
|
||||
window.location.href="/download/";
|
||||
}
|
||||
//tab内容显示和隐藏
|
||||
for(var j = 0;j<cons.length;j++){
|
||||
if(j==this.num){
|
||||
cons[this.num].style.display = 'block';
|
||||
}else{
|
||||
cons[j].style.display = 'none';
|
||||
}
|
||||
}
|
||||
//设置选中
|
||||
for(var k=0;k<lis.length;k++){
|
||||
if(k==this.num){
|
||||
lis[this.num].style.backgroundColor ="#006DFE"; //设置为选中
|
||||
}else{
|
||||
lis[k].style.backgroundColor="#888"; //设置背景为灰色
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 根据url参数设置选中
|
||||
var value=getQueryVariable("tab");
|
||||
console.log("value",value);
|
||||
if(value==0){
|
||||
lis[0].onclick();
|
||||
}else if(value==1){
|
||||
lis[1].onclick();
|
||||
}
|
||||
}
|
||||
function getQueryVariable(variable){
|
||||
var query = window.location.search.substring(1);
|
||||
var vars = query.split("&");
|
||||
for (var i=0;i<vars.length;i++) {
|
||||
var pair = vars[i].split("=");
|
||||
if(pair[0] == variable){return pair[1];}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
function wifiSubmit(){
|
||||
var ssid = document.getElementById("ssid").value;
|
||||
var password = document.getElementById("password").value;
|
||||
var uuid = document.getElementById("uuid").value;
|
||||
if(ssid=="" || password=="" || uuid==""){
|
||||
alert("WIFI的名称、密码和关联用户不能为空。")
|
||||
return;
|
||||
}else{
|
||||
// 确认提交
|
||||
}
|
||||
|
||||
var button = document.getElementById("wifi_submit").submit();
|
||||
}
|
||||
function mqttSubmit(){
|
||||
var mqtt_address = document.getElementById("mqtt_address").value;
|
||||
var mqtt_port = document.getElementById("mqtt_port").value;
|
||||
if(mqtt_address=="" || mqtt_port==""){
|
||||
alert("MQTT的地址和端口不能为空");
|
||||
return;
|
||||
}else{
|
||||
//确认提交
|
||||
}
|
||||
var button = document.getElementById("mqtt_submit").submit();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style="width:100%;height:60px;font-size:22px;line-height:60px;background:#006DFE;color:#fff;text-align:center;">物美智能设备配置</div>
|
||||
|
||||
<div id="all">
|
||||
<ul id="tab">
|
||||
<li style="background: #006DFE;">服务端</li>
|
||||
<li style="background: #888;">配网</li>
|
||||
<li style="background: #888;">上传证书</li>
|
||||
</ul>
|
||||
<div class="con" style="display:block;">
|
||||
<form name=”form1” method="post" action="mqtt" id="mqtt_submit">
|
||||
<div class="group">
|
||||
<span>MQTT地址:</span>
|
||||
<input type="text" name="mqtt_address" placeholder="www.wumei.live" id="mqtt_address">
|
||||
</div>
|
||||
<div class="group">
|
||||
<span>MQTT端口:</span>
|
||||
<input type="text" name="mqtt_port" placeholder="1883" id="mqtt_port">
|
||||
</div>
|
||||
<div class="group">
|
||||
<span>MQTT账号:</span>
|
||||
<input type="text" name="mqtt_account" placeholder="可选项">
|
||||
</div>
|
||||
<div class="group">
|
||||
<span>MQTT密码:</span>
|
||||
<input type="text" name="mqtt_password" placeholder="可选项">
|
||||
</div>
|
||||
<div style="line-height:50px;">
|
||||
<span>使用证书:</span>
|
||||
<input type="radio" name="is_certifi" id="unuse" value=0 checked> <label for="unuse" style="margin-right:20px;">不使用</label>
|
||||
<input type="radio" name="is_certifi" id="use" value=1> <label for="use" style="margin-right:35px;">使用</label><br/>
|
||||
</div>
|
||||
<div style="line-height:20px;" class="group">
|
||||
<span></span>
|
||||
<input type="button" class="btn" value="连接服务端" onclick="mqttSubmit()">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="con" style="display:none;">
|
||||
<form name=”form2” method="post" action="wifi" id="wifi_submit">
|
||||
<div class="group">
|
||||
<span>WIFI名称:</span>
|
||||
<input type="text" name="ssid" placeholder="不能包含中文" id="ssid">
|
||||
</div>
|
||||
<div class="group">
|
||||
<span>WIFI密码:</span>
|
||||
<input type="text" name="password" placeholder="不能包含中文" id="password">
|
||||
</div>
|
||||
<div class="group">
|
||||
<span>关联用户:</span>
|
||||
<input type="text" name="uuid" placeholder="用户ID或者手机号" id="uuid">
|
||||
</div>
|
||||
<div style="line-height:20px;" class="group">
|
||||
<span></span>
|
||||
<input type="button" class="btn" value="配网" onclick="wifiSubmit()" >
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="con"></div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
firmware/esp-idf/wumei-smart-firmware/main/www/home.html.gz
Normal file
BIN
firmware/esp-idf/wumei-smart-firmware/main/www/home.html.gz
Normal file
Binary file not shown.
55
firmware/esp-idf/wumei-smart-firmware/main/www/prompt.html
Normal file
55
firmware/esp-idf/wumei-smart-firmware/main/www/prompt.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>物美智能设备AP配置</title>
|
||||
<style type="text/css">
|
||||
*{
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
#main{
|
||||
margin: 20px auto;
|
||||
position: relative;
|
||||
width:320px;
|
||||
height:200px;
|
||||
border:1px solid #ccc;
|
||||
border-radius:5px;
|
||||
text-align:center;
|
||||
}
|
||||
.header{
|
||||
width:320px;
|
||||
line-height:32px;
|
||||
font-size:18px;
|
||||
background:#006DFE;
|
||||
color:#fff;
|
||||
}
|
||||
.content span{
|
||||
line-height:130px;
|
||||
}
|
||||
.content a{
|
||||
position:absolute;
|
||||
bottom:10px;
|
||||
width:90px;
|
||||
right:10px;
|
||||
font-size:14px;
|
||||
text-decoration:none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style="width:100%;height:60px;font-size:22px;line-height:60px;background:#006DFE;color:#fff;text-align:center;">物美智能设备配置</div>
|
||||
|
||||
<div id="main">
|
||||
<div class="header">-- 温馨提示 --</div>
|
||||
<div class="content">
|
||||
<span>配置已经完成,请重新启动设备。</span>
|
||||
<a href="/" target="_self">返回主页 >></a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
BIN
firmware/esp-idf/wumei-smart-firmware/main/www/prompt.html.gz
Normal file
BIN
firmware/esp-idf/wumei-smart-firmware/main/www/prompt.html.gz
Normal file
Binary file not shown.
@@ -0,0 +1,103 @@
|
||||
<style type="text/css">
|
||||
*{margin: 0;padding: 0;}
|
||||
#all{margin: 20px auto;position: relative;width:320px;text-align:center;}
|
||||
#all #tab li{list-style: none;float: left;width: 94px;line-height: 40px;text-align: center;font-size: 16px;color:#fff;margin-left:10px;}
|
||||
#tab{ height:40px;}
|
||||
#all .con{border:1px solid #aaa;padding:10px;margin:15px 10px;}
|
||||
#list{margin: 20px auto;position:relative;width:300px;text-align:center;}
|
||||
#list table{border-collapse:collapse;border:none;width:300px;}
|
||||
#list table tr td{border:solid#aaa 1px;padding:10px;}
|
||||
</style>
|
||||
<div style="width:100%;height:60px;font-size:22px;line-height:60px;background:#006DFE;color:#fff;text-align:center;">物美智能设备配置</div>
|
||||
<div id="all">
|
||||
<ul id="tab">
|
||||
<li style="background: #888;">服务端</li>
|
||||
<li style="background: #888;">配网</li>
|
||||
<li style="background: #006DFE;">上传证书</li>
|
||||
</ul>
|
||||
<div class="con" style="display:block;">
|
||||
<table class="fixed" border="0">
|
||||
<col width="1000px" /><col width="500px" />
|
||||
<tr><td>
|
||||
<table border="0">
|
||||
<tr style="height:50px;">
|
||||
<td>
|
||||
<input id="newfile" type="file" onchange="setpath()" style="width:100%;">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<input id="filepath" type="hidden" style="width:100%;">
|
||||
<td>
|
||||
<button style="margin:10px 0;padding:6px 14px;background:#f56c6c;color:#fff; border:1px solid #ddd;border-radius:6px;width:270px;" id="upload" type="button" onclick="upload()" style="padding:0 10px;">上传</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
window.onload = function(){
|
||||
var tab = document.getElementById("tab");
|
||||
var lis = tab.getElementsByTagName('li');//获得标签li的数组
|
||||
var cons = document.getElementsByClassName('con');//获得下面内容div的数组
|
||||
for(var i=0;i<lis.length;i++){
|
||||
lis[i].num = i;//给对象添加属性,赋值用于标记
|
||||
lis[i].onclick = function(){
|
||||
if(this.num==0 ){
|
||||
window.location.href="/?tab=0";
|
||||
}
|
||||
if(this.num==1){
|
||||
window.location.href="/?tab=1";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
function setpath() {
|
||||
var default_path = document.getElementById("newfile").files[0].name;
|
||||
document.getElementById("filepath").value = default_path;
|
||||
}
|
||||
function upload() {
|
||||
var filePath = document.getElementById("filepath").value;
|
||||
var upload_path = "/upload/" + filePath;
|
||||
var fileInput = document.getElementById("newfile").files;
|
||||
/* Max size of an individual file. Make sure this
|
||||
* value is same as that set in file_server.c */
|
||||
var MAX_FILE_SIZE = 200*1024;
|
||||
var MAX_FILE_SIZE_STR = "200KB";
|
||||
if (fileInput.length == 0) {
|
||||
alert("No file selected!");
|
||||
} else if (filePath.length == 0) {
|
||||
alert("File path on server is not set!");
|
||||
} else if (filePath.indexOf(' ') >= 0) {
|
||||
alert("File path on server cannot have spaces!");
|
||||
} else if (filePath[filePath.length-1] == '/') {
|
||||
alert("File name not specified after path!");
|
||||
} else if (fileInput[0].size > 200*1024) {
|
||||
alert("File size must be less than 200KB!");
|
||||
} else {
|
||||
document.getElementById("newfile").disabled = true;
|
||||
document.getElementById("filepath").disabled = true;
|
||||
document.getElementById("upload").disabled = true;
|
||||
var file = fileInput[0];
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function() {
|
||||
if (xhttp.readyState == 4) {
|
||||
if (xhttp.status == 200) {
|
||||
document.open();
|
||||
document.write(xhttp.responseText);
|
||||
document.close();
|
||||
} else if (xhttp.status == 0) {
|
||||
alert("Server closed the connection abruptly!");
|
||||
location.reload()
|
||||
} else {
|
||||
alert(xhttp.status + " Error!\n" + xhttp.responseText);
|
||||
location.reload()
|
||||
}
|
||||
}
|
||||
};
|
||||
xhttp.open("POST", upload_path, true);
|
||||
xhttp.send(file);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user