变更为智能机器人聊天室

master
cleverqin 8 years ago
parent 03ad7a0a37
commit 4acd1038ab

@ -128,7 +128,7 @@ window.onload=function () {
type:'user',
content:{
user:robot,
msg:face.replaceFace(data.text)
msg:filterData(data)
}
}
_this.msgList.push(msgItem);
@ -174,4 +174,43 @@ window.onload=function () {
app.msg+="【"+face.title+"】"
}
});
function filterData(data) {
switch(data.code)
{
case 100000://文本类
return data.text
break;
case 200000://链接类
return data.text+"<a href='"+data.url+"' class='res-link' target='_blank'>打开页页面</a>"
break;
case 302000://新闻类
var html=data.text+"<ul class='res-list'>";
var len=3;
if(data.list.length<3){
len=data.list.length
}
for(var i=0;i<len;i++){
var item=data.list[i];
html+="<li><a href='"+item.detailurl+"' target='_blank'>"+item.article+"</a></li>"
}
html+='</li>';
return html;
break;
case 308000://菜谱类
var html=data.text+"<ul class='res-list'>";
var len=3;
if(data.list.length<3){
len=data.list.length
}
for(var i=0;i<len;i++){
var item=data.list[i];
html+="<li><a href='"+item.detailurl+"' target='_blank'>"+item.name+"</a></li>"
}
html+='</li>';
return html;
break;
default:
return data.text
}
}
}

@ -495,4 +495,37 @@ body{
}
.online-user:hover{
background: #636363;
}
/************************************/
.res-list{
list-style: none;
padding: 0;
border-top: 1px solid #9f9f9f;
margin: 10px 0 0 0;
}
.res-list li{
line-height: 32px;
height: 32px;
max-width: 240px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
border-bottom: 1px solid #9f9f9f;
border-left: 1px solid #9f9f9f;
border-right: 1px solid #9f9f9f;
background-color: rgba(255, 255, 255, 0.8);
padding: 5px 15px;
}
.res-list li a{
text-decoration: none;
font-size: 14px;
color: #6d6d6d;
}
.res-list li a:hover{
color: #5598e6;
}
.res-link{
color: #5598e6;
text-decoration: none;
margin-left: 10px;
}
Loading…
Cancel
Save