更新对不使用/使用区块链的判断适配 #506

Merged
xxq250 merged 2 commits from Nigel/forgeplus-react:master_zxh into dev_nanda 2023-02-04 18:10:19 +08:00
5 changed files with 63 additions and 62 deletions

View File

@ -23,5 +23,5 @@ export const getUser = async (login)=>{
// author: zxh
export const getUser4Proj = async (login, projectsId)=>{
return (await axios.get(`/users/${login}/hovercard4proj.json?project_name=${projectsId}`)).data;
return (await axios.get(`/users/${login}/hovercard4proj.json?project_identifier=${projectsId}`)).data;
}

View File

@ -644,13 +644,6 @@ class MessageCount extends Component {
value={this.state.body}
onChange={this.changbodypr}
/>
{/*<Input*/}
{/* type="select"*/}
{/* placeholder="请选择解决的issue"*/}
{/* style={{ marginTop: 20 }}*/}
{/* value={this.state.fix_issue_id}*/}
{/* onChange={this.changefixissue}*/}
{/*/>*/}
<Select
id = {'select_project'}
style={{ marginTop: 20, width: "500px" }}

View File

@ -52,7 +52,7 @@ class Index extends Component {
languageFlag:false,
ignoreFlag:false,
licenseFlag:false,
show_div:"hidden",
display: "none",
}
}
componentDidMount = () => {
@ -303,13 +303,13 @@ class Index extends Component {
// add by zxh: handleBlockchainChange
handleBlockchainChange = (event) => {
if (this.state.show_div == 'hidden') {
if (this.state.display == "none") {
this.setState({
show_div: "visible"
display: "block"
});
} else {
this.setState({
show_div: "hidden"
display: "none"
});
}
}
@ -578,40 +578,6 @@ class Index extends Component {
<Checkbox value="limit">将项目设为私有<span className="font-13 color-grey-9">(只有项目所有人或拥有权限的项目成员才能看到)</span></Checkbox>
)}
</Form.Item >
{/*增加区块链选项,不要求必选,默认是选择的*/}
<Form.Item
label="确权"
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('blockchain')(
<Checkbox value="limit" onClick={this.handleBlockchainChange}>项目加入确权机制<span className="ml15 font-13 color-grey-9">(贡献确权上链并使用权益证明代表贡献)</span></Checkbox>
)}
</Form.Item >
<Form.Item
style={{ margin: "15px", display: "block" }}
className="privatePart"
ref={(blockchain_item => {this.blockchain_item = blockchain_item})}
>
<div class="div_flex_row" style={{visibility: this.state.show_div == "visible" ? "visible": "hidden"}}>
{getFieldDecorator('blockchain_token_all', {
rules: [{
required: false, message: '请填写项目token总数(单位:枚)'
}],
})(
<Input type={'number'} min={0} step={1} placeholder="请填写项目token总数(单位:枚)" />
)}
{getFieldDecorator('blockchain_init_token', {
rules: [{
required: false, message: '请填写项目创始人获取token的百分比(%)'
}],
})(
<Input type={'number'} min={0} max={100} step={1} placeholder="请填写项目创始人获取token的百分比(%)" />
)}
</div>
</Form.Item>
{
projectsType && projectsType === "mirror" &&
@ -680,6 +646,42 @@ class Index extends Component {
)}
</Form.Item>
}
{/*增加区块链选项,不要求必选,默认是选择的*/}
<Form.Item
label="确权"
style={{ margin: "0px" }}
className="privatePart"
>
{getFieldDecorator('blockchain')(
<Checkbox value="limit" onClick={this.handleBlockchainChange}>项目加入确权机制<span className="ml15 font-13 color-grey-9">(贡献确权上链并使用权益证明代表贡献)</span></Checkbox>
)}
</Form.Item >
<Form.Item
style={{ margin: "15px", display: "block" }}
className="privatePart"
ref={(blockchain_item => {this.blockchain_item = blockchain_item})}
>
<div class="div_flex_row" style={{display: this.state.display == "block" ? "block": "none"}}>
{getFieldDecorator('blockchain_token_all', {
rules: [{
required: false, message: '请填写项目token总数(单位:枚)'
}],
})(
<Input type={'number'} min={0} step={1} placeholder="请填写项目token总数(单位:枚)" />
)}
{getFieldDecorator('blockchain_init_token', {
rules: [{
required: false, message: '请填写项目创始人获取token的百分比(%)'
}],
})(
<Input type={'number'} min={0} max={100} step={1} placeholder="请填写项目创始人获取token的百分比(%)" />
)}
</div>
</Form.Item>
<div className="mt20">
<span className="ant-form-item-required"></span>
</div>

View File

@ -42,8 +42,8 @@ class Detail extends Component {
}
componentDidMount = () => {
this.getDetail();
this.getBlockchainTokenNum();
this.getDetail();
};
componentDidUpdate=()=>{
@ -362,10 +362,13 @@ class Detail extends Component {
)}
</span>
</p>
<p className="grid-item-left pb15">
{
this.state.blockchain_token_num != -1 ? <p className="grid-item-left pb15">
<span className="issue_detail_info">悬赏金额:</span>
<span>{this.state.blockchain_token_num}</span>
</p>
</p> : ""
}
<p className="grid-item-left pb15">
<span className="issue_detail_info">里程碑:</span>
<span className="title_overflow">

View File

@ -490,18 +490,21 @@ class order_form extends Component {
</div>
<div className="list-left list-left-padding issue-edit-form-right">
<div className="pd20 background-f issue-form-right">
<Form.Item label="悬赏金额">
{getFieldDecorator("issue_token_num", {rules: []})(
<Input
ref={(input) => this.input_token=input}
type={"number"}
min={0}
max={this.state.issue_token_num}
onChange={this.adjustTokenNum.bind(this)}
placeholder="定义悬赏token数量"
/>
)}
</Form.Item>
{issue_chosen && issue_chosen.use_blockchain ?
<Form.Item label="悬赏金额">
{getFieldDecorator("issue_token_num", { rules: [] })(
<Input
ref={(input) => this.input_token = input}
type={"number"}
min={0}
max={this.state.issue_token_num}
onChange={this.adjustTokenNum.bind(this)}
placeholder="定义悬赏token数量"
/>
)}
</Form.Item>
: ""}
<Form.Item label="指派成员">
{getFieldDecorator("assigned_to_id", {rules: []})(
<Select