You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
5.9 KiB
191 lines
5.9 KiB
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
|
pageEncoding="UTF-8"%>
|
|
<%@ page import="com.lp.cfg.ProConfig"%>
|
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title><%=ProConfig.PROJECT_NAME %></title>
|
|
<%@ include file="/WEB-INF/wechat/iot/common/resource_lib.jsp"%>
|
|
<style type="text/css">
|
|
.body-container{
|
|
background: #fff ;
|
|
padding-top: 20px;
|
|
/* padding: 0px 5px 0 5px; */
|
|
}
|
|
.weui-cells{
|
|
margin-top: 0;
|
|
font-size: 15px;
|
|
}
|
|
.qrcode{
|
|
position: absolute;
|
|
width: 24px;
|
|
top: 10px;
|
|
right: 25px;
|
|
}
|
|
.weui-select{
|
|
height: 35px !important;
|
|
line-height: 35px !important;
|
|
padding-left:0;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<div class="t-c title-info">
|
|
<span id="device_edit">设备增加</span>
|
|
<div class="back" onclick="back()" style=" position: fixed;top: 0px;" >返回</div>
|
|
</div>
|
|
<div style="height: 50px;"></div>
|
|
|
|
<div class="body-container">
|
|
<div id="form_submit" class="weui-cells weui-cells_form jui-form_submit" data-options="url:'/node',
|
|
submit:'#saveBtn',
|
|
success:'sunccessReturn'">
|
|
<div id="form_submit_update" data-options=" 'url':'/node','method':'put',
|
|
'submit':'#saveBtn',
|
|
'success':'sunccessReturn' " >
|
|
<div id="detail_get" config-option=" 'url':'/node?id=$#init-id$' ">
|
|
<input type="hidden" id="scene_id" type-name="scene_id">
|
|
<input type="hidden" id="init-id" type-name="id">
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label class="weui-label">名称:</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<input class="weui-input" validate="empty" type-name="name" placeholder="请输入设备名称">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="weui-cell" style="position: relative;">
|
|
<div class="weui-cell__hd">
|
|
<label class="weui-label">设备号:</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<input class="weui-input device_code" maxlength="32" type-name="device_code" validate="empty" style="width: 80%" placeholder="请输入设备号">
|
|
<img class="qrcode" onclick="scanQRCode()" src="<%=basePath%>/image/wechat/iot/qrcodeimg.png" >
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label class="weui-label">设备协议:</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<select class="weui-select jui-selecter" type-name="iot_node_type" validate="empty"
|
|
data-options="'method':'GET','url':'/dictionary/81','key':'code','value':'name','type':'list' " >
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="weui-cell" id="device_type">
|
|
<div class="weui-cell__hd">
|
|
<label class="weui-label">设备型号:</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<select class="weui-select jui-selecter" validate="empty" type-name="device_template_id" data-options=" 'url':'/page/deviceTemplateInfo?paged=1&pageSize=100','key':'id',
|
|
'value':'name','init_value':'请选择设备型号',data:{ user_id:'${user.id}' } " >
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="weui-cell">
|
|
<div class="weui-cell__hd">
|
|
<label for="date" class="weui-label">排序:</label>
|
|
</div>
|
|
<div class="weui-cell__bd">
|
|
<input class="weui-input" id="seq" validate="empty" type-name="seq" type="text" placeholder="请输入排序" readonly="true">
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="width80 m-auto" style="padding: 30px 0;">
|
|
<a class="weui-btn" style="background: #3499da;" href="javascript:" id="saveBtn">保存</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script src="http://res2.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
|
<script src="<%=basePath%>/lib/weixinLib/WeixinApi.js"></script>
|
|
<script type="text/javascript">
|
|
|
|
var noncestr = "${noncestr}" ;
|
|
var timestamp = "${timestamp}" ;
|
|
var signature = "${signature}" ;
|
|
|
|
wx.config({
|
|
debug : false, // 开启调试模式
|
|
appId : "<%=ProConfig.WEIXIN.APP_ID%>",
|
|
timestamp : timestamp, // 必填,生成签名的时间戳
|
|
nonceStr : noncestr, // 必填,生成签名的随机串
|
|
signature : signature,// 必填,签名,见附录1
|
|
jsApiList : [ 'checkJsApi', 'scanQRCode' ]
|
|
});
|
|
|
|
var flag = WeixinApi.openInWeixin();
|
|
if(!flag){
|
|
// alert("请在微信浏览器中打开");
|
|
$(".qrcode").hide();
|
|
}
|
|
|
|
function scanQRCode(){
|
|
wx.scanQRCode({
|
|
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
scanType: ["qrCode"], // 可以指定扫二维码还是一维码,默认二者都有
|
|
success: function (res) {
|
|
var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
|
|
if(result != null){
|
|
//
|
|
$(".device_code").val(result);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$(function(){
|
|
if( GetQueryString("id")!=null ){
|
|
$("#scene_id").val( GetQueryString("id"));
|
|
}
|
|
|
|
if(GetQueryString("did")!=null){
|
|
// 编辑项目
|
|
$("#device_edit").html("设备编辑");
|
|
$("#init-id").val(GetQueryString("did"));
|
|
|
|
$("#detail_get").addClass("jui-detail_get");
|
|
$("#form_submit_update").addClass("jui-form_submit");
|
|
$("#form_submit").removeClass("jui-form_submit");
|
|
$("#device_type").remove();
|
|
|
|
}
|
|
|
|
})
|
|
|
|
function sunccessReturn(data){
|
|
if(isOK(data)){
|
|
tip("成功");
|
|
setTimeout(function() {
|
|
forward('/wiot/mdevice?id='+GetQueryString("id") );
|
|
}, 300);
|
|
}
|
|
}
|
|
|
|
function back(){
|
|
forward('/wiot/mdevice?id=' +GetQueryString("id")) ;
|
|
}
|
|
|
|
$("#seq").picker({
|
|
title: "请选择排列顺序",
|
|
cols: [
|
|
{
|
|
textAlign: 'center',
|
|
values: [1,2,3,4,5,6,7,8,9,10],
|
|
displayValues: ["1 [最靠前]","2 [次靠前]","3 [较靠前]",4,5,6,7,8,"9 [较靠后]","10 [最靠后]" ]
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
</script>
|
|
</html>
|