issue-筛选保存

This commit is contained in:
caishi 2022-01-14 17:33:25 +08:00
parent 8e4819217c
commit ed2c16661a
6 changed files with 90 additions and 29 deletions

View File

@ -140,7 +140,7 @@ class App extends Component {
pathname && this.getPathnameType(pathname);
// 添加路由监听,决定组织还是个人
this.unlisten = this.props.history.listen((location) => {
this.unlisten = this.props.history.listen((location,history) => {
let newPathname = location.pathname.split('/')[1];
if (this.state.pathName !== newPathname) {
// this.setState({ pathType: '' });

View File

@ -36,7 +36,7 @@ export function initAxiosInterceptors(props) {
//响应前的设置
axios.interceptors.request.use(
config => {
if(config.url.indexOf("http") !== -1) {
if(config.url.substr(0, 4) === "http") {
return config
}
requestProxy(config);

View File

@ -5,7 +5,7 @@ import { Menu, Popconfirm } from "antd";
import { TagsLine } from "../Component/OpsStatus";
import { Time } from "../Utils/Time";
import { truncateCommitId } from "../common/util";
import { getUrl } from 'educoder';
import { getImageUrl } from 'educoder';
const SubMenu = Menu.SubMenu;
const Img = styled.img`
@ -70,7 +70,7 @@ export default ({ data, repeatSet , chooseSteps }) => {
<div>
<FlexAJ className="leftheader">
<AlignCenter>
<Img src={getUrl(`/images/${data && data.author && data.author.image_url}`)} />
<Img src={getImageUrl(`/${data && data.author && data.author.image_url}`)} />
{data && data.started &&
<span className="nest">
开始时间<span> {data.started}</span>

View File

@ -3,7 +3,7 @@ import { Spin, Tooltip } from 'antd';
import { Link, Route, Switch } from 'react-router-dom';
import { Content, AlignTop } from '../Component/layout';
import DetailBanner from './sub/DetailBanner';
import { numFormat } from 'educoder';
import cookie from 'react-cookies';
import '../css/index.scss'
import './list.scss';
@ -204,6 +204,8 @@ class Detail extends Component {
componentDidMount = () => {
this.getProject();
let history = this.props.location;
this.clearIssueCookies(history);
}
componentDidUpdate = (prevState) => {
@ -212,6 +214,20 @@ class Detail extends Component {
if (prevState && this.props && (prevParam.projectsId !== propsParam.projectsId || prevParam.owner !== propsParam.owner)) {
this.getProject();
}
this.props.history.listen((history) => {
// 非issue链接地址清除cookie states具体保存和操作在order.js页面
this.clearIssueCookies(history);
})
}
clearIssueCookies=(history)=>{
const { pathname } = history;
const { projectsId , owner } = this.props.match.params;
let currentIssue = pathname.indexOf(`/${owner}/${projectsId}/issues`) === -1;
if (currentIssue) {
cookie.save('states', undefined,{ expires: 0,path:`/` });
}
}
componentWillUnmount() {

View File

@ -75,19 +75,26 @@ class order extends Component {
};
}
componentDidMount = () => {
// const selectParams = cookie.load('selectParams');
// let states = selectParams.select_params;
// this.setState({
// ...states
// },()=>{
// this.getSelectList();
// this.getIssueList('1');
// })
this.getSelectList();
this.getIssueList('1');
const datas = cookie.load('states');
let states = datas === "undefined" ? undefined : datas;
if(states){
this.setState({
...states
},()=>{
this.getSelectList();
this.getIssueList(states.status_type);
})
}else{
this.getSelectList();
this.getIssueList('1');
}
};
getSelectList = () => {
this.setState({
isSpin: true
@ -110,7 +117,6 @@ class order extends Component {
// 获取列表数据
getIssueList = (status_type, begin, end) => {
cookie.remove('selectParams');
this.setState({
isSpin: true
})
@ -129,8 +135,7 @@ class order extends Component {
.then((result) => {
if (result) {
const issues = result.data.issues;
// let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);
// cookie.save('selectParams', {states:this.state},{ expires: inFifteenMinutes,path:`/${owner}/${projectsId}/issues` });
this.saveCookies(status_type);
this.setState({
data: result.data,
issues: issues,
@ -138,7 +143,8 @@ class order extends Component {
isSpin: false,
allValue: issues && issues.length > 0 && issues.map((item) => {
return (item.id)
})
}),
status_type
});
}
})
@ -147,6 +153,36 @@ class order extends Component {
});
};
saveCookies=(status_type)=>{
const { projectsId, owner } = this.props.match.params;
const {
select_params,
issue_tag_ids,//标记
tracker_ids,//类型
author_ids,//发布人
assigned_to_ids,//负责人
author_id,//发布人(用来区分选中的是搜索结果、指派给我、我的发布)
assigned_to_id,//负责人(用来区分选中的是搜索结果、指派给我、我的发布)
fixed_version_ids,//里程碑
status_ids,//状态
done_ratios,//完成度
paix,//排序
update_author_ids,//更换负责人
update_fixed_version_idsx,//更换里程碑
update_status_ids,//修改状态
begin,
end,
search
} = this.state;
const d = {select_params,assigned_to_ids,status_type,issue_tag_ids,tracker_ids,author_id,assigned_to_id,
author_ids,fixed_version_ids,status_ids,done_ratios,paix,update_author_ids,update_fixed_version_idsx,update_status_ids,
begin,end,search
};
let inFifteenMinutes = new Date(new Date().getTime() + 24 * 3600 * 1000);
cookie.save('states', {...d},{ expires: inFifteenMinutes,path:`/` });
}
getMenu = (e, id, name) => {
this.setState({
isSpin: true,
@ -162,7 +198,7 @@ class order extends Component {
paix: "最早创建",
});
}
this.state.select_params.order_name = e.key;
// this.state.select_params.order_name = e.key;
} else if (key_name[0] === "updated_on") {
if (e.item.props.value === "desc") {
this.setState({
@ -174,11 +210,19 @@ class order extends Component {
});
}
}
this.state.select_params.order_name = key_name[0];
this.state.select_params.order_type = e.item.props.value;
this.state.select_params.page = 1;
const { status_type } = this.state;
this.getIssueList(status_type);
this.setState({
select_params:{
order_name:key_name[0],
order_type:e.item.props.value,
page:1
}
},()=>{
const { status_type } = this.state;
this.getIssueList(status_type);
})
// this.state.select_params.order_name = key_name[0];
// this.state.select_params.order_type = e.item.props.value;
// this.state.select_params.page = 1;
};
getOption = (e, id, name, toGet) => {
@ -548,9 +592,8 @@ class order extends Component {
isSpin,
status_type,
select_params,
begin, end, checkedValue, all
begin, end, checkedValue, all,search
} = this.state;
return (
<div className="main" style={{padding:"0px"}}>
<div style={{padding:"10px 20px 0px 20px"}}>
@ -585,6 +628,9 @@ class order extends Component {
enterButton
onSearch={this.searchFunc}
style={{ width: 300 }}
value={search}
allowClear
onChange={(e)=>{this.setState({search:e.target.value})}}
/>
</div>
<div>
@ -633,7 +679,7 @@ class order extends Component {
display:
current_user && current_user.login === "" ? "none" : "flex",
}}
className={author_id ? "active" : ""}
className={ author_id ? "active" : ""}
onClick={() => this.ChangeAssign(2)}
>
<label>我的发布</label>

View File

@ -26,7 +26,6 @@ class claims extends React.Component {
axios.get(`/issues/${issue_id}/claims.json`)
.then((result) => {
if(result){
console.log(result.data),
this.setState({
claimerdata: result.data.claimers,
currentUserClaimed: result.data.currentUserclaimed,