Extjs 回调取得store中的数据

本文介绍了一个基于Ext框架的公告提醒机制实现。该机制通过比较公告发布时间与当前系统时间,判断是否存在最近三天内发布的公告,并据此弹出提示对话框询问用户是否查看最新公告。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 <script type="text/javascript">
		  Ext.onReady(function(){
		  var noticeInfoStore =new Ext.data.Store({		//公告信息store
		        proxy: new Ext.data.HttpProxy({url:"/INAS4/maintenance/notice/getNoticeInfoByTypeId.action", method:'POST'}),
		        reader: new Ext.data.JsonReader({totalProperty: 'totalProperty', root:'root'},[{name: 'id'},{name: 'name'},{name: 'title'},{name: 'content'},{name: 'userName'},{name: 'author'},{name: 'issueTime'}])
		    });
		   noticeInfoStore.reload({
		    params: {start: 0, limit: 10, recordCount: -1, typeId: null},
		    callback:function(r,options,success){
		            if(success){
		                    noticeInfoStore.each(function(record) { 
		                    var myDate = new Date(); 
		    				var a1 = record.get('issueTime').time; //通知时间
		    				var a2 = myDate.getTime();//系统时间
		    				subtractionTime = a2-a1; //系统时间减去通知发布的时间
		    				var limitTime=3*24*60*60*1000;//3天时间,毫秒   
		     					if(subtractionTime<limitTime){
		    						Ext.MessageBox.confirm('提示','存在最近3天内的公告,您是否前去浏览?',function(btn){  
		                				if(btn!='yes'){
									}else{
									//window.location.href = "/INAS4/maintenance/notice/displayNotice.jsp";
									document.frames['MyWorkFrame'].location = "/INAS4/maintenance/notice/displayNotice.jsp";
										}		
		            				});
		    					}  
		  					});  
		             };
		           }
		        })
			})
  </script>

  

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值