修改bug

This commit is contained in:
何童崇 2021-07-13 11:38:08 +08:00
parent 507976bf10
commit bdf3a8e72a
4 changed files with 58 additions and 41 deletions

View File

@ -17,6 +17,14 @@ export function getUserInfo() {
}); });
} }
// 获取用户企业信息
export function getCompanyInfo() {
return fetch({
url: '/api/tasks/getEnterpriseUserInfo',
method: 'get'
});
}
// 获取任务领域 // 获取任务领域
export async function getTaskCategory() { export async function getTaskCategory() {
let res = await fetch({ let res = await fetch({

View File

@ -115,25 +115,28 @@ export default Form.create()(
// //
useEffect(() => { useEffect(() => {
setLoading(true); //
let params = { if (detailData.id) {
taskId: id, setLoading(true);
orderBy: '', let params = {
pageSize: 10, taskId: id,
curPage, orderBy: '',
status, pageSize: 10,
} curPage,
id && getTaskPaper(params).then(data => { status,
if (data && Array.isArray(data.rows)) {
for (const item of data.rows) {
item.detail = item.paperDetail ? item.paperDetail.content : "";
}
} }
setDataList(data.rows || []); getTaskPaper(params).then(data => {
setLoading(false); if (data && Array.isArray(data.rows)) {
setTotal(data.total); for (const item of data.rows) {
}); item.detail = item.paperDetail ? item.paperDetail.content : "";
}, [id, status, curPage, reload, relaodChildList]); }
}
setDataList(data.rows || []);
setLoading(false);
setTotal(data.total);
});
}
}, [id, status, curPage, reload, relaodChildList, detailData]);
// //

View File

@ -6,7 +6,7 @@ import ReactWEditor from 'wangeditor-for-react';
import { Link } from "react-router-dom"; import { Link } from "react-router-dom";
import Upload from '../../components/Upload'; import Upload from '../../components/Upload';
import { httpUrl } from '../../fetch'; 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 { formItemLayout, formModalLayout } from '../static';
import { editorConfig } from '../../components/config'; import { editorConfig } from '../../components/config';
import './index.scss'; import './index.scss';
@ -21,14 +21,14 @@ function getSomeDayAfter(nDay) {
export default Form.create()(forwardRef(({ current_user, form, showNotification, match, history }, ref) => { export default Form.create()(forwardRef(({ current_user, form, showNotification, match, history }, ref) => {
console.log(current_user); console.log(current_user);
const [taskCategoryArr, setTaskCategoryArr] = useState([]); const [taskCategoryArr, setTaskCategoryArr] = useState([]);
const [fileList, setFileList] = useState(null); const [fileList, setFileList] = useState(null);
const [publishMode, setPublishMode] = useState('0'); const [publishMode, setPublishMode] = useState('0');
const [categoryId, setCategoryId] = useState('7'); const [categoryId, setCategoryId] = useState('7');
const [descriptionHtml, setDescriptionHtml] = useState(''); const [descriptionHtml, setDescriptionHtml] = useState('');
const [enterpriseName, setEnterpriseName] = useState('神马科技股份有限公司'); const [enterpriseName, setEnterpriseName] = useState('');
const [displayTime, setDisplayTime] = useState(() => { const [displayTime, setDisplayTime] = useState(() => {
return { return {
collectingTime: getSomeDayAfter(30), collectingTime: getSomeDayAfter(30),
@ -92,7 +92,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
} else { } else {
let formValue = { let formValue = {
contactName: current_user.username || current_user.login, contactName: current_user.username || current_user.login,
contactPhone: current_user.contactPhone || 18888888888, contactPhone: current_user.contactPhone,
taskModeId: 1, taskModeId: 1,
collectionMode: 1, collectionMode: 1,
publishMode: '0', publishMode: '0',
@ -107,6 +107,19 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
} }
}, [id]); }, [id]);
useEffect(() => {
getCompanyInfo().then(res => {
if (res && res.message === 'success') {
setEnterpriseName(res.data.enterpriseName);
setFieldsValue({
contactPhone:res.data.phone
})
}else{
showNotification(res.message);
}
});
},[]);
useEffect(() => { useEffect(() => {
getTaskCategory().then(data => { getTaskCategory().then(data => {
if (data) { if (data) {
@ -285,7 +298,7 @@ export default Form.create()(forwardRef(({ current_user, form, showNotification,
<Input <Input
className="contact-input" className="contact-input"
placeholder="请输入联系电话" placeholder="请输入联系电话"
// disabled disabled
/>, '', <Icon className="editPhone" type="edit" onClick={() => { setVisible(true) }} /> />, '', <Icon className="editPhone" type="edit" onClick={() => { setVisible(true) }} />
)} )}

View File

@ -5,11 +5,11 @@ import ChooseNav from '../../components/chooseNav';
import SortBox from '../../components/sortBox'; import SortBox from '../../components/sortBox';
import ItemListTask from '../components/itemListTask'; import ItemListTask from '../components/itemListTask';
import { taskTimeArr, taskStatusArr, sortArr, taskModeIdArr } from '../static'; import { taskTimeArr, taskStatusArr, sortArr, taskModeIdArr } from '../static';
import { getTaskList, getTaskCategory } from '../api'; import { getTaskList, getTaskCategory, getCompanyInfo } from '../api';
import '../index.scss'; import '../index.scss';
const Search = Input.Search; const Search = Input.Search;
export default ({ history, current_user}) => { export default ({ history, current_user }) => {
console.log(current_user); console.log(current_user);
const [loading, setLoading] = useState(false); const [loading, setLoading] = useState(false);
@ -60,7 +60,6 @@ export default ({ history, current_user}) => {
}, [categoryId, taskModeId, expiredStartTime, expiredEndTime, statusString, searchInput, orderBy, curPage]); }, [categoryId, taskModeId, expiredStartTime, expiredEndTime, statusString, searchInput, orderBy, curPage]);
// function changeOptionId(option, type) {
const changeOptionId = useCallback((option, type) => { const changeOptionId = useCallback((option, type) => {
if (type === 'taskCategory') { if (type === 'taskCategory') {
setCategoryId(option.dicItemCode); setCategoryId(option.dicItemCode);
@ -93,27 +92,21 @@ export default ({ history, current_user}) => {
setOrderBy(sortValue); setOrderBy(sortValue);
setCurPage(1); 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) { function taskClick(id) {
history.push(`/task/taskDetail/${id}`); history.push(`/task/taskDetail/${id}`);
} }
function goAdd() { function goAdd() {
history.push("/task/taskAdd"); getCompanyInfo().then(res => {
if(res){
if (res.message === 'success') {
history.push("/task/taskAdd");
} else {
}
}
});
} }
return ( return (