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.
		
		
		
		
		
			
		
			
				
					
					
						
							158 lines
						
					
					
						
							4.6 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							158 lines
						
					
					
						
							4.6 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;
							 | 
						|
										}
							 | 
						|
										.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/bind',
							 | 
						|
																				  submit:'#saveBtn',
							 | 
						|
																				  success:'sunccessReturn'">
							 | 
						|
												<div id="form_submit_update"  data-options=" 'url':'/node/bind','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" 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="请输入设备SN号">
							 | 
						|
														<img class="qrcode" onclick="scanQRCode()" src="<%=basePath%>/image/wechat/iot/qrcodeimg.png" >
							 | 
						|
													</div>
							 | 
						|
												</div>
							 | 
						|
												
							 | 
						|
								
							 | 
						|
											</div>
							 | 
						|
											</div>
							 | 
						|
											</div>
							 | 
						|
											<div class="width80 m-auto" style="padding: 30px 0;margin-top: 70px;">
							 | 
						|
												<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','configWXDeviceWiFi' ]
							 | 
						|
									});
							 | 
						|
									
							 | 
						|
									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 &&  result.indexOf('device_id:')>-1 ){
							 | 
						|
								                	$(".device_code").val(result.substring(10));
							 | 
						|
								                }else{
							 | 
						|
								                	tip('设备号错误','w');
							 | 
						|
								                }
							 | 
						|
								            }
							 | 
						|
								        });
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									$(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")  );
							 | 
						|
											}, 1000);
							 | 
						|
										}else{
							 | 
						|
											tip(data.statusMsg,'w');
							 | 
						|
										}
							 | 
						|
									}
							 | 
						|
									
							 | 
						|
									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>
							 |