mirror of
https://github.com/YMFE/yapi.git
synced 2025-01-30 13:20:24 +08:00
feat: 修复上传头像bug
This commit is contained in:
parent
ee61593d20
commit
8e3d072da4
@ -170,7 +170,11 @@ const ToolUser = (props) => {
|
|||||||
/>
|
/>
|
||||||
}>
|
}>
|
||||||
<a className="dropdown-link">
|
<a className="dropdown-link">
|
||||||
<Avatar src={`/api/user/avatar?uid=${props.uid}`} />
|
{/* <Avatar src={props.url + props.uid}></Avatar> */}
|
||||||
|
{
|
||||||
|
props.imageUrl? <Avatar src={props.imageUrl} />: <Avatar src={`/api/user/avatar?uid=${props.uid}`} />
|
||||||
|
}
|
||||||
|
|
||||||
{/*<img style={{width:24,height:24}} src={`/api/user/avatar?uid=${props.uid}`} />*/}
|
{/*<img style={{width:24,height:24}} src={`/api/user/avatar?uid=${props.uid}`} />*/}
|
||||||
{/*<span className="name">{props.user}</span>*/}
|
{/*<span className="name">{props.user}</span>*/}
|
||||||
<span className="name"><Icon type="down" /></span>
|
<span className="name"><Icon type="down" /></span>
|
||||||
@ -190,7 +194,8 @@ ToolUser.propTypes = {
|
|||||||
logout: PropTypes.func,
|
logout: PropTypes.func,
|
||||||
groupList: PropTypes.array,
|
groupList: PropTypes.array,
|
||||||
studyTip: PropTypes.number,
|
studyTip: PropTypes.number,
|
||||||
study: PropTypes.bool
|
study: PropTypes.bool,
|
||||||
|
imageUrl: PropTypes.any
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -203,7 +208,8 @@ ToolUser.propTypes = {
|
|||||||
role: state.user.role,
|
role: state.user.role,
|
||||||
login: state.user.isLogin,
|
login: state.user.isLogin,
|
||||||
studyTip: state.user.studyTip,
|
studyTip: state.user.studyTip,
|
||||||
study: state.user.study
|
study: state.user.study,
|
||||||
|
imageUrl: state.user.imageUrl
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -234,7 +240,8 @@ export default class HeaderCom extends Component {
|
|||||||
history: PropTypes.object,
|
history: PropTypes.object,
|
||||||
location: PropTypes.object,
|
location: PropTypes.object,
|
||||||
study: PropTypes.bool,
|
study: PropTypes.bool,
|
||||||
studyTip: PropTypes.number
|
studyTip: PropTypes.number,
|
||||||
|
imageUrl:PropTypes.any
|
||||||
}
|
}
|
||||||
linkTo = (e) => {
|
linkTo = (e) => {
|
||||||
if (e.key != '/doc') {
|
if (e.key != '/doc') {
|
||||||
@ -281,7 +288,7 @@ export default class HeaderCom extends Component {
|
|||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { login, user, msg, uid, role, studyTip, study } = this.props;
|
const { login, user, msg, uid, role, studyTip, study,imageUrl } = this.props;
|
||||||
return (
|
return (
|
||||||
<Header className="header-box m-header">
|
<Header className="header-box m-header">
|
||||||
<div className="content g-row">
|
<div className="content g-row">
|
||||||
@ -296,7 +303,7 @@ export default class HeaderCom extends Component {
|
|||||||
style={{ position: 'relative', zIndex: this.props.studyTip > 0 ? 3 : 1 }}>
|
style={{ position: 'relative', zIndex: this.props.studyTip > 0 ? 3 : 1 }}>
|
||||||
{login ?
|
{login ?
|
||||||
<ToolUser
|
<ToolUser
|
||||||
{...{ studyTip, study, user, msg, uid, role }}
|
{...{ studyTip, study, user, msg, uid, role, imageUrl }}
|
||||||
relieveLink={this.relieveLink}
|
relieveLink={this.relieveLink}
|
||||||
logout={this.logout}
|
logout={this.logout}
|
||||||
/>
|
/>
|
||||||
|
@ -262,7 +262,7 @@ export default class Run extends Component {
|
|||||||
} else if (that.state.bodyType === 'json') {
|
} else if (that.state.bodyType === 'json') {
|
||||||
body = json_parse(that.state.bodyOther);
|
body = json_parse(that.state.bodyOther);
|
||||||
}
|
}
|
||||||
if (res_body && res_body_type === 'json' && typeof res === 'object') {
|
if (res_body && res_body_type === 'json' && typeof res === 'object' && this.state.resMockTest === true) {
|
||||||
let tpl = MockExtra(json_parse(res_body), {
|
let tpl = MockExtra(json_parse(res_body), {
|
||||||
query: query,
|
query: query,
|
||||||
body: body
|
body: body
|
||||||
|
@ -86,7 +86,8 @@ export default class GroupList extends Component {
|
|||||||
for (let i = 0; i < this.props.groupList.length; i++) {
|
for (let i = 0; i < this.props.groupList.length; i++) {
|
||||||
if (this.props.groupList[i]._id === groupId) {
|
if (this.props.groupList[i]._id === groupId) {
|
||||||
currGroup = this.props.groupList[i];
|
currGroup = this.props.groupList[i];
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
} else if (!groupId && this.props.groupList.length) {
|
} else if (!groupId && this.props.groupList.length) {
|
||||||
this.props.history.push(`/group/${this.props.groupList[0]._id}`);
|
this.props.history.push(`/group/${this.props.groupList[0]._id}`);
|
||||||
}
|
}
|
||||||
@ -141,7 +142,10 @@ export default class GroupList extends Component {
|
|||||||
});
|
});
|
||||||
await this.props.fetchGroupList();
|
await this.props.fetchGroupList();
|
||||||
this.setState({ groupList: this.props.groupList });
|
this.setState({ groupList: this.props.groupList });
|
||||||
this.props.setCurrGroup(res.data.data);
|
console.log('add', res.data.data);
|
||||||
|
console.log('groupList', this.state.groupList);
|
||||||
|
// this.props.setCurrGroup(res.data.data);
|
||||||
|
this.props.setCurrGroup(this.state.groupList[1]);
|
||||||
this.props.fetchGroupMsg(this.props.currGroup._id);
|
this.props.fetchGroupMsg(this.props.currGroup._id);
|
||||||
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
||||||
} else {
|
} else {
|
||||||
@ -160,8 +164,11 @@ export default class GroupList extends Component {
|
|||||||
editGroupModalVisible: false
|
editGroupModalVisible: false
|
||||||
});
|
});
|
||||||
await this.props.fetchGroupList();
|
await this.props.fetchGroupList();
|
||||||
|
|
||||||
this.setState({ groupList: this.props.groupList });
|
this.setState({ groupList: this.props.groupList });
|
||||||
this.props.setCurrGroup({ group_name, group_desc, _id: id});
|
const currGroup = _.find(this.props.groupList, (group) => { return +group._id === +id });
|
||||||
|
this.props.setCurrGroup(currGroup);
|
||||||
|
// this.props.setCurrGroup({ group_name, group_desc, _id: id });
|
||||||
this.props.fetchGroupMsg(this.props.currGroup._id);
|
this.props.fetchGroupMsg(this.props.currGroup._id);
|
||||||
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
this.props.fetchNewsData(this.props.currGroup._id, "group", 1, 10)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,10 @@ class MemberList extends Component {
|
|||||||
role: this.state.inputRole
|
role: this.state.inputRole
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (!res.payload.data.errcode) {
|
if (!res.payload.data.errcode) {
|
||||||
message.success('添加成功!');
|
const { add_members, exist_members } = res.payload.data.data;
|
||||||
|
const addLength = add_members.length;
|
||||||
|
const existLength = exist_members.length;
|
||||||
|
message.success(`添加成功! 已成功添加 ${addLength} 人,其中 ${existLength} 人已存在`);
|
||||||
this.reFetchList(); // 添加成功后重新获取分组成员列表
|
this.reFetchList(); // 添加成功后重新获取分组成员列表
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -118,6 +118,7 @@ class ProjectList extends Component {
|
|||||||
return b.up_time - a.up_time;
|
return b.up_time - a.up_time;
|
||||||
})
|
})
|
||||||
projectData = [...followProject, ...noFollow]
|
projectData = [...followProject, ...noFollow]
|
||||||
|
console.log('role', this.props.currGroup.role);
|
||||||
return (
|
return (
|
||||||
<div style={{ paddingTop: '24px' }} className="m-panel card-panel card-panel-s project-list" >
|
<div style={{ paddingTop: '24px' }} className="m-panel card-panel card-panel-s project-list" >
|
||||||
<Row className="project-list-header">
|
<Row className="project-list-header">
|
||||||
|
@ -2,7 +2,7 @@ import React, { Component } from 'react'
|
|||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import InterfaceEditForm from './InterfaceEditForm.js'
|
import InterfaceEditForm from './InterfaceEditForm.js'
|
||||||
import { updateInterfaceData,fetchInterfaceList } from '../../../../reducer/modules/interface.js';
|
import { updateInterfaceData, fetchInterfaceList, fetchInterfaceData } from '../../../../reducer/modules/interface.js';
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { message } from 'antd'
|
import { message } from 'antd'
|
||||||
import './Edit.scss'
|
import './Edit.scss'
|
||||||
@ -16,7 +16,8 @@ import { withRouter, Link } from 'react-router-dom';
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
updateInterfaceData,
|
updateInterfaceData,
|
||||||
fetchInterfaceList
|
fetchInterfaceList,
|
||||||
|
fetchInterfaceData
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -26,6 +27,7 @@ class InterfaceEdit extends Component {
|
|||||||
currProject: PropTypes.object,
|
currProject: PropTypes.object,
|
||||||
updateInterfaceData: PropTypes.func,
|
updateInterfaceData: PropTypes.func,
|
||||||
fetchInterfaceList: PropTypes.func,
|
fetchInterfaceList: PropTypes.func,
|
||||||
|
fetchInterfaceData: PropTypes.func,
|
||||||
match: PropTypes.object,
|
match: PropTypes.object,
|
||||||
switchToView: PropTypes.func
|
switchToView: PropTypes.func
|
||||||
}
|
}
|
||||||
@ -44,8 +46,10 @@ class InterfaceEdit extends Component {
|
|||||||
params.id = this.props.match.params.actionId;
|
params.id = this.props.match.params.actionId;
|
||||||
let result = await axios.post('/api/interface/up', params);
|
let result = await axios.post('/api/interface/up', params);
|
||||||
this.props.fetchInterfaceList(this.props.currProject._id).then();
|
this.props.fetchInterfaceList(this.props.currProject._id).then();
|
||||||
|
this.props.fetchInterfaceData(params.id).then()
|
||||||
if (result.data.errcode === 0) {
|
if (result.data.errcode === 0) {
|
||||||
this.props.updateInterfaceData(params);
|
this.props.updateInterfaceData(params);
|
||||||
|
console.log('switch');
|
||||||
message.success('保存成功');
|
message.success('保存成功');
|
||||||
this.props.switchToView()
|
this.props.switchToView()
|
||||||
} else {
|
} else {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
.interface-edit{
|
.interface-edit{
|
||||||
padding: 24px;
|
padding: 24px;
|
||||||
|
// overflow: hidden;
|
||||||
.interface-edit-item{
|
.interface-edit-item{
|
||||||
margin-bottom: 16px;
|
margin-bottom: 16px;
|
||||||
}
|
}
|
||||||
@ -19,12 +20,31 @@
|
|||||||
margin-left: 5px;
|
margin-left: 5px;
|
||||||
cursor: pointer
|
cursor: pointer
|
||||||
}
|
}
|
||||||
|
.interface-edit-direc-icon{
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
cursor: pointer
|
||||||
|
}
|
||||||
.ant-select-selection__rendered{
|
.ant-select-selection__rendered{
|
||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
}
|
}
|
||||||
.interace-edit-desc{
|
.interace-edit-desc{
|
||||||
height: 250px;
|
height: 250px;
|
||||||
}
|
}
|
||||||
|
.ant-affix{
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
padding: 16px 0;
|
||||||
|
z-index: 10002;
|
||||||
|
}
|
||||||
|
.interface-edit-submit-button{
|
||||||
|
background-color: #32325d;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.interface-edit-submit-button:hover{
|
||||||
|
color: #32325d;
|
||||||
|
border-color: #32325d;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.table-interfacelist {
|
.table-interfacelist {
|
||||||
|
@ -6,7 +6,7 @@ import constants from '../../../../constants/variable.js'
|
|||||||
import { handlePath, nameLengthLimit } from '../../../../common.js'
|
import { handlePath, nameLengthLimit } from '../../../../common.js'
|
||||||
import { changeEditStatus } from '../../../../reducer/modules/interface.js';
|
import { changeEditStatus } from '../../../../reducer/modules/interface.js';
|
||||||
import json5 from 'json5'
|
import json5 from 'json5'
|
||||||
import { message, Tabs } from 'antd'
|
import { message, Tabs, Affix } from 'antd'
|
||||||
import Editor from 'wangeditor'
|
import Editor from 'wangeditor'
|
||||||
const TabPane = Tabs.TabPane;
|
const TabPane = Tabs.TabPane;
|
||||||
let EditFormContext;
|
let EditFormContext;
|
||||||
@ -277,6 +277,8 @@ class InterfaceEditForm extends Component {
|
|||||||
this.setState(newValue)
|
this.setState(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
handleMockPreview = () => {
|
handleMockPreview = () => {
|
||||||
let str = '';
|
let str = '';
|
||||||
try {
|
try {
|
||||||
@ -365,6 +367,7 @@ class InterfaceEditForm extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const queryTpl = (data, index) => {
|
const queryTpl = (data, index) => {
|
||||||
|
|
||||||
return <Row key={index} className="interface-edit-item-content">
|
return <Row key={index} className="interface-edit-item-content">
|
||||||
<Col span="5" className="interface-edit-item-content-col">
|
<Col span="5" className="interface-edit-item-content-col">
|
||||||
{getFieldDecorator('req_query[' + index + '].name', {
|
{getFieldDecorator('req_query[' + index + '].name', {
|
||||||
@ -400,7 +403,6 @@ class InterfaceEditForm extends Component {
|
|||||||
<Col span="1" className="interface-edit-item-content-col" >
|
<Col span="1" className="interface-edit-item-content-col" >
|
||||||
<Icon type="delete" className="interface-edit-del-icon" onClick={() => this.delParams(index, 'req_query')} />
|
<Icon type="delete" className="interface-edit-del-icon" onClick={() => this.delParams(index, 'req_query')} />
|
||||||
</Col>
|
</Col>
|
||||||
|
|
||||||
</Row>
|
</Row>
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -822,7 +824,10 @@ class InterfaceEditForm extends Component {
|
|||||||
className="interface-edit-item"
|
className="interface-edit-item"
|
||||||
style={{ textAlign: 'center', marginTop: '16px' }}
|
style={{ textAlign: 'center', marginTop: '16px' }}
|
||||||
>
|
>
|
||||||
<Button type="primary" htmlType="submit">保存</Button>
|
{/* <Button type="primary" htmlType="submit">保存1</Button> */}
|
||||||
|
<Affix offsetBottom={0}>
|
||||||
|
<Button className="interface-edit-submit-button" size="large" htmlType="submit">保存</Button>
|
||||||
|
</Affix>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
|
@ -91,7 +91,7 @@ class InterfaceList extends Component {
|
|||||||
data.project_id = this.props.curProject._id;
|
data.project_id = this.props.curProject._id;
|
||||||
axios.post('/api/interface/add', data).then((res) => {
|
axios.post('/api/interface/add', data).then((res) => {
|
||||||
if (res.data.errcode !== 0) {
|
if (res.data.errcode !== 0) {
|
||||||
return message.error(res.data.errmsg);
|
return message.error(`${res.data.errmsg}, 你可以在左侧的接口列表中对接口进行删改`);
|
||||||
}
|
}
|
||||||
message.success('接口添加成功')
|
message.success('接口添加成功')
|
||||||
let interfaceId = res.data.data._id;
|
let interfaceId = res.data.data._id;
|
||||||
@ -180,6 +180,7 @@ class InterfaceList extends Component {
|
|||||||
item.key = item._id;
|
item.key = item._id;
|
||||||
return item;
|
return item;
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ padding: '24px' }}>
|
<div style={{ padding: '24px' }}>
|
||||||
<h2 className="interface-title" style={{ display: 'inline-block', margin: 0 }}>{intername ? intername : '全部接口'}</h2>
|
<h2 className="interface-title" style={{ display: 'inline-block', margin: 0 }}>{intername ? intername : '全部接口'}</h2>
|
||||||
|
@ -157,7 +157,8 @@ class InterfaceMenu extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleChangeInterfaceCat = (data) => {
|
handleChangeInterfaceCat = (data) => {
|
||||||
|
data.project_id = this.props.projectId;
|
||||||
|
console.log('change',data);
|
||||||
let params = {
|
let params = {
|
||||||
catid: this.state.curCatdata._id,
|
catid: this.state.curCatdata._id,
|
||||||
name: data.name
|
name: data.name
|
||||||
@ -169,6 +170,7 @@ class InterfaceMenu extends Component {
|
|||||||
}
|
}
|
||||||
message.success('接口分类更新成功')
|
message.success('接口分类更新成功')
|
||||||
this.getList()
|
this.getList()
|
||||||
|
this.props.getProject(data.project_id)
|
||||||
this.setState({
|
this.setState({
|
||||||
change_cat_modal_visible: false
|
change_cat_modal_visible: false
|
||||||
});
|
});
|
||||||
@ -203,6 +205,7 @@ class InterfaceMenu extends Component {
|
|||||||
async onOk() {
|
async onOk() {
|
||||||
await that.props.deleteInterfaceCatData(catid, that.props.projectId)
|
await that.props.deleteInterfaceCatData(catid, that.props.projectId)
|
||||||
await that.getList()
|
await that.getList()
|
||||||
|
await that.props.getProject(that.props.projectId)
|
||||||
that.props.history.push('/project/' + that.props.match.params.id + '/interface/api')
|
that.props.history.push('/project/' + that.props.match.params.id + '/interface/api')
|
||||||
ref.destroy()
|
ref.destroy()
|
||||||
},
|
},
|
||||||
|
@ -94,7 +94,10 @@ class ProjectMember extends Component {
|
|||||||
role: this.state.inputRole
|
role: this.state.inputRole
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (!res.payload.data.errcode) {
|
if (!res.payload.data.errcode) {
|
||||||
message.success('添加成功!');
|
const { add_members, exist_members } = res.payload.data.data;
|
||||||
|
const addLength = add_members.length;
|
||||||
|
const existLength = exist_members.length;
|
||||||
|
message.success(`添加成功! 已成功添加 ${addLength} 人,其中 ${existLength} 人已存在`);
|
||||||
this.reFetchList(); // 添加成功后重新获取分组成员列表
|
this.reFetchList(); // 添加成功后重新获取分组成员列表
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -3,7 +3,7 @@ import { Row, Col, Input, Button, Select, message, Upload, Tooltip} from 'antd'
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { formatTime } from '../../common.js'
|
import { formatTime } from '../../common.js'
|
||||||
import PropTypes from 'prop-types'
|
import PropTypes from 'prop-types'
|
||||||
import { setBreadcrumb } from '../../reducer/modules/user';
|
import { setBreadcrumb, setImageUrl } from '../../reducer/modules/user';
|
||||||
import { connect } from 'react-redux'
|
import { connect } from 'react-redux'
|
||||||
|
|
||||||
@connect(state => {
|
@connect(state => {
|
||||||
@ -23,7 +23,8 @@ class Profile extends Component {
|
|||||||
curUid: PropTypes.number,
|
curUid: PropTypes.number,
|
||||||
userType: PropTypes.string,
|
userType: PropTypes.string,
|
||||||
setBreadcrumb: PropTypes.func,
|
setBreadcrumb: PropTypes.func,
|
||||||
curRole: PropTypes.string
|
curRole: PropTypes.string,
|
||||||
|
upload: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@ -278,7 +279,11 @@ class Profile extends Component {
|
|||||||
{userinfo.uid === this.props.curUid ? <h3>个人设置</h3> : <h3>{userinfo.username} 资料设置</h3>}
|
{userinfo.uid === this.props.curUid ? <h3>个人设置</h3> : <h3>{userinfo.username} 资料设置</h3>}
|
||||||
|
|
||||||
<Row className="avatarCon" type="flex" justify="start">
|
<Row className="avatarCon" 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={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>
|
</Row>
|
||||||
<Row className="user-item" type="flex" justify="start">
|
<Row className="user-item" type="flex" justify="start">
|
||||||
<div className="maoboli"></div>
|
<div className="maoboli"></div>
|
||||||
@ -335,21 +340,27 @@ class Profile extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@connect(state => {
|
||||||
|
return {
|
||||||
|
url: state.user.imageUrl
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
setImageUrl
|
||||||
|
})
|
||||||
|
|
||||||
class AvatarUpload extends Component {
|
class AvatarUpload extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
|
||||||
imageUrl: ""
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
uid: PropTypes.number
|
uid: PropTypes.number,
|
||||||
|
setImageUrl: PropTypes.func,
|
||||||
|
url: PropTypes.any
|
||||||
}
|
}
|
||||||
uploadAvatar(basecode) {
|
uploadAvatar(basecode) {
|
||||||
axios.post("/api/user/upload_avatar", { basecode: basecode }).then(() => {
|
axios.post("/api/user/upload_avatar", { basecode: basecode }).then(() => {
|
||||||
this.setState({ imageUrl: basecode });
|
// this.setState({ imageUrl: basecode });
|
||||||
|
this.props.setImageUrl(basecode)
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
})
|
})
|
||||||
@ -361,9 +372,10 @@ class AvatarUpload extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
let imageUrl = this.state.imageUrl?this.state.imageUrl:`/api/user/avatar?uid=${this.props.uid}`;
|
const { url } = this.props;
|
||||||
|
let imageUrl = url ? url : `/api/user/avatar?uid=${this.props.uid}`
|
||||||
|
// let imageUrl = this.state.imageUrl ? this.state.imageUrl : `/api/user/avatar?uid=${this.props.uid}`;
|
||||||
// console.log(this.props.uid);
|
// console.log(this.props.uid);
|
||||||
|
|
||||||
return <div className="avatar-box">
|
return <div className="avatar-box">
|
||||||
<Tooltip placement="right" title={<div>点击头像更换 (只支持jpg、png格式且大小不超过200kb的图片)</div>}>
|
<Tooltip placement="right" title={<div>点击头像更换 (只支持jpg、png格式且大小不超过200kb的图片)</div>}>
|
||||||
<div>
|
<div>
|
||||||
@ -375,7 +387,9 @@ class AvatarUpload extends Component {
|
|||||||
beforeUpload={beforeUpload}
|
beforeUpload={beforeUpload}
|
||||||
onChange={this.handleChange.bind(this)} >
|
onChange={this.handleChange.bind(this)} >
|
||||||
{/*<Avatar size="large" src={imageUrl} />*/}
|
{/*<Avatar size="large" src={imageUrl} />*/}
|
||||||
|
<div style={{ width: 100, height: 100 }}>
|
||||||
<img className="avatar" src={imageUrl} />
|
<img className="avatar" src={imageUrl} />
|
||||||
|
</div>
|
||||||
</Upload>
|
</Upload>
|
||||||
</div>
|
</div>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
@ -64,7 +64,6 @@ export function initInterface(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function updateInterfaceData(updata) {
|
export function updateInterfaceData(updata) {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: UPDATE_INTERFACE_DATA,
|
type: UPDATE_INTERFACE_DATA,
|
||||||
updata: updata,
|
updata: updata,
|
||||||
@ -93,7 +92,6 @@ export async function deleteInterfaceCatData(id) {
|
|||||||
// Action Creators
|
// Action Creators
|
||||||
export async function fetchInterfaceData(interfaceId) {
|
export async function fetchInterfaceData(interfaceId) {
|
||||||
let result = await axios.get('/api/interface/get?id=' + interfaceId);
|
let result = await axios.get('/api/interface/get?id=' + interfaceId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: FETCH_INTERFACE_DATA,
|
type: FETCH_INTERFACE_DATA,
|
||||||
payload: result.data
|
payload: result.data
|
||||||
|
@ -9,6 +9,7 @@ const REGISTER = 'yapi/user/REGISTER';
|
|||||||
const SET_BREADCRUMB = 'yapi/user/SET_BREADCRUMB';
|
const SET_BREADCRUMB = 'yapi/user/SET_BREADCRUMB';
|
||||||
const CHANGE_STUDY_TIP = 'yapi/user/CHANGE_STUDY_TIP';
|
const CHANGE_STUDY_TIP = 'yapi/user/CHANGE_STUDY_TIP';
|
||||||
const FINISH_STUDY = 'yapi/user/FINISH_STUDY';
|
const FINISH_STUDY = 'yapi/user/FINISH_STUDY';
|
||||||
|
const SET_IMAGE_URL = 'yapi/user/SET_IMAGE_URL';
|
||||||
|
|
||||||
// Reducer
|
// Reducer
|
||||||
const LOADING_STATUS = 0;
|
const LOADING_STATUS = 0;
|
||||||
@ -32,7 +33,8 @@ const initialState = {
|
|||||||
// }]
|
// }]
|
||||||
breadcrumb: [],
|
breadcrumb: [],
|
||||||
studyTip: 0,
|
studyTip: 0,
|
||||||
study: false
|
study: false,
|
||||||
|
imageUrl: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (state = initialState, action) => {
|
export default (state = initialState, action) => {
|
||||||
@ -112,6 +114,14 @@ export default (state = initialState, action) => {
|
|||||||
studyTip: 0
|
studyTip: 0
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case SET_IMAGE_URL: {
|
||||||
|
// console.log('state', state);
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
imageUrl: action.data
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@ -170,6 +180,15 @@ export function setBreadcrumb(data) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function setImageUrl(data) {
|
||||||
|
|
||||||
|
return {
|
||||||
|
type: SET_IMAGE_URL,
|
||||||
|
data
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
export function changeStudyTip() {
|
export function changeStudyTip() {
|
||||||
return {
|
return {
|
||||||
type: CHANGE_STUDY_TIP
|
type: CHANGE_STUDY_TIP
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
"prop-types": "^15.5.10",
|
"prop-types": "^15.5.10",
|
||||||
"rc-queue-anim": "^1.2.0",
|
"rc-queue-anim": "^1.2.0",
|
||||||
"rc-scroll-anim": "^1.0.7",
|
"rc-scroll-anim": "^1.0.7",
|
||||||
|
"rc-tween-one": "^1.5.5",
|
||||||
"react": "^15.6.1",
|
"react": "^15.6.1",
|
||||||
"react-dnd": "^2.5.1",
|
"react-dnd": "^2.5.1",
|
||||||
"react-dnd-html5-backend": "^2.5.1",
|
"react-dnd-html5-backend": "^2.5.1",
|
||||||
|
@ -361,9 +361,7 @@ class groupController extends baseController {
|
|||||||
let projectInst = yapi.getInst(projectModel);
|
let projectInst = yapi.getInst(projectModel);
|
||||||
let userInst = yapi.getInst(userModel);
|
let userInst = yapi.getInst(userModel);
|
||||||
let result = await groupInst.list();
|
let result = await groupInst.list();
|
||||||
// let count = await groupInst.getListCount();
|
|
||||||
// let count = await projectInst.getProjectListCount();
|
|
||||||
// console.log('count', count);
|
|
||||||
let privateGroup = await groupInst.getByPrivateUid(this.getUid());
|
let privateGroup = await groupInst.getByPrivateUid(this.getUid());
|
||||||
let newResult = [];
|
let newResult = [];
|
||||||
|
|
||||||
|
@ -120,11 +120,13 @@ class interfaceController extends baseController {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (!_.isUndefined(params.req_query)) {
|
if (!_.isUndefined(params.req_query)) {
|
||||||
data.req_query = params.req_query;
|
data.req_query = this.requiredSort(params.req_query);
|
||||||
|
// data.req_query = params.req_query;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(params.req_body_form)) {
|
if (!_.isUndefined(params.req_body_form)) {
|
||||||
data.req_body_form = params.req_body_form;
|
data.req_body_form = this.requiredSort(params.req_body_form);
|
||||||
|
// data.req_body_form = params.req_body_form;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.path.indexOf(":") > 0) {
|
if (params.path.indexOf(":") > 0) {
|
||||||
@ -441,7 +443,8 @@ class interfaceController extends baseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(params.req_body_form)) {
|
if (!_.isUndefined(params.req_body_form)) {
|
||||||
data.req_body_form = params.req_body_form;
|
data.req_body_form = this.requiredSort(params.req_body_form);
|
||||||
|
// data.req_body_form = params.req_body_form;
|
||||||
}
|
}
|
||||||
if (!_.isUndefined(params.req_params) && Array.isArray(params.req_params) && params.req_params.length > 0) {
|
if (!_.isUndefined(params.req_params) && Array.isArray(params.req_params) && params.req_params.length > 0) {
|
||||||
if (Array.isArray(params.req_params) && params.req_params.length > 0) {
|
if (Array.isArray(params.req_params) && params.req_params.length > 0) {
|
||||||
@ -455,7 +458,9 @@ class interfaceController extends baseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(params.req_query)) {
|
if (!_.isUndefined(params.req_query)) {
|
||||||
data.req_query = params.req_query;
|
// data.req_query = params.req_query;
|
||||||
|
data.req_query = this.requiredSort(params.req_query);
|
||||||
|
// console.log("req",this.requiredSort(params.req_query));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_.isUndefined(params.req_body_other)) {
|
if (!_.isUndefined(params.req_body_other)) {
|
||||||
@ -779,6 +784,12 @@ class interfaceController extends baseController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requiredSort(params) {
|
||||||
|
return params.sort((item1, item2) => {
|
||||||
|
return item2.required - item1.required;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = interfaceController;
|
module.exports = interfaceController;
|
||||||
|
@ -180,7 +180,7 @@
|
|||||||
<p>这里比新建项目页面新增的功能如下:</p>
|
<p>这里比新建项目页面新增的功能如下:</p>
|
||||||
<h3 class="subject" id="修改项目图标">修改项目图标 <a class="hashlink" href="#修改项目图标">#</a></h3><p>点击项目图标,可以修改图标及背景色:</p>
|
<h3 class="subject" id="修改项目图标">修改项目图标 <a class="hashlink" href="#修改项目图标">#</a></h3><p>点击项目图标,可以修改图标及背景色:</p>
|
||||||
<p><img src="./images/usage/project_setting_logo.png" /></p>
|
<p><img src="./images/usage/project_setting_logo.png" /></p>
|
||||||
<h3 class="subject" id="配置环境">配置环境 <a class="hashlink" href="#配置环境">#</a></h3><p><code>环境配置</code> 一项可以添加该项目下接口的实际环境,供 <a href="./usage-使用测试集.html">接口测试</a> 使用。</p>
|
<h3 class="subject" id="配置环境">配置环境 <a class="hashlink" href="#配置环境">#</a></h3><p><code>环境配置</code> 一项可以添加该项目下接口的实际环境,供 <a href="case.html">接口测试</a> 使用。</p>
|
||||||
<p><img src="./images/usage/project_setting_env.png" /></p>
|
<p><img src="./images/usage/project_setting_env.png" /></p>
|
||||||
<h2 class="subject" id="删除项目">删除项目 <a class="hashlink" href="#删除项目">#</a></h2><p>点击下方的删除按钮,输入项目名称进行删除。</p>
|
<h2 class="subject" id="删除项目">删除项目 <a class="hashlink" href="#删除项目">#</a></h2><p>点击下方的删除按钮,输入项目名称进行删除。</p>
|
||||||
<blockquote>
|
<blockquote>
|
||||||
|
Loading…
Reference in New Issue
Block a user