| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284 |
- <!doctype html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title></title>
- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
- <link rel="stylesheet" href="../css/mescroll.min.css">
- <link rel="stylesheet" href="../css/mui.min.css"/>
- <style type="text/css">
- body{
- font-size: 14px;
- }
- /*蓝色导航*/
- .mui-bar {
- background-color: #21b2e7;
- }
-
- .mui-action-back {
- touch-action: none;
- }
-
- .mui-title,
- .mui-bar a {
- color: #fff;
- }
- /*搜索浮动*/
- .searchBox:before{
- position: absolute;
- content: '';
- background: #21b2e7;
- width: 100%;
- height: 35%;
- }
- .searchControl{
- width: 91%;
- margin: 0 auto;
- }
- .mui-search{
- display: inline-block;
- width: 79%;
- }
- .searchBtn,.mui-search >input{
- box-shadow: 1px 2px 3px 1px #cccccc;
- }
- .searchBtn,.mui-search >input{
- background: #fff;
- }
-
- .searchBtn{
- border-color: #fff;
- width: 19%;
- }
-
- /*列表*/
- ul{
- padding: 0;
- list-style: none;
- }
- #dataList >li{
- padding: 0 20px 10px 20px;
- background: #fff;
- margin-bottom: 10px;
- font-family: '楷体';
- }
- #dataList >li .topInner{
- height: 66px;
- }
- .icon{
- float: left;
- width: 40px;
- height: 40px;
- /*background: blue;*/
- border-radius: 50%;
- margin-right: 15px;
- margin-top: 9px;
- line-height: 52px;
- text-align: center;
- }
- .roseRed{
- background: radial-gradient(#dbc9fa 5%,#b083ff 60%);
- }
- .blue{
- background: radial-gradient(#b1eaff 5%,#3dcaff 60%);
- }
- .equipId{
- line-height: 35px;
- font-size: 16px;
- }
- .equipName{
- font-size: 14px;
- }
- #dataList >li .bottomInner{
- border-top: 1px dashed #d0d0d0;
- font-size: 14px;
- margin: 0 21px;
- padding-top: 9px;
- }
-
- .searchBox {
- position: fixed;
- left: 0;
- right: 0;
- z-index: 222;
- padding: 0;
- }
- .mescroll{
- position: fixed;
- top: 73px;
- bottom: 0;
- height: auto; /*如设置bottom:50px,则需height:auto才能生效*/
- }
- </style>
- </head>
- <body>
- <header class="mui-bar mui-bar-nav">
- <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
- <h1 class="mui-title">杀虫灯报表管理</h1>
- </header>
- <div class="mui-content">
- <div class="searchBox">
- <div class="searchControl">
- <div class="mui-input-row mui-search">
- <input type="search" id="searchInp" class="mui-input-clear" placeholder="请输入设备ID">
- </div>
- <button id="searchBtn" class="searchBtn">搜索</button>
- </div>
- </div>
- <div id="scrollPlace" class="mescroll"> <!--id可以改,而"mescroll"的class不能删-->
- <ul id="dataList">
- <!--<li class="" data-id="">
- <div class="topInner">
- <div class="icon roseRed">
- <img src="../images/scdBulb.png" width="25"/>
- </div>
- <h1 class="equipId">设备ID:84512134543231545</h1>
- <p class="equipName">设备名称:无</p>
- </div>
- 删除了上报时间
- <div class="bottomInner">
- <p>上报时间:2018-12-03 09:41:21</p>
- </div>
- </li>-->
- </ul>
- </div>
- </div>
- <script src="../js/jquery-2.1.0.js"></script>
- <script src="../js/mescroll.min.js" charset="utf-8"></script>
- <script src="../js/mui.min.js"></script>
-
- <script type="text/javascript">
- mui.init();
- var mescroll;
- document.addEventListener('plusready',function () {
- //创建MeScroll对象,内部已默认开启下拉刷新,自动执行up.callback,重置列表数据;
- mescroll = new MeScroll("scrollPlace", {
- up: {
- callback: getListData, //上拉回调,此处可简写; 相当于 callback: function (page) { getListData(page); }
- isBounce: false, //此处禁止ios回弹,解析(务必认真阅读,特别是最后一点): http://www.mescroll.com/qa.html#q10
- clearEmptyId: "dataList", //1.下拉刷新时会自动先清空此列表,再加入数据; 2.无任何数据时会在此列表自动提示空
- toTop:{ //配置回到顶部按钮
- src : "../images/totop.png", //默认滚动到1000px显示,可配置offset修改
- offset : 700
- },
- empty: {
- //列表第一页无任何数据时,显示的空提示布局; 需配置warpId才显示
- warpId: "dataList", //父布局的id (1.3.5版本支持传入dom元素)
- icon: "../images/listNull.png", //图标,默认null,支持网络图
- tip: "暂无相关数据~" //提示
- },
- htmlNodata: '<p class="upwarp-nodata">-- 没有更多内容了 --</p>',
- noMoreSize: 5, //如果列表已无数据,可设置列表的总数量要大于5才显示无更多数据;
- lazyLoad: {
- use: true // 是否开启懒加载,默认false
- }
- }
- });
- },false);
-
- /*联网加载列表数据 page = {num:1, size:10}; num:当前页 从1开始, size:每页数据条数 */
- function getListData(page){
- //联网加载数据
- getListDataFromNet(page.num, page.size, function(curPageData,totalSize){
- //联网成功的回调,隐藏下拉刷新和上拉加载的状态;
- //mescroll会根据传的参数,自动判断列表如果无任何数据,则提示空;列表无下一页数据,则提示无更多数据;
- //方法二(推荐): 后台接口有返回列表的总数据量 totalSize
- mescroll.endBySize(curPageData.length, totalSize); //必传参数(当前页的数据个数, 总数据量)
- //设置列表数据,因为配置了emptyClearId,第一页会清空dataList的数据,所以setListData应该写在最后;
- setListData(curPageData);
- }, function(){
- //联网失败的回调,隐藏下拉刷新和上拉加载的状态;
- mescroll.endErr();
- mui.toast('数据请求失败');
- });
- }
- /*设置列表数据*/
- function setListData(curPageData){
- var html = '';
- // var listDom=document.getElementById("dataList");
- var dat = curPageData;
- for(var i = 0; i < dat.length; i++) {
- var equip_name = dat[i].equip_name || '无';
- var className;
- if(i%2 == 0){
- className = 'blue';
- }else{
- className = 'roseRed';
- }
- html += '<li class="" data-id="'+dat[i].equip_id+'"><div class="topInner"><div class="icon '+className+'"><img src="../images/scdBulb.png" width="25"/></div>'+
- '<h1 class="equipId">设备ID:'+dat[i].equip_id+'</h1><p class="equipName">设备名称:'+equip_name+'</p>'+
- '</div></li>';
- }
- $('#dataList').append(html);
- }
- /*联网加载列表数据*/
- function getListDataFromNet(pageNum,pageSize,successCallback,errorCallback) {
- $.ajax({
- type: 'POST',
- url: 'http://192.168.1.11:8000/app_reportmanage',
- timeout : 10000, //超时时间设置,单位毫秒
- data:{
- 'etype': 'scd',
- 'page': pageNum,
- 'filter': mui('#searchInp')[0].value,
- },
- // beforeSend: function() {
- // plus.nativeUI.showWaiting('请求中...');
- // },
- // complete: function() {
- // plus.nativeUI.closeWaiting();
- // },
- dataType: 'json',
- success: function(data){
- successCallback(data.dat,data.nums);
- },
- error: function(){
- errorCallback();
- }
- });
- }
-
- //进入详情页面
- mui('#dataList').on('tap', 'li', function() {
- var imei = this.getAttribute('data-id');
- var upl_time = $(this).find('.upl_time').html();console.log(upl_time)
- markingid = imei;
- mui.openWindow({
- url: 'reprotManage_scd_detail.html',
- id: 'reprotManage_scd_detail',
- extras: {
- 'equipId': imei,
- 'upl_time':upl_time
- },
- })
- })
-
- //搜索操作
- $("#searchInp").on('keypress',function(e) {
- var keycode = e.keyCode;
- if(keycode=='13') {
- e.preventDefault();
- //请求搜索接口
- if(mui('#searchInp')[0].value) {
- $('#dataList').html('');
- getListData({num:1, size:10})
- } else {
- mui.toast("请输入设备ID");
- }
- }
- })
- document.getElementById('searchBtn').addEventListener('tap', function() {
- if(mui('#searchInp')[0].value) {
- $('#dataList').html('');
- getListData({num:1, size:10})
- } else {
- mui.toast("请输入设备ID");
- }
- })
- </script>
- </body>
- </html>
|