mirror of
https://github.com/YMFE/yapi.git
synced 2025-04-06 15:00:26 +08:00
fix: modify
This commit is contained in:
parent
44688dfff4
commit
15c78db2e0
@ -7,21 +7,30 @@
|
||||
background: #FFF;
|
||||
display: block;
|
||||
min-height: 550px;
|
||||
|
||||
border-radius: 4px;
|
||||
.news-timeline{
|
||||
padding: 24px;
|
||||
padding-left: 125px;
|
||||
color: #6b6c6d;
|
||||
.ant-timeline-item{
|
||||
min-height: 60px;
|
||||
.ant-timeline-item-head{
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
left: -13px;
|
||||
top:8px;
|
||||
// border-color:#e1e3e4;
|
||||
border:2px solid #e1e3e4;
|
||||
border-radius: 20px;
|
||||
}
|
||||
.ant-timeline-item-tail{
|
||||
top: 30px;
|
||||
}
|
||||
}
|
||||
.ant-timeline-item-head{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
left: -8px;
|
||||
top: -4px;
|
||||
border-color:#e1e3e4;
|
||||
.ant-avatar{
|
||||
// border:2px solid gray;
|
||||
}
|
||||
|
||||
.logusername{
|
||||
color: #4eaef3;
|
||||
padding: 0px 16px 0px 8px;
|
||||
@ -72,6 +81,7 @@
|
||||
padding: 0px;
|
||||
padding-bottom: 16px;
|
||||
min-width: 300px;
|
||||
max-width: 600px;
|
||||
border-radius: 8px;
|
||||
|
||||
.logMesHeade{
|
||||
@ -85,9 +95,10 @@
|
||||
left: -120px;
|
||||
}
|
||||
.logcontent{
|
||||
text-indent: 2em;
|
||||
// text-indent: 2em;
|
||||
line-height: 1.5em;
|
||||
margin-top: 16px;
|
||||
padding: 0px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,6 +108,7 @@
|
||||
.ant-timeline-item-content{
|
||||
padding: 0px;
|
||||
min-width: auto;
|
||||
margin-top: 15px;
|
||||
.loggetMore{
|
||||
margin: 0px;
|
||||
padding: 8px;
|
||||
|
@ -238,7 +238,7 @@ class View extends Component {
|
||||
</div>
|
||||
<div className="colMockUrl">
|
||||
<span className="colKey">Mock地址:</span>
|
||||
<span className="colValue">{location.protocol + '//' + location.hostname + (location.port !== "" ? ":" + location.port : "") + `/mock/${this.props.currProject._id}${this.props.currProject.basepath}/${this.props.curData.path}`}</span>
|
||||
<span className="colValue">{location.protocol + '//' + location.hostname + (location.port !== "" ? ":" + location.port : "") + `/mock/${this.props.currProject._id}${this.props.currProject.basepath}${this.props.curData.path}`}</span>
|
||||
</div>
|
||||
{this.props.curData.desc?<div className="colDesc">
|
||||
<span className="colKey">接口描述:</span>
|
||||
|
@ -115,7 +115,7 @@ class List extends Component {
|
||||
}, {
|
||||
title: '功能',
|
||||
key: 'action',
|
||||
width:"80px",
|
||||
width:"90px",
|
||||
render: (item) => {
|
||||
return (
|
||||
<span>
|
||||
|
@ -3,6 +3,7 @@ import { Row, Col, Input, Button, Select, message, Upload} from 'antd'
|
||||
import axios from 'axios';
|
||||
import {formatTime} from '../../common.js'
|
||||
import PropTypes from 'prop-types'
|
||||
import { Link } from 'react-router-dom'
|
||||
import { connect } from 'react-redux'
|
||||
|
||||
@connect(state=>{
|
||||
@ -252,52 +253,84 @@ class Profile extends Component {
|
||||
</ButtonGroup>
|
||||
</div>
|
||||
}
|
||||
|
||||
let bacToPer = "";
|
||||
if(userinfo.uid != this.props.curUid){
|
||||
bacToPer = <div className="bacToPer"><Link to={`/user/profile/${this.props.curUid}`}><Button onClick={()=>{this.getUserInfo(this.props.curUid)}}>返回到当前用户</Button></Link></div>
|
||||
}
|
||||
return <div className="user-profile">
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={24}>{userinfo.uid === this.props.curUid?<AvatarUpload uid={userinfo.uid}>点击上传头像</AvatarUpload>:<div className = "avatarImg"><img src = {`/api/user/avatar?uid=${userinfo.uid}`} /></div>}</Col>
|
||||
<Col span={4}>用户id</Col>
|
||||
<Col span={12}>
|
||||
{userinfo.uid}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={4}>用户名</Col>
|
||||
<Col span={12}>
|
||||
{userNameEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={4}>Email</Col>
|
||||
<Col span={12}>
|
||||
{emailEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" style={{display: this.props.curRole === 'admin'? '': 'none'}} type="flex" justify="start">
|
||||
<Col span={4}>角色</Col>
|
||||
<Col span={12}>
|
||||
{roleEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={4}>创建账号时间</Col>
|
||||
<Col span={12}>
|
||||
{formatTime(userinfo.add_time)}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={4}>更新账号时间</Col>
|
||||
<Col span={12}>
|
||||
{formatTime(userinfo.up_time)}
|
||||
</Col>
|
||||
{
|
||||
bacToPer
|
||||
}
|
||||
<Row className="avatarCon" type="flex" justify="start">
|
||||
<div className="m-bg">
|
||||
<div className="m-bg-mask m-bg-mask0"></div>
|
||||
<div className="m-bg-mask m-bg-mask1"></div>
|
||||
<div className="m-bg-mask m-bg-mask2"></div>
|
||||
<div className="m-bg-mask m-bg-mask3"></div>
|
||||
</div>
|
||||
<Col span={24}>{userinfo.uid === this.props.curUid?<AvatarUpload uid={userinfo.uid}>点击上传头像</AvatarUpload>:<div className = "avatarImg"><img src = {`/api/user/avatar?uid=${userinfo.uid}`} /></div>}</Col>
|
||||
</Row>
|
||||
<div className="user-item-body">
|
||||
<div className="user-item-mask-top"></div>
|
||||
<div className="user-item-mask">
|
||||
<div className="m-bg">
|
||||
<div className="m-bg-mask m-bg-mask0"></div>
|
||||
<div className="m-bg-mask m-bg-mask1"></div>
|
||||
<div className="m-bg-mask m-bg-mask2"></div>
|
||||
<div className="m-bg-mask m-bg-mask3"></div>
|
||||
</div>
|
||||
</div>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>用户id</Col>
|
||||
<Col span={12}>
|
||||
{userinfo.uid}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>用户名</Col>
|
||||
<Col span={12}>
|
||||
{userNameEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>Email</Col>
|
||||
<Col span={12}>
|
||||
{emailEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" style={{display: this.props.curRole === 'admin'? '': 'none'}} type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>角色</Col>
|
||||
<Col span={12}>
|
||||
{roleEditHtml}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>创建账号时间</Col>
|
||||
<Col span={12}>
|
||||
{formatTime(userinfo.add_time)}
|
||||
</Col>
|
||||
</Row>
|
||||
<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>更新账号时间</Col>
|
||||
<Col span={12}>
|
||||
{formatTime(userinfo.up_time)}
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
{(userType)?<Row className="user-item" type="flex" justify="start">
|
||||
<Col span={4}>密码</Col>
|
||||
<Col span={12}>
|
||||
{secureEditHtml}
|
||||
</Col>
|
||||
</Row>:""}
|
||||
{(userType)?<Row className="user-item" type="flex" justify="start">
|
||||
<div className="maoboli"></div>
|
||||
<Col span={4}>密码</Col>
|
||||
<Col span={12}>
|
||||
{secureEditHtml}
|
||||
</Col>
|
||||
</Row>:""}
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
@ -342,7 +375,7 @@ class AvatarUpload extends Component {
|
||||
{/*<Avatar size="large" src={imageUrl} />*/}
|
||||
<img className = "avatar" src = {imageUrl} />
|
||||
</Upload>
|
||||
<span className="avatarChange">点击头像更换</span>
|
||||
<span className="avatarChange">点击头像更换<br></br>只支持jpg、png格式且大小不超过200kb的图片</span>
|
||||
</div>
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
}
|
||||
ul{border:none}
|
||||
.ant-menu-item{
|
||||
font-size: 14px;
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
.user-name{
|
||||
@ -31,7 +31,7 @@
|
||||
// text-align: center;
|
||||
background-color: #34495e;
|
||||
color: white;
|
||||
font-size: 16px;
|
||||
font-size: 18px;
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
span{
|
||||
@ -60,19 +60,68 @@
|
||||
|
||||
.user-profile {
|
||||
-webkit-box-flex: 1;
|
||||
padding: 24px;
|
||||
padding: 32px;
|
||||
box-shadow: 0 2px 4px 0 rgba(0,0,0,0.20);
|
||||
background: #FFF;
|
||||
border-radius: .04rem;
|
||||
min-height: 5rem;
|
||||
position: relative;
|
||||
.bacToPer{
|
||||
position: absolute;
|
||||
right: 40px;
|
||||
top: 40px;
|
||||
z-index: 3;
|
||||
}
|
||||
.user-item-body{
|
||||
padding: 32px;
|
||||
background-color: #ececec;
|
||||
position: relative;
|
||||
.user-item-mask-top{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
background: black;
|
||||
z-index: 2;
|
||||
opacity: .7;
|
||||
}
|
||||
.user-item-mask{
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
height: 0px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
background-color: rgba(0,0,0,0.70);
|
||||
}
|
||||
.user-item{
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
padding: 8px 0px;
|
||||
.maoboli{
|
||||
background-color: rgba(225,225,225,0.60);
|
||||
// filter: blur(3px);
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
.user-item {
|
||||
min-height:35px;
|
||||
line-height:35px;
|
||||
margin: 5px;
|
||||
margin-left: 0px;
|
||||
margin-bottom: 16px;
|
||||
border-bottom: 1px solid #f1f3f6;
|
||||
// border-bottom: 1px solid #f1f3f6;
|
||||
padding-bottom: 16px;
|
||||
font-size: 14px;
|
||||
#old_password,#password,#verify_pass{
|
||||
margin-top: 20px;
|
||||
}
|
||||
@ -121,6 +170,7 @@
|
||||
}
|
||||
.avatar{
|
||||
width: 100px;
|
||||
min-height: 100px;
|
||||
// border-radius: 50px;
|
||||
}
|
||||
.avatarImg{
|
||||
@ -128,6 +178,8 @@
|
||||
border-radius: 50px;
|
||||
overflow: hidden;
|
||||
height: 100px;
|
||||
background-color: white;
|
||||
margin: 0px auto;
|
||||
img{
|
||||
width: 100%;
|
||||
}
|
||||
@ -135,10 +187,63 @@
|
||||
.avatar-uploader {
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
height: 100px;
|
||||
}
|
||||
.ant-upload-list{
|
||||
display: none;
|
||||
}
|
||||
.avatar-box{
|
||||
width: 100px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
.avatarCon{
|
||||
background: gray;
|
||||
padding: 16px 0px;
|
||||
margin-bottom: 16px;
|
||||
width: 100%;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.m-bg {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: -300px;
|
||||
height: 1200px;
|
||||
width: 100%;
|
||||
transform: skewY(-11deg);
|
||||
background-image: linear-gradient(-20deg, #21d4fd 0%, #b721ff 100%);
|
||||
.m-bg-mask {
|
||||
position: absolute;
|
||||
height: 180px;
|
||||
}
|
||||
.m-bg-mask0 {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 30%;
|
||||
background-image: linear-gradient(120deg, #6ab3fd 0%, #8ba3fd 102%);
|
||||
}
|
||||
.m-bg-mask1 {
|
||||
bottom: 180px;
|
||||
right: 0;
|
||||
width: 36%;
|
||||
background-image: linear-gradient(120deg, #28c5f5 0%, #6682fe 100%);
|
||||
}
|
||||
.m-bg-mask2 {
|
||||
bottom: 540px;
|
||||
left: 0;
|
||||
width: 20%;
|
||||
height: 240px;
|
||||
background-image: linear-gradient(120deg, #8121ff 0%, #5e5ef7 100%);
|
||||
}
|
||||
.m-bg-mask3 {
|
||||
bottom: 540px;
|
||||
left: 20%;
|
||||
width: 70%;
|
||||
height: 240px;
|
||||
background-image: linear-gradient(-225deg, #5f2bff 0%, #6088fe 48%, #22ccf6 100%);
|
||||
}
|
||||
}
|
||||
.avatar-uploader-trigger {
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
@ -147,8 +252,13 @@
|
||||
}
|
||||
.avatarChange{
|
||||
display: block;
|
||||
width: 100px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
padding-bottom: 8px;
|
||||
padding: 8px;
|
||||
margin-left: -100px;
|
||||
color: #ececec;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
0
npm-debug.log.9006047
Normal file
0
npm-debug.log.9006047
Normal file
@ -1,11 +1,13 @@
|
||||
import yapi from '../yapi.js';
|
||||
import baseController from './base.js';
|
||||
import followModel from '../models/follow';
|
||||
import projectModel from '../models/project';
|
||||
|
||||
class followController extends baseController {
|
||||
constructor(ctx) {
|
||||
super(ctx);
|
||||
this.Model = yapi.getInst(followModel);
|
||||
this.projectModel = yapi.getInst(projectModel);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,13 +91,10 @@ class followController extends baseController {
|
||||
async add(ctx) {
|
||||
let params = ctx.request.body;
|
||||
params = yapi.commons.handleParams(params, {
|
||||
projectid: 'number',
|
||||
projectname: 'string',
|
||||
icon: 'string',
|
||||
color: 'string'
|
||||
projectid: 'number'
|
||||
});
|
||||
|
||||
let uid = this.getUid()
|
||||
let uid = this.getUid();
|
||||
|
||||
if (!params.projectid) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目id不能为空');
|
||||
@ -107,25 +106,15 @@ class followController extends baseController {
|
||||
return ctx.body = yapi.commons.resReturn(null, 401, '项目已关注');
|
||||
}
|
||||
|
||||
if (!params.projectname) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目名不能为空');
|
||||
}
|
||||
if (!params.icon) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目图标标志不能为空');
|
||||
}
|
||||
if (!params.color) {
|
||||
return ctx.body = yapi.commons.resReturn(null, 400, '项目颜色不能为空');
|
||||
}
|
||||
|
||||
let data = {
|
||||
uid: uid,
|
||||
projectid: params.projectid,
|
||||
projectname: params.projectname,
|
||||
icon: params.icon,
|
||||
color: params.color
|
||||
};
|
||||
|
||||
try {
|
||||
let project = await this.projectModel.get(params.projectid);
|
||||
let data = {
|
||||
uid: uid,
|
||||
projectid: params.projectid,
|
||||
projectname: project.name,
|
||||
icon: project.icon,
|
||||
color: project.color
|
||||
};
|
||||
let result = await this.Model.save(data);
|
||||
result = yapi.commons.fieldSelect(result, ['_id', 'uid', 'projectid', 'projectname', 'icon', 'color']);
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
|
@ -113,14 +113,12 @@ class projectController extends baseController {
|
||||
let result = await this.Model.save(data);
|
||||
let username = this.getUsername();
|
||||
yapi.commons.saveLog({
|
||||
content: `用户${username}添加了项目${params.name}`,
|
||||
content: `用户 "${username}" 添加了项目 "${params.name}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.group_id,
|
||||
typename: params.group_name,
|
||||
color: params.color,
|
||||
icon: params.icon
|
||||
typename: params.group_name
|
||||
});
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (e) {
|
||||
@ -168,15 +166,12 @@ class projectController extends baseController {
|
||||
try {
|
||||
let result = await this.Model.addMember(params.id, userdata);
|
||||
let username = this.getUsername();
|
||||
let project = await this.Model.get(params.id);
|
||||
yapi.commons.saveLog({
|
||||
content: `用户${username}添加了项目成员${userdata.username}`,
|
||||
content: `用户 "${username}" 添加了项目成员 "${userdata.username}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.id,
|
||||
color: project.color,
|
||||
icon: project.icon
|
||||
typeid: params.id
|
||||
});
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (e) {
|
||||
@ -219,13 +214,11 @@ class projectController extends baseController {
|
||||
let project = await this.Model.get(params.id);
|
||||
let member = await yapi.getInst(userModel).findById(params.member_uid);
|
||||
yapi.commons.saveLog({
|
||||
content: `用户${username}删除了项目${project.name}中的成员${member.username}`,
|
||||
content: `用户 "${username}" 删除了项目 "${project.name}" 中的成员 "${member.username}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.id,
|
||||
color: project.color,
|
||||
icon: project.icon
|
||||
typeid: params.id
|
||||
});
|
||||
ctx.body = yapi.commons.resReturn(result);
|
||||
} catch (e) {
|
||||
@ -430,7 +423,7 @@ class projectController extends baseController {
|
||||
let project = await this.Model.get(params.id);
|
||||
let member = await yapi.getInst(userModel).findById(params.member_uid);
|
||||
yapi.commons.saveLog({
|
||||
content: `用户${username}修改了项目${project.name}中成员${member.username}的角色为${params.role}`,
|
||||
content: `用户 "${username}" 修改了项目 "${project.name}" 中成员 "${member.username}" 的角色为 "${params.role}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
@ -544,7 +537,7 @@ class projectController extends baseController {
|
||||
let result = await this.Model.up(id, data);
|
||||
let username = this.getUsername();
|
||||
yapi.commons.saveLog({
|
||||
content: `用户${username}更新了项目${projectData.name}`,
|
||||
content: `用户 "${username}" 更新了项目 "${projectData.name}"`,
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
|
@ -40,6 +40,10 @@ var _follow = require('../models/follow');
|
||||
|
||||
var _follow2 = _interopRequireDefault(_follow);
|
||||
|
||||
var _project = require('../models/project');
|
||||
|
||||
var _project2 = _interopRequireDefault(_project);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
var followController = function (_baseController) {
|
||||
@ -51,6 +55,7 @@ var followController = function (_baseController) {
|
||||
var _this = (0, _possibleConstructorReturn3.default)(this, (followController.__proto__ || (0, _getPrototypeOf2.default)(followController)).call(this, ctx));
|
||||
|
||||
_this.Model = _yapi2.default.getInst(_follow2.default);
|
||||
_this.projectModel = _yapi2.default.getInst(_project2.default);
|
||||
return _this;
|
||||
}
|
||||
|
||||
@ -213,7 +218,7 @@ var followController = function (_baseController) {
|
||||
key: 'add',
|
||||
value: function () {
|
||||
var _ref3 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee3(ctx) {
|
||||
var params, uid, checkRepeat, data, result;
|
||||
var params, uid, checkRepeat, project, data, result;
|
||||
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
||||
while (1) {
|
||||
switch (_context3.prev = _context3.next) {
|
||||
@ -221,10 +226,7 @@ var followController = function (_baseController) {
|
||||
params = ctx.request.body;
|
||||
|
||||
params = _yapi2.default.commons.handleParams(params, {
|
||||
projectid: 'number',
|
||||
projectname: 'string',
|
||||
icon: 'string',
|
||||
color: 'string'
|
||||
projectid: 'number'
|
||||
});
|
||||
|
||||
uid = this.getUid();
|
||||
@ -251,61 +253,42 @@ var followController = function (_baseController) {
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 401, '项目已关注'));
|
||||
|
||||
case 10:
|
||||
if (params.projectname) {
|
||||
_context3.next = 12;
|
||||
break;
|
||||
}
|
||||
_context3.prev = 10;
|
||||
_context3.next = 13;
|
||||
return this.projectModel.get(params.projectid);
|
||||
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目名不能为空'));
|
||||
|
||||
case 12:
|
||||
if (params.icon) {
|
||||
_context3.next = 14;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目图标标志不能为空'));
|
||||
|
||||
case 14:
|
||||
if (params.color) {
|
||||
_context3.next = 16;
|
||||
break;
|
||||
}
|
||||
|
||||
return _context3.abrupt('return', ctx.body = _yapi2.default.commons.resReturn(null, 400, '项目颜色不能为空'));
|
||||
|
||||
case 16:
|
||||
case 13:
|
||||
project = _context3.sent;
|
||||
data = {
|
||||
uid: uid,
|
||||
projectid: params.projectid,
|
||||
projectname: params.projectname,
|
||||
icon: params.icon,
|
||||
color: params.color
|
||||
projectname: project.name,
|
||||
icon: project.icon,
|
||||
color: project.color
|
||||
};
|
||||
_context3.prev = 17;
|
||||
_context3.next = 20;
|
||||
_context3.next = 17;
|
||||
return this.Model.save(data);
|
||||
|
||||
case 20:
|
||||
case 17:
|
||||
result = _context3.sent;
|
||||
|
||||
result = _yapi2.default.commons.fieldSelect(result, ['_id', 'uid', 'projectid', 'projectname', 'icon', 'color']);
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context3.next = 28;
|
||||
_context3.next = 25;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
_context3.prev = 25;
|
||||
_context3.t0 = _context3['catch'](17);
|
||||
case 22:
|
||||
_context3.prev = 22;
|
||||
_context3.t0 = _context3['catch'](10);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context3.t0.message);
|
||||
|
||||
case 28:
|
||||
case 25:
|
||||
case 'end':
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3, this, [[17, 25]]);
|
||||
}, _callee3, this, [[10, 22]]);
|
||||
}));
|
||||
|
||||
function add(_x3) {
|
||||
|
@ -244,14 +244,12 @@ var projectController = function (_baseController) {
|
||||
username = this.getUsername();
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237' + username + '\u6DFB\u52A0\u4E86\u9879\u76EE' + params.name,
|
||||
content: '\u7528\u6237 "' + username + '" \u6DFB\u52A0\u4E86\u9879\u76EE "' + params.name + '"',
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.group_id,
|
||||
typename: params.group_name,
|
||||
color: params.color,
|
||||
icon: params.icon
|
||||
typename: params.group_name
|
||||
});
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context.next = 32;
|
||||
@ -293,7 +291,7 @@ var projectController = function (_baseController) {
|
||||
key: 'addMember',
|
||||
value: function () {
|
||||
var _ref2 = (0, _asyncToGenerator3.default)(_regenerator2.default.mark(function _callee2(ctx) {
|
||||
var params, check, userdata, result, username, project;
|
||||
var params, check, userdata, result, username;
|
||||
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
||||
while (1) {
|
||||
switch (_context2.prev = _context2.next) {
|
||||
@ -368,37 +366,30 @@ var projectController = function (_baseController) {
|
||||
case 24:
|
||||
result = _context2.sent;
|
||||
username = this.getUsername();
|
||||
_context2.next = 28;
|
||||
return this.Model.get(params.id);
|
||||
|
||||
case 28:
|
||||
project = _context2.sent;
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237' + username + '\u6DFB\u52A0\u4E86\u9879\u76EE\u6210\u5458' + userdata.username,
|
||||
content: '\u7528\u6237 "' + username + '" \u6DFB\u52A0\u4E86\u9879\u76EE\u6210\u5458 "' + userdata.username + '"',
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.id,
|
||||
color: project.color,
|
||||
icon: project.icon
|
||||
typeid: params.id
|
||||
});
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context2.next = 36;
|
||||
_context2.next = 33;
|
||||
break;
|
||||
|
||||
case 33:
|
||||
_context2.prev = 33;
|
||||
case 30:
|
||||
_context2.prev = 30;
|
||||
_context2.t1 = _context2['catch'](21);
|
||||
|
||||
ctx.body = _yapi2.default.commons.resReturn(null, 402, _context2.t1.message);
|
||||
|
||||
case 36:
|
||||
case 33:
|
||||
case 'end':
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this, [[21, 33]]);
|
||||
}, _callee2, this, [[21, 30]]);
|
||||
}));
|
||||
|
||||
function addMember(_x2) {
|
||||
@ -493,13 +484,11 @@ var projectController = function (_baseController) {
|
||||
member = _context3.sent;
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237' + username + '\u5220\u9664\u4E86\u9879\u76EE' + project.name + '\u4E2D\u7684\u6210\u5458' + member.username,
|
||||
content: '\u7528\u6237 "' + username + '" \u5220\u9664\u4E86\u9879\u76EE "' + project.name + '" \u4E2D\u7684\u6210\u5458 "' + member.username + '"',
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
typeid: params.id,
|
||||
color: project.color,
|
||||
icon: project.icon
|
||||
typeid: params.id
|
||||
});
|
||||
ctx.body = _yapi2.default.commons.resReturn(result);
|
||||
_context3.next = 33;
|
||||
@ -1001,7 +990,7 @@ var projectController = function (_baseController) {
|
||||
member = _context9.sent;
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237' + username + '\u4FEE\u6539\u4E86\u9879\u76EE' + project.name + '\u4E2D\u6210\u5458' + member.username + '\u7684\u89D2\u8272\u4E3A' + params.role,
|
||||
content: '\u7528\u6237 "' + username + '" \u4FEE\u6539\u4E86\u9879\u76EE "' + project.name + '" \u4E2D\u6210\u5458 "' + member.username + '" \u7684\u89D2\u8272\u4E3A "' + params.role + '"',
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
@ -1228,7 +1217,7 @@ var projectController = function (_baseController) {
|
||||
username = this.getUsername();
|
||||
|
||||
_yapi2.default.commons.saveLog({
|
||||
content: '\u7528\u6237' + username + '\u66F4\u65B0\u4E86\u9879\u76EE' + projectData.name,
|
||||
content: '\u7528\u6237 "' + username + '" \u66F4\u65B0\u4E86\u9879\u76EE "' + projectData.name + '"',
|
||||
type: 'project',
|
||||
uid: this.getUid(),
|
||||
username: username,
|
||||
|
Loading…
x
Reference in New Issue
Block a user