Procházet zdrojové kódy

rlmui.js下拉刷新扩展

git před 5 roky
rodič
revize
a938fe0014

+ 2 - 1
index.html

@@ -25,7 +25,8 @@
         <script type="text/javascript" src="cordova.js"></script>
         <script type="text/javascript" src="data/city.js"></script>
         <script type="text/javascript" src="scripts/echarts.js"></script>
-        <script type="text/javascript" src="scripts/rlmui.js"></script>
+        <!-- <script type="text/javascript" src="scripts/rlmui.js"></script> -->
+        <script type="text/javascript" src="scripts/rlmuidebug.js"></script>
         <script type="text/javascript" src="scripts/rlmuiex.js"></script>
         <script type="text/javascript" src="scripts/platformOverrides.js"></script>
         <script type="text/javascript" src="config/config.js"></script>

+ 2 - 2
pages/alarmdetail/alarmdetail.js

@@ -5,13 +5,13 @@
 			var array = JSON.parse( $param );
 			var html = '';
 			userinfo = renlian.storage.get('userinfo');
-			renlian.httpget(config.webapi + "/?s=api/get_baojing_detail&plate="+userinfo.baseinfo.plate+"&addtime="+array.addtime, {}, function(res) {
+			renlian.httpget(config.webapi + "/?s=api/get_baojing_detail&plate="+userinfo.baseinfo.plate+"&id="+array.ID, {}, function(res) {
 				console.log(res);
 				if(res.success == true){
 				html += '<div class="lr-list-item">车牌号<span class="lr-badge" style="background-color:white">'+res.data.LicensePlate+'</span></div>\
 				<div class="lr-list-item">电子标签<span class="lr-badge" style="background-color:white">'+res.data.DeviceNumber+'</span></div>\
 				<div class="lr-list-item">报警时间<span class="lr-badge" style="background-color:white">'+res.data.AddTime+'</span></div>\
-				<div class="lr-list-item">报警类型<span class="lr-badge" style="background-color:white">告警</span></div>\
+				<div class="lr-list-item">报警类型<span class="lr-badge" style="background-color:white">'+res.data.Title+'</span></div>\
 				<div class="lr-list-item">报警信息<span class="lr-badge" style="background-color:white">'+res.data.Comment+'</span></div>';
 				$page.find('.detail').html(html);
 				}else{

+ 6 - 0
pages/baojinginfo/baojinginfo.html

@@ -1,5 +1,11 @@
 <div id="toptab" >
+
 </div>
+<div id="gaojinginfo">
+
+
+    </div>
+    <div id="gonggaoinfo"></div>
 
 <!-- <div class="lr-list"> -->
     <!-- <div class="lr-list-item"> -->

+ 112 - 87
pages/baojinginfo/baojinginfo.js

@@ -2,78 +2,102 @@
 	var page = {
         isScroll: false,
         init: function ($page,param) {
-            $page.find('#toptab').toptab(['告警', '公告']).each(function (index) {
+
+
+			userinfo = renlian.storage.get('userinfo');
+            $page.find('#toptab').rltoptab(['告警', '公告']).each(function (index) {
                 var $this = $(this);
                 switch (index) {
                     case 0:
-						var msg_html = '';
-						msg_html += '\
-									<div class="f-page-body f-scroll-wrapper">\
-										<div class="f-scroll" style="overflow:auto;height: 100%;">\
-											<div class="lr-list gaojinginfo">\
-											</div>\
-										</div>\
-										<div class="f-scrollbar f-scrollbar-vertical">\
-											<div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
-											</div>\
-										</div>\
-									</div>';
-						$this.html(msg_html);
-						//var baojing_info = '';
-						userinfo = renlian.storage.get('userinfo');
-						renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
-							console.log(res)
-							if(res.success == true){
-								var msg_html_list = '';
-								$.each(res.data, function (_index, _item) {
-									msg_html_list += '\
-												<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
-													<h4 id="time">'+ _item.AddTime +'</h4>\
-													<p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
-													<a class="lr-nav-right gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
-												</div>';
-									$page.find('.gaojinginfo').html(msg_html_list);
-									var addtime = $('#time').text();
-									$('.gaojingdetail').on('tap', function () {	
-										renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
-									});
-								});
-							}else{
-								msg_html += '<h4>暂无消息</h4>';
-								$page.find('.gaojinginfo').html(msg_html);
-							}
-							});
+						// var msg_html = '';
+						// msg_html += '\
+						// 			<div class="f-page-body f-scroll-wrapper">\
+						// 				<div class="f-scroll" style="overflow:auto;height: 100%;">\
+						// 					<div class="lr-list gaojinginfo">\
+						// 					</div>\
+						// 				</div>\
+						// 				<div class="f-scrollbar f-scrollbar-vertical">\
+						// 					<div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
+						// 					</div>\
+						// 				</div>\
+						// 			</div>';
+						// $this.html(msg_html);
+						// //var baojing_info = '';
+						// userinfo = renlian.storage.get('userinfo');
+						// renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
+						// 	console.log(res)
+						// 	if(res.success == true){
+						// 		var msg_html_list = '';
+						// 		$.each(res.data, function (_index, _item) {
+						// 			msg_html_list += '\
+						// 						<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
+						// 							<h4 id="time">'+ _item.AddTime +'</h4>\
+						// 							<p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
+						// 							<a class="lr-nav-right gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
+						// 						</div>';
+						// 			$page.find('.gaojinginfo').html(msg_html_list);
+						// 			var addtime = $('#time').text();
+						// 			$('.gaojingdetail').on('tap', function () {	
+						// 				renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
+						// 			});
+						// 		});
+						// 	}else{
+						// 		msg_html += '<h4>暂无消息</h4>';
+						// 		$page.find('.gaojinginfo').html(msg_html);
+						// 	}
+						// 	});
 						
-						//msg_html += '';
-						//刷新
-							var pageobj = $('.gaojinginfo').lrpagination({
+						// //msg_html += '';
+						// //刷新
+							
+							var pageobj = $('#gaojinginfo').lrpagination({
 								lclass: "lr-list",
-								rows: 10,                            // 每页行数
+								rows: 5,
+								
+	                            // 每页行数
 								getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
 								// param:   page: 当前页,rows:行数
 									setTimeout(function () {
 										var data = [];
-										renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
+										var count = 0;
+										var page = param.page-1;
+										renlian.httpget(config.webapi + "/?s=api/get_baojing_info&plate="+userinfo.baseinfo.plate+'&pagesize='+param.rows+'&page='+page, {}, function(res) {
+											var length = 0;
 											if(res.success == true){
-												$.each(res.data, function (_index, _item) {
-													data.push({ AddTime: _item.AddTime,LicensePlate: _item.LicensePlate,DeviceNumber:_item.DeviceNumber})
-												})
+												length = res.data.length;
+												for (var i = 0; i < length; i++) {
+												// $.each(res.data, function (_index, _item) {
+													data.push({ ID: res.data[i].ID,AddTime: res.data[i].AddTime,LicensePlate: res.data[i].LicensePlate,DeviceNumber:res.data[i].DeviceNumber, Title:res.data[i].Title})
+												// })
+													count  = (param.page-1) * param.rows + i + 1;
+												}
+												
+												// count = (param.page-1) * param.rows + i + 1;
 											}
+											
+											callback(data, count+1);
 										})
-										callback(data, 20);
+										
 									}, 1000);
 								},
 								renderData: function (_index, _item) {// 渲染数据模板
-									console.log(_index);
 									var _msg_html_list = '';
 									_msg_html_list+= '\
 												<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
 													<h4 id="time">'+ _item.AddTime +'</h4>\
 													<p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
-													<a class="lr-nav-right gaojingdetail">告警<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
+													<a class="lr-nav-right" id="gaojingdetail'+_item.AddTime+'">'+_item.Title+'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
 												</div>';
+
+									// $('#gaojingdetail'+_item.AddTime).on('tap', function () {	
+									// 	renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"addtime":"'+_item.Addtime+'"}'});
+									// });
+
 									return _msg_html_list;
 								},
+								click: function(item, $item){
+										renlian.nav.go({ path: 'alarmdetail', title: '告警详情', type: 'right', param:'{"ID":"'+item.ID+'"}'});
+								},
 								down: {
 									contentinit: '下拉可以刷新',
 									contentdown: '下拉可以刷新',
@@ -90,45 +114,46 @@
 						//刷新结束
                         break;
                     case 1:
-                        var msg_html = '';
-						var msg_html = '';
-						msg_html += '\
-									<div class="f-page-body f-scroll-wrapper">\
-										<div class="f-scroll" style="overflow:auto;height: 100%;">\
-											<div style="position:unset;padding:10px" class="lr-list gonggaoinfo">\
-											</div>\
-										</div>\
-										<div class="f-scrollbar f-scrollbar-vertical">\
-											<div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
-											</div>\
-										</div>\
-									</div>';
-						$this.html(msg_html);
-						//var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}';
-						userinfo = renlian.storage.get('userinfo');
-						renlian.httpget(config.webapi + "/?s=api/get_gonggao_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
-							var msg_html_list = '';
-							if(res.success == true){
-								$.each(res.data, function (_index, _item) {
-									msg_html_list += '\
-												<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
-													<h4 id="time">'+ _item.AddTime +'</h4>\
-													<p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
-													<a class="lr-nav-right gonggaodetail">公告<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
-												</div>';
-									$page.find('.gonggaoinfo').html(msg_html_list);
-									$('.gonggaodetail').on('tap', function () {
-										var addtime = $('#time').text();
-										renlian.nav.go({ path: 'noticedetail', title: '公告详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
-									});
-								});
+                        // var msg_html = '';
+						// var msg_html = '';
+						// msg_html += '\
+						// 			<div class="f-page-body f-scroll-wrapper">\
+						// 				<div class="f-scroll" style="overflow:auto;height: 100%;">\
+						// 					<div style="position:unset;padding:10px" class="lr-list gonggaoinfo">\
+						// 					</div>\
+						// 				</div>\
+						// 				<div class="f-scrollbar f-scrollbar-vertical">\
+						// 					<div class="f-scrollbar-indicator" style="transition-duration: 0ms; display: none; height: 830px; transform: translate3d(0px, 0px, 0px) translateZ(0px);">\
+						// 					</div>\
+						// 				</div>\
+						// 			</div>';
+						// $this.html(msg_html);
+						// //var baojing_info = '{"0":{"data":"1111","msg":"公告","time":"2/28"},"1":{"data":"2222","msg":"公告","time":"2/29"}}';
+						
+						// renlian.httpget(config.webapi + "/?s=api/get_gonggao_info&plate="+userinfo.baseinfo.plate, {}, function(res) {
+						// 	var msg_html_list = '';
+						// 	if(res.success == true){
+						// 		$.each(res.data, function (_index, _item) {
+						// 			msg_html_list += '\
+						// 						<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
+						// 							<h4 id="time">'+ _item.AddTime +'</h4>\
+						// 							<p class="lr-ellipsis">'+ _item.LicensePlate +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.DeviceNumber +'</span></p>\
+						// 							<a class="lr-nav-right gonggaodetail">公告<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
+						// 						</div>';
+						// 			$page.find('.gonggaoinfo').html(msg_html_list);
+						// 			$('.gonggaodetail').on('tap', function () {
+						// 				var addtime = $('#time').text();
+						// 				renlian.nav.go({ path: 'noticedetail', title: '公告详情', type: 'right', param:'{"addtime":"'+addtime+'"}'});
+						// 			});
+						// 		});
 								
-							}else{
-								msg_html += '<h4 style="text-align: center;">暂无消息</h4>';
-								$page.find('.gonggaoinfo').html(msg_html);
-							}
-						});
-                        break;
+						// 	}else{
+						// 		msg_html += '<h4 style="text-align: center;">暂无消息</h4>';
+						// 		$page.find('.gonggaoinfo').html(msg_html);
+						// 	}
+						// });
+						// break;
+						
                 }
                 $this = null;
             });

+ 1 - 1
pages/demo/pulltorefresh/pulltorefresh.js

@@ -3,7 +3,7 @@
         init: function ($page, param) {
             var pageobj = $('#pulltorefreshlist').lrpagination({
                 lclass: "lr-list",
-                rows: 10,                            // 每页行数
+                rows: 1,                            // 每页行数
                 getData: function (param, callback) {// 获取数据 param 分页参数,callback 异步回调
                     // param:   page: 当前页,rows:行数
                     setTimeout(function () {

+ 1 - 0
pages/my/myplate/myplate.css

@@ -85,6 +85,7 @@ h3{
 
 .ElectronicPlate{
     display: none;
+    background-color: #EFEFF4;
 }
 
 .isnull{

+ 2 - 2
pages/my/myplate/myplate.html

@@ -1,6 +1,6 @@
 <div class="lr-list lr-userInfo-list ElectronicPlate">
-   <img src="" class="images" id="FrontElectronicPlateUrl">
-   <img src="" class="images" id="BackElectronicPlateUrl">
+ <!--   <img src="" class="images" id="FrontElectronicPlateUrl">
+   <img src="" class="images" id="BackElectronicPlateUrl"> -->
    <div class="messagetext">本驾驶证信息由浙江省公安厅提供,仅供参考,如有疑问,请拨打客服电话<div class="phone">0571-88808880</div></div> 
 </div>
 

+ 67 - 3
pages/my/myplate/myplate.js

@@ -2,6 +2,7 @@
     var page = {
         isScroll: true,
         init: function ($page) {
+            renlian.layer.loading(true,"加载图片中");
             var userinfo = renlian.storage.get('userinfo');
             var postdata = {
                     token: userinfo.baseinfo.token,
@@ -11,15 +12,78 @@
             renlian.http.post(config.webapi + "/?s=api/get_vehicle_ElectronicPlateUrl", postdata, function(res) {
                   if (res.data.BackElectronicPlateUrl != '' && res.data.BackElectronicPlateUrl != null && res.data.FrontElectronicPlateUrl != '' && res.data.FrontElectronicPlateUrl != null) {
                      $('.ElectronicPlate').css('display','block');
-                     $('#FrontElectronicPlateUrl').attr('src',res.data.FrontElectronicPlateUrl);
-                     $('#BackElectronicPlateUrl').attr('src',res.data.BackElectronicPlateUrl);
+                      var img = new Image();
+                      var imgType = false;
+                      var img2 = new Image();
+                      var img2Type = false;
+                      var type = false;
+                      var bigimg = $(".ElectronicPlate");
+                      img.src = res.data.FrontElectronicPlateUrl;
+                      img.id = "FrontElectronicPlateUrl";
+                      img2.src = res.data.BackElectronicPlateUrl;
+                      img2.id = "BackElectronicPlateUrl";
+                    // if(img.complete && img2.complete) {
+                    //     renlian.layer.loading(false);
+                    //     bigimg.append(img);
+                    //     bigimg.append(img2);
+                    //     return;
+                    // }
+                     img.onload = function(){
+                         bigimg.append(img);
+                         $('#FrontElectronicPlateUrl').attr('class','images');
+                         $('#FrontElectronicPlateUrl').css('display','none');
+                         if(type == true){
+                           var n = $('#BackElectronicPlateUrl').next(),p = $('#FrontElectronicPlateUrl').prev();
+                           $('.ElectronicPlate').append($('#BackElectronicPlateUrl'));
+                           //$('#FrontElectronicPlateUrl').insertBefore(n);
+                           //$('#BackElectronicPlateUrl').insertAfter(p);
+                         }
+                         imgType = true;
+                         if(img2Type == true){
+                            $('#FrontElectronicPlateUrl').css('display','block');
+                            $('#BackElectronicPlateUrl').css('display','block');
+                             renlian.layer.loading(false);
+                         }
+                     }
+                     img2.onload = function(){
+                         bigimg.append(img2);
+                         $('#BackElectronicPlateUrl').attr('class','images');
+                         $('#BackElectronicPlateUrl').css('display','none');
+                         if($('#FrontElectronicPlateUrl').length == 0){
+                               type = true;
+                         }
+                         img2Type = true;
+                         if(imgType == true){
+                            $('#FrontElectronicPlateUrl').css('display','block');
+                            $('#BackElectronicPlateUrl').css('display','block');
+                             renlian.layer.loading(false);
+                         }
+                     }                     
+                      // $('.ElectronicPlate').css('display','block');
+                      // $('#FrontElectronicPlateUrl').attr('src',res.data.FrontElectronicPlateUrl);
+                      // $('#BackElectronicPlateUrl').attr('src',res.data.BackElectronicPlateUrl);
                   }
                   else{
                      $('.isnull').css('display','block');
                      $('.f-scroll').css('height','100%');
+                      renlian.layer.loading(false);
                   }
          });
         }
     };
     return page;
-})();
+})();
+
+
+
+
+
+
+
+
+
+
+
+
+
+

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 1 - 1
scripts/rlmui.js


+ 41 - 0
scripts/rlmuidebug.js

@@ -5057,6 +5057,47 @@ u[o]&&(delete u[o],c?delete n[l]:typeof n.removeAttribute!==i?n.removeAttribute(
             return d.find(".f-toptab-content-item")
         }
         return null
+    };
+    //renlian toptab
+    a.fn.rltoptab = function(f, e) {
+        var b = a(this);
+        f = f || [];
+        if (f.length > 0) {
+            b.addClass("f-toptab");
+            b.height(0);
+            var c = a('<div class="f-toptab-btns" ><div></div></div>');
+            var d = a('<div class="f-toptab-content" ></div>');
+            a.each(f,
+            function(i, j) {
+                var g = '<a class="f-toptab-btn' + (i == 0 ? " f-active ": "") + '"  data-value="' + i + '"  href="#">' + j + "</a>";
+                c.find("div").append(g);
+                var h = '<div class="f-toptab-content-item' + (i == 0 ? " f-active ": "") + '" data-value="' + i + '" ></div>';
+                d.append(h)
+            });
+            b.append(c);
+            // b.append(d);
+            c[0].callback = e;
+            c.find(".f-toptab-btn").on("tap",
+            function() {
+                var h = a(this);
+                var i = h.parent().parent();
+                var g = i.next();
+                if (!h.hasClass("f-active")) {
+                    i.find(".f-active").removeClass("f-active");
+                    h.addClass("f-active");
+                    g.find(".f-active").removeClass("f-active");
+                    var k = h.attr("data-value");
+                    g.find('[data-value="' + k + '"]').addClass("f-active");
+                    var j = i[0].callback;
+                    j && j(k)
+                }
+                h = null;
+                i = null;
+                g = null
+            });
+            return d.find(".f-toptab-content-item")
+        }
+        return null
     }
 })(window.jQuery); (function(a) {
     a.fn.ftimeline = function(f) {