Explorar el Código

gaojinginfo no-message tips

git hace 5 años
padre
commit
d650f1e87b

BIN
images/test.jpg


+ 204 - 0
pages/baojinginfo-backup/baojing_bak.js

@@ -0,0 +1,204 @@
+(function () {
+	/*function list(data, $page) {
+		$.each(data, function (_index, _item) {
+			renlian.httpget(config.webapi + "renlian/adms/desktop/data", { type: 'list', id: _item.F_Id }, function(data) {
+				if (data) {
+					var html = '';
+					$.each(data.value, function (_j, _jitem) {	
+						html += '\
+							<div class="lr-list-item lr-dtlist-item">\
+								<div class="lr-ellipsis">'+ _jitem.f_title + '</div>\
+								<div class="date">'+ renlian.date.format(_jitem.f_time, 'yyyy-MM-dd') + '</div>\
+							</div>';
+					});
+					console.log(html);
+				}
+				 $page.find('#lr_desktop_msg_content').append(html);
+			});
+		});
+	}*/
+	
+	var page = {
+        isScroll: false,
+        init: function ($page,param) {
+            $page.find('#toptab').toptab(['告警', '公告']).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) {
+							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 += '';
+						
+                        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 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+'"}'});
+									});
+								});
+								
+							}else{
+								msg_html += '<h4>暂无消息</h4>';
+								$page.find('.gonggaoinfo').html(msg_html);
+							}
+						});
+                        break;
+                }
+                $this = null;
+            });
+        }
+		/*reload: function ($page, pageinfo) {
+			if (renlian.isOutLogin) {// 如果是重新登录的情况刷新下桌面数据
+                renlian.isOutLogin = false;
+			$page.find('#toptab').toptab(['告警', '公告']).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" id="gaojinginfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';
+						renlian.http.get("http://czapp.rltest.cn/?s=api/get_baojing_info", {}, function(res) {
+							if(res){
+								$.each(res.data, function (_index, _item) {
+									msg_html += '\
+										<div class="lr-list">\
+												<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
+													<h4>'+ _item.AddTime +'</h4>\
+													<p class="lr-ellipsis">'+ _item.DeviceNumber +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.AddTime +'</span></p>\
+													<a class="lr-nav-right">'+ _item.Comment +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
+												</div>\
+											</div>';
+								});
+								
+							}else{
+								msg_html += '<h4>暂无消息</h4>';	
+							}
+							$page.find('#gaojinginfo').html(msg_html);
+							});
+						
+						msg_html += '\
+										</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);
+                        break;
+                    case 1:
+                        var msg_html = '';
+						msg_html += '\
+									<div class="f-page-body f-scroll-wrapper">\
+										<div class="f-scroll" id="gonggaoinfo" style="transform: translate3d(0px, 0px, 0px) translateZ(0px);">';						
+						renlian.http.get("http://czapp.rltest.cn/?s=api/get_baojing_info", {}, function(res) {
+							if(res){
+								$.each(res.data, function (_index, _item) {
+									msg_html += '\
+										<div class="lr-list">\
+												<div class="lr-list-item lr-list-item-multi" style="line-height: 25px;">\
+													<h4>'+ _item.AddTime +'</h4>\
+													<p class="lr-ellipsis">'+ _item.DeviceNumber +'<span class="" style="right: 15px;position: absolute;top: 50%;transform: translateY(-50%);">'+ _item.AddTime +'</span></p>\
+													<a class="lr-nav-right">'+ _item.Comment +'<span class="lr-badge lr-badge-primary lr-badge-inverted">详情</span></a>\
+												</div>\
+											</div>';
+								});
+								
+							}else{
+								msg_html += '<h4>暂无消息</h4>';	
+							}
+							$page.find('#gonggaoinfo').html(msg_html);
+						});
+						msg_html += '\
+									</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);
+                        break;
+                }
+                $this = null;
+            });
+			}
+		}*/
+    };
+    return page;
+	
+    /*var page = {
+        isScroll: false,
+        init: function ($page) {
+			renlian.clientdata.get('desktop', {
+				callback: function (data) {
+					console.log(data);
+					list(data.list || [], $page);
+				}
+			});
+			
+        }
+    };
+    return page;*/
+})();

+ 2 - 0
pages/baojinginfo-backup/baojinginfo.css

@@ -0,0 +1,2 @@
+body {
+}

+ 12 - 0
pages/baojinginfo-backup/baojinginfo.html

@@ -0,0 +1,12 @@
+<div id="toptab" >
+
+</div>
+<div id="gaojinginfo">
+
+    </div>
+
+<!-- <div class="lr-list"> -->
+    <!-- <div class="lr-list-item"> -->
+        <!-- 第一行 -->
+    <!-- </div> -->
+<!-- </div> -->

+ 139 - 0
pages/baojinginfo-backup/baojinginfo.js

@@ -0,0 +1,139 @@
+(function () {
+	var page = {
+        isScroll: false,
+        init: function ($page,param) {
+            $page.find('#toptab').toptab(['告警', '公告']).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);
+							}
+							});
+						
+						//msg_html += '';
+						//刷新
+							var pageobj = $('.gaojinginfo').lrpagination({
+								lclass: "lr-list",
+								rows: 10,                            // 每页行数
+								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) {
+											if(res.success == true){
+												$.each(res.data, function (_index, _item) {
+													data.push({ AddTime: _item.AddTime,LicensePlate: _item.LicensePlate,DeviceNumber:_item.DeviceNumber})
+												})
+											}
+										})
+										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>\
+												</div>';
+									return _msg_html_list;
+								},
+								down: {
+									contentinit: '下拉可以刷新',
+									contentdown: '下拉可以刷新',
+									contentover: '释放立即刷新',
+									contentrefresh: '正在刷新...'
+								},
+								up: {
+									contentinit: '上拉显示更多',
+									contentdown: '上拉显示更多',
+									contentrefresh: '正在加载...',
+									contentnomore: '没有更多数据了'
+								}
+							});
+						//刷新结束
+                        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+'"}'});
+									});
+								});
+								
+							}else{
+								msg_html += '<h4 style="text-align: center;">暂无消息</h4>';
+								$page.find('.gonggaoinfo').html(msg_html);
+							}
+						});
+                        break;
+                }
+                $this = null;
+            });
+        }
+		
+    };
+    return page;
+})();

+ 9 - 3
pages/baojinginfo/baojinginfo.html

@@ -2,10 +2,16 @@
 
 </div>
 <div id="gaojinginfo">
-
-
+    <div id="no-message" style="display:none">
+        <div class="lr-list">
+            <div class="lr-list-item" style="text-align: center">
+                <span style="font-size:1.2em;font-weight:bold">暂无消息</span>
+            </div>
+        </div>
     </div>
-    <div id="gonggaoinfo"></div>
+
+</div>
+<div id="gonggaoinfo"></div>
 
 <!-- <div class="lr-list"> -->
     <!-- <div class="lr-list-item"> -->

+ 5 - 1
pages/baojinginfo/baojinginfo.js

@@ -74,7 +74,11 @@
 												
 												// count = (param.page-1) * param.rows + i + 1;
 											}
-											
+											if($.isArray(data) && data.length === 0){
+												$('#no-message').show();
+											}else{
+												$('#no-message').hide();
+											}
 											callback(data, count+1);
 										})