This commit is contained in:
qitmac000249 2017-07-27 12:02:04 +08:00
commit df18193c5f
8 changed files with 84 additions and 34 deletions

View File

@ -36,32 +36,16 @@
} }
} }
.group-operate { .group-operate {
height: 48px;
padding: 10px 6px; padding: 10px 6px;
background: #eee; background: #eee;
display: flex;
justify-content: space-around;
.search {
margin-right: 6px;
flex-grow: 1;
}
@media screen and (min-width:1100px){
.search {
display: inline-block;
margin-right: 6px;
width: 162px;
}
}
@media screen and (max-width:1100px){
.search {
display: inline-block;
margin-right: 6px;
width: 80%;
margin: 0px auto;
display: block;
}
button{
width: 80%;
margin: 0px auto;
display: block;
margin-top: 10px;
}
}
} }
.group-list { .group-list {
max-height: 650px; max-height: 650px;

View File

@ -1,5 +1,11 @@
module.exports = { import path from 'path'
/**
* config.js是用来第一次安装初始化网站配置如果不用默认的runtime_path可以直接修改runtime_path路径
*/
let runtime_path = path.join(path.resolve(__dirname, '../'), 'runtime')
let config = {
"port": 80, "port": 80,
"runtime_path": runtime_path,
"webhost": "yapi.local.qunar.com", "webhost": "yapi.local.qunar.com",
"adminAccount": "admin@admin.com", "adminAccount": "admin@admin.com",
"db": { "db": {
@ -16,4 +22,8 @@ module.exports = {
"pass": "**********" "pass": "**********"
} }
} }
} }
module.exports = config

View File

@ -2,8 +2,10 @@ import path from 'path';
import fs from 'fs-extra'; import fs from 'fs-extra';
import config from '../config.js'; import config from '../config.js';
fs.ensureDirSync( path.join(path.resolve(__dirname, '../../'), 'runtime') ); let runtimePath = config.runtime_path;
let configPath = path.join(path.resolve(__dirname, '../../'), 'runtime', 'config.json') fs.ensureDirSync( runtimePath );
fs.ensureDirSync( path.join(runtimePath, 'log'));
let configPath = path.join(runtimePath, 'config.json')
fs.writeFileSync(configPath, fs.writeFileSync(configPath,
JSON.stringify(config, null, '\t'), JSON.stringify(config, null, '\t'),

View File

@ -8,7 +8,7 @@ let mail;
const WEBROOT = path.resolve(__dirname, '..'); //路径 const WEBROOT = path.resolve(__dirname, '..'); //路径
const WEBROOT_SERVER = __dirname; const WEBROOT_SERVER = __dirname;
const WEBROOT_RUNTIME = path.join(WEBROOT, 'runtime'); const WEBROOT_RUNTIME = config.runtime_path;
const WEBROOT_LOG = path.join(WEBROOT_RUNTIME, 'log'); const WEBROOT_LOG = path.join(WEBROOT_RUNTIME, 'log');
const WEBCONFIG = config; const WEBCONFIG = config;

View File

@ -1,7 +1,18 @@
"use strict"; 'use strict';
module.exports = { var _path = require('path');
var _path2 = _interopRequireDefault(_path);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* config.js是用来第一次安装初始化网站配置如果不用默认的runtime_path可以直接修改runtime_path路径
*/
var runtime_path = _path2.default.join(_path2.default.resolve(__dirname, '../'), 'runtime');
var config = {
"port": 80, "port": 80,
"runtime_path": runtime_path,
"webhost": "yapi.local.qunar.com", "webhost": "yapi.local.qunar.com",
"adminAccount": "admin@admin.com", "adminAccount": "admin@admin.com",
"db": { "db": {
@ -18,4 +29,6 @@ module.exports = {
"pass": "**********" "pass": "**********"
} }
} }
}; };
module.exports = config;

View File

@ -18,7 +18,9 @@ var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
_fsExtra2.default.ensureDirSync(_path2.default.join(_path2.default.resolve(__dirname, '../../'), 'runtime')); var runtimePath = _config2.default.runtime_path;
var configPath = _path2.default.join(_path2.default.resolve(__dirname, '../../'), 'runtime', 'config.json'); _fsExtra2.default.ensureDirSync(runtimePath);
_fsExtra2.default.ensureDirSync(_path2.default.join(runtimePath, 'log'));
var configPath = _path2.default.join(runtimePath, 'config.json');
_fsExtra2.default.writeFileSync(configPath, (0, _stringify2.default)(_config2.default, null, '\t'), { encoding: 'utf8' }); _fsExtra2.default.writeFileSync(configPath, (0, _stringify2.default)(_config2.default, null, '\t'), { encoding: 'utf8' });

View File

@ -27,7 +27,7 @@ var mail = void 0;
var WEBROOT = _path2.default.resolve(__dirname, '..'); //路径 var WEBROOT = _path2.default.resolve(__dirname, '..'); //路径
var WEBROOT_SERVER = __dirname; var WEBROOT_SERVER = __dirname;
var WEBROOT_RUNTIME = _path2.default.join(WEBROOT, 'runtime'); var WEBROOT_RUNTIME = _config2.default.runtime_path;
var WEBROOT_LOG = _path2.default.join(WEBROOT_RUNTIME, 'log'); var WEBROOT_LOG = _path2.default.join(WEBROOT_RUNTIME, 'log');
var WEBCONFIG = _config2.default; var WEBCONFIG = _config2.default;

39
service.sh Normal file
View File

@ -0,0 +1,39 @@
#!/bin/bash
prog="/var/soft/node-v6.11.1-linux-x64/bin/pm2"
app="/home/q/www/yapi.beta.corp.qunar.com/webapp/server_dist/app.js"
start() {
echo "Starting Server..."
eval "$prog start $app --name=yapi"
}
stop() {
echo "Stopping Server..."
eval "$prog stop yapi"
}
restart() {
echo "Restart Server..."
eval "$prog restart yapi"
}
case "$1" in
start)
start && exit 0
;;
stop)
stop || exit 0
;;
restart)
restart || exit 0
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 2
esac