优化弹出框V1
parent
fb5640e093
commit
6c2a92977d
42
index.html
42
index.html
|
@ -63,7 +63,7 @@
|
|||
}
|
||||
</style>
|
||||
</head>
|
||||
<body onload="init()" style="background-color: #fbfbfb;">
|
||||
<body onload="init()" style="background-color: #fbfbfb;" >
|
||||
<div class="layui-fluid" style="padding-top: 5px;">
|
||||
<div class="layui-panel" id="headContent" >
|
||||
<form class="layui-form " style="background-color: #ebebeb7a;" lay-size="xs" action="" lay-filter="search-form" id="search-form">
|
||||
|
@ -262,6 +262,7 @@
|
|||
var scrollTop = 0;
|
||||
var click = false;
|
||||
var size = 100;// 每次加载数量
|
||||
var tipsIndex = null;
|
||||
|
||||
// 添加窗口大小变化的事件监听器
|
||||
window.addEventListener('resize', function() {
|
||||
|
@ -670,13 +671,34 @@
|
|||
var msgHistory = window.localStorage ? window.localStorage.getItem('msgHistory') : undefined;
|
||||
if(msgHistory){
|
||||
var items = JSON.parse(msgHistory);
|
||||
var lis = '';
|
||||
var lis = '<input id="666" style="display: block;width:0;height:0;" >';
|
||||
for (var msgHistoryKey in items) {
|
||||
var item = items[msgHistoryKey];
|
||||
lis += '<div onclick="setMsgHistory('+msgHistoryKey+')" class="single-line" style="width:240px;color:black;overflow: hidden;">'+item+'</div>';
|
||||
lis += '<div onclick="setMsgHistory(\'msg\','+msgHistoryKey+')" class="single-line" style="width:240px;color:black;overflow: hidden;">'+item+'</div>';
|
||||
}
|
||||
console.log(lis)
|
||||
layer.tips(lis, '#msg',{tips:[3, '#ffffff']});
|
||||
var tipsIndex1 = layer.tips(lis, '#msg',{tips:[3, '#ffffff']});
|
||||
$("#666").focus();
|
||||
$("#666").blur(function() {
|
||||
layer.close(tipsIndex1);
|
||||
});
|
||||
}
|
||||
});
|
||||
// 消息历史记录单机显示
|
||||
$('#msgAdd').on('click', function(){
|
||||
var msgHistory = window.localStorage ? window.localStorage.getItem('msgHistory') : undefined;
|
||||
if(msgHistory){
|
||||
var items = JSON.parse(msgHistory);
|
||||
var lis = '<input id="666777" style="display: block;width:0;height:0;" >';
|
||||
for (var msgHistoryKey in items) {
|
||||
var item = items[msgHistoryKey];
|
||||
lis += '<div onclick="setMsgHistory(\'msgAdd\','+msgHistoryKey+')" class="single-line" style="width:240px;color:black;overflow: hidden;">'+item+'</div>';
|
||||
}
|
||||
var tipsIndex2 = layer.tips(lis, '#msgAdd',{tips:[3, '#ffffff']});
|
||||
$("#666777").focus();
|
||||
$("#666777").blur(function() {
|
||||
layer.close(tipsIndex2);
|
||||
});
|
||||
}
|
||||
});
|
||||
// 线程历史记录单机显示
|
||||
|
@ -684,12 +706,16 @@
|
|||
var threadHistory = window.localStorage ? window.localStorage.getItem('threadHistory') : undefined;
|
||||
if(threadHistory){
|
||||
var items = JSON.parse(threadHistory);
|
||||
var lis = '';
|
||||
var lis = '<input id="666777888" style="display: block;width:0;height:0;" >';
|
||||
for (var msgHistoryKey in items) {
|
||||
var item = items[msgHistoryKey];
|
||||
lis += '<div onclick="setThreadHistory('+msgHistoryKey+')" class="single-line" style="width:240px;color:black;overflow: hidden;">'+item+'</div>';
|
||||
}
|
||||
layer.tips(lis, '#thread',{tips:[3, '#ffffff']});
|
||||
var tipsIndex3 = layer.tips(lis, '#thread',{tips:[3, '#ffffff']});
|
||||
$("#666777888").focus();
|
||||
$("#666777888").blur(function() {
|
||||
layer.close(tipsIndex3);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -702,11 +728,11 @@
|
|||
}
|
||||
layer.closeAll();
|
||||
};
|
||||
function setMsgHistory(index){
|
||||
function setMsgHistory(id,index){
|
||||
var msgHistory = window.localStorage ? window.localStorage.getItem('msgHistory') : undefined;
|
||||
if(msgHistory) {
|
||||
var items = JSON.parse(msgHistory);
|
||||
$('#msg').val(items[index]+'');
|
||||
$('#'+id).val(items[index]+'');
|
||||
}
|
||||
layer.closeAll();
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue