From ed2c16661a77b3ed2fcae8b2626a69371e068592 Mon Sep 17 00:00:00 2001
From: caishi <1149225589@qq.com>
Date: Fri, 14 Jan 2022 17:33:25 +0800
Subject: [PATCH] =?UTF-8?q?issue-=E7=AD=9B=E9=80=89=E4=BF=9D=E5=AD=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/App.js | 2 +-
src/AppConfig.js | 2 +-
src/forge/DevOps/OpsDetailLeftpanel.jsx | 4 +-
src/forge/Main/Detail.js | 18 ++++-
src/forge/Order/order.js | 92 ++++++++++++++++++-------
src/forge/claims/claims.js | 1 -
6 files changed, 90 insertions(+), 29 deletions(-)
diff --git a/src/App.js b/src/App.js
index e9333272..718017d6 100644
--- a/src/App.js
+++ b/src/App.js
@@ -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: '' });
diff --git a/src/AppConfig.js b/src/AppConfig.js
index 665e85f0..faef3bd2 100644
--- a/src/AppConfig.js
+++ b/src/AppConfig.js
@@ -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);
diff --git a/src/forge/DevOps/OpsDetailLeftpanel.jsx b/src/forge/DevOps/OpsDetailLeftpanel.jsx
index 9d9fefd9..2dff8d81 100644
--- a/src/forge/DevOps/OpsDetailLeftpanel.jsx
+++ b/src/forge/DevOps/OpsDetailLeftpanel.jsx
@@ -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 }) => {
-
+
{data && data.started &&
开始时间: {data.started}
diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js
index a73ee8f0..d53d446b 100644
--- a/src/forge/Main/Detail.js
+++ b/src/forge/Main/Detail.js
@@ -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() {
diff --git a/src/forge/Order/order.js b/src/forge/Order/order.js
index ef100805..19babaab 100644
--- a/src/forge/Order/order.js
+++ b/src/forge/Order/order.js
@@ -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 (
@@ -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})}}
/>
@@ -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)}
>
diff --git a/src/forge/claims/claims.js b/src/forge/claims/claims.js
index 4361a10a..d098923b 100644
--- a/src/forge/claims/claims.js
+++ b/src/forge/claims/claims.js
@@ -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,