feat: add server_ip

This commit is contained in:
suxiaoxin 2017-07-27 18:00:43 +08:00
parent 3743e3301f
commit bb9c05f035
6 changed files with 26 additions and 11 deletions

View File

@ -19,8 +19,6 @@ const deleteConfirm = (id, props) => {
const { delProject, currGroup, fetchProjectList } = props;
const handle = () => {
delProject(id).then((res) => {
console.log(res);
console.log(fetchProjectList, currGroup._id);
if (res.payload.data.errcode == 0) {
message.success('删除成功!')
fetchProjectList(currGroup._id).then((res) => {
@ -43,6 +41,13 @@ const getColumns = (data, props) => {
render: (text, record) => {
return <Link to={`/Interface/${record._id}`}>{text}</Link>
}
},{
title: 'Mock链接',
key: 'domain',
render: (item) => {
return 'http://'+ item.prd_host + item.basepath;
}
}, {
title: '创建人',
dataIndex: 'owner',

View File

@ -26,7 +26,8 @@ export default (state = initialState, action) => {
isLogin: (action.payload.data.errcode == 0),
loginState: (action.payload.data.errcode == 0)?MEMBER_STATUS:GUEST_STATUS,
userName: action.payload.data.data ? action.payload.data.data.username : null,
uid: action.payload.data.data ? action.payload.data.data._id : null
uid: action.payload.data.data ? action.payload.data.data._id : null,
server_ip: action.payload.data.data.server_ip
};
}
case LOGIN: {
@ -36,7 +37,8 @@ export default (state = initialState, action) => {
isLogin: true,
loginState: MEMBER_STATUS,
uid: action.payload.data.data.uid,
userName: action.payload.data.data.username
userName: action.payload.data.data.username,
server_ip: action.payload.data.data.server_ip
};
} else {
return state;

View File

@ -60,7 +60,9 @@ class baseController {
async getLoginStatus(ctx) {
if (await this.checkLogin(ctx) === true) {
return ctx.body = yapi.commons.resReturn(yapi.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']));
let result = yapi.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']);
result.server_ip = yapi.WEBCONFIG.server_ip;
return ctx.body = yapi.commons.resReturn(result);
}
return ctx.body = yapi.commons.resReturn(null, 300, 'Please login.');
}

View File

@ -48,7 +48,8 @@ class userController extends baseController {
uid: result._id,
email: result.email,
add_time: result.add_time,
up_time: result.up_time
up_time: result.up_time,
server_ip: yapi.WEBCONFIG.server_ip
}, 0, 'logout success...');
} else {

View File

@ -154,6 +154,7 @@ var baseController = function () {
key: 'getLoginStatus',
value: function () {
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
var result;
return _regenerator2.default.wrap(function _callee3$(_context3) {
while (1) {
switch (_context3.prev = _context3.next) {
@ -165,16 +166,19 @@ var baseController = function () {
_context3.t0 = _context3.sent;
if (!(_context3.t0 === true)) {
_context3.next = 5;
_context3.next = 7;
break;
}
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(_yapi2.default.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time'])));
result = _yapi2.default.commons.fieldSelect(this.$user, ['_id', 'username', 'email', 'up_time', 'add_time']);
case 5:
result.server_ip = _yapi2.default.WEBCONFIG.server_ip;
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(result));
case 7:
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 300, 'Please login.'));
case 6:
case 8:
case 'end':
return _context3.stop();
}

View File

@ -141,7 +141,8 @@ var userController = function (_baseController) {
uid: result._id,
email: result.email,
add_time: result.add_time,
up_time: result.up_time
up_time: result.up_time,
server_ip: _yapi2.default.WEBCONFIG.server_ip
}, 0, 'logout success...'));