mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-06 12:45:22 +08:00
feat: user style
This commit is contained in:
parent
689e4d2081
commit
d80dfea9aa
@ -1,7 +1,7 @@
|
|||||||
import './index.scss'
|
import './index.scss'
|
||||||
import React, { Component } from 'react'
|
import React, { Component } from 'react'
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
import { Route} from 'react-router-dom'
|
import { Route, Redirect} from 'react-router-dom'
|
||||||
import LeftMenu from './LeftMenu.js'
|
import LeftMenu from './LeftMenu.js'
|
||||||
import List from './List.js'
|
import List from './List.js'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
@ -29,7 +29,7 @@ class User extends Component {
|
|||||||
<section className="user-box">
|
<section className="user-box">
|
||||||
|
|
||||||
<LeftMenu />
|
<LeftMenu />
|
||||||
|
<Redirect from={this.props.match.path} to={this.props.match.path + '/list'} />
|
||||||
<Route path={this.props.match.path + '/list'} component={List} />
|
<Route path={this.props.match.path + '/list'} component={List} />
|
||||||
<Route path={this.props.match.path + '/profile/:uid'} component={Profile} />
|
<Route path={this.props.match.path + '/profile/:uid'} component={Profile} />
|
||||||
</section>
|
</section>
|
||||||
|
@ -5,23 +5,30 @@
|
|||||||
-webkit-box-flex: 1;
|
-webkit-box-flex: 1;
|
||||||
margin: .88rem auto 0 auto;
|
margin: .88rem auto 0 auto;
|
||||||
font-size: 0.14rem;
|
font-size: 0.14rem;
|
||||||
background: #FFF;
|
|
||||||
min-height:500px;
|
min-height:500px;
|
||||||
margin-top: 84px;
|
margin-top: 84px;
|
||||||
|
|
||||||
ul{border:none}
|
|
||||||
|
|
||||||
.user-list {
|
.user-list {
|
||||||
width: 216px;
|
width: 216px;
|
||||||
|
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||||
|
background: #FFF;
|
||||||
|
border-radius:5px;
|
||||||
.search{
|
.search{
|
||||||
margin: 5px;
|
margin: 5px;
|
||||||
}
|
}
|
||||||
|
ul{border:none}
|
||||||
}
|
}
|
||||||
|
|
||||||
.user-table {
|
.user-table {
|
||||||
-webkit-box-flex: 1;
|
-webkit-box-flex: 1;
|
||||||
padding-right: 15px;
|
padding: 15px;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
border-radius:5px;
|
||||||
|
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||||
|
background: #FFF;
|
||||||
.ant-table-wrapper table {
|
.ant-table-wrapper table {
|
||||||
font-size: .14rem;
|
font-size: .14rem;
|
||||||
|
|
||||||
@ -35,7 +42,9 @@
|
|||||||
-webkit-box-flex: 1;
|
-webkit-box-flex: 1;
|
||||||
margin-top: 15px;
|
margin-top: 15px;
|
||||||
margin-left: 15px;
|
margin-left: 15px;
|
||||||
|
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||||
|
background: #FFF;
|
||||||
|
border-radius:5px;
|
||||||
.user-item {
|
.user-item {
|
||||||
min-height:35px;
|
min-height:35px;
|
||||||
line-height:35px;
|
line-height:35px;
|
||||||
|
@ -61,6 +61,7 @@ var interfaceController = function (_baseController) {
|
|||||||
* @category interface
|
* @category interface
|
||||||
* @foldnumber 10
|
* @foldnumber 10
|
||||||
* @param {Number} project_id 项目id,不能为空
|
* @param {Number} project_id 项目id,不能为空
|
||||||
|
* @param {String} title 接口标题,不能为空
|
||||||
* @param {String} path 接口请求路径,不能为空
|
* @param {String} path 接口请求路径,不能为空
|
||||||
* @param {String} method 请求方式
|
* @param {String} method 请求方式
|
||||||
* @param {Array} [req_headers] 请求的header信息
|
* @param {Array} [req_headers] 请求的header信息
|
||||||
@ -141,30 +142,31 @@ var interfaceController = function (_baseController) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
if (data.req_params_type === 'form') data.req_params_form = params.req_params;else data.req_params_other = params.req_params;
|
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||||
|
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||||
|
|
||||||
_context.next = 17;
|
_context.next = 18;
|
||||||
return this.Model.save(data);
|
return this.Model.save(data);
|
||||||
|
|
||||||
case 17:
|
case 18:
|
||||||
result = _context.sent;
|
result = _context.sent;
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||||
_context.next = 24;
|
_context.next = 25;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 21:
|
case 22:
|
||||||
_context.prev = 21;
|
_context.prev = 22;
|
||||||
_context.t0 = _context['catch'](12);
|
_context.t0 = _context['catch'](12);
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||||
|
|
||||||
case 24:
|
case 25:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee, this, [[12, 21]]);
|
}, _callee, this, [[12, 22]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function add(_x) {
|
function add(_x) {
|
||||||
@ -371,39 +373,41 @@ var interfaceController = function (_baseController) {
|
|||||||
|
|
||||||
|
|
||||||
if (params.path) data.path = params.path;
|
if (params.path) data.path = params.path;
|
||||||
|
if (params.title) data.title = params.title;
|
||||||
if (params.desc) data.desc = params.desc;
|
if (params.desc) data.desc = params.desc;
|
||||||
if (params.method) data.method = params.method;
|
if (params.method) data.method = params.method;
|
||||||
|
|
||||||
if (params.req_headers) data.req_headers = params.req_headers;
|
if (params.req_headers) data.req_headers = params.req_headers;
|
||||||
|
|
||||||
if (params.req_params_type === 'form') data.req_params_form = params.req_params;else data.req_params_other = params.req_params;
|
if (params.req_params_form) data.req_params_form = params.req_params_form;
|
||||||
|
if (params.req_params_other) data.req_params_other = params.req_params_other;
|
||||||
|
|
||||||
if (params.res_body_type) data.res_body_type = params.res_body_type;
|
if (params.res_body_type) data.res_body_type = params.res_body_type;
|
||||||
if (params.res_body) data.res_body = params.res_body;
|
if (params.res_body) data.res_body = params.res_body;
|
||||||
|
|
||||||
_context4.prev = 19;
|
_context4.prev = 21;
|
||||||
_context4.next = 22;
|
_context4.next = 24;
|
||||||
return this.Model.up(id, data);
|
return this.Model.up(id, data);
|
||||||
|
|
||||||
case 22:
|
case 24:
|
||||||
result = _context4.sent;
|
result = _context4.sent;
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||||
_context4.next = 29;
|
_context4.next = 31;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 26:
|
case 28:
|
||||||
_context4.prev = 26;
|
_context4.prev = 28;
|
||||||
_context4.t0 = _context4['catch'](19);
|
_context4.t0 = _context4['catch'](21);
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context4.t0.message);
|
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context4.t0.message);
|
||||||
|
|
||||||
case 29:
|
case 31:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context4.stop();
|
return _context4.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee4, this, [[19, 26]]);
|
}, _callee4, this, [[21, 28]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function up(_x4) {
|
function up(_x4) {
|
||||||
|
@ -71,6 +71,36 @@ var projectController = function (_baseController) {
|
|||||||
return _this;
|
return _this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(0, _createClass3.default)(projectController, [{
|
||||||
|
key: 'handleBasepath',
|
||||||
|
value: function handleBasepath(basepath) {
|
||||||
|
if (!basepath) return false;
|
||||||
|
if (basepath[0] !== '/') basepath = '/' + basepath;
|
||||||
|
if (basepath[basepath.length - 1] === '/') basepath = basepath.substr(0, basepath.length - 1);
|
||||||
|
if (!this.verifyPath(basepath)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return basepath;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'verifyPath',
|
||||||
|
value: function verifyPath(path) {
|
||||||
|
if (/^[a-zA-Z0-9\-\/_:]+$/.test(basepath)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
key: 'verifyDomain',
|
||||||
|
value: function verifyDomain(domain) {
|
||||||
|
if (!domain) return false;
|
||||||
|
if (/^[a-zA-Z0-9\-_\.]+[a-zA-Z]{2,6}$/.test(domain)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加项目分组
|
* 添加项目分组
|
||||||
* @interface /project/add
|
* @interface /project/add
|
||||||
@ -87,8 +117,7 @@ var projectController = function (_baseController) {
|
|||||||
* @example ./api/project/add.json
|
* @example ./api/project/add.json
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
}, {
|
||||||
(0, _createClass3.default)(projectController, [{
|
|
||||||
key: 'add',
|
key: 'add',
|
||||||
value: function () {
|
value: function () {
|
||||||
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
var _ref = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee(ctx) {
|
||||||
@ -145,20 +174,36 @@ var projectController = function (_baseController) {
|
|||||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目domain不能为空'));
|
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目domain不能为空'));
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
|
if (!(params.basepath = this.handleBasepath(params.basepath) === false)) {
|
||||||
_context.next = 16;
|
_context.next = 16;
|
||||||
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, 'basepath格式有误'));
|
||||||
|
|
||||||
case 16:
|
case 16:
|
||||||
|
if (this.verifyDomain(params.prd_host)) {
|
||||||
|
_context.next = 18;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '线上域名格式有误'));
|
||||||
|
|
||||||
|
case 18:
|
||||||
|
_context.next = 20;
|
||||||
|
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
||||||
|
|
||||||
|
case 20:
|
||||||
checkRepeatDomain = _context.sent;
|
checkRepeatDomain = _context.sent;
|
||||||
|
|
||||||
if (!(checkRepeatDomain > 0)) {
|
if (!(checkRepeatDomain > 0)) {
|
||||||
_context.next = 19;
|
_context.next = 23;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
return _context.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
||||||
|
|
||||||
case 19:
|
case 23:
|
||||||
data = {
|
data = {
|
||||||
name: params.name,
|
name: params.name,
|
||||||
desc: params.desc,
|
desc: params.desc,
|
||||||
@ -171,29 +216,29 @@ var projectController = function (_baseController) {
|
|||||||
add_time: _yapi2.default.commons.time(),
|
add_time: _yapi2.default.commons.time(),
|
||||||
up_time: _yapi2.default.commons.time()
|
up_time: _yapi2.default.commons.time()
|
||||||
};
|
};
|
||||||
_context.prev = 20;
|
_context.prev = 24;
|
||||||
_context.next = 23;
|
_context.next = 27;
|
||||||
return this.Model.save(data);
|
return this.Model.save(data);
|
||||||
|
|
||||||
case 23:
|
case 27:
|
||||||
result = _context.sent;
|
result = _context.sent;
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||||
_context.next = 30;
|
_context.next = 34;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 27:
|
case 31:
|
||||||
_context.prev = 27;
|
_context.prev = 31;
|
||||||
_context.t0 = _context['catch'](20);
|
_context.t0 = _context['catch'](24);
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context.t0.message);
|
||||||
|
|
||||||
case 30:
|
case 34:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context.stop();
|
return _context.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee, this, [[20, 27]]);
|
}, _callee, this, [[24, 31]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function add(_x) {
|
function add(_x) {
|
||||||
@ -743,6 +788,23 @@ var projectController = function (_baseController) {
|
|||||||
case 12:
|
case 12:
|
||||||
projectData = _context8.sent;
|
projectData = _context8.sent;
|
||||||
|
|
||||||
|
if (!(params.basepath = this.handleBasepath(params.basepath) === false)) {
|
||||||
|
_context8.next = 15;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, 'basepath格式有误'));
|
||||||
|
|
||||||
|
case 15:
|
||||||
|
if (this.verifyDomain(params.prd_host)) {
|
||||||
|
_context8.next = 17;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '线上域名格式有误'));
|
||||||
|
|
||||||
|
case 17:
|
||||||
|
|
||||||
if (projectData.name === params.name) {
|
if (projectData.name === params.name) {
|
||||||
delete params.name;
|
delete params.name;
|
||||||
}
|
}
|
||||||
@ -752,43 +814,43 @@ var projectController = function (_baseController) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!params.name) {
|
if (!params.name) {
|
||||||
_context8.next = 21;
|
_context8.next = 25;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context8.next = 18;
|
_context8.next = 22;
|
||||||
return this.Model.checkNameRepeat(params.name);
|
return this.Model.checkNameRepeat(params.name);
|
||||||
|
|
||||||
case 18:
|
case 22:
|
||||||
checkRepeat = _context8.sent;
|
checkRepeat = _context8.sent;
|
||||||
|
|
||||||
if (!(checkRepeat > 0)) {
|
if (!(checkRepeat > 0)) {
|
||||||
_context8.next = 21;
|
_context8.next = 25;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的项目名'));
|
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在的项目名'));
|
||||||
|
|
||||||
case 21:
|
case 25:
|
||||||
if (!(params.basepath && params.prd_host)) {
|
if (!(params.basepath && params.prd_host)) {
|
||||||
_context8.next = 27;
|
_context8.next = 31;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
_context8.next = 24;
|
_context8.next = 28;
|
||||||
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
return this.Model.checkDomainRepeat(params.prd_host, params.basepath);
|
||||||
|
|
||||||
case 24:
|
case 28:
|
||||||
checkRepeatDomain = _context8.sent;
|
checkRepeatDomain = _context8.sent;
|
||||||
|
|
||||||
if (!(checkRepeatDomain > 0)) {
|
if (!(checkRepeatDomain > 0)) {
|
||||||
_context8.next = 27;
|
_context8.next = 31;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
return _context8.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '已存在domain和basepath'));
|
||||||
|
|
||||||
case 27:
|
case 31:
|
||||||
data = {
|
data = {
|
||||||
uid: this.getUid(),
|
uid: this.getUid(),
|
||||||
up_time: _yapi2.default.commons.time()
|
up_time: _yapi2.default.commons.time()
|
||||||
@ -804,28 +866,28 @@ var projectController = function (_baseController) {
|
|||||||
if (params.protocol) data.protocol = params.protocol;
|
if (params.protocol) data.protocol = params.protocol;
|
||||||
if (params.env) data.env = params.env;
|
if (params.env) data.env = params.env;
|
||||||
|
|
||||||
_context8.next = 35;
|
_context8.next = 39;
|
||||||
return this.Model.up(id, data);
|
return this.Model.up(id, data);
|
||||||
|
|
||||||
case 35:
|
case 39:
|
||||||
result = _context8.sent;
|
result = _context8.sent;
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||||
_context8.next = 42;
|
_context8.next = 46;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 39:
|
case 43:
|
||||||
_context8.prev = 39;
|
_context8.prev = 43;
|
||||||
_context8.t1 = _context8['catch'](0);
|
_context8.t1 = _context8['catch'](0);
|
||||||
|
|
||||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context8.t1.message);
|
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context8.t1.message);
|
||||||
|
|
||||||
case 42:
|
case 46:
|
||||||
case 'end':
|
case 'end':
|
||||||
return _context8.stop();
|
return _context8.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, _callee8, this, [[0, 39]]);
|
}, _callee8, this, [[0, 43]]);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
function up(_x8) {
|
function up(_x8) {
|
||||||
|
@ -47,13 +47,9 @@ var interfaceModel = function (_baseModel) {
|
|||||||
key: 'getSchema',
|
key: 'getSchema',
|
||||||
value: function getSchema() {
|
value: function getSchema() {
|
||||||
return {
|
return {
|
||||||
|
title: { type: String, required: true },
|
||||||
uid: { type: Number, required: true },
|
uid: { type: Number, required: true },
|
||||||
path: { type: String, required: true, validate: {
|
path: { type: String, required: true },
|
||||||
validator: function validator(v) {
|
|
||||||
return v && v[0] !== '/';
|
|
||||||
},
|
|
||||||
message: '接口路径第一位不能是/'
|
|
||||||
} },
|
|
||||||
method: { type: String, required: true },
|
method: { type: String, required: true },
|
||||||
project_id: { type: Number, required: true },
|
project_id: { type: Number, required: true },
|
||||||
desc: String,
|
desc: String,
|
||||||
|
@ -51,9 +51,9 @@ var projectModel = function (_baseModel) {
|
|||||||
name: { type: String, required: true },
|
name: { type: String, required: true },
|
||||||
basepath: { type: String, required: true, validate: {
|
basepath: { type: String, required: true, validate: {
|
||||||
validator: function validator(v) {
|
validator: function validator(v) {
|
||||||
return v && v[v.length - 1] === '/';
|
return v && v[0] === '/';
|
||||||
},
|
},
|
||||||
message: 'basepath字符串结尾必须是/'
|
message: 'basepath必须是/开头'
|
||||||
} },
|
} },
|
||||||
desc: String,
|
desc: String,
|
||||||
group_id: { type: Number, required: true },
|
group_id: { type: Number, required: true },
|
||||||
|
Loading…
Reference in New Issue
Block a user