diff --git a/config/webpack.config.dev.js b/config/webpack.config.dev.js index 914c0ce7c..40b0b12bf 100644 --- a/config/webpack.config.dev.js +++ b/config/webpack.config.dev.js @@ -101,6 +101,9 @@ module.exports = { extensions: [".web.js", ".mjs", ".js", ".json", ".web.jsx", ".jsx"], alias: { educoder: __dirname + "/../src/common/educoder.js", + src: path.join(paths.appSrc), // 整个源代码目录 + forge: path.join(paths.appSrc, 'forge'), + military: path.join(paths.appSrc, 'military'), // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ "react-native": "react-native-web", diff --git a/config/webpack.config.prod.js b/config/webpack.config.prod.js index a7b2c9f4e..467771a56 100644 --- a/config/webpack.config.prod.js +++ b/config/webpack.config.prod.js @@ -87,6 +87,9 @@ module.exports = { extensions: [".web.js", ".mjs", ".js", ".json", ".web.jsx", ".jsx"], alias: { educoder: __dirname + "/../src/common/educoder.js", + src: path.join(paths.appSrc), + forge: path.join(paths.appSrc, 'forge'), + military: path.join(paths.appSrc, 'military'), // Support React Native Web // https://www.smashingmagazine.com/2016/08/a-glimpse-into-the-future-with-react-native-for-web/ "react-native": "react-native-web", diff --git a/src/common/DateUtil.js b/src/common/DateUtil.js index 0912ac494..5869a1a23 100644 --- a/src/common/DateUtil.js +++ b/src/common/DateUtil.js @@ -109,20 +109,20 @@ export function timeAgo(backDate) { return; } let time = new Date() - moment(backDate); - var days = Math.round(time / (1000 * 60 * 60 * 24)); - var hours = Math.round((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - var minutes = Math.round((time % (1000 * 60 * 60)) / (1000 * 60)); - var seconds = Math.round((time % (1000 * 60 * 60)) / 1000); + var days = Math.floor(time / (1000 * 60 * 60 * 24)); + var hours = Math.floor((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); + var minutes = Math.floor((time % (1000 * 60 * 60)) / (1000 * 60)); + var seconds = Math.floor((time % (1000 * 60 * 60)) / 1000); if (days) { - return "约" + days + "天前"; + return days + "天前"; } if (hours) { - return "约" + hours + "小时前"; + return hours + "小时前"; } if (minutes) { - return "约" + minutes + "分前"; + return minutes + "分前"; } if (seconds) { - return "约" + seconds + "秒前"; + return seconds + "秒前"; } } \ No newline at end of file diff --git a/src/military/components/chooseNav/index.jsx b/src/military/components/chooseNav/index.jsx index 251ee9951..1074cb185 100644 --- a/src/military/components/chooseNav/index.jsx +++ b/src/military/components/chooseNav/index.jsx @@ -1,10 +1,11 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState,memo } from 'react'; import classNames from 'classnames'; import './index.scss'; -export default (props) => { +export default memo((props) => { const { title, options, changeOptionId, type ,size} = props; - + console.log(" --- 组件重新渲染 --- "); + const [option, setOption] = useState({ code: "", dicItemName: "" ,dicItemCode:""}); useEffect(() => { @@ -26,4 +27,4 @@ export default (props) => { ) -} \ No newline at end of file +}) \ No newline at end of file diff --git a/src/military/components/sortBox/index.jsx b/src/military/components/sortBox/index.jsx index 546907daa..ebfcc7dc1 100644 --- a/src/military/components/sortBox/index.jsx +++ b/src/military/components/sortBox/index.jsx @@ -1,9 +1,9 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState ,memo} from 'react'; import { Icon, } from 'antd'; import classNames from 'classnames'; import './index.scss'; -export default (props) => { +export default memo((props) => { const { options, changeOptionId, type, defaultValue } = props; const [myOptions, setMyOptions] = useState(options); @@ -45,4 +45,4 @@ export default (props) => { ) -} \ No newline at end of file +}) \ No newline at end of file diff --git a/src/military/components/statusNav/index.jsx b/src/military/components/statusNav/index.jsx index c059dd731..d0d58e2b4 100644 --- a/src/military/components/statusNav/index.jsx +++ b/src/military/components/statusNav/index.jsx @@ -1,9 +1,9 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState ,memo} from 'react'; import classNames from 'classnames'; import './index.scss'; -export default (props) => { - const { title, options, changeOptionId, type } = props; +export default memo((props) => { + const { options, changeOptionId, type } = props; const [option, setOption] = useState({ code: "", dicItemName: "" ,dicItemCode:""}); @@ -23,4 +23,4 @@ export default (props) => { ) -} \ No newline at end of file +}) \ No newline at end of file diff --git a/src/military/fetch.js b/src/military/fetch.js index da73e6fdf..8dcb87756 100644 --- a/src/military/fetch.js +++ b/src/military/fetch.js @@ -2,6 +2,14 @@ import { notification } from 'antd'; import axios from 'axios'; import cookie from 'react-cookies'; +<<<<<<< HEAD +======= +// export const httpUrl='http://117.50.100.12:8001'; +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'; +>>>>>>> 09e81b9... 添加成果内容 let actionUrl = ''; @@ -69,6 +77,10 @@ service.interceptors.response.use( message: "提示", description: '账户或密码错误!', }); +<<<<<<< HEAD +======= + // window.location.href="/404"; +>>>>>>> 09e81b9... 添加成果内容 return Promise.reject('error'); } if (response.status !== 200 && res.status !== 200) { diff --git a/src/military/index.scss b/src/military/index.scss index ed28e2e70..f8be6f731 100644 --- a/src/military/index.scss +++ b/src/military/index.scss @@ -227,6 +227,37 @@ >>>>>>> 92f3934... 上传我的需求及 ======= +// 富文本样式 +.w-e-text table td, .w-e-text table th{ + height: 30px; +} +// 富文本生成的内容的样式 +.editor-w-text table td, .editor-w-text table th{ + border-bottom: 1px solid #ccc; + border-right: 1px solid #ccc; + padding: 3px 5px; + height: 30px; + min-height: 30px; +} +.editor-w-text table th { + border-bottom: 2px solid #ccc; + text-align: center; + background-color: #f1f1f1; +} +.editor-w-text table { + border-top: 1px solid #ccc; + border-left: 1px solid #ccc; +} +.editor-w-text blockquote { + display: block; + border-left: 8px solid #d0e5f2; + padding: 5px 10px; + margin: 10px 0; + line-height: 1.4; + font-size: 100%; + background-color: #f1f1f1; +} + @media screen and (max-width: 1200px){ .centerbox { diff --git a/src/military/task/api.js b/src/military/task/api.js index 8fcb252ed..d0b9c5440 100644 --- a/src/military/task/api.js +++ b/src/military/task/api.js @@ -42,7 +42,7 @@ export async function getTaskList(params) { } } -// 我的列表查询 +// 我的任务列表查询 export async function getMyTaskList(params) { let res = await fetch({ url: '/api/myTasks/', @@ -59,6 +59,23 @@ export async function getMyTaskList(params) { } } +// 我参与的任务列表查询 +export async function getJoinTaskList(params) { + let res = await fetch({ + url: '/api/myTasks/myPapers', + method: 'get', + params, + }); + if (res.data) { + return res.data; + } else { + notification.open({ + message: "提示", + description: res.message || '请求错误', + }); + } +} + // 详情查询 export async function getTaskDetail(id) { diff --git a/src/military/components/itemListAchieve/index.jsx b/src/military/task/components/itemListAchieve/index.jsx similarity index 70% rename from src/military/components/itemListAchieve/index.jsx rename to src/military/task/components/itemListAchieve/index.jsx index 3f6023952..26720353a 100644 --- a/src/military/components/itemListAchieve/index.jsx +++ b/src/military/task/components/itemListAchieve/index.jsx @@ -1,22 +1,16 @@ import React, { useEffect, useState } from 'react'; -import { Icon, Pagination, Modal, Input ,Button} from 'antd'; -import { getImageUrl, timeAgo } from 'educoder'; +import { Pagination, Modal, Input, Button } from 'antd'; import ReactWEditor from 'wangeditor-for-react'; -import { reportAchieve, thumbUpAchieve, commentAdd } from '../../task/api'; -import { httpUrl } from '../../fetch'; -import Nodata from '../../../forge/Nodata'; -import Loading from "../../../Loading"; +import { getImageUrl, timeAgo } from 'educoder'; +import Nodata from 'forge/Nodata'; +import Loading from "src/Loading"; +import { reportAchieve, thumbUpAchieve, commentAdd } from '../../api'; +import { httpUrl } from '../../../fetch'; + import './index.scss'; const { TextArea } = Input; -// 如果是开发,那么文件系统默认使用117.50.100.12 -let fileHttpUrl = httpUrl; -if (window.location.href.indexOf('localhost') > -1) { - fileHttpUrl = 'http://117.50.100.12:8001'; -} - -// const classArr = ['', 'list-done', 'list-error', 'list-red', 'list-yellow', '', '', 'list-pay', 'list-gray',]; export default (props) => { const { list, curPage, total, changePage, loading, applyStatusAllNameArr, relaodList, showNotification } = props; const [page, setPage] = useState(1); @@ -28,12 +22,14 @@ export default (props) => { const [reportValue, setReportValue] = useState(''); const [commentHtml, setCommentHtml] = useState(''); + const [commentId, setCommentId] = useState(undefined); + useEffect(() => { changePage(page); }, [page]); function downFile(item) { - let url = fileHttpUrl + '/busiAttachments/download/' + item.id; + let url = httpUrl + '/busiAttachments/download/' + item.id; window.open(url); } @@ -60,16 +56,27 @@ export default (props) => { } function commentPush(item) { + if (!commentHtml) { + showNotification("请输入评价"); + return; + } commentAdd({ - content:commentHtml, - paperId:'' + content: commentHtml, + paperId: item.id, + taskId: item.taskId }).then(res => { - + if (res.message === 'success') closeComment(); }); } - function commentEdit(id){ + function closeComment() { + setCommentId(undefined); + setCommentHtml(''); + } + function commentEdit(id) { + setCommentId(id); + setCommentHtml(''); } return ( @@ -111,37 +118,54 @@ export default (props) => { } - {/*
-
-

- - - 歌曲ID代入演示.txt - - (299 Bytes) -

-
+
+ {item.comments.length > 0 && + item.comments.map(commentsItem => { + return
+

+ {commentsItem.user.nickname || commentsItem.user.login} + 大约 3 小时 +

+ +
+
+
+ }) + } + {/* */} + {/* */}
- */} + +
  • 成果编号:#{item.number} 提交时间:{item.createdAt} 稿件状态:{item.read ? '雇主已浏览' : '雇主未浏览'} { setReportVisible(true); setCheckedItem(item) }}>举报 - { commentEdit(item.id) }}>0 + { commentEdit(item.id) }}>{item.comments.length} { thumbUp(item.id) }}>{item.thumbsUp}
  • - + {commentId === item.id && { customInsert: function (insertImgFn, result) { // insertImgFn 可把图片插入到编辑器,传入图片 src ,执行函数即可 if (result && result.data && result.data.id) { - insertImgFn(`${fileHttpUrl}/busiAttachments/view/${result.data.id}`); + insertImgFn(`${httpUrl}/busiAttachments/view/${result.data.id}`); } } }, @@ -161,8 +185,10 @@ export default (props) => { setCommentHtml(html); }} /> - - + + + + }
    diff --git a/src/military/components/itemListAchieve/index.scss b/src/military/task/components/itemListAchieve/index.scss similarity index 87% rename from src/military/components/itemListAchieve/index.scss rename to src/military/task/components/itemListAchieve/index.scss index 69399ed86..7544184f7 100644 --- a/src/military/components/itemListAchieve/index.scss +++ b/src/military/task/components/itemListAchieve/index.scss @@ -17,4 +17,6 @@ text-align: center; } - +.fileCommentsList { + background: #FAFAFA; +} diff --git a/src/military/components/itemListMyTask/index.jsx b/src/military/task/components/itemListMyTask/index.jsx similarity index 89% rename from src/military/components/itemListMyTask/index.jsx rename to src/military/task/components/itemListMyTask/index.jsx index 930842752..791dea24b 100644 --- a/src/military/components/itemListMyTask/index.jsx +++ b/src/military/task/components/itemListMyTask/index.jsx @@ -1,18 +1,21 @@ import React, { useEffect, useState } from 'react'; -import { Icon, Modal, Pagination } from 'antd'; +import { Modal, Pagination } from 'antd'; import { Link } from "react-router-dom"; -import Nodata from '../../../forge/Nodata'; -import Loading from "../../../Loading"; -import { publishModeArr } from '../../task/static'; +import Nodata from 'forge/Nodata'; +import Loading from "src/Loading"; +import { publishModeArr ,taskStatusAllArr} from '../../static'; import './index.scss'; -const statusArr = ["草稿", "待审核", "已拒绝", "成果征集中", "成果评选中", "公示中", "协议签订中", "支付中", "已完成"]; +const statusArr = []; +for (const item of taskStatusAllArr){ + statusArr[item.dicItemCode]=item.dicItemName; +} export default (props) => { - const { list, itemClick, curPage, total, changePage, taskCategoryValueArr, loading } = props; + const { list, curPage, total, changePage, taskCategoryValueArr, loading } = props; const [page, setPage] = useState(1); - const [activeItem, setActiveItem] = useState(''); const [visibleProofs, setVisibleProofs] = useState(false); + const [activeItem,setActiveItem]=useState({}); const [pageSize, setPageSize] = useState(() => { return props.pageSize || 10; @@ -29,7 +32,7 @@ export default (props) => { return ( -