web系统 右下角弹出温馨提示消息
1.[代码][HTML]代码
2.[代码][JavaScript]代码
$(function(){
$.extend({
popboxmessage:function(keepTime,popSpeed,Objm,message){
if(!keepTime){keepTime = 0};
if(!popSpeed){popSpeed = 400};
delayTime = keepTime * 1000;
var CloseBtn = Objm.find("a.close");
Objm.animate({"height":150},popSpeed);
if(delayTime){timer = setTimeout(function(){Objm.animate({"height":0},popSpeed)},delayTime)};
CloseBtn.click(function(){Objm.animate({"height":0},popSpeed)});
}
});
var url="currentBirth.action";
$.ajax({
type : "POST",
timeout : 10000,
data : {},
url : url,
success : function(data,textStatus) {
if(data!=''){
var obj = eval("(" + data + ")");//转换后的JSON对象
var Obj = $(".popbox")
var i=0;
var m=400;
$(obj).each(function(i,n){
var nobj=Obj.clone();
nobj.find("#popid").text(n.MESSAGE);
nobj.find("#hrefId").attr("code",n.CODE);
Obj.after(nobj);
m=m+200;
i=i+6;
$.popboxmessage(i,m,nobj,n.MESSAGE);
});
}
}
});
});
function popClick(obj){
var bizId=$(obj).attr("code");
var bizType=5;//提示消息已读
var actionurl=$('#initPath').val()+"/showMessage.action";
$.post(actionurl,{"bizId":bizId,"bizType":bizType},function(json){
},'json');
}
3.[代码]提示的样式
.popbox{width:240px; height:0; position:fixed; bottom:0; right:1px; overflow:hidden; z-index:9999;}
.popbox table{width:100%;}
.popbox table td.tl,.popbox table td.tc,.popbox table td.tr{background-image:url(../images/imPopbox/popbox_1.gif); height:30px; font:bold 12px/30px "寰蒋闆呴粦",Arial; color:#039;}
.popbox table td.bl,.popbox table td.bc,.popbox table td.br{background-image:url(../images/imPopbox/popbox_1.gif); height:5px;}
.popbox table td.ml,.popbox table td.mr{background-image:url(../images/imPopbox/popbox_2.gif);}
.popbox table td.tl{background-position:0 0; width:5px;}
.popbox table td.tc{background-position:0 -36px; position:relative;}
.popbox table td.tr{background-position:-5px 0; width:5px;}
.popbox table td.ml{background-position:0 0; width:5px;}
.popbox table td.mc{background-image:none; background-color:#f7f7f7; height:115px; font:normal 12px/2 Arial; padding:5px; vertical-align:top;}
.popbox table td.mr{background-position:-5px 0; width:5px;}
.popbox table td.bl{background-position:0 -31px; width:5px;}
.popbox table td.bc{background-position:0 -67px;}
.popbox table td.br{background-position:-5px -31px; width:5px;}
.popbox table td.tc a.close{background:url(../images/imPopbox/popbox_1.gif) 0 -72px; width:20px; height:20px; display:block; position:absolute; right:5px; top:5px; cursor:pointer;}
.popbox table td.tc a.close:hover{background:url(../images/imPopbox/popbox_1.gif) 0 -92px;}
.popbox table td.mc table th{font-weight:normal; text-align:right; vertical-align:top; padding:0 8px 0 0;}
.popbox table td.mc table td{ text-align:left; vertical-align:top; line-height:18px;}
.popbox table td.mc table td a{color:#185ecf;}
4.[文件] popboxstyle.css ~ 2KB 下载(10)
.popbox{width:240px; height:0; position:fixed; bottom:0; right:1px; overflow:hidden; z-index:9999;}
.popbox table{width:100%;}
.popbox table td.tl,.popbox table td.tc,.popbox table td.tr{background-image:url(../images/imPopbox/popbox_1.gif); height:30px; font:bold 12px/30px "微软雅黑",Arial; color:#039;}
.popbox table td.bl,.popbox table td.bc,.popbox table td.br{background-image:url(../images/imPopbox/popbox_1.gif); height:5px;}
.popbox table td.ml,.popbox table td.mr{background-image:url(../images/imPopbox/popbox_2.gif);}
.popbox table td.tl{background-position:0 0; width:5px;}
.popbox table td.tc{background-position:0 -36px; position:relative;}
.popbox table td.tr{background-position:-5px 0; width:5px;}
.popbox table td.ml{background-position:0 0; width:5px;}
.popbox table td.mc{background-image:none; background-color:#f7f7f7; height:115px; font:normal 12px/2 Arial; padding:5px; vertical-align:top;}
.popbox table td.mr{background-position:-5px 0; width:5px;}
.popbox table td.bl{background-position:0 -31px; width:5px;}
.popbox table td.bc{background-position:0 -67px;}
.popbox table td.br{background-position:-5px -31px; width:5px;}
.popbox table td.tc a.close{background:url(../images/imPopbox/popbox_1.gif) 0 -72px; width:20px; height:20px; display:block; position:absolute; right:5px; top:5px; cursor:pointer;}
.popbox table td.tc a.close:hover{background:url(../images/imPopbox/popbox_1.gif) 0 -92px;}
.popbox table td.mc table th{font-weight:normal; text-align:right; vertical-align:top; padding:0 8px 0 0;}
.popbox table td.mc table td{ text-align:left; vertical-align:top; line-height:18px;}
.popbox table td.mc table td a{color:#185ecf;}
5.[代码][Java]代码
@Action(value="currentBirth")
public void currentBirthday(){
String currDate=DateUtil.getDateFormator(DateUtil.DEFAULT_SHORT_DATE_FORMAT).format(new Date());
List> currbithList=userPersonManager.getBirthdayForCurrent(login.getId(), currDate);
if(currbithList!=null&&currbithList.size()>0){
List ids=new ArrayList();
for(Map umap:currbithList){
ids.add((String) umap.get("CODE"));//用户code
}
Calendar today = Calendar.getInstance();
today.setTime(new Date());
Lunar lunar = new Lunar(today);
Map param=new HashMap();
param.put("USERCODE", login.getId());//查询用户参数
param.put("R_ID", ids);//设置查询参数
param.put("TYPE", CzConstants.MESSAGE_TYPE_TIPS);//类型
param.put("STATUS", CzConstants.USER_MESSAGE_READ);//已读状态
List> userReadMessageList=noticeMessageManger.getUserReadMessage(param);
List> result=new ArrayList>();
boolean flag=true;
for(Map umap:currbithList){
flag=true;
String musercode=(String) umap.get("CODE");
for(Map ureadmap:userReadMessageList){
String R_ID=(String)ureadmap.get("R_ID");//保存用户code
if(musercode.equals(R_ID)){
flag=false;
break;
}
}
if(flag){
//2013年7月12日,农历六月初五,今天是张三的生日,让我们一起为他送上祝福吧!
setMessage(umap,lunar.toTime());
result.add(umap);
}
}
try {
System.out.println(ConvertJson.list2json(result));
response.getWriter().write(ConvertJson.list2json(result));
} catch (Exception e) {
e.printStackTrace();
}
}
}
/**
* FuncName : setMessage
* Description :
* @param umap
* @param string
* @author: chenhj
* @CreateDate 2013-9-9
* @ModifeDate 2013-9-9
*/
private void setMessage(Map umap, String lunar) {
StringBuffer message=new StringBuffer();
message.append(lunar).append(",");
String ucode=(String) umap.get("CODE");
String USERNAME=(String) umap.get("USERNAME");
if(ucode.equals(login.getId())){
message.append("今天是您的生日,祝愿您生日快乐,天天开心,工作顺利 !");
}else{
message.append("今天是").append(USERNAME).append("的生日,让我们一起为他送上祝福吧 !");
}
umap.put("MESSAGE", message);
}
6.[图片] 无标题.jpg
7.[文件] imPopbox.zip ~ 7KB 下载(24)
8.[代码]整理打文件包message
引message文件样式方式
$("#message").load("/page/message/message.jsp");
9.[文件] message.zip ~ 9KB 下载(28)