Base Code
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
.gitignore
|
||||
.idea/
|
||||
node_modules
|
46
app.js
Normal file
@ -0,0 +1,46 @@
|
||||
var express = require('express');
|
||||
var path = require('path');
|
||||
var favicon = require('serve-favicon');
|
||||
var logger = require('morgan');
|
||||
var cookieParser = require('cookie-parser');
|
||||
var bodyParser = require('body-parser');
|
||||
|
||||
var index = require('./routes/index');
|
||||
var users = require('./routes/users');
|
||||
|
||||
var app = express();
|
||||
|
||||
// view engine setup
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'ejs');
|
||||
|
||||
// uncomment after placing your favicon in /public
|
||||
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({ extended: false }));
|
||||
app.use(cookieParser());
|
||||
app.use(express.static(path.join(__dirname, 'public')));
|
||||
|
||||
app.use('/', index);
|
||||
app.use('/users', users);
|
||||
|
||||
// catch 404 and forward to error handler
|
||||
app.use(function(req, res, next) {
|
||||
var err = new Error('Not Found');
|
||||
err.status = 404;
|
||||
next(err);
|
||||
});
|
||||
|
||||
// error handler
|
||||
app.use(function(err, req, res, next) {
|
||||
// set locals, only providing error in development
|
||||
res.locals.message = err.message;
|
||||
res.locals.error = req.app.get('env') === 'development' ? err : {};
|
||||
|
||||
// render the error page
|
||||
res.status(err.status || 500);
|
||||
res.render('error');
|
||||
});
|
||||
|
||||
module.exports = app;
|
93
bin/www
Executable file
@ -0,0 +1,93 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var app = require('../app');
|
||||
var debug = require('debug')('kefu:server');
|
||||
var http = require('http');
|
||||
|
||||
var ioSvc = require('../io/io');
|
||||
/**
|
||||
* Get port from environment and store in Express.
|
||||
*/
|
||||
|
||||
var port = normalizePort(process.env.PORT || '9010');
|
||||
app.set('port', port);
|
||||
|
||||
/**
|
||||
* Create HTTP server.
|
||||
*/
|
||||
|
||||
var server = http.createServer(app);
|
||||
var io = require('socket.io')(server);
|
||||
ioSvc.ioServer(io);
|
||||
|
||||
/**
|
||||
* Listen on provided port, on all network interfaces.
|
||||
*/
|
||||
|
||||
server.listen(port);
|
||||
server.on('error', onError);
|
||||
server.on('listening', onListening);
|
||||
|
||||
/**
|
||||
* Normalize a port into a number, string, or false.
|
||||
*/
|
||||
|
||||
function normalizePort(val) {
|
||||
var port = parseInt(val, 10);
|
||||
|
||||
if (isNaN(port)) {
|
||||
// named pipe
|
||||
return val;
|
||||
}
|
||||
|
||||
if (port >= 0) {
|
||||
// port number
|
||||
return port;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "error" event.
|
||||
*/
|
||||
|
||||
function onError(error) {
|
||||
if (error.syscall !== 'listen') {
|
||||
throw error;
|
||||
}
|
||||
|
||||
var bind = typeof port === 'string'
|
||||
? 'Pipe ' + port
|
||||
: 'Port ' + port;
|
||||
|
||||
// handle specific listen errors with friendly messages
|
||||
switch (error.code) {
|
||||
case 'EACCES':
|
||||
console.error(bind + ' requires elevated privileges');
|
||||
process.exit(1);
|
||||
break;
|
||||
case 'EADDRINUSE':
|
||||
console.error(bind + ' is already in use');
|
||||
process.exit(1);
|
||||
break;
|
||||
default:
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Event listener for HTTP server "listening" event.
|
||||
*/
|
||||
|
||||
function onListening() {
|
||||
var addr = server.address();
|
||||
var bind = typeof addr === 'string'
|
||||
? 'pipe ' + addr
|
||||
: 'port ' + addr.port;
|
||||
debug('Listening on ' + bind);
|
||||
}
|
126
io/io.js
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
*介绍:socket.io 功能封装
|
||||
*作者:TaiGuangYin
|
||||
*时间:2017-09-09
|
||||
* */
|
||||
var redis = require('../utils/redis');
|
||||
var msgType = require('./messageTpye');
|
||||
var ioSvc = require('./ioHelper').ioSvc;
|
||||
|
||||
//服务端连接
|
||||
function ioServer(io) {
|
||||
|
||||
var _self = this;
|
||||
ioSvc.setInstance(io);
|
||||
|
||||
//初始化连接人数
|
||||
redis.set('online_count',0,null,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
|
||||
io.on('connection', function (socket) {
|
||||
console.log('SocketIO有新的连接!');
|
||||
|
||||
_self.updateOnlieCount(true);
|
||||
|
||||
//用户与Socket进行绑定
|
||||
socket.on('login', function (uid) {
|
||||
console.log(uid+'登录成功');
|
||||
redis.set(uid,socket.id,null,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
redis.set(socket.id,uid,null,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//断开事件
|
||||
socket.on('disconnect', function() {
|
||||
console.log("与服务其断开");
|
||||
_self.updateOnlieCount(false);
|
||||
redis.get(socket.id,function (err,val) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
redis.del(socket.id,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
});
|
||||
redis.del(val,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//重连事件
|
||||
socket.on('reconnect', function() {
|
||||
console.log("重新连接到服务器");
|
||||
});
|
||||
|
||||
//监听客户端发送的信息,实现消息转发到各个其他客户端
|
||||
socket.on('message',function(msg){
|
||||
if(msg.type == msgType.messageType.public){
|
||||
socket.broadcast.emit("message",msg.content);
|
||||
}else if(msg.type == msgType.messageType.private){
|
||||
var uid = msg.uid;
|
||||
redis.get(uid,function (err,sid) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
if(sid){
|
||||
//给指定的客户端发送消息
|
||||
io.sockets.socket(sid).emit('message', msg.content);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
this.updateOnlieCount = function (isConnect) {
|
||||
//记录在线客户连接数
|
||||
redis.get('online_count',function (err,val) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
if(!val){
|
||||
val = 0;
|
||||
}
|
||||
if(typeof val == 'string'){
|
||||
val = parseInt(val);
|
||||
}
|
||||
if(isConnect){
|
||||
val += 1;
|
||||
}else{
|
||||
val -= 1;
|
||||
if(val<=0){
|
||||
val = 0;
|
||||
}
|
||||
}
|
||||
|
||||
console.log('当前在线人数:'+val);
|
||||
io.sockets.emit('update_online_count', { online_count: val });
|
||||
|
||||
redis.set('online_count',val,null,function (err,ret) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
//模块导出
|
||||
exports.ioServer = ioServer;
|
37
io/ioHelper.js
Normal file
@ -0,0 +1,37 @@
|
||||
var redis = require('../utils/redis');
|
||||
|
||||
var ioSvc = {};
|
||||
ioSvc.io = null;
|
||||
|
||||
//初始化实例
|
||||
ioSvc.setInstance = function (io) {
|
||||
this.io = io;
|
||||
};
|
||||
|
||||
ioSvc.getInstance =function () {
|
||||
return this.io;
|
||||
};
|
||||
|
||||
//服务器给所有客户端广播消息
|
||||
ioSvc.serverBroadcastMsg = function (data) {
|
||||
console.log('发送广播消息');
|
||||
console.log(data);
|
||||
this.io.sockets.emit('message',data);
|
||||
};
|
||||
|
||||
//服务端给指定用户发消息
|
||||
ioSvc.serverToPrivateMsg = function (uid,data) {
|
||||
console.log('发送私人消息');
|
||||
console.log(data);
|
||||
redis.get(uid,function (err,sid) {
|
||||
if(err){
|
||||
console.error(err);
|
||||
}
|
||||
if(sid){
|
||||
//给指定的客户端发送消息
|
||||
this.io.sockets.socket(sid).emit('message',data);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports.ioSvc = ioSvc;
|
6
io/messageTpye.js
Normal file
@ -0,0 +1,6 @@
|
||||
const messageType= {
|
||||
'public':'public',
|
||||
'private':'private'
|
||||
};
|
||||
|
||||
exports.messageType = messageType;
|
20
package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "kefu",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "~1.17.1",
|
||||
"cookie-parser": "~1.4.3",
|
||||
"debug": "~2.6.3",
|
||||
"ejs": "~2.5.6",
|
||||
"express": "~4.15.2",
|
||||
"morgan": "~1.8.1",
|
||||
"serve-favicon": "~2.4.2",
|
||||
"socket.io":"~2.0.4",
|
||||
"socket.io-client":"^2.0.4",
|
||||
"redis":"^2.8.0"
|
||||
}
|
||||
}
|
196
public/css/client.css
Normal file
@ -0,0 +1,196 @@
|
||||
body {
|
||||
padding: 50px;
|
||||
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #00B7FF;
|
||||
}
|
||||
|
||||
.page-current{
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.msg-box {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.msg-agent, .msg-bot, .msg-client {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
margin-bottom: 20px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
.msg-agent .agent-avatar,.msg-bot .agent-avatar {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.msg-client .date {
|
||||
margin-bottom: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
color: #b2b2b2;
|
||||
width: 100%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.msg-client .bubble, .msg-client .photo {
|
||||
float: right;
|
||||
width: auto;
|
||||
max-width: 100%;
|
||||
margin-left: 35px;
|
||||
}
|
||||
|
||||
.msg-agent .bubble, .msg-bot .bubble, .msg-client .bubble {
|
||||
position: relative;
|
||||
padding: 8px 12px;
|
||||
font-size: 13px;
|
||||
line-height: 20px;
|
||||
border-radius: 4px;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.msg-client .arrow {
|
||||
top: 14px;
|
||||
right: -6px;
|
||||
border-top: 5px solid transparent;
|
||||
border-bottom: 5px solid transparent;
|
||||
border-left: 6px solid #007aff;
|
||||
}
|
||||
|
||||
.msg-agent .arrow, .msg-agent .arrow-bg, .msg-bot .arrow, .msg-bot .arrow-bg, .msg-client .arrow, .msg-client .arrow-bg {
|
||||
position: absolute;
|
||||
display: block;
|
||||
width: 0;
|
||||
height: 0;
|
||||
font-size: 0;
|
||||
}
|
||||
|
||||
.msg-client .status {
|
||||
position: absolute;
|
||||
left: -25px;
|
||||
top: 8px;
|
||||
}
|
||||
|
||||
.msg-agent:after, .msg-bot:after, .msg-client:after, .evaluation-body .evaluation-btn-group:after {
|
||||
display: block;
|
||||
clear: both;
|
||||
content: '';
|
||||
}
|
||||
|
||||
.msg-client .bubble {
|
||||
background-color: #007aff;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.msg-agent .date,.msg-bot .date {
|
||||
margin-bottom: 2px;
|
||||
font-size: 12px;
|
||||
line-height: 14px;
|
||||
color: #b2b2b2;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.msg-agent .bubble,.msg-bot .bubble {
|
||||
color: #000;
|
||||
background-color: #fff;
|
||||
border-left: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.msg-agent .agent-avatar, .msg-bot .agent-avatar {
|
||||
position: absolute;
|
||||
top: 18px;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.msg-agent .agent-avatar>img,.msg-bot .agent-avatar>img {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
margin-top: 1px;
|
||||
border-radius: 18px;
|
||||
}
|
||||
|
||||
.msg-agent .arrow-bg,.msg-bot .arrow-bg {
|
||||
top: 13px;
|
||||
left: -7px;
|
||||
border-top: 6px solid transparent;
|
||||
border-bottom: 6px solid transparent;
|
||||
border-right: 7px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.msg-agent .arrow,.msg-bot .arrow {
|
||||
top: 14px;
|
||||
left: -6px;
|
||||
border-top: 5px solid transparent;
|
||||
border-bottom: 5px solid transparent;
|
||||
border-right: 6px solid #fff;
|
||||
}
|
||||
|
||||
*, :after, :before {
|
||||
box-sizing: border-box;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 2;
|
||||
width: 100%;
|
||||
height: 50px;
|
||||
background-color: #fff;
|
||||
box-shadow: 0 -1px 0 0 rgba(0,0,0,.04), 0 -2px 0 0 rgba(0,0,0,.01);
|
||||
}
|
||||
|
||||
.input-holder {
|
||||
position: relative;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
.footer .input-holder .feature-holder {
|
||||
float: left;
|
||||
padding-left: 4px;
|
||||
}
|
||||
|
||||
.footer .input-holder .text-holder {
|
||||
position: relative;
|
||||
padding-right: 50px;
|
||||
padding-left: 4px;
|
||||
overflow: hidden;
|
||||
zoom: 1;
|
||||
}
|
||||
|
||||
.footer .input-holder .text-holder #textarea {
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 32px;
|
||||
padding: 5px;
|
||||
margin-top: 12px;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
resize: none;
|
||||
vertical-align: middle;
|
||||
outline: 0;
|
||||
border: 0;
|
||||
word-break: break-all;
|
||||
font-size: 14px;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
}
|
||||
|
||||
.footer .input-holder .text-holder #btnSend {
|
||||
position: absolute;
|
||||
top: 3px;
|
||||
right: 2px;
|
||||
width: 46px;
|
||||
height: 44px;
|
||||
text-align: center;
|
||||
line-height: 44px;
|
||||
font-size: 14px;
|
||||
color: #858e99;
|
||||
}
|
59
public/js/client/client.js
Normal file
@ -0,0 +1,59 @@
|
||||
$(function(){
|
||||
//Socket.IO 连接
|
||||
var socket = io.connect('http://'+document.domain+':9010');
|
||||
|
||||
function insert_client_html(time,content){
|
||||
var tpl = '<div class="msg-box">'+
|
||||
'<div class="msg-client">'+
|
||||
'<div class="date">' + time + '</div>'+
|
||||
'<div class="bubble rich-text-bubble">'+
|
||||
'<span class="arrow"></span>'+
|
||||
'<div class="text">' + content + '</div>'+
|
||||
'<span class="status icon"></span>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
$(".msg-container").append(tpl);
|
||||
}
|
||||
|
||||
function insert_agent_html(time,content){
|
||||
var tpl = '<div class="msg-box">'+
|
||||
'<div class="msg-agent">'+
|
||||
'<div class="agent-avatar">'+
|
||||
'<img src="https://s3-qcloud.meiqia.com/pics.meiqia.bucket/avatars/20170929/972a7c64426ed82da1de67ac3f16bd07.png">'+
|
||||
'</div>'+
|
||||
'<div class="date">' + time + '</div>'+
|
||||
'<div class="bubble rich-text-bubble">'+
|
||||
'<span class="arrow-bg"></span>'+
|
||||
'<span class="arrow"></span>'+
|
||||
'<div class="text">' + content + '</div>'+
|
||||
'</div>'+
|
||||
'</div>'+
|
||||
'</div>';
|
||||
$(".msg-container").append(tpl);
|
||||
}
|
||||
|
||||
|
||||
$("#btnSend").click(function(){
|
||||
var date = dateFormat();
|
||||
var msg = $("#textarea").val();
|
||||
insert_client_html(date,msg);
|
||||
});
|
||||
|
||||
//连接服务器
|
||||
socket.on('connect', function () {
|
||||
console.log('连接成功...');
|
||||
var uuid = 'chat'+ guid();
|
||||
socket.emit('login', uuid);
|
||||
});
|
||||
|
||||
// /* 后端推送来消息时
|
||||
// msg:
|
||||
// type 消息类型 image,text
|
||||
// content 消息
|
||||
// */
|
||||
socket.on('message', function(msg){
|
||||
insert_agent_html(dateFormat(),msg.content);
|
||||
});
|
||||
|
||||
});
|
30
public/js/common.js
Normal file
@ -0,0 +1,30 @@
|
||||
//用于生成uuid
|
||||
function S4() {
|
||||
return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
|
||||
}
|
||||
|
||||
function guid() {
|
||||
return (S4()+S4()+"-"+S4()+S4()+S4());
|
||||
}
|
||||
|
||||
function dateFormat(fmt,date) {
|
||||
if(!fmt){
|
||||
fmt = "yyyy-MM-dd hh:mm:ss";
|
||||
}
|
||||
if(!date){
|
||||
date = new Date();
|
||||
}
|
||||
var o = {
|
||||
"M+": date.getMonth() + 1, //月份
|
||||
"d+": date.getDate(), //日
|
||||
"h+": date.getHours(), //小时
|
||||
"m+": date.getMinutes(), //分
|
||||
"s+": date.getSeconds(), //秒
|
||||
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
|
||||
"S": date.getMilliseconds() //毫秒
|
||||
};
|
||||
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (date.getFullYear() + "").substr(4 - RegExp.$1.length));
|
||||
for (var k in o)
|
||||
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
|
||||
return fmt;
|
||||
}
|
2
public/layui/css/layui.css
Executable file
2
public/layui/css/layui.mobile.css
Executable file
2
public/layui/css/modules/code.css
Executable file
@ -0,0 +1,2 @@
|
||||
/** layui-v2.1.5 MIT License By http://www.layui.com */
|
||||
html #layuicss-skincodecss{display:none;position:absolute;width:1989px}.layui-code-h3,.layui-code-view{position:relative;font-size:12px}.layui-code-view{display:block;margin:10px 0;padding:0;border:1px solid #e2e2e2;border-left-width:6px;background-color:#F2F2F2;color:#333;font-family:Courier New}.layui-code-h3{padding:0 10px;height:32px;line-height:32px;border-bottom:1px solid #e2e2e2}.layui-code-h3 a{position:absolute;right:10px;top:0;color:#999}.layui-code-view .layui-code-ol{position:relative;overflow:auto}.layui-code-view .layui-code-ol li{position:relative;margin-left:45px;line-height:20px;padding:0 5px;border-left:1px solid #e2e2e2;list-style-type:decimal-leading-zero;*list-style-type:decimal;background-color:#fff}.layui-code-view pre{margin:0}.layui-code-notepad{border:1px solid #0C0C0C;border-left-color:#3F3F3F;background-color:#0C0C0C;color:#C2BE9E}.layui-code-notepad .layui-code-h3{border-bottom:none}.layui-code-notepad .layui-code-ol li{background-color:#3F3F3F;border-left:none}
|
2
public/layui/css/modules/laydate/default/laydate.css
Executable file
BIN
public/layui/css/modules/layer/default/icon-ext.png
Executable file
After Width: | Height: | Size: 5.8 KiB |
BIN
public/layui/css/modules/layer/default/icon.png
Executable file
After Width: | Height: | Size: 11 KiB |
2
public/layui/css/modules/layer/default/layer.css
Executable file
BIN
public/layui/css/modules/layer/default/loading-0.gif
Executable file
After Width: | Height: | Size: 5.7 KiB |
BIN
public/layui/css/modules/layer/default/loading-1.gif
Executable file
After Width: | Height: | Size: 701 B |
BIN
public/layui/css/modules/layer/default/loading-2.gif
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
public/layui/font/iconfont.eot
Executable file
402
public/layui/font/iconfont.svg
Executable file
After Width: | Height: | Size: 202 KiB |
BIN
public/layui/font/iconfont.ttf
Executable file
BIN
public/layui/font/iconfont.woff
Executable file
BIN
public/layui/images/face/0.gif
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/layui/images/face/1.gif
Executable file
After Width: | Height: | Size: 5.4 KiB |
BIN
public/layui/images/face/10.gif
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/layui/images/face/11.gif
Executable file
After Width: | Height: | Size: 4.0 KiB |
BIN
public/layui/images/face/12.gif
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
public/layui/images/face/13.gif
Executable file
After Width: | Height: | Size: 7.3 KiB |
BIN
public/layui/images/face/14.gif
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
public/layui/images/face/15.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
public/layui/images/face/16.gif
Executable file
After Width: | Height: | Size: 6.6 KiB |
BIN
public/layui/images/face/17.gif
Executable file
After Width: | Height: | Size: 4.3 KiB |
BIN
public/layui/images/face/18.gif
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
public/layui/images/face/19.gif
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
public/layui/images/face/2.gif
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
public/layui/images/face/20.gif
Executable file
After Width: | Height: | Size: 5.0 KiB |
BIN
public/layui/images/face/21.gif
Executable file
After Width: | Height: | Size: 5.1 KiB |
BIN
public/layui/images/face/22.gif
Executable file
After Width: | Height: | Size: 9.6 KiB |
BIN
public/layui/images/face/23.gif
Executable file
After Width: | Height: | Size: 3.7 KiB |
BIN
public/layui/images/face/24.gif
Executable file
After Width: | Height: | Size: 7.9 KiB |
BIN
public/layui/images/face/25.gif
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
public/layui/images/face/26.gif
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
public/layui/images/face/27.gif
Executable file
After Width: | Height: | Size: 4.3 KiB |
BIN
public/layui/images/face/28.gif
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/layui/images/face/29.gif
Executable file
After Width: | Height: | Size: 4.7 KiB |
BIN
public/layui/images/face/3.gif
Executable file
After Width: | Height: | Size: 3.9 KiB |
BIN
public/layui/images/face/30.gif
Executable file
After Width: | Height: | Size: 2.5 KiB |
BIN
public/layui/images/face/31.gif
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
public/layui/images/face/32.gif
Executable file
After Width: | Height: | Size: 3.4 KiB |
BIN
public/layui/images/face/33.gif
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
public/layui/images/face/34.gif
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
public/layui/images/face/35.gif
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
public/layui/images/face/36.gif
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
public/layui/images/face/37.gif
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
public/layui/images/face/38.gif
Executable file
After Width: | Height: | Size: 3.5 KiB |
BIN
public/layui/images/face/39.gif
Executable file
After Width: | Height: | Size: 6.3 KiB |
BIN
public/layui/images/face/4.gif
Executable file
After Width: | Height: | Size: 5.6 KiB |
BIN
public/layui/images/face/40.gif
Executable file
After Width: | Height: | Size: 3.1 KiB |
BIN
public/layui/images/face/41.gif
Executable file
After Width: | Height: | Size: 3.6 KiB |
BIN
public/layui/images/face/42.gif
Executable file
After Width: | Height: | Size: 5.2 KiB |
BIN
public/layui/images/face/43.gif
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/layui/images/face/44.gif
Executable file
After Width: | Height: | Size: 4.0 KiB |
BIN
public/layui/images/face/45.gif
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
public/layui/images/face/46.gif
Executable file
After Width: | Height: | Size: 2.9 KiB |
BIN
public/layui/images/face/47.gif
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
public/layui/images/face/48.gif
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/layui/images/face/49.gif
Executable file
After Width: | Height: | Size: 2.3 KiB |
BIN
public/layui/images/face/5.gif
Executable file
After Width: | Height: | Size: 4.5 KiB |
BIN
public/layui/images/face/50.gif
Executable file
After Width: | Height: | Size: 5.7 KiB |
BIN
public/layui/images/face/51.gif
Executable file
After Width: | Height: | Size: 2.7 KiB |
BIN
public/layui/images/face/52.gif
Executable file
After Width: | Height: | Size: 777 B |
BIN
public/layui/images/face/53.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
public/layui/images/face/54.gif
Executable file
After Width: | Height: | Size: 2.1 KiB |
BIN
public/layui/images/face/55.gif
Executable file
After Width: | Height: | Size: 1.9 KiB |
BIN
public/layui/images/face/56.gif
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
public/layui/images/face/57.gif
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/layui/images/face/58.gif
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
public/layui/images/face/59.gif
Executable file
After Width: | Height: | Size: 10 KiB |
BIN
public/layui/images/face/6.gif
Executable file
After Width: | Height: | Size: 2.2 KiB |
BIN
public/layui/images/face/60.gif
Executable file
After Width: | Height: | Size: 3.2 KiB |
BIN
public/layui/images/face/61.gif
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
public/layui/images/face/62.gif
Executable file
After Width: | Height: | Size: 2.0 KiB |
BIN
public/layui/images/face/63.gif
Executable file
After Width: | Height: | Size: 5.7 KiB |
BIN
public/layui/images/face/64.gif
Executable file
After Width: | Height: | Size: 6.3 KiB |
BIN
public/layui/images/face/65.gif
Executable file
After Width: | Height: | Size: 3.5 KiB |
BIN
public/layui/images/face/66.gif
Executable file
After Width: | Height: | Size: 3.0 KiB |
BIN
public/layui/images/face/67.gif
Executable file
After Width: | Height: | Size: 2.6 KiB |
BIN
public/layui/images/face/68.gif
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
public/layui/images/face/69.gif
Executable file
After Width: | Height: | Size: 2.4 KiB |
BIN
public/layui/images/face/7.gif
Executable file
After Width: | Height: | Size: 3.3 KiB |
BIN
public/layui/images/face/70.gif
Executable file
After Width: | Height: | Size: 4.5 KiB |
BIN
public/layui/images/face/71.gif
Executable file
After Width: | Height: | Size: 5.2 KiB |
BIN
public/layui/images/face/8.gif
Executable file
After Width: | Height: | Size: 4.0 KiB |
BIN
public/layui/images/face/9.gif
Executable file
After Width: | Height: | Size: 4.1 KiB |
2
public/layui/lay/modules/carousel.js
Executable file
@ -0,0 +1,2 @@
|
||||
/** layui-v2.1.5 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var i=layui.$,n=(layui.hint(),layui.device(),{config:{},set:function(e){var n=this;return n.config=i.extend({},n.config,e),n},on:function(e,i){return layui.onevent.call(this,t,e,i)}}),t="carousel",a="layui-this",l=">*[carousel-item]>*",o="layui-carousel-left",r="layui-carousel-right",d="layui-carousel-prev",s="layui-carousel-next",u="layui-carousel-arrow",c="layui-carousel-ind",m=function(e){var t=this;t.config=i.extend({},t.config,n.config,e),t.render()};m.prototype.config={width:"600px",height:"280px",full:!1,arrow:"hover",indicator:"inside",autoplay:!0,interval:3e3,anim:"",trigger:"click",index:0},m.prototype.render=function(){var e=this,n=e.config;n.elem=i(n.elem),n.elem[0]&&(e.elemItem=n.elem.find(l),n.index<0&&(n.index=0),n.index>=e.elemItem.length&&(n.index=e.elemItem.length-1),n.interval<800&&(n.interval=800),n.full?n.elem.css({position:"fixed",width:"100%",height:"100%",zIndex:9999}):n.elem.css({width:n.width,height:n.height}),n.elem.attr("lay-anim",n.anim),e.elemItem.eq(n.index).addClass(a),e.indicator(),e.elemItem.length<=1||(e.arrow(),e.autoplay(),e.events()))},m.prototype.reload=function(e){var n=this;clearInterval(n.timer),n.config=i.extend({},n.config,e),n.render()},m.prototype.prevIndex=function(){var e=this,i=e.config,n=i.index-1;return n<0&&(n=e.elemItem.length-1),n},m.prototype.nextIndex=function(){var e=this,i=e.config,n=i.index+1;return n>=e.elemItem.length&&(n=0),n},m.prototype.addIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index+e,n.index>=i.elemItem.length&&(n.index=0)},m.prototype.subIndex=function(e){var i=this,n=i.config;e=e||1,n.index=n.index-e,n.index<0&&(n.index=i.elemItem.length-1)},m.prototype.autoplay=function(){var e=this,i=e.config;i.autoplay&&(e.timer=setInterval(function(){e.slide()},i.interval))},m.prototype.arrow=function(){var e=this,n=e.config,t=i(['<button class="layui-icon '+u+'" lay-type="sub">'+("updown"===n.anim?"":"")+"</button>",'<button class="layui-icon '+u+'" lay-type="add">'+("updown"===n.anim?"":"")+"</button>"].join(""));n.elem.attr("lay-arrow",n.arrow),n.elem.find("."+u)[0]&&n.elem.find("."+u).remove(),n.elem.append(t),t.on("click",function(){var n=i(this),t=n.attr("lay-type");e.slide(t)})},m.prototype.indicator=function(){var e=this,n=e.config,t=e.elemInd=i(['<div class="'+c+'"><ul>',function(){var i=[];return layui.each(e.elemItem,function(e){i.push("<li"+(n.index===e?' class="layui-this"':"")+"></li>")}),i.join("")}(),"</ul></div>"].join(""));n.elem.attr("lay-indicator",n.indicator),n.elem.find("."+c)[0]&&n.elem.find("."+c).remove(),n.elem.append(t),"updown"===n.anim&&t.css("margin-top",-(t.height()/2)),t.find("li").on("hover"===n.trigger?"mouseover":n.trigger,function(){var t=i(this),a=t.index();a>n.index?e.slide("add",a-n.index):a<n.index&&e.slide("sub",n.index-a)})},m.prototype.slide=function(e,i){var n=this,l=n.elemItem,u=n.config,c=u.index,m=u.elem.attr("lay-filter");n.haveSlide||("sub"===e?(n.subIndex(i),l.eq(u.index).addClass(d),setTimeout(function(){l.eq(c).addClass(r),l.eq(u.index).addClass(r)},50)):(n.addIndex(i),l.eq(u.index).addClass(s),setTimeout(function(){l.eq(c).addClass(o),l.eq(u.index).addClass(o)},50)),setTimeout(function(){l.removeClass(a+" "+d+" "+s+" "+o+" "+r),l.eq(u.index).addClass(a),n.haveSlide=!1},300),n.elemInd.find("li").eq(u.index).addClass(a).siblings().removeClass(a),n.haveSlide=!0,layui.event.call(this,t,"change("+m+")",{index:u.index,prevIndex:c,item:l.eq(u.index)}))},m.prototype.events=function(){var e=this,i=e.config;i.elem.data("haveEvents")||(i.elem.on("mouseenter",function(){clearInterval(e.timer)}).on("mouseleave",function(){e.autoplay()}),i.elem.data("haveEvents",!0))},n.render=function(e){var i=new m(e);return i},e(t,n)});
|
2
public/layui/lay/modules/code.js
Executable file
@ -0,0 +1,2 @@
|
||||
/** layui-v2.1.5 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var a=layui.$,l="http://www.layui.com/doc/modules/code.html";e("code",function(e){var t=[];e=e||{},e.elem=a(e.elem||".layui-code"),e.about=!("about"in e)||e.about,e.elem.each(function(){t.push(this)}),layui.each(t.reverse(),function(t,i){var c=a(i),o=c.html();(c.attr("lay-encode")||e.encode)&&(o=o.replace(/&(?!#?[a-zA-Z0-9]+;)/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""")),c.html('<ol class="layui-code-ol"><li>'+o.replace(/[\r\t\n]+/g,"</li><li>")+"</li></ol>"),c.find(">.layui-code-h3")[0]||c.prepend('<h3 class="layui-code-h3">'+(c.attr("lay-title")||e.title||"code")+(e.about?'<a href="'+l+'" target="_blank">layui.code</a>':"")+"</h3>");var d=c.find(">.layui-code-ol");c.addClass("layui-box layui-code-view"),(c.attr("lay-skin")||e.skin)&&c.addClass("layui-code-"+(c.attr("lay-skin")||e.skin)),(d.find("li").length/100|0)>0&&d.css("margin-left",(d.find("li").length/100|0)+"px"),(c.attr("lay-height")||e.height)&&d.css("max-height",c.attr("lay-height")||e.height)})})}).addcss("modules/code.css","skincodecss");
|
2
public/layui/lay/modules/element.js
Executable file
2
public/layui/lay/modules/flow.js
Executable file
@ -0,0 +1,2 @@
|
||||
/** layui-v2.1.5 MIT License By http://www.layui.com */
|
||||
;layui.define("jquery",function(e){"use strict";var l=layui.$,o=function(e){},t='<i class="layui-anim layui-anim-rotate layui-anim-loop layui-icon "></i>';o.prototype.load=function(e){var o,i,n,r,a=this,c=0;e=e||{};var f=l(e.elem);if(f[0]){var m=l(e.scrollElem||document),u=e.mb||50,s=!("isAuto"in e)||e.isAuto,v=e.end||"没有更多了",y=e.scrollElem&&e.scrollElem!==document,d="<cite>加载更多</cite>",h=l('<div class="layui-flow-more"><a href="javascript:;">'+d+"</a></div>");f.find(".layui-flow-more")[0]||f.append(h);var p=function(e,t){e=l(e),h.before(e),t=0==t||null,t?h.html(v):h.find("a").html(d),i=t,o=null,n&&n()},g=function(){o=!0,h.find("a").html(t),"function"==typeof e.done&&e.done(++c,p)};if(g(),h.find("a").on("click",function(){l(this);i||o||g()}),e.isLazyimg)var n=a.lazyimg({elem:e.elem+" img",scrollElem:e.scrollElem});return s?(m.on("scroll",function(){var e=l(this),t=e.scrollTop();r&&clearTimeout(r),i||(r=setTimeout(function(){var i=y?e.height():l(window).height(),n=y?e.prop("scrollHeight"):document.documentElement.scrollHeight;n-t-i<=u&&(o||g())},100))}),a):a}},o.prototype.lazyimg=function(e){var o,t=this,i=0;e=e||{};var n=l(e.scrollElem||document),r=e.elem||"img",a=e.scrollElem&&e.scrollElem!==document,c=function(e,l){var o=n.scrollTop(),r=o+l,c=a?function(){return e.offset().top-n.offset().top+o}():e.offset().top;if(c>=o&&c<=r&&!e.attr("src")){var m=e.attr("lay-src");layui.img(m,function(){var l=t.lazyimg.elem.eq(i);e.attr("src",m).removeAttr("lay-src"),l[0]&&f(l),i++})}},f=function(e,o){var f=a?(o||n).height():l(window).height(),m=n.scrollTop(),u=m+f;if(t.lazyimg.elem=l(r),e)c(e,f);else for(var s=0;s<t.lazyimg.elem.length;s++){var v=t.lazyimg.elem.eq(s),y=a?function(){return v.offset().top-n.offset().top+m}():v.offset().top;if(c(v,f),i=s,y>u)break}};if(f(),!o){var m;n.on("scroll",function(){var e=l(this);m&&clearTimeout(m),m=setTimeout(function(){f(null,e)},50)}),o=!0}return f},e("flow",new o)});
|