diff --git a/src/App.js b/src/App.js index e958782c..beaa0a36 100644 --- a/src/App.js +++ b/src/App.js @@ -68,12 +68,15 @@ const http500 = Loadable({ loading: Loading, }) // 个人主页 +// const InfosIndex = Loadable({ +// loader: () => import('./modules/user/usersInfo/InfosIndex'), +// loading: Loading, +// }) const InfosIndex = Loadable({ - loader: () => import('./modules/user/usersInfo/InfosIndex'), + loader: () => import('./forge/users/Infos'), loading: Loading, }) - class App extends Component { constructor(props) { super(props) @@ -257,8 +260,6 @@ class App extends Component { return () } }> - - () diff --git a/src/AppConfig.js b/src/AppConfig.js index 42ac4c23..b74dd678 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -98,9 +98,9 @@ export function initAxiosInterceptors(props) { // TODO 避免重复的请求 https://github.com/axios/axios#cancellation // TODO 读取到package.json中的配置? - // var proxy = "http://localhost:3000" + var proxy = "http://localhost:3000" // proxy = "https://pre-newweb.educoder.net" - var proxy = "https://testforgeplus.trustie.net/" + // var proxy = "https://testforgeplus.trustie.net/" // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 diff --git a/src/forge/Index.js b/src/forge/Index.js index 8d61a77a..9c4a90c5 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -1,62 +1,76 @@ -import React, { Component } from 'react'; +import React, { Component } from "react"; -import { Route, Switch } from 'react-router-dom'; -import { withRouter } from 'react-router' +import { Route, Switch } from "react-router-dom"; +import { withRouter } from "react-router"; +import { SnackbarHOC } from "educoder"; +import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC"; +import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC"; -import { SnackbarHOC } from 'educoder'; -import { CNotificationHOC } from '../modules/courses/common/CNotificationHOC'; -import { TPMIndexHOC } from '../modules/tpm/TPMIndexHOC'; +import "./css/index.css"; -import './css/index.css'; - -import Loadable from 'react-loadable'; -import Loading from '../Loading'; -import { ImageLayerOfCommentHOC } from '../modules/page/layers/ImageLayerOfCommentHOC'; +import Loadable from "react-loadable"; +import Loading from "../Loading"; +import { ImageLayerOfCommentHOC } from "../modules/page/layers/ImageLayerOfCommentHOC"; const ProjectNew = Loadable({ - loader: () => import('./New/Index'), + loader: () => import("./New/Index"), loading: Loading, -}) +}); const ProjectIndex = Loadable({ - loader: () => import('./Main/Index'), + loader: () => import("./Main/Index"), loading: Loading, -}) +}); const ProjectDetail = Loadable({ - loader: () => import('./Main/Detail'), + loader: () => import("./Main/Detail"), loading: Loading, -}) +}); + class Index extends Component { - render() { return (
- () - } + ( + + )} > - () - } + ( + + )} > - () - } + ( + + )} > - () - } + ( + + )} />
- ) + ); } } -export default withRouter(ImageLayerOfCommentHOC({ imgSelector: '.imageLayerParent img, .imageLayerParent .imageTarget', parentSelector: '.newMain' })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index))))); +export default withRouter( + ImageLayerOfCommentHOC({ + imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget", + parentSelector: ".newMain", + })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Index)))) +); diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 9d880ec0..ccbf10ca 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -112,6 +112,7 @@ const TrendsIndex = Loadable({ loader: () => import('../Activity/Activity'), loading: Loading, }) + /** * permission:Manager:管理员,Reporter:报告人员(只有读取权限),Developer:开发人员(除不能设置仓库信息外) */ @@ -239,11 +240,10 @@ class Detail extends Component { // fork项目 forkFunc = () => { - const { checkIfLogin } = this.props; - if (!checkIfLogin) { - this.props.showLoginDialog(); - return; - } + // if (!checkIfLogin) { + // this.props.showLoginDialog(); + // return; + // } this.setState({ isSpin: true }) diff --git a/src/forge/Newfile/UserSubmitComponent.js b/src/forge/Newfile/UserSubmitComponent.js index 6618fc15..12f2cb6a 100644 --- a/src/forge/Newfile/UserSubmitComponent.js +++ b/src/forge/Newfile/UserSubmitComponent.js @@ -121,7 +121,7 @@ class UserSubmitComponent extends Component { }; return (
- +
-
+
+ +

+
+
+
+
+ + {getFieldDecorator("branch_name", { + rules: [], + initialValue: branch_name, + })( + + )} + + + {getFieldDecorator("status_id", { + rules: [ + { + required: true, + message: "请选择完成状态", + }, + ], + initialValue: status_id, + })( + + )} + + + {getFieldDecorator("tracker_id", { + rules: [ + { + required: true, + message: "请选择类型", + }, + ], + initialValue: tracker_id, + })( + + )} + + + + {getFieldDecorator("priority_id", { + rules: [ + { + required: true, + message: "请选择优先度", + }, + ], + initialValue: priority_id, + })( + + )} + + + {getFieldDecorator("done_ratio", { + rules: [ + { + required: true, + message: "请选择完成度", + }, + ], + initialValue: done_ratio, + })( + + )} + + + {getFieldDecorator("fixed_version_id", { + rules: [], + initialValue: fixed_version_id, + })( + + )} + + + {getFieldDecorator("issue_tag_ids", { + rules: [], + initialValue: issue_tag_ids, + })( + + )} + + + + {getFieldDecorator("assigned_to_id", { + rules: [{}], + initialValue: assigned_to_id, + })( + + )} + + + + + + + + + + + {(show_token || (issue_type && issue_type === "2")) && ( + + {getFieldDecorator("token", { + rules: [ + { + required: true, + message: "请填写token值", + }, + ], + initialValue: token, + })()} + + )} +
+
+ + + ); + } +} +const WrappedNewForm = Form.create({ name: "NewOrderForm" })(order_form); +export default WrappedNewForm; diff --git a/src/forge/Upload/attachment.js b/src/forge/Upload/attachment.js index d1f099f2..812156f3 100644 --- a/src/forge/Upload/attachment.js +++ b/src/forge/Upload/attachment.js @@ -47,11 +47,11 @@ class Attachment extends Component{
{ attachments ? -
+
{ attachments.map((item,key)=>{ return( -
0 && Deleted.indexOf(item.id) !== -1) ? "none" : "block"}} className="mt10 attachment-list-div" > +
0 && Deleted.indexOf(item.id) !== -1) ? "none" : "block"}} className="pd510 attachment-list-div" > {item.title} diff --git a/src/forge/UsersList/focus_button.js b/src/forge/UsersList/focus_button.js index 9ea17173..8a640307 100644 --- a/src/forge/UsersList/focus_button.js +++ b/src/forge/UsersList/focus_button.js @@ -1,6 +1,6 @@ import React, { Component } from "react"; import axios from "axios"; -import { Spin, Button } from "antd"; +import { Button } from "antd"; import "./list.css"; class FocusButton extends Component { @@ -10,6 +10,9 @@ class FocusButton extends Component { is_watch: false, id: "", isSpin: false, + fontClass: "font-12", + starText: "关注", + is_block: false }; } @@ -22,6 +25,9 @@ class FocusButton extends Component { is_watch: this.props.is_watch, id: this.props.id, isSpin: false, + fontClass: this.props.fontClass ? this.props.fontClass : "font-12", + starText: this.props.starText ? this.props.starText : "关注", + is_block: this.props.is_block === undefined ? false : this.props.is_block }); }; @@ -46,23 +52,24 @@ class FocusButton extends Component { } }) .catch((error) => { + this.setState({isSpin: false}) console.log(error); }); }; render() { - const { is_watch, isSpin } = this.state; + const { is_watch, isSpin,fontClass,starText,is_block } = this.state; return ( - diff --git a/src/forge/comments/children_comments.js b/src/forge/comments/children_comments.js new file mode 100644 index 00000000..032168cd --- /dev/null +++ b/src/forge/comments/children_comments.js @@ -0,0 +1,206 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; + +import axios from "axios"; +import { getImageUrl } from "educoder"; +import { List, Popconfirm, Pagination, Button } from "antd"; +import Attachments from "../Upload/attachment"; +import RenderHtml from "../../components/render-html"; +import "../Order/order.css"; + +class children_comments extends Component { + constructor(props) { + super(props); + this.state = { + journalsdata: undefined, + limit: 10, + page: 1, + journal_spin: false, + search_count: 0, + }; + } + + componentDidMount() { + this.getChildrenJournals(); + } + componentDidUpdate(prevProps, prevState) { + if (this.props.children_comment_id) { + if (prevProps.children_comment_id !== this.props.children_comment_id) + this.getChildrenJournals(); + } + } + //获取评论信息 + getChildrenJournals = (i_order_id, i_parentId) => { + const { order_id, parent_id } = this.props; + const { page, limit } = this.state; + let new_order_id = i_order_id ? i_order_id : order_id; + let new_parent_id = i_parentId ? i_parentId : parent_id; + const url = `/issues/${new_order_id}/journals/${new_parent_id}/get_children_journals.json`; + axios + .get(url, { + params: { + page, + limit, + }, + }) + .then((result) => { + if (result) { + this.setState({ + journalsdata: result.data, + search_count: result.data.journals_count, + isSpin: false, + }); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + //删除评论 + deleteorder = (id) => { + const { order_id } = this.props; + const url = `/issues/${order_id}/journals/${id}.json`; + axios + .delete(url, { + data: { + issue_id: order_id, + id: id, + }, + }) + .then((result) => { + if (result) { + this.getChildrenJournals(); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + // 翻页 + ChangePage = (page) => { + this.state.page = page; + this.state.isSpin = true; + this.getChildrenJournals(); + }; + + commentCtx = (v) => { + return ; + }; + + render() { + const { + journalsdata, + page, + limit, + search_count, + isSpin, + parent_id, + } = this.state; + const { current_user } = this.props; + + const Paginations = ( + + {search_count > limit ? ( +
+ +
+ ) : ( + "" + )} +
+ ); + + const renderList = (item) => { + return ( +
+
+ + + + + + + {item && item.user_name} + + {item.created_at} + + + + {current_user && + (current_user.admin || + current_user.login === item.user_login) ? ( + this.deleteorder(item.id)} + > + + + ) : ( + "" + )} + + +
+
+ {this.commentCtx(item.content)} + {item && item.attachments && item.attachments.length > 0 ? ( + + ) : ( + "" + )} +
+
+ ); + }; + + return ( +
+ {search_count > 0 && ( +
+ {renderList(item)}} + /> + {Paginations} +
+ )} +
+ ); + } +} + +export default children_comments; diff --git a/src/forge/comments/children_journals.js b/src/forge/comments/children_journals.js new file mode 100644 index 00000000..98272bc4 --- /dev/null +++ b/src/forge/comments/children_journals.js @@ -0,0 +1,175 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; + +import axios from "axios"; +import { getImageUrl } from "educoder"; +import { List, Popconfirm, Pagination, Button } from "antd"; +import Attachments from "../Upload/attachment"; +// import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; +import RenderHtml from "../../components/render-html"; +import "../Order/order.css"; + +class children_journals extends Component { + constructor(props) { + super(props); + this.state = { + journalsdata: this.props.comments, + limit: 10, + page: 1, + journal_spin: false, + search_count: this.props.comments && this.props.comments.journals_count, + orderId: this.props.order_id, + parent_id: this.props.parent_id + }; + } + + //删除评论 + deleteorder = (id) => { + const { orderId, parent_id, page, limit } = this.state; + const url = `/issues/${orderId}/journals/${id}.json`; + axios + .delete(url, { + data: { + issue_id: orderId, + id: id, + }, + }) + .then((result) => { + if (result) { + this.props.getChildrenJournals(orderId,parent_id,1,limit); + // this.getChildrenJournals(); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + // 翻页 + ChangePage = (page) => { + const { orderId, parent_id, limit } = this.state; + this.state.page = page + this.state.isSpin = true + this.props.getChildrenJournals(orderId,parent_id,page,limit); + // this.getChildrenJournals(); + }; + + commentCtx = (v) => { + return ; + }; + + render() { + const { + journalsdata, + page, + limit, + search_count, + isSpin + } = this.state; + const { current_user } = this.props; + + const Paginations = ( + + {search_count > limit ? ( +
+ +
+ ) : ( + "" + )} +
+ ); + + const renderList = (item) => { + return ( +
+
+ + + + + + + {item && item.user_name} + + {item.created_at} + + + + {current_user && + (current_user.admin || + current_user.login === item.user_login) ? ( + this.deleteorder(item.id)} + > + + + ) : ( + "" + )} + + +
+
+ {this.commentCtx(item.content)} + {item && item.attachments && item.attachments.length > 0 ? ( + + ) : ( + "" + )} +
+
+ ); + }; + + return ( +
+ { + search_count > 0 && +
+ {renderList(item)}} + /> + {Paginations} +
+ } +
+ ); + } +} + +export default children_journals; diff --git a/src/forge/comments/comments.js b/src/forge/comments/comments.js new file mode 100644 index 00000000..8d14961c --- /dev/null +++ b/src/forge/comments/comments.js @@ -0,0 +1,518 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; + +import axios from "axios"; +import Upload from "../Upload/Index"; +import UploadImg from "../Images/upload.png"; +import { getImageUrl } from "educoder"; +import { List, Popconfirm, Pagination, Button } from "antd"; +import Attachments from "../Upload/attachment"; +import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; +import RenderHtml from "../../components/render-html"; +import ChildrenComments from "./children_comments"; +import "../Order/order.css"; + +class comments extends Component { + constructor(props) { + super(props); + this.state = { + content: undefined, + journalsdata: undefined, + isedit: undefined, + fileList: undefined, + limit: 10, + page: 1, + journal_spin: false, + edit_spin: false, + attachment_clean: true, + orderId: this.props.order_id, + is_reply: false, + reply_id: undefined, + reply_content: undefined, + new_journal_id: undefined, + }; + } + + componentDidMount = () => { + this.getjournalslist(); + }; + + //添加评论 + addjournals = () => { + const { content, reply_content } = this.state; + this.setState({ + journal_spin: true, + }); + if (!content && !reply_content) { + this.setState({ + journal_spin: false, + }); + return; + } + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + const { + page, + limit, + fileList, + orderId, + reply_id, + is_reply, + } = this.state; + + const url = `/issues/${orderId}/journals.json`; + + axios + .post(url, { + ...values, + content: is_reply ? reply_content : content, + issue_id: orderId, + attachment_ids: fileList, + parent_id: reply_id, + }) + .then((result) => { + if (result && result.data.status === 0) { + this.props.form.setFieldsValue({ + content: "", + reply_content: undefined, + }); + this.setState({ + showFiles: false, + content: "", + is_reply: false, + reply_id: undefined, + reply_content: undefined, + quillFlag: false, + journal_spin: false, + attachment_clean: false, + }); + this.state.new_journal_id = result.data.id; + this.getjournalslist(page, limit); + } + this.props.showNotification(result.data.message); + }) + .catch((error) => { + this.setState({ + journal_spin: false, + }); + console.log(error); + }); + } else { + this.setState({ + journal_spin: false, + }); + } + }); + }; + add_reply = (id) => { + this.setState({ + is_reply: true, + success_journal: false, + reply_id: id, + }); + }; + + cancel_reply = () => { + this.setState({ + is_reply: false, + reply_id: undefined, + success_journal: false, + reply_content: undefined, + }); + }; + //获取评论信息 + getjournalslist = (page, limit) => { + const { orderId } = this.state; + const url = `/issues/${orderId}/journals.json`; + let id = orderId; + axios + .get(url, { + params: { + id, + page, + limit, + }, + }) + .then((result) => { + if (result) { + this.setState({ + journalsdata: result.data, + search_count: result.data.journals_count, + isSpin: false, + fileList: undefined, + }); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + // 获取上传后的文件id数组 + UploadFunc = (fileList) => { + this.setState({ + fileList, + attachment_clean: true, + }); + }; + + //删除评论 + deleteorder = (id) => { + const { page, limit, orderId } = this.state; + const url = `/issues/${orderId}/journals/${id}.json`; + axios + .delete(url, { + data: { + issue_id: orderId, + id: id, + }, + }) + .then((result) => { + if (result) { + this.getjournalslist(page, limit); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + renderJournalList = (list) => { + if (list && list.length > 0) { + return list.map((item, key) => { + return ( +
+ {item.detail}: + + {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"} + + + {item.value && item.value.length > 0 ? ( + item.detail === "标签" ? ( + + {item.value[0].name} + + ) : ( + item.value + ) + ) : ( + "无" + )} + +
+ ); + }); + } else { + return ( +
+ 没有评论~ +
+ ); + } + }; + + // 翻页 + ChangePage = (page) => { + this.setState({ + page, + isSpin: true, + }); + const { limit } = this.state; + this.getjournalslist(page, limit); + }; + + // 判断是否重新上传文件 + changeIsComplete = (flag) => { + this.setState({ + showFiles: flag, + }); + }; + // 新建评论 + onContentChange = (value) => { + if (value) { + this.setState({ + content: value, + quillFlag: false, + }); + } + }; + replyContentChange = (value) => { + if (value) { + this.setState({ + reply_content: value, + quillFlag: false, + }); + } + }; + + onRef = (ref) => { + this.child = ref; + }; + + commentCtx = (v) => { + return ; + }; + + render() { + const { + journalsdata, + page, + limit, + search_count, + isSpin, + content, + quillFlag, + journal_spin, + attachment_clean, + is_reply, + reply_id, + reply_content, + orderId, + new_journal_id, + } = this.state; + const { current_user } = this.props; + + const Paginations = ( + + {search_count > limit ? ( +
+ +
+ ) : ( + "" + )} +
+ ); + + const new_comment = (is_reply, item_id) => { + return ( +
+ {current_user && current_user.login ? ( +
+
+ + + + + {current_user && current_user.real_name} + +
+ +

+ {quillFlag && 请输入评论内容} +

+ + } + size={100} + showNotification={this.props.showNotification} + /> +

+ {is_reply && ( + + )} + +

+
+ ) : ( +
+ 登录并参与到对话中 +
+ )} +
+ ); + }; + + const renderList = (item) => { + return ( +
+
+ + + + + + + {item && item.user_name} + + {item.created_at} + + + + {current_user && + (current_user.admin || + current_user.login === item.user_login) ? ( + this.deleteorder(item.id)} + > + + + ) : ( + "" + )} + + +
+
+ {item.content ? ( + this.commentCtx(item.content) + ) : ( +
{this.renderJournalList(item.journal_details)}
+ )} + {item && item.attachments && item.attachments.length > 0 ? ( + + ) : ( + "" + )} + +
+ + {current_user && ( +
+ {is_reply && reply_id && reply_id === item.id ? ( +
{new_comment(is_reply, item.id)}
+ ) : ( +
+ + + + + + +
+ )} +
+ )} +
+ ); + }; + + return ( +
+
+ {journalsdata && journalsdata.journals_total_count > 0 ? ( + 回复({journalsdata.journals_total_count})
} + dataSource={journalsdata.issue_journals} + renderItem={(item) => {renderList(item)}} + /> + ) : ( +
+
回复({search_count})
+
+ )} + {Paginations} +
{new_comment()}
+
+
+ ); + } +} + +export default comments; diff --git a/src/forge/comments/new.js b/src/forge/comments/new.js new file mode 100644 index 00000000..1498e36f --- /dev/null +++ b/src/forge/comments/new.js @@ -0,0 +1,636 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; + +import axios from "axios"; +import Upload from "../Upload/Index"; +import UploadImg from "../Images/upload.png"; +import { getImageUrl } from "educoder"; +import { List } from "antd"; +import Attachments from "../Upload/attachment"; +import MDEditor from "../../modules/tpm/challengesnew/tpm-md-editor"; +import RenderHtml from "../../components/render-html"; +import new_comment from "./new" +import "./order.css"; + +class comments extends Component { + constructor(props) { + super(props); + this.state = { + }; + } + + componentDidMount = () => { + this.getjournalslist(); + }; + + handleok = () => { + this.setState({ + isShow: false, + }); + }; + handleCancel = () => { + this.setState({ + isShow: false, + }); + }; + + imgshow = () => { + this.setState({ + isShow: true, + }); + }; + + //添加评论 + addjournals = () => { + const { quillValue } = this.state; + this.setState({ + journal_spin: true, + }); + if (!quillValue) { + this.setState({ + quillFlag: true, + journal_spin: false, + }); + return; + } + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + const { data, page, limit, fileList } = this.state; + const url = `/issues/${data.id}/journals.json`; + axios + .post(url, { + ...values, + content: quillValue, + issue_id: data.id, + attachment_ids: fileList, + }) + .then((result) => { + if (result) { + this.props.showNotification("评论成功!"); + this.props.form.setFieldsValue({ + content: "", + }); + this.setState({ + showFiles: false, + quillValue: "", + quillFlag: false, + journal_spin: false, + }); + this.getjournalslist(page, limit); + } + }) + .catch((error) => { + this.setState({ + journal_spin: false, + }); + console.log(error); + }); + } else { + this.setState({ + journal_spin: false, + }); + } + }); + }; + //获取评论信息 + getjournalslist = (page, limit) => { + const { data } = this.state; + const url = `/issues/${data.id}/journals.json`; + let id = data.id; + axios + .get(url, { + params: { + id, + page, + limit, + }, + }) + .then((result) => { + if (result) { + this.setState({ + journalsdata: result.data, + search_count: result.data.journals_count, + isSpin: false, + fileList: undefined, + }); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + //修改评论 + updatedetail = (id) => { + const { page, limit, countvalue } = this.state; + const { orderId } = this.props.match.params; + this.setState({ + edit_spin: true, + }); + const url = `/issues/${orderId}/journals/${id}.json`; + axios + .put(url, { + issue_id: orderId, + id: id, + content: countvalue, + }) + .then((result) => { + if (result) { + this.setState({ + isedit: undefined, + edit_spin: false, + }); + this.getjournalslist(page, limit); + } + }) + .catch((error) => { + this.setState({ + edit_spin: false, + }); + console.log(error); + }); + }; + // 获取上传后的文件id数组 + UploadFunc = (fileList) => { + this.setState({ + fileList, + }); + }; + + //删除评论 + deleteorder = (id) => { + const { orderId } = this.props.match.params; + const { page, limit } = this.state; + const url = `/issues/${orderId}/journals/${id}.json`; + axios + .delete(url, { + data: { + issue_id: orderId, + id: id, + }, + }) + .then((result) => { + if (result) { + this.getjournalslist(page, limit); + } + }) + .catch((error) => { + console.log(error); + }); + }; + + editdetail = (count, status) => { + this.setState({ + countvalue: this.stringJson(count), + isedit: status, + }); + }; + + renderJournalList = (list) => { + if (list && list.length > 0) { + return list.map((item, key) => { + return ( +
+ {item.detail}: + + {item.old_value && item.old_value.length > 0 ? "更新为" : "新增"} + + + {item.value && item.value.length > 0 ? ( + item.detail === "标签" ? ( + + {item.value[0].name} + + ) : ( + item.value + ) + ) : ( + "无" + )} + +
+ ); + }); + } else { + return ( +
+ 没有评论~ +
+ ); + } + }; + + // 翻页 + ChangePage = (page) => { + this.setState({ + page, + isSpin: true, + }); + const { limit } = this.state; + this.getjournalslist(page, limit); + }; + + // 判断是否重新上传文件 + changeIsComplete = (flag) => { + this.setState({ + showFiles: flag, + }); + }; + // 新建评论 + onContentChange = (value) => { + if (value) { + this.setState({ + quillValue: value, + quillFlag: false, + }); + } + }; + // 编辑评论 + onEditContentChange = (value) => { + if (value) { + this.setState({ + countvalue: value, + }); + } + }; + + handleShowImage = (value) => { + this.setState({ + imageUrl: value, + visible: true, + }); + }; + setVisible = (flag) => { + this.setState({ + visible: flag, + }); + }; + + stringJson = (value) => { + let _value = null; + + try { + _value = JSON.parse(value); + } catch (e) { + _value = value; + } + return _value; + }; + + commentCtx = (v) => { + return ; + }; + + render() { + const { projectsId, orderId } = this.props.match.params; + const { + data, + journalsdata, + page, + limit, + search_count, + isSpin, + isedit, + quillFlag, + countvalue, + edit_spin, + } = this.state; + const { current_user } = this.props; + const Paginations = ( + + {search_count > limit ? ( +
+ +
+ ) : ( + "" + )} +
+ ); + const renderList = () => { + if ( + journalsdata && + journalsdata.issue_journals && + journalsdata.issue_journals.length > 0 + ) { + return ( +
+ {journalsdata.issue_journals.map((item, key) => { + return ( +
  • + {key > 0 && ( +
    + )} +
    + + + + +
    +
    +

    + {item.user_name} + 评论于 + + {item.created_at} + +

    +
    + + this.editdetail(item.content, item.id) + } + className="detail_edit_action" + > + 编辑 + + this.deleteorder(item.id)} + > + 删除 + +
    +
    +
    +
    + {item.content ? ( + this.commentCtx(item.content) + ) : ( +
    + {this.renderJournalList(item.journal_details)} +
    + )} + {item && + item.attachments && + item.attachments.length > 0 ? ( + + ) : ( + "" + )} +
    + +
    +
    +
    +
    +
    +
    +
  • + ); + })} +
    + ); + } + }; + + return ( +
    +
    + //
    + // {visible && } + //
    + //
    + //

    + // { + // data ? + // 【{data.issue_classify === "issue" ? (data.tracker ? data.tracker : "缺陷") : "合并请求"}】 + // : + // "" + // } + // {data && data.subject} + + //

    + //

    + // {data && data.issue_status === "关闭" ? "关闭中" : "开启中"} + // + // 由 {data && data.author_name} 于 {data && data.created_at}创建{data && data.journals_count && data.journals_count > 0 ? ` · ${data.journals_count} 条评论` : ""} + // + // { + // data && data.user_permission ? + // + // 复制 + // this.deletedetail(orderId)}> + // 删除 + // + + // 编辑 + // + // : + // "" + // } + //

    + + //
    + //
    + //
    + //
    + // + //
    + //
    + // {data && data.description && (data.description.length > 0) ? this.commentCtx(data.description) : 没有描述} + //
    + // { + // data && data.attachments && data.attachments.length > 0 ? + // + // : + // "" + // } + //
    + //
    + //
    + // + //
      + // {renderList()} + //
    + //
    + + // {Paginations} + // { + // current_user && current_user.login ? + // + //
    + //
    + // + //
    + //
    + // + //

    + // {quillFlag && 请输入评论内容} + //

    + //
    + // + //

    + // + // 评论 + // { + // data && data.user_permission ? + // this.closedetail(data && data.issue_status === "关闭" ? 2 : 5)}>{data && data.issue_status === "关闭" ? "重新开启" : "关闭"} + // : + // "" + // } + // + + //

    + //
    + //
    + //
    + // : + //
    登录并参与到对话中
    + // } + + //
    + //
    + //

    + // 分支 + // { + // data && data.branch_name ? data.branch_name : "--" + // } + //

    + //

    + // 标签 + // { + // data && data.issue_tags ? {data.issue_tags[0].name} : "--" + // } + //

    + //

    + // 里程碑 + // { + // data && data.version ? data.version : "--" + // } + //

    + //

    + // 当前状态 + // { + // data && data.issue_status ? data.issue_status : "--" + // } + //

    + //

    + // 分类 + // { + // data && data.tracker ? data.tracker : "--" + // } + //

    + //

    + // 指派给 + // {data && data.assign_user_name ? data.assign_user_name : "--"} + //

    + //

    + // 优先级 + // {data && data.priority ? data.priority : "--"} + //

    + //

    + // 完成度 + // {data && data.done_ratio ? data.done_ratio : "--"} + //

    + + //
    + //
    + //
    + // + // + // + //
    + ); + } +} + +export default comments; diff --git a/src/forge/css/index.css b/src/forge/css/index.css index 5065fac3..c8d05f63 100644 --- a/src/forge/css/index.css +++ b/src/forge/css/index.css @@ -115,4 +115,5 @@ ul,ol,dl{ } .ver-middle{ vertical-align: middle; -} \ No newline at end of file +} +.pd510{padding: 5px 10px;} \ No newline at end of file diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js new file mode 100644 index 00000000..00070b84 --- /dev/null +++ b/src/forge/users/Infos.js @@ -0,0 +1,191 @@ +import React, { Component } from "react"; +import { Link } from "react-router-dom"; +import { Avatar, Tag, Button, Pagination, Spin, Dropdown, Menu } from "antd"; +import FocusButton from "../UsersList/focus_button"; + +import axios from "axios"; +import { getImageUrl } from "educoder"; +import { Route, Switch } from "react-router-dom"; +import { withRouter } from "react-router"; + +import { SnackbarHOC } from "educoder"; +import { CNotificationHOC } from "../../modules/courses/common/CNotificationHOC"; +import { TPMIndexHOC } from "../../modules/tpm/TPMIndexHOC"; +import "./new_user.css"; +import "../css/index.css"; + +import Loadable from "react-loadable"; +import Loading from "../../Loading"; +import { ImageLayerOfCommentHOC } from "../../modules/page/layers/ImageLayerOfCommentHOC"; + +const InfosIndex = Loadable({ + loader: () => import("./InfosUser"), + loading: Loading, +}); + +class Infos extends Component { + constructor(props) { + super(props); + this.state = { + isSpin: false, + user: undefined, + }; + } + + componentDidMount = () => { + this.fetchUser(); + }; + + fetchUser = () => { + let url = `/users/${this.props.match.params.username}.json`; + axios + .get(url) + .then((result) => { + this.setState({ + user: result.data, + }); + }) + .catch((error) => { + console.log(error); + this.setState({ + isSpin: false, + }); + }); + }; + + render() { + const { current_user, mygetHelmetapi } = this.props; + const { user } = this.state; + return ( +
    +
    +
    +
    +
    + + {user && user.user_identity && ( +
    + {user && user.user_identity} +
    + )} + +
    + {user && current_user && user.login === current_user.login && ( +
    + +
    + )} + {current_user && user && user.login !== current_user.login && ( +
    + +
    + )} +
    +
    + +
    我关注的
    + {user && user.watching_count} + + +
    关注我的
    + {user && user.watched_count} + +
    +
    +
    + {current_user && user && current_user.id === user.id && ( +
    +
    +

    + + + 待办事项 + + + {user.undo_events} + +

    +
    +
    + )} +
    +
      + +
    • +

      + 托管项目 + 3773 +

      +
    • +
    • +

      + 镜像项目 + 3 +

      +
    • +
    +
    +
    +
    +

    + + + 组织 + + + {user && user.undo_events} + +

    +
    +
    +
    +
    + + { + return ; + }} + > + +
    +
    +
    + ); + } +} +export default withRouter( + ImageLayerOfCommentHOC({ + imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget", + parentSelector: ".newMain", + })(CNotificationHOC()(SnackbarHOC()(TPMIndexHOC(Infos)))) +); diff --git a/src/forge/users/InfosUser.js b/src/forge/users/InfosUser.js new file mode 100644 index 00000000..967ca151 --- /dev/null +++ b/src/forge/users/InfosUser.js @@ -0,0 +1,105 @@ +import React, { Component } from "react"; +// import { SnackbarHOC } from 'educoder'; +import { Link } from "react-router-dom"; +import { Avatar, Tag, Button, Pagination, Spin, Dropdown, Menu } from "antd"; +import FocusButton from "../UsersList/focus_button"; + +import axios from "axios"; +import { getImageUrl } from "educoder"; +import NoneData from "../Nodata"; + +// import "./new_user.css"; +import "../css/index.css"; + +class InfosUser extends Component { + constructor(props) { + super(props); + this.state = { + category: undefined, + status: undefined, + page: 1, + per_page: 16, + sort_by: "updated_on", + sort_direction: "desc", + totalCount: undefined, + data: undefined, + isSpin: false, + + }; + } + + componentDidMount = () => { + }; + + + + //切换种类 + changeCategory = (cate) => { + this.setState({ + category: cate, + page: 1, + isSpin: true, + }); + let { status, sort_by, sort_direction } = this.state; + this.getCourses(cate, status, 1, sort_by, sort_direction); + }; + //切换状态 + changeStatus = (status) => { + this.setState({ + status: status, + page: 1, + isSpin: true, + }); + let { category, sort_by, sort_direction } = this.state; + this.getCourses(category, status, 1, sort_by, sort_direction); + }; + //切换页数 + changePage = (page) => { + this.setState({ + page, + isSpin: true, + }); + let { category, status, sort_by, sort_direction } = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); + }; + + //切换种类 + updatedlist(sort_by) { + //按照什么样子排序 + this.setState({ + isSpin: true, + }); + let { category, status, page, sort_direction } = this.state; + this.getCourses(category, status, 1, sort_by, "desc"); + } + + //排序 + updatedlists(sort_directions) { + //是否是倒序 + this.setState({ + isSpin: true, + }); + let { category, status, page, sort_by, sort_direction } = this.state; + let sort_directiony = sort_directions; + if (sort_directions === "asc") { + if (sort_directions === sort_direction) { + sort_directiony = "desc"; + } + } else if (sort_directions === "desc") { + if (sort_directions === sort_direction) { + sort_directiony = "asc"; + } + } + this.getCourses(category, status, page, sort_by, sort_directiony); + } + + render() { + + return ( +
    + ddddd +
    + ); + } +} +export default InfosUser; diff --git a/src/forge/users/new_user.css b/src/forge/users/new_user.css new file mode 100644 index 00000000..7bed9599 --- /dev/null +++ b/src/forge/users/new_user.css @@ -0,0 +1,101 @@ +.new-content-flex{ + width: 1200px; + margin: 20px auto; + display: -ms-flexbox; + display: flex; + -ms-flex-align: start; + align-items: flex-start; + -ms-flex-wrap: wrap; + flex-wrap: wrap; +} +.list-left{ + width: 26%; + padding-right: 20px; + box-sizing: border-box; + margin-bottom: 20px; +} +.list-right{ + width:74%; + background: #fff; + padding:10px; +} +.list-l-Menu{ + margin-bottom: 12px; + border-radius:2px; + background-color: #fff; +} +.list-l-Menu>li{ + font-size: 1rem; + padding:0px 0px 0px 20px; + box-sizing: border-box; + position: relative; +} +.list-l-Menu>li > p{ + height: 62px; + line-height: 62px; + width: 100%; + border-bottom: 1px solid #eee; + display: flex; + justify-content: space-between; + cursor: pointer; + padding-right: 20px; +} +.list-l-Menu>li:last-child > p{ + border-bottom: none; +} +.list-l-Menu li p span:last-child{ + color: #999; +} +.list-l-Menu .MenuTitle{ + font-size: 16px; + background-size: 100% 100%; + height: 62px; + line-height: 62px; + border-bottom: 1px solid #E0E0E0; +} +.list-l-Menu > li:not(.MenuTitle):hover{ + background-color: #fafafa; +} + +/* 左侧menu */ +.list-l-Menu .ant-menu-inline{ + border:none; +} +.list-l-Menu .ant-menu-inline .ant-menu-item{ + width:100%!important; +} +.list-l-Menu .ant-menu-item-group-title{ + padding:0px; +} +.list-l-Menu li.active{ + background-color: #fafafa; +} +.list-l-Menu li.active::before{ + position: absolute; + left: 0px; + top: 10px; + width: 6px; + content: ''; + height: 33px; + background: #4CACFF; +} +.text-center{text-align: center;} +.mt-n15{margin-top: -15px;} +.position-relative{position: relative;} +.mr-5{margin-right: 5px;} +a.text-button-grey{ + color: rgba(0, 0, 0, 0.65) +} +.user-info-star-button{margin: 20px 50px 0 50px} +.list-l-p{ + width: 100%; + display: -ms-flexbox; + display: flex; + -ms-flex-pack: justify; + justify-content: space-between; + cursor: pointer; + padding-right: 20px; +} +.fwb { + font-weight: bold; +} \ No newline at end of file diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 4c2f499d..4d89f6a9 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -922,12 +922,13 @@ class NewHeader extends Component {
    • - {user.username} + 个人中心 + {/* {user.username} */}
    • - { + {/* { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.edit_account &&
    • 修改资料
    • - } + } */} { mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_courses &&
    • 我的课程
    • diff --git a/src/modules/tpm/TPMIndex.css b/src/modules/tpm/TPMIndex.css index dde8c34c..1f40ed79 100644 --- a/src/modules/tpm/TPMIndex.css +++ b/src/modules/tpm/TPMIndex.css @@ -96,7 +96,7 @@ body>.-task-title { } .newContainer { - background: #fafafa !important; + background: #EAEBEC !important; } .ant-modal-title { diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 4136ae3a..a196967a 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -581,7 +581,7 @@ export function TPMIndexHOC(WrappedComponent) { } render() { - let { Headertop, Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype } = this.state; + let { Headertop, Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state; const common = { isSuperAdmin: this.isSuperAdmin, isAdminOrCreator: this.isAdminOrCreator, diff --git a/src/modules/tpm/challengesnew/tpm-md-editor.js b/src/modules/tpm/challengesnew/tpm-md-editor.js index 34507ff4..9105f23f 100644 --- a/src/modules/tpm/challengesnew/tpm-md-editor.js +++ b/src/modules/tpm/challengesnew/tpm-md-editor.js @@ -75,14 +75,14 @@ function md_elocalStorage(editor, mdu, id) { } -export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, className = '', noStorage = false, imageExpand = true, placeholder = '', width = '100%', height = 400, initValue = '', emoji, watch, showNullButton = false, showResizeBar = false, startInit = true }) => { +export default ({ mdID,onChange,autoFocus,onCMBeforeChange, onCMBlur, error = false, className = '', noStorage = false, imageExpand = true, placeholder = '', width = '100%', height = 400, initValue = '', emoji, watch, showNullButton = false, showResizeBar = false, startInit = true }) => { const editorEl = useRef() const resizeBarEl = useRef() const [editorInstance, setEditorInstance] = useState() const containerId = `mdEditor_${mdID}` const editorBodyId = `mdEditors_${mdID}` - const tipId = `e_tips_mdEditor_${mdID}` + const tipId = `e_tips_mdEditor_${mdID}` function onLayout() { let ro @@ -92,7 +92,10 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla if (entry.target.offsetHeight > 0 || entry.target.offsetWidth > 0) { editorInstance.resize() editorInstance.cm.refresh() - editorInstance.cm.focus() + // if(autofocus){ + // editorInstance.cm.focus() + // } + } } }) @@ -102,6 +105,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla } useEffect(() => { + if (editorInstance) { return } @@ -120,7 +124,7 @@ export default ({ mdID, onChange, onCMBeforeChange, onCMBlur, error = false, cla searchReplace: true, htmlDecode: "style,script,iframe", sequenceDiagram: true, - autoFocus: false, + autoFocus: autoFocus === undefined ? false : autoFocus, watch: watch === undefined ? true : watch, saveHTMLToTextarea: true,