Commit 6f1679c1 authored by coolfish's avatar coolfish

发布

parents
{
"presets": ["es2015", "stage-2"],
"plugins": []
}
# 环境变量
NODE_ENV =
# 端口号
PORT =
# 日志监听级别
LOG_LEVEL=
# MONGO 数据库
MONGO_URL =
\ No newline at end of file
.DS_Store
npm-debug.log
node_modules/
.env
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 router = require('./src/router');
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('/', router);
// 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;
#!/usr/bin/env node
/**
* Module dependencies.
*/
var app = require('../app');
var debug = require('debug')('xy-ads:server');
var http = require('http');
/**
* Get port from environment and store in Express.
*/
var port = normalizePort(process.env.PORT || '3000');
app.set('port', port);
/**
* Create HTTP server.
*/
var server = http.createServer(app);
/**
* 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);
}
/* eslint-disable */
require('dotenv').config({ silent: true })
require('./bin/www')
/* eslint-enable */
This diff is collapsed.
{
"name": "xy-ads",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "NODE_ENV=development npm run dev",
"dev": "nodemon index.js --exec babel-node"
},
"dependencies": {
"body-parser": "~1.17.1",
"cookie-parser": "~1.4.3",
"debug": "~2.6.3",
"dotenv": "^4.0.0",
"ejs": "~2.5.6",
"express": "~4.15.2",
"mongoose": "^4.10.5",
"morgan": "~1.8.1",
"serve-favicon": "~2.4.2"
},
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-core": "^6.24.1",
"babel-eslint": "^7.2.3",
"babel-polyfill": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"nodemon": "^1.11.0"
}
}
* {
margin: 0;
padding: 0;
outline: 0;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
html {
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
-ms-font-smoothing: grayscale;
-o-font-smoothing: grayscale;
font-smoothing: grayscale;
font-size: 12px;
}
html, body {
background-color: #fff;
min-height: 100%;
height: 100%;
position: relative;
font-size: 12px;
-webkit-font-smoothing: antialiased;
font-family: PingFangSC-Light,'helvetica neue','hiragino sans gb',arial,'microsoft yahei ui','microsoft yahei',simsun,sans-serif;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
img {
border: none;
}
ul, ol, li {
list-style: none;
}
a {
text-decoration: none;
outline: none;
cursor: pointer;
border: none;
}
input {
outline: none;
resize: none;
border: none;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
.clearfix { zoom:1; }
.clearfix:after { content: ""; display: block; height: 0; visibility: hidden; clear: both; }
.hide {
display: none;
}
.show {
display: block;
}
.font-title {
height: 24px;
line-height: 24px;
font-weight: normal;
font-size: 24px;
color: #424242;
}
.help-text {
font-size: 12px;
color: #424242;
font-weight: normal;
height: 12px;
line-height: 12px;
opacity: 0.7;
}
.top-wrapper {
background-color: #fff;
background-color: rgba(255, 255, 255, 0.7);
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 99999;
}
.top-nav {
max-width: 984px;
position: relative;
height: 79px;
margin: 0 auto;
border-bottom: 1px solid #d2d2d2;
}
.top-nav-left {
padding: 0 20px;
float: left;
}
.top-nav-left .font-title {
height: auto;
line-height: 78px;
}
.top-nav-left .help-text {
margin-top: 10px;
}
.fullpage {
height: 100%;
}
.section {
width: 100%;
text-align: center;
position: relative;
background-repeat: no-repeat;
background-position: center center;
background-size: 100%;
}
#section0 {
height: 100%;
}
#industry, #format, #resultPage {
background-color: #f2f2f2;
}
#section0 .section-content {
position: absolute;
top: 50%;
height: 200px;
margin-top: -100px;
width: 500px;
left: 50%;
margin-left: -250px;
}
#industry .section-content,
#platform .section-content,
#format .section-content,
#readCount .section-content,
#resultPage .section-content {
padding-top: 50px;
padding-bottom: 60px;
}
#readCount .section-content {
padding-bottom: 72px;
}
#resultPage .section-content {
padding-bottom: 90px;
}
#section5 .section-content {
padding-top: 100px;
padding-bottom: 120px;
padding-left: 20px;
padding-right: 20px;
}
.section-h1 {
margin: 15px 0;
font-size: 40px;
font-weight: bolder;
}
.section-h2 {
margin: 12px 0;
font-size: 24px;
color: #333333;
}
.section-h3 {
margin: 10px 0;
font-size: 18px;
color: #b3b3b3;
}
.page-tip {
width: 36px;
height: 36px;
position: absolute;
bottom: 36px;
left: 50%;
margin-left: -18px;
background-image: url(../images/arrow@2x.png);
background-size: cover;
}
.fadeInUp {
animation-name: fadeInUp;
animation-duration: 0.75s;
-webkit-animation-name: fadeInUp;
-webkit-animation-duration: 0.75s;
animation-iteration-count: infinite;
-webkit-animation-iteration-count: infinite;
}
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(-100%);
}
90%,100% {
opacity: 1;
-webkit-transform: none;
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
transform: translateY(-100%);
}
90%,100% {
opacity: 1;
transform: none;
}
}
.xy-btn-group {
max-width: 768px;
margin: 20px auto 0 auto;
}
.xy-btn-group li {
max-width: 256px;
float: left;
width: 50%;
}
.xy-btn {
display: block;
margin: 20px;
border: 1px solid #d3d3d3;
color: #666;
position: relative;
background-color: #fff;
text-align: center;
}
.xy-btn span {
display: block;
height: 60px;
line-height: 60px;
font-size: 18px;
}
.xy-btn img {
background-color: #fff;
display: block;
border: 1px solid #d2d2d2;
margin: 25px auto 0 auto;
}
.xy-btn img.icon {
height: 60px;
width: 60px;
-webkit-border-radius: 15px;
-moz-border-radius: 15px;
-ms-border-radius: 15px;
-o-border-radius: 15px;
border-radius: 15px;
}
.xy-btn img.image-format {
width: 100%;
margin: 0;
}
.xy-btn.on {
color: #2277da;
border-color: #2277da;
background-color: #d7e6f8;
}
.xy-btn.on img {
border-color: #2277da;
}
.xy-btn:not(.on):hover {
color: #333;
border-color: #8a9099;
}
.xy-btn:not(.on):hover img {
border-color: #8a9099;
}
.xy-btn.on {
color: #2277da;
border-color: #2277da;
background-color: #d7e6f8;
}
.xy-btn.on:after {
content: '';
display: block;
position: absolute;
right: 0;
bottom: 0;
width: 0;
height: 0;
border-right: 14px solid #2277da;
border-bottom: 14px solid #2277da;
border-top: 14px solid transparent;
border-left: 14px solid transparent;
}
#platform .xy-btn {
padding: 10px 0;
}
#format .xy-btn img {
height: 380px;
border-top: 0;
border-left: 0;
border-right: 0;
}
#industry li {
max-width: 153.6px;
}
.section-text {
max-width: 768px;
margin: 20px auto 0 auto;
padding-top: 20px;
font-size: 36px;
padding-bottom: 20px;
}
#resultPage .section-text {
margin: 32px auto 0 auto;
}
.section-text input {
font-size: 32px;
width: 165px;
text-align: right;
padding-bottom: 5px;
border-bottom: 2px solid #666;
background-color: transparent;
}
#resultPage {
background: #f2f2f2 url(../images/timing_bg.png) center no-repeat;
}
#resultPage .section-text font {
color: #2277da;
padding: 0 10px;
border-bottom: 2px solid #666;
}
#section5 .section-text {
padding-top: 0;
}
#section5 .section-h3 {
color: #666;
}
#section5 input {
height: 24px;
width: 120px;
padding: 7px 12px 7px 40px;
border: 1px solid #e3e3e3;
background-color: #ffffff;
background-image: url(../images/phone@2x.png);
background-repeat: no-repeat;
background-position: 10px center;
background-size: 24px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
color: #565656;
font-size: 18px;
-webkit-transition: background-color .3s linear;
-moz-transition: background-color .3s linear;
-ms-transition: background-color .3s linear;
-o-transition: background-color .3s linear;
transition: background-color .3s linear;
}
#section5 input:focus {
background-color: #faffbd;
}
.btn-submit {
background-color: #d7e6f8;
color: #2277da;
padding: 8px 18px;
font-size: 16px;
font-weight: 400;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-ms-border-radius: 4px;
-o-border-radius: 4px;
border-radius: 4px;
border: 1px solid #2277da;
cursor: pointer;
-webkit-transition: background-color .3s linear, color .3s linear;
-moz-transition: background-color .3s linear, color .3s linear;
-ms-transition: background-color .3s linear, color .3s linear;
-o-transition: background-color .3s linear, color .3s linear;
transition: background-color .3s linear, color .3s linear;
}
.btn-submit:hover {
background-color: #2277da;
color: #fff;
}
#footer {
background-color: #292929;
color: #999;
padding: 20px 0;
text-align: center;
}
.friends {
padding-bottom: 5px;
padding: 0 20px;
}
.friends p {
font-size: 12px;
margin-bottom: 2px;
}
.friends a {
margin: 0 6px;
color: #999;
}
.friends a:hover {
color: #fff;
}
.copyright {
font-size: 12px;
padding: 0 20px;
}
.section-text {
padding: 0 20px;
}
#section5 #contacts {
color: #2277da;
font-weight: bold;
border-top: 2px solid #2277da;
border-bottom: 2px solid #2277da;
padding: 10px;
width: 220px;
margin: 0 auto;
}
.xyfc-logo {
vertical-align: middle;
color: #f96868;
}
.hjy-logo {
height: 46px;
vertical-align: middle;
}
.top-nav-left .font-title {
font-family: "Helvetica Neue For Number", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.top-nav-left .font-title span {
vertical-align: middle;
padding-left: 1px;
padding-right: 5px;
}
@media(max-width:415px) {
.top-nav-left .font-title {
line-height: 20px;
}
#platform .xy-btn {
padding: 0;
}
#format li {
float: initial;
width: 100%;
margin: 0 auto;
}
#section0 .section-content {
width: 280px;
margin-left: -150px;
padding-left: 10px;
padding-right: 10px;
}
}
This diff is collapsed.
window.onload = function () {
if (window.applicationCache) {
particlesJS.load('section0', 'js/particles.json');
} else {
$('#section0').css('backgroundImage', 'url(../images/section0_bg.png)')
$('.page-tip').css('backgroundImage', 'url(../images/arrow.png)');
$('#section5 input').css('backgroundImage', 'url(../images/phone.png)');
$('.btn-submit').css({
'height': '40px',
'marginLeft': '10px',
'lineHeight': '20px'
});
setInterval(animateTips, 1500);
function animateTips () {
$('.page-tip').css({
'bottom': '60px',
'opacity': 0
}).animate({
'bottom': '36px',
'opacity': 1
}, 750);
}
animateTips();
}
var flag = {
industry: false,
platform: false,
format: false,
expect: false
};
var expect = 0;
var articles = 0;
var days = 0;
var articlesPv = 3000;
var publishArticlesCount = 100;
function clickBtn (id) {
$('#' + id).on('click', '.xy-btn', function () {
$('#' + id + ' .xy-btn').removeClass('on');
$(this).addClass('on');
flag[id] = true;
checkFlag();
});
}
function checkFlag () {
if (flag.industry && flag.platform && flag.format && flag.expect) {
compute();
}
}
function compute () {
articles = Math.ceil(expect / articlesPv);
days = Math.ceil(articles / publishArticlesCount);
$('#articles').html(articles);
$('#days').html(days);
$('#tips').hide();
$('#result').show();
}
function changeExpect (value) {
expect = value * 10000;
flag['expect'] = (!isNaN(expect) && expect > 0);
checkFlag();
}
clickBtn('industry');
clickBtn('platform');
clickBtn('format');
$('#expect').blur(function () {
changeExpect(+$(this).val());
});
$(document).keypress(function (e) {
if (e.which === 13) {
changeExpect(+$('#expect').val());
}
});
};
This diff is collapsed.
{
"particles": {
"number": {
"value": 80,
"density": {
"enable": true,
"value_area": 800
}
},
"color": {
"value": "#cccccc"
},
"shape": {
"type": "circle",
"stroke": {
"width": 0,
"color": "#000000"
},
"polygon": {
"nb_sides": 5
},
"image": {
"src": "img/github.svg",
"width": 100,
"height": 100
}
},
"opacity": {
"value": 0.5,
"random": false,
"anim": {
"enable": false,
"speed": 1,
"opacity_min": 0.1,
"sync": false
}
},
"size": {
"value": 6,
"random": true,
"anim": {
"enable": false,
"speed": 40,
"size_min": 0.1,
"sync": false
}
},
"line_linked": {
"enable": true,
"distance": 150,
"color": "#999999",
"opacity": 0.4,
"width": 1
},
"move": {
"enable": true,
"speed": 3,
"direction": "none",
"random": false,
"straight": false,
"out_mode": "out",
"bounce": false,
"attract": {
"enable": false,
"rotateX": 600,
"rotateY": 1200
}
}
},
"interactivity": {
"detect_on": "canvas",
"events": {
"onhover": {
"enable": false
},
"onclick": {
"enable": false
},
"resize": true
},
"modes": {
"grab": {
"distance": 400,
"line_linked": {
"opacity": 1
}
},
"bubble": {
"distance": 400,
"size": 40,
"duration": 2,
"opacity": 8,
"speed": 3
},
"repulse": {
"distance": 200,
"duration": 0.4
},
"push": {
"particles_nb": 4
},
"remove": {
"particles_nb": 2
}
}
},
"retina_detect": true
}
\ No newline at end of file
This diff is collapsed.
/* eslint-disable */
import 'babel-polyfill'
/* eslint-enable */
import Model from './model'
const create = async (options) => {
options.createdAt = options.createdAt || Date.now()
const result = await Model.create(Object.assign({}, options))
return result
}
const find = async (options = {}, query = { limit: 25, skip: 1, createdAt: -1 }) => {
if (!query.skip) {
query.skip = 1
}
if (!query.limit) {
query.limit = 25
}
if (!query.createdAt) {
query.createdAt = -1
}
if (options.removed === undefined) {
options.removed = false
}
const result = await Model.find(options).sort({ createdAt: query.createdAt }).limit(query.limit).skip((query.skip - 1) * query.limit)
return result
}
const remove = async (id) => {
let analyse = await Model.findById(id)
if (!analyse) {
return null
}
analyse.removed = true
analyse.updatedAt = Date.now()
const result = await analyse.save()
return result
}
const update = async (id, options = {}) => {
let analyse = await Model.findById(id)
if (!analyse) {
return null
}
analyse = Object.assign({}, analyse, options)
analyse.updatedAt = Date.now()
const result = await analyse.save()
return result
}
const count = async () => {
const result = await Model.count({ removed: false })
return result
}
export default {
create,
find,
remove,
update,
count
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
<h1><%= message %></h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment