forked from Gitlink/forgeplus-react
fix
This commit is contained in:
parent
7526a6a1d8
commit
3ab9c67dcf
|
|
@ -17,8 +17,8 @@ import Claims from '../../claims/claims';
|
|||
import ChooseMenu from '../Component/chooseMenu';
|
||||
import CaseDrop from '../Component/caseDrop';
|
||||
import Nodata from '../../../forge/Nodata';
|
||||
import pf from './pf.png';
|
||||
import pfjl from './pfjl.png';
|
||||
import pf from './pf.jpg';
|
||||
import pfjl from './pfjl.jpg';
|
||||
|
||||
function Details(props) {
|
||||
const owner = props.match.params.owner;
|
||||
|
|
@ -64,6 +64,8 @@ function Details(props) {
|
|||
const [rewardFlag, setRewardFlag] = useState(false);
|
||||
const [caseValue, setCaseValue] = useState(undefined);
|
||||
|
||||
const [scoreActive, setScoreActive] = useState('');
|
||||
|
||||
const pathname = props.history.location.pathname;
|
||||
const permission = props && props.projectDetail && props.projectDetail.permission;
|
||||
let colors = ["#1abcb1", "#28be6c", "#e67e22", "#db3d1d"];
|
||||
|
|
@ -96,7 +98,7 @@ function Details(props) {
|
|||
const url = `/v1/${owner}/${projectsId}/issues/${index}`;
|
||||
axios.get(url).then(result => {
|
||||
if (result && result.data) {
|
||||
let data=result.data
|
||||
let data = result.data
|
||||
setDetails(data);
|
||||
let per = data && !data.user_permission;
|
||||
setEditFlag(per);
|
||||
|
|
@ -125,23 +127,10 @@ function Details(props) {
|
|||
|
||||
setOrderId(data.id);
|
||||
}
|
||||
|
||||
|
||||
let urls = `/ratings.json`;
|
||||
axios.get(urls, {
|
||||
params: {
|
||||
ratee_type: 'Issue',
|
||||
ratee_id: result.data.id,
|
||||
}
|
||||
}).then(result => {
|
||||
if (result && result.data && result.data.status === 0) {
|
||||
recordsData.current = result.data.data
|
||||
}
|
||||
}).catch(error => { })
|
||||
}).catch(error => {
|
||||
console.log(error);
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -385,25 +374,22 @@ function Details(props) {
|
|||
};
|
||||
|
||||
function onSure() {
|
||||
validateFields((error, values) => {
|
||||
if (!error) {
|
||||
let url = `/ratings.json`;
|
||||
// const { email , is_sync_pwd} = current_user;
|
||||
// if(email && !is_sync_pwd){
|
||||
// url = `/users/change_password.json`;
|
||||
// }
|
||||
axios.post(url, {
|
||||
ratee_type: 'Issue',
|
||||
ratee_id: details.id,
|
||||
...values
|
||||
}).then(result => {
|
||||
if (result && result.data && result.data.status === 0) {
|
||||
Init()
|
||||
setScoreVisible(false)
|
||||
}
|
||||
}).catch(error => { })
|
||||
let url = `/ratings.json`;
|
||||
// const { email , is_sync_pwd} = current_user;
|
||||
// if(email && !is_sync_pwd){
|
||||
// url = `/users/change_password.json`;
|
||||
// }
|
||||
axios.post(url, {
|
||||
ratee_type: 'Issue',
|
||||
ratee_id: details.id,
|
||||
score: scoreActive,
|
||||
}).then(result => {
|
||||
if (result && result.data && result.data.status === 0) {
|
||||
Init()
|
||||
setScoreVisible(false)
|
||||
message.success('评分成功!')
|
||||
}
|
||||
})
|
||||
}).catch(error => { })
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
@ -447,21 +433,39 @@ function Details(props) {
|
|||
<div>
|
||||
<Link to={`/${details.author.login}`} className="author"><img src={getImageUrl(details.author.image_url)} alt="" />{details.author.name}</Link>
|
||||
<span className="ml10" style={{ color: "#898d9d" }}>添加于{details.created_at}</span>
|
||||
{details.score>0&&<span style={{ color: "#db6c2b", marginLeft: '10px', fontSize: '14px',fontWeight:'bold' }}>综合得分: {details.score}分</span>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{
|
||||
details.user_permission &&
|
||||
<ul className="detailoperate">
|
||||
<li><a className="color-blue" onClick={() => setEdit(true)}><i className="iconfont icon-a-bianji12 font-12 mr5"></i>编辑</a></li>
|
||||
<li><Link to={`/${owner}/${projectsId}/issues/${index}/copy`} className="color-blue ml20"><i className="iconfont icon-a-fuzhi2 font-12 mr5"></i>复制</Link></li>
|
||||
<li><a className="color-red ml20" onClick={() => setDelVisible(true)}><i className="iconfont icon-fuzhi-shanchu font-12 mr5"></i>删除</a></li>
|
||||
<li><a className="color-blue ml20" onClick={() => setScoreVisible(true)}><img src={pf} style={{ marginRight: '5px' }}></img>评分</a></li>
|
||||
<li><a className="color-blue ml20" onClick={() => {
|
||||
setRecordsVisible(true)
|
||||
}}><img src={pfjl} style={{ marginRight: '5px' }}></img>评分记录</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<ul className="detailoperate">
|
||||
<li><a className="color-blue" onClick={() => setEdit(true)}><i className="iconfont icon-a-bianji12 font-12 mr5"></i>编辑</a></li>
|
||||
<li><Link to={`/${owner}/${projectsId}/issues/${index}/copy`} className="color-blue ml20"><i className="iconfont icon-a-fuzhi2 font-12 mr5"></i>复制</Link></li>
|
||||
<li><a className="color-red ml20" onClick={() => setDelVisible(true)}><i className="iconfont icon-fuzhi-shanchu font-12 mr5"></i>删除</a></li>
|
||||
</ul>
|
||||
<ul className="detailoperate">
|
||||
<li><a className="color-blue" onClick={() => { setScoreActive(''), setScoreVisible(true) }}><img src={pf} style={{ marginRight: '5px' }}></img>评分</a></li>
|
||||
<li><a className="color-blue ml20" onClick={() => {
|
||||
let urls = `/ratings.json`;
|
||||
axios.get(urls, {
|
||||
params: {
|
||||
ratee_type: 'Issue',
|
||||
ratee_id: details.id,
|
||||
}
|
||||
}).then(result => {
|
||||
if (result && result.data && result.data.status === 0) {
|
||||
recordsData.current = result.data.data
|
||||
setRecordsVisible(true)
|
||||
}
|
||||
}).catch(error => { })
|
||||
|
||||
}}><img src={pfjl} style={{ marginRight: '5px' }}></img>评分记录</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="descPanel">
|
||||
|
|
@ -572,7 +576,7 @@ function Details(props) {
|
|||
<Modal
|
||||
visible={scoreVisible}
|
||||
title="评分"
|
||||
width="400px"
|
||||
width="450px"
|
||||
destroyOnClose={true}
|
||||
// maskClosable={isCancel}
|
||||
onCancel={() => setScoreVisible(false)}
|
||||
|
|
@ -580,7 +584,11 @@ function Details(props) {
|
|||
<div>
|
||||
<Button onClick={() => setScoreVisible(false)}>取消</Button>
|
||||
<Button type={"primary"} style={{ marginLeft: "20px" }} onClick={() => {
|
||||
onSure();
|
||||
if (scoreActive) {
|
||||
onSure();
|
||||
} else {
|
||||
message.error('请选择分数!')
|
||||
}
|
||||
// setScoreVisible(false)
|
||||
}
|
||||
}>确定</Button>
|
||||
|
|
@ -589,7 +597,7 @@ function Details(props) {
|
|||
centered
|
||||
>
|
||||
<div>
|
||||
<Form {...layout}>
|
||||
{/* <Form {...layout}>
|
||||
<Form.Item label="评分">
|
||||
{getFieldDecorator("score", {
|
||||
rules: [
|
||||
|
|
@ -599,7 +607,19 @@ function Details(props) {
|
|||
<InputNumber placeholder="请填写1-10的分值" style={{ width: 220 }} min={1} max={10} />
|
||||
)}
|
||||
</Form.Item>
|
||||
</Form>
|
||||
</Form> */}
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap' }}>
|
||||
{[1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map((item, index) => {
|
||||
return <div key={index} onClick={() => {
|
||||
setScoreActive(item)
|
||||
}} style={{
|
||||
width: '30px', height: '30px', marginRight: '10px', textAlign: 'center',
|
||||
lineHeight: "30px", border: '1px solid', background: scoreActive == item ? '#2A61FF' : '#fff',
|
||||
borderColor: scoreActive == item ? '#2A61FF' : '#999999',
|
||||
color: scoreActive == item ? '#fff' : '#666666', cursor: "pointer"
|
||||
}}>{item}</div>
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
<Modal
|
||||
|
|
|
|||
Loading…
Reference in New Issue