From 75fb32b252155d7211a68df2725f536cebb35521 Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 27 Jul 2017 11:50:15 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=9B=A0=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9runtime=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/config.js | 14 ++++++++++-- server/utils/initConfig.js | 6 +++-- server/yapi.js | 2 +- server_dist/config.js | 19 +++++++++++++--- server_dist/utils/initConfig.js | 6 +++-- server_dist/yapi.js | 2 +- service.sh | 39 +++++++++++++++++++++++++++++++++ 7 files changed, 77 insertions(+), 11 deletions(-) create mode 100644 service.sh diff --git a/server/config.js b/server/config.js index 96623b87..c83346d6 100644 --- a/server/config.js +++ b/server/config.js @@ -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, + "runtime_path": runtime_path, "webhost": "yapi.local.qunar.com", "adminAccount": "admin@admin.com", "db": { @@ -16,4 +22,8 @@ module.exports = { "pass": "**********" } } -} \ No newline at end of file +} + +module.exports = config + + diff --git a/server/utils/initConfig.js b/server/utils/initConfig.js index a52fa17e..bafb5980 100644 --- a/server/utils/initConfig.js +++ b/server/utils/initConfig.js @@ -2,8 +2,10 @@ import path from 'path'; import fs from 'fs-extra'; import config from '../config.js'; -fs.ensureDirSync( path.join(path.resolve(__dirname, '../../'), 'runtime') ); -let configPath = path.join(path.resolve(__dirname, '../../'), 'runtime', 'config.json') +let runtimePath = config.runtime_path; +fs.ensureDirSync( runtimePath ); +fs.ensureDirSync( path.join(runtimePath, 'log')); +let configPath = path.join(runtimePath, 'config.json') fs.writeFileSync(configPath, JSON.stringify(config, null, '\t'), diff --git a/server/yapi.js b/server/yapi.js index c7d3eb4a..dc5e0198 100644 --- a/server/yapi.js +++ b/server/yapi.js @@ -8,7 +8,7 @@ let mail; const WEBROOT = path.resolve(__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 WEBCONFIG = config; diff --git a/server_dist/config.js b/server_dist/config.js index cbf2c2a6..3121f802 100644 --- a/server_dist/config.js +++ b/server_dist/config.js @@ -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, + "runtime_path": runtime_path, "webhost": "yapi.local.qunar.com", "adminAccount": "admin@admin.com", "db": { @@ -18,4 +29,6 @@ module.exports = { "pass": "**********" } } -}; \ No newline at end of file +}; + +module.exports = config; \ No newline at end of file diff --git a/server_dist/utils/initConfig.js b/server_dist/utils/initConfig.js index f089425f..c7ae500e 100644 --- a/server_dist/utils/initConfig.js +++ b/server_dist/utils/initConfig.js @@ -18,7 +18,9 @@ var _config2 = _interopRequireDefault(_config); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -_fsExtra2.default.ensureDirSync(_path2.default.join(_path2.default.resolve(__dirname, '../../'), 'runtime')); -var configPath = _path2.default.join(_path2.default.resolve(__dirname, '../../'), 'runtime', 'config.json'); +var runtimePath = _config2.default.runtime_path; +_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' }); \ No newline at end of file diff --git a/server_dist/yapi.js b/server_dist/yapi.js index fe35f0ad..135a58df 100644 --- a/server_dist/yapi.js +++ b/server_dist/yapi.js @@ -27,7 +27,7 @@ var mail = void 0; var WEBROOT = _path2.default.resolve(__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 WEBCONFIG = _config2.default; diff --git a/service.sh b/service.sh new file mode 100644 index 00000000..f9d4b434 --- /dev/null +++ b/service.sh @@ -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 \ No newline at end of file From c5e3258fa33b2d30fe3b54520887d9002061060a Mon Sep 17 00:00:00 2001 From: qitmac000249 Date: Thu, 27 Jul 2017 12:01:56 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix:=20user=20=E6=A0=B7=E5=BC=8F=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/containers/User/Profile.js | 16 +++++++------- client/containers/User/index.scss | 35 +++++++++++++++++++++++-------- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/client/containers/User/Profile.js b/client/containers/User/Profile.js index b8de8a2e..3a256867 100644 --- a/client/containers/User/Profile.js +++ b/client/containers/User/Profile.js @@ -138,8 +138,8 @@ class Profile extends Component { userNameEditHtml =
- - + +
} @@ -154,8 +154,8 @@ class Profile extends Component { emailEditHtml =
- - + +
} @@ -175,15 +175,15 @@ class Profile extends Component { } if (this.state.secureEdit === false) { - secureEditHtml = + secureEditHtml = } else { secureEditHtml =
- - + +
} @@ -228,7 +228,7 @@ class Profile extends Component { - 安全 + 密码 {secureEditHtml} diff --git a/client/containers/User/index.scss b/client/containers/User/index.scss index 56dca065..75cbbb3b 100644 --- a/client/containers/User/index.scss +++ b/client/containers/User/index.scss @@ -21,15 +21,22 @@ border-radius:5px; margin-top: 15px; .search{ - margin: 5px; + padding: 5px; + background-color: #eee; } ul{border:none} + .ant-menu-item{ + font-size: 14px; + } } .user-name{ - padding: 10px 0px; + padding: 24px 0px; text-align: center; background-color: #34495e; color: white; + font-size: 16px; + border-top-left-radius:5px; + border-top-right-radius: 5px; span{ margin-right: 10px; } @@ -59,17 +66,27 @@ -webkit-box-flex: 1; margin-top: 15px; margin-left: 15px; - padding: 10px 30px; + padding: 24px; box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20); background: #FFF; border-radius:5px; + .ant-btn-group{ + margin-top: 12px; + } .user-item { min-height:35px; line-height:35px; margin: 5px; + margin-left: 0px; margin-bottom:10px; border-bottom: 1px solid #f1f3f6; padding-bottom: 10px; + #old_password,#password,#verify_pass{ + margin-top: 20px; + } + #old_password{ + margin-top: 0px; + } .ant-col-4{ color: black; padding: 0px 10px; @@ -87,13 +104,13 @@ cursor: pointer } - .edit-buttons{ - margin:10px; - } + // .edit-buttons{ + // margin:10px; + // } - .edit-button{ - margin: 5px; - } + // .edit-button{ + // margin: 5px; + // } } } From e0fb864b9c3f8d4b656f1dd19c18c82eb17196f8 Mon Sep 17 00:00:00 2001 From: sean Date: Thu, 27 Jul 2017 12:03:18 +0800 Subject: [PATCH 3/3] chore: ops --- server/config.js | 4 +--- server/yapi.js | 4 ++++ server_dist/config.js | 11 ++--------- server_dist/yapi.js | 4 ++++ 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/server/config.js b/server/config.js index c83346d6..ed9b761b 100644 --- a/server/config.js +++ b/server/config.js @@ -1,11 +1,9 @@ -import path from 'path' /** * config.js是用来第一次安装初始化网站配置,如果不用默认的runtime_path,可以直接修改runtime_path路径 */ -let runtime_path = path.join(path.resolve(__dirname, '../'), 'runtime') let config = { "port": 80, - "runtime_path": runtime_path, + "runtime_path": '', "webhost": "yapi.local.qunar.com", "adminAccount": "admin@admin.com", "db": { diff --git a/server/yapi.js b/server/yapi.js index dc5e0198..e201b643 100644 --- a/server/yapi.js +++ b/server/yapi.js @@ -6,6 +6,10 @@ import config from '../runtime/config.json'; let insts = new Map(); let mail; +if(!config.runtime_path){ + config.runtime_path = path.join(path.resolve(__dirname, '../'), 'runtime') +} + const WEBROOT = path.resolve(__dirname, '..'); //路径 const WEBROOT_SERVER = __dirname; const WEBROOT_RUNTIME = config.runtime_path; diff --git a/server_dist/config.js b/server_dist/config.js index 3121f802..44a2d110 100644 --- a/server_dist/config.js +++ b/server_dist/config.js @@ -1,18 +1,11 @@ -'use strict'; - -var _path = require('path'); - -var _path2 = _interopRequireDefault(_path); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +"use strict"; /** * config.js是用来第一次安装初始化网站配置,如果不用默认的runtime_path,可以直接修改runtime_path路径 */ -var runtime_path = _path2.default.join(_path2.default.resolve(__dirname, '../'), 'runtime'); var config = { "port": 80, - "runtime_path": runtime_path, + "runtime_path": '', "webhost": "yapi.local.qunar.com", "adminAccount": "admin@admin.com", "db": { diff --git a/server_dist/yapi.js b/server_dist/yapi.js index 135a58df..0308ff03 100644 --- a/server_dist/yapi.js +++ b/server_dist/yapi.js @@ -25,6 +25,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de var insts = new _map2.default(); var mail = void 0; +if (!_config2.default.runtime_path) { + _config2.default.runtime_path = _path2.default.join(_path2.default.resolve(__dirname, '../'), 'runtime'); +} + var WEBROOT = _path2.default.resolve(__dirname, '..'); //路径 var WEBROOT_SERVER = __dirname; var WEBROOT_RUNTIME = _config2.default.runtime_path;