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.
		
		
		
		
			
				
					154 lines
				
				3.9 KiB
			
		
		
			
		
	
	
					154 lines
				
				3.9 KiB
			| 
								 
											3 years ago
										 
									 | 
							
								<%@ 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">
							 | 
						||
| 
								 | 
							
										.sub-container{
							 | 
						||
| 
								 | 
							
											margin-left: 13px;
							 | 
						||
| 
								 | 
							
											padding: 10px 5px 10px 0;
							 | 
						||
| 
								 | 
							
											border-top: 1px solid #d9d9d9;
							 | 
						||
| 
								 | 
							
											cursor: pointer;
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
										
							 | 
						||
| 
								 | 
							
										.sub-container:FIRST-CHILD{
							 | 
						||
| 
								 | 
							
											border-top: 0;
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
										
							 | 
						||
| 
								 | 
							
										.body-container{
							 | 
						||
| 
								 | 
							
											background: #fff ;
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
										.sub-container p{
							 | 
						||
| 
								 | 
							
											font-size: 14px;
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
										.sub-container img {
							 | 
						||
| 
								 | 
							
											vertical-align: middle;
							 | 
						||
| 
								 | 
							
											border-radius: 4px;
							 | 
						||
| 
								 | 
							
										}
							 | 
						||
| 
								 | 
							
									</style>
							 | 
						||
| 
								 | 
							
								</head>
							 | 
						||
| 
								 | 
							
								<body>
							 | 
						||
| 
								 | 
							
									<div class="container">
							 | 
						||
| 
								 | 
							
										<div class="t-c title-info">
							 | 
						||
| 
								 | 
							
											<span>项目列表</span>
							 | 
						||
| 
								 | 
							
											<div class="back" onclick="forward('/wiot/user')" style=" position: fixed;top: 0px;" >返回</div>
							 | 
						||
| 
								 | 
							
											<c:if test="${user.type != 7 }">
							 | 
						||
| 
								 | 
							
												<div class="add" onclick="forward('/wiot/escene')" style=" position: fixed;top: 0px;right: 10px;" >增加</div>
							 | 
						||
| 
								 | 
							
											</c:if>
							 | 
						||
| 
								 | 
							
										</div>
							 | 
						||
| 
								 | 
							
										<div style="height: 50px;"></div>
							 | 
						||
| 
								 | 
							
										
							 | 
						||
| 
								 | 
							
										<div class="body-container">
							 | 
						||
| 
								 | 
							
											
							 | 
						||
| 
								 | 
							
										</div>
							 | 
						||
| 
								 | 
							
										<%@ include file="/WEB-INF/wechat/iot/common/pager.jsp"%>
							 | 
						||
| 
								 | 
							
									</div>
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									<div class="hide" id="template">
							 | 
						||
| 
								 | 
							
										<div class="sub-container clear" tag="{id}">
							 | 
						||
| 
								 | 
							
											<div class="float-left width30">
							 | 
						||
| 
								 | 
							
												<img alt="" style="max-height: 69px;" width="100%" src="{img_id}">
							 | 
						||
| 
								 | 
							
											</div>
							 | 
						||
| 
								 | 
							
											<div class="float-left width70 pl-10">
							 | 
						||
| 
								 | 
							
												<div class="clear">
							 | 
						||
| 
								 | 
							
													<p class="title float-left" style="color: #000;">{name}</p>
							 | 
						||
| 
								 | 
							
													<p style="color: #666;" class="body float-right">
							 | 
						||
| 
								 | 
							
														<span>设备数量: {device_num}</span>
							 | 
						||
| 
								 | 
							
													</p>
							 | 
						||
| 
								 | 
							
												</div>
							 | 
						||
| 
								 | 
							
												<p style="color: #aaa;" >{atimestr}</p>
							 | 
						||
| 
								 | 
							
												
							 | 
						||
| 
								 | 
							
												
							 | 
						||
| 
								 | 
							
												<c:if test="${user.type != 7 }">
							 | 
						||
| 
								 | 
							
													<div class="mt-10">
							 | 
						||
| 
								 | 
							
														<img style="width: 20px;float: right;" tag="{id}" class="deletebtn" src="<%=basePath%>/image/wechat/iot/delete.png">
							 | 
						||
| 
								 | 
							
														<img style="width: 20px;float: right;margin-right: 20px;" tag="{id}" class="editbtn" src="<%=basePath%>/image/wechat/iot/edit.png">
							 | 
						||
| 
								 | 
							
													</div>
							 | 
						||
| 
								 | 
							
												</c:if>
							 | 
						||
| 
								 | 
							
											</div>
							 | 
						||
| 
								 | 
							
										</div>
							 | 
						||
| 
								 | 
							
									</div>
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								</body>
							 | 
						||
| 
								 | 
							
								<script type="text/javascript">
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								$(function(){
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
									$(document).on("click",".deletebtn",function(e){
							 | 
						||
| 
								 | 
							
										var self = this ;
							 | 
						||
| 
								 | 
							
										$.confirm("是否确认删除", function() {
							 | 
						||
| 
								 | 
							
											commonAjax("DELETE",localUrl+"/scene?id="+ $(self).attr("tag") , "",function(){
							 | 
						||
| 
								 | 
							
												tip("删除成功");
							 | 
						||
| 
								 | 
							
												setTimeout(function(){
							 | 
						||
| 
								 | 
							
													$(self).parent().parent().parent().remove();
							 | 
						||
| 
								 | 
							
												},500)
							 | 
						||
| 
								 | 
							
											});
							 | 
						||
| 
								 | 
							
										  }, function() {
							 | 
						||
| 
								 | 
							
										  
							 | 
						||
| 
								 | 
							
										  });
							 | 
						||
| 
								 | 
							
										
							 | 
						||
| 
								 | 
							
										e.stopPropagation();
							 | 
						||
| 
								 | 
							
									})
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									$(document).on("click",".editbtn",function(e){
							 | 
						||
| 
								 | 
							
										forward('/wiot/escene?id=' + $(this).attr("tag") );
							 | 
						||
| 
								 | 
							
										e.stopPropagation();
							 | 
						||
| 
								 | 
							
									})
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									// 委托冒泡
							 | 
						||
| 
								 | 
							
									$(document).on("click",".sub-container",function(e){
							 | 
						||
| 
								 | 
							
										forward('/wiot/mdevice?id=' + $(this).attr("tag") );
							 | 
						||
| 
								 | 
							
									})
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									function getData(n){
							 | 
						||
| 
								 | 
							
										postAjax(localUrl+"/self/page/scene.json?paged="+n, data,function(data){
							 | 
						||
| 
								 | 
							
											if(isOK(data)){
							 | 
						||
| 
								 | 
							
												var dataT = data.data.data ;
							 | 
						||
| 
								 | 
							
												for(var i=0;i<dataT.length;i++){
							 | 
						||
| 
								 | 
							
													dataT[i].atimestr = time2Str(dataT[i].atime);
							 | 
						||
| 
								 | 
							
													if(validater.empty(dataT[i].img_id )){
							 | 
						||
| 
								 | 
							
														dataT[i].img_id = '<%=basePath%>/image/wechat/iot/tinmg.png';
							 | 
						||
| 
								 | 
							
													}else{
							 | 
						||
| 
								 | 
							
														dataT[i].img_id = imgUrl + dataT[i].img_id ;
							 | 
						||
| 
								 | 
							
													}
							 | 
						||
| 
								 | 
							
													$(".body-container").append( $("#template").html().format(dataT[i]));					
							 | 
						||
| 
								 | 
							
												}
							 | 
						||
| 
								 | 
							
												
							 | 
						||
| 
								 | 
							
												if(data.data.totalPage > data.data.paged){
							 | 
						||
| 
								 | 
							
													loading = false;						
							 | 
						||
| 
								 | 
							
												}else{
							 | 
						||
| 
								 | 
							
													loading =true ;	
							 | 
						||
| 
								 | 
							
												}
							 | 
						||
| 
								 | 
							
												
							 | 
						||
| 
								 | 
							
											}else{
							 | 
						||
| 
								 | 
							
												loading =true ;	
							 | 
						||
| 
								 | 
							
											}
							 | 
						||
| 
								 | 
							
											// 传data就可以,分页的
							 | 
						||
| 
								 | 
							
											pagerinit(data,".body-container");
							 | 
						||
| 
								 | 
							
										});	
							 | 
						||
| 
								 | 
							
									}
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
									// 查询条件
							 | 
						||
| 
								 | 
							
									var data = {} ;
							 | 
						||
| 
								 | 
							
									var paged = 1;
							 | 
						||
| 
								 | 
							
									getData(paged++);
							 | 
						||
| 
								 | 
							
									var loading = false;  //状态标记
							 | 
						||
| 
								 | 
							
									$(document.body).infinite().on("infinite", function() {
							 | 
						||
| 
								 | 
							
										if (loading)
							 | 
						||
| 
								 | 
							
											return;
							 | 
						||
| 
								 | 
							
										loading = true;
							 | 
						||
| 
								 | 
							
										setTimeout(function() {
							 | 
						||
| 
								 | 
							
											// 获取商品信息
							 | 
						||
| 
								 | 
							
											getData(paged++);
							 | 
						||
| 
								 | 
							
										}, 500); 
							 | 
						||
| 
								 | 
							
									});
							 | 
						||
| 
								 | 
							
								})
							 | 
						||
| 
								 | 
							
									
							 | 
						||
| 
								 | 
							
								</script>
							 | 
						||
| 
								 | 
							
								</html>
							 |