diff --git a/src/military/fetch.js b/src/military/fetch.js index 9098e5f3..0a1d5923 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -3,12 +3,12 @@ import axios from 'axios'; import cookie from 'react-cookies'; // export const httpUrl='http://117.50.100.12:8001'; -// export const httpUrl='http://192.168.31.72:8081'; +export const httpUrl='http://192.168.31.72:8081'; // export const httpUrl = 'http://106.75.31.211:58088'; // export const httpUrl = 'http://192.168.31.72:8089'; // export const httpUrl = 'http://192.168.31.104:8081'; -export const httpUrl = 'http://192.168.31.168:8081'; +// export const httpUrl = 'http://192.168.31.168:8081'; const TokenKey = 'autologin_forge_military'; diff --git a/src/military/task/api.js b/src/military/task/api.js index c2940197..068e0f96 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -17,6 +17,14 @@ export function getUserInfo() { }); } +// 获取用户企业信息 +export function getCompanyInfo() { + return fetch({ + url: '/api/tasks/getEnterpriseUserInfo', + method: 'get' + }); +} + // 获取任务领域 export async function getTaskCategory() { let res = await fetch({ diff --git a/src/military/task/taskDetail/index.jsx b/src/military/task/taskDetail/index.jsx index 04a851ce..d8ff7ec1 100644 --- a/src/military/task/taskDetail/index.jsx +++ b/src/military/task/taskDetail/index.jsx @@ -115,25 +115,28 @@ export default Form.create()( // 获取成果列表 useEffect(() => { - setLoading(true); - let params = { - taskId: id, - orderBy: '', - pageSize: 10, - curPage, - status, - } - id && getTaskPaper(params).then(data => { - if (data && Array.isArray(data.rows)) { - for (const item of data.rows) { - item.detail = item.paperDetail ? item.paperDetail.content : ""; - } + // 等加载完成果详情再加载成果列表 + if (detailData.id) { + setLoading(true); + let params = { + taskId: id, + orderBy: '', + pageSize: 10, + curPage, + status, } - setDataList(data.rows || []); - setLoading(false); - setTotal(data.total); - }); - }, [id, status, curPage, reload, relaodChildList]); + getTaskPaper(params).then(data => { + if (data && Array.isArray(data.rows)) { + for (const item of data.rows) { + item.detail = item.paperDetail ? item.paperDetail.content : ""; + } + } + setDataList(data.rows || []); + setLoading(false); + setTotal(data.total); + }); + } + }, [id, status, curPage, reload, relaodChildList, detailData]); // 流程步骤显示,返回剩余时间 diff --git a/src/military/task/taskEdit/index.jsx b/src/military/task/taskEdit/index.jsx index b7819977..17f98d79 100644 --- a/src/military/task/taskEdit/index.jsx +++ b/src/military/task/taskEdit/index.jsx @@ -6,7 +6,7 @@ import ReactWEditor from 'wangeditor-for-react'; import { Link } from "react-router-dom"; import Upload from '../../components/Upload'; import { httpUrl } from '../../fetch'; -import { getTaskDetail, addTask, updateTask, getTaskCategory } from '../api'; +import { getTaskDetail, addTask, updateTask, getTaskCategory, getCompanyInfo } from '../api'; import { formItemLayout, formModalLayout } from '../static'; import { editorConfig } from '../../components/config'; import './index.scss'; @@ -21,14 +21,14 @@ function getSomeDayAfter(nDay) { export default Form.create()(forwardRef(({ current_user, form, showNotification, match, history }, ref) => { console.log(current_user); - + const [taskCategoryArr, setTaskCategoryArr] = useState([]); const [fileList, setFileList] = useState(null); const [publishMode, setPublishMode] = useState('0'); const [categoryId, setCategoryId] = useState('7'); const [descriptionHtml, setDescriptionHtml] = useState(''); - const [enterpriseName, setEnterpriseName] = useState('神马科技股份有限公司'); + const [enterpriseName, setEnterpriseName] = useState(''); const [displayTime, setDisplayTime] = useState(() => { return { collectingTime: getSomeDayAfter(30), @@ -92,7 +92,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification, } else { let formValue = { contactName: current_user.username || current_user.login, - contactPhone: current_user.contactPhone || 18888888888, + contactPhone: current_user.contactPhone, taskModeId: 1, collectionMode: 1, publishMode: '0', @@ -107,6 +107,19 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification, } }, [id]); + useEffect(() => { + getCompanyInfo().then(res => { + if (res && res.message === 'success') { + setEnterpriseName(res.data.enterpriseName); + setFieldsValue({ + contactPhone:res.data.phone + }) + }else{ + showNotification(res.message); + } + }); + },[]); + useEffect(() => { getTaskCategory().then(data => { if (data) { @@ -285,7 +298,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification, , '', { setVisible(true) }} /> )} diff --git a/src/military/task/taskList/index.jsx b/src/military/task/taskList/index.jsx index cee2090e..014e45b2 100644 --- a/src/military/task/taskList/index.jsx +++ b/src/military/task/taskList/index.jsx @@ -5,11 +5,11 @@ import ChooseNav from '../../components/chooseNav'; import SortBox from '../../components/sortBox'; import ItemListTask from '../components/itemListTask'; import { taskTimeArr, taskStatusArr, sortArr, taskModeIdArr } from '../static'; -import { getTaskList, getTaskCategory } from '../api'; +import { getTaskList, getTaskCategory, getCompanyInfo } from '../api'; import '../index.scss'; const Search = Input.Search; -export default ({ history, current_user}) => { +export default ({ history, current_user }) => { console.log(current_user); const [loading, setLoading] = useState(false); @@ -60,7 +60,6 @@ export default ({ history, current_user}) => { }, [categoryId, taskModeId, expiredStartTime, expiredEndTime, statusString, searchInput, orderBy, curPage]); - // function changeOptionId(option, type) { const changeOptionId = useCallback((option, type) => { if (type === 'taskCategory') { setCategoryId(option.dicItemCode); @@ -93,27 +92,21 @@ export default ({ history, current_user}) => { setOrderBy(sortValue); setCurPage(1); }, []); - // function changeSort(sortType) { - // console.log('-----sort----'); - // console.log(sortType); - // let sortValue = ''; - // if (sortType.type !== 'default') { - // if (sortType.desc) { - // sortValue = sortType.type + 'Desc'; - // } else { - // sortValue = sortType.type + 'Asc'; - // } - // } - // setOrderBy(sortValue); - // setCurPage(1); - // } function taskClick(id) { history.push(`/task/taskDetail/${id}`); } function goAdd() { - history.push("/task/taskAdd"); + getCompanyInfo().then(res => { + if(res){ + if (res.message === 'success') { + history.push("/task/taskAdd"); + } else { + + } + } + }); } return (