diff --git a/public/css/iconfont.css b/public/css/iconfont.css index 080d38a7..92de082a 100644 --- a/public/css/iconfont.css +++ b/public/css/iconfont.css @@ -1,8 +1,8 @@ @font-face { font-family: "iconfont"; /* Project id 2340181 */ - src: url('iconfont.woff2?t=1649726899310') format('woff2'), - url('iconfont.woff?t=1649726899310') format('woff'), - url('iconfont.ttf?t=1649726899310') format('truetype'); + src: url('iconfont.woff2?t=1651041108151') format('woff2'), + url('iconfont.woff?t=1651041108151') format('woff'), + url('iconfont.ttf?t=1651041108151') format('truetype'); } .iconfont { @@ -13,6 +13,10 @@ -moz-osx-font-smoothing: grayscale; } +.icon-personal-center:before { + content: "\e927"; +} + .icon-bangzhuzhongxinicon:before { content: "\e926"; } diff --git a/public/css/iconfont.js b/public/css/iconfont.js index 709a100e..b910937d 100644 --- a/public/css/iconfont.js +++ b/public/css/iconfont.js @@ -1 +1 @@ -!function(a){var l,c,h,i,o,z='',t=(t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss"),p=function(a,l){l.parentNode.insertBefore(a,l)};if(t&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}function v(){o||(o=!0,h())}function m(){try{i.documentElement.doScroll("left")}catch(a){return void setTimeout(m,50)}v()}l=function(){var a,l=document.createElement("div");l.innerHTML=z,z=null,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?p(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),l()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(h=l,i=a.document,o=!1,m(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,v())})}(window); \ No newline at end of file +!function(a){var l,c,h,i,o,z='',t=(t=document.getElementsByTagName("script"))[t.length-1].getAttribute("data-injectcss"),p=function(a,l){l.parentNode.insertBefore(a,l)};if(t&&!a.__iconfont__svg__cssinject__){a.__iconfont__svg__cssinject__=!0;try{document.write("")}catch(a){console&&console.log(a)}}function v(){o||(o=!0,h())}function m(){try{i.documentElement.doScroll("left")}catch(a){return void setTimeout(m,50)}v()}l=function(){var a,l=document.createElement("div");l.innerHTML=z,z=null,(l=l.getElementsByTagName("svg")[0])&&(l.setAttribute("aria-hidden","true"),l.style.position="absolute",l.style.width=0,l.style.height=0,l.style.overflow="hidden",l=l,(a=document.body).firstChild?p(l,a.firstChild):a.appendChild(l))},document.addEventListener?~["complete","loaded","interactive"].indexOf(document.readyState)?setTimeout(l,0):(c=function(){document.removeEventListener("DOMContentLoaded",c,!1),l()},document.addEventListener("DOMContentLoaded",c,!1)):document.attachEvent&&(h=l,i=a.document,o=!1,m(),i.onreadystatechange=function(){"complete"==i.readyState&&(i.onreadystatechange=null,v())})}(window); \ No newline at end of file diff --git a/public/css/iconfont.json b/public/css/iconfont.json index d1a1779f..3bf3eb57 100644 --- a/public/css/iconfont.json +++ b/public/css/iconfont.json @@ -5,6 +5,13 @@ "css_prefix_text": "icon-", "description": "", "glyphs": [ + { + "icon_id": "29206429", + "name": "personal-center", + "font_class": "personal-center", + "unicode": "e927", + "unicode_decimal": 59687 + }, { "icon_id": "28888753", "name": "帮助中心icon", diff --git a/public/css/iconfont.ttf b/public/css/iconfont.ttf index 976c59a3..76ccae2b 100644 Binary files a/public/css/iconfont.ttf and b/public/css/iconfont.ttf differ diff --git a/public/css/iconfont.woff b/public/css/iconfont.woff index c2a9a151..be0e660d 100644 Binary files a/public/css/iconfont.woff and b/public/css/iconfont.woff differ diff --git a/public/css/iconfont.woff2 b/public/css/iconfont.woff2 index a7418992..51640e89 100644 Binary files a/public/css/iconfont.woff2 and b/public/css/iconfont.woff2 differ diff --git a/src/App.css b/src/App.css index 8d916d39..55bdd7f4 100644 --- a/src/App.css +++ b/src/App.css @@ -93,6 +93,9 @@ body { .editormd-preview .markdown-body{ padding:0px !important; } +.editormd-preview{ + width: 50%!important; +} /* 图片点击放大的场景,隐藏图片链接 */ .editormd-image-click-expand .editormd-image-dialog { diff --git a/src/AppConfig.js b/src/AppConfig.js index b4107e46..cd3aca3d 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -25,7 +25,7 @@ if (isDev) { } debugType = window.location.search.indexOf('debug=t') !== -1 ? 'teacher' : window.location.search.indexOf('debug=s') !== -1 ? 'student' : - window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'admin' + window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 'student' } window._debugType = debugType; export function initAxiosInterceptors(props) { diff --git a/src/forge/Main/CoderDepot.jsx b/src/forge/Main/CoderDepot.jsx index 6d45159b..4183131b 100644 --- a/src/forge/Main/CoderDepot.jsx +++ b/src/forge/Main/CoderDepot.jsx @@ -436,7 +436,7 @@ function CoderDepot(props){
{ baseOperate && - urlLink(`/${owner}/${projectsId}/compare/master...${turnbar(branchName || defaultBranch)}`)} >+ 合并请求 + urlLink(`/${owner}/${projectsId}/compare/${turnbar(branchName || defaultBranch)}...${turnbar(branchName || defaultBranch)}`)} >+ 合并请求 } { issuesFlag && diff --git a/src/forge/Main/tree/Index.jsx b/src/forge/Main/tree/Index.jsx index 2829331b..f7aa7bd8 100644 --- a/src/forge/Main/tree/Index.jsx +++ b/src/forge/Main/tree/Index.jsx @@ -14,8 +14,8 @@ function Index(props) { const [ isSpin , setIsSpin ] = useState(true); const { projectsId , owner } = props.match.params; - const { isManager , isDeveloper , projectDetail } = props; - + const { isManager , isDeveloper , projectDetail , defaultBranch } = props; + useEffect(()=>{ getList(); },[]) @@ -85,7 +85,7 @@ function Index(props) {
{ (isManager || isDeveloper) && (projectDetail && projectDetail.type!==2) && - + 合并请求 + + 合并请求 } 下载 diff --git a/src/forge/Merge/CreateMerge.js b/src/forge/Merge/CreateMerge.js index e6d0d037..e4ac51d4 100644 --- a/src/forge/Merge/CreateMerge.js +++ b/src/forge/Merge/CreateMerge.js @@ -116,68 +116,45 @@ class CreateMerge extends Component { this.setState({ isSpin: true }); const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams; const url = `/${pullOwner}/${projectId}/pulls/new.json`; - axios - .get(url) - .then((result) => { - if (result) { - if(init){ - //页面初始化时调用selectProjectName,给is_original、fork_project_id、merge_user_login赋值 - const initUser = result.data.projects_names && result.data.projects_names.filter((item)=>item.project_user_login === branchParams.mergeOwner); - initUser && initUser[0] && this.selectProjectName(initUser[0].id,false,{projects_names: result.data.projects_names,id: result.data.id}); - } - this.setState({isSpin: false}); - // 如果url上的分支不存在,取默认值master - const noMergeBranch = - (result.data.branches || []).filter( - (branch) => branch.name === returnbar(mergeBranch) - ).length === 0; - const noPullBranch = - (result.data.branches || []).filter( - (branch) => branch.name === returnbar(pullBranch) - ).length === 0; - this.setState({ - // isFork: result.data.is_fork, - projects_names: result.data.projects_names, - mergeProjects: result.data.merge_projects, - pullBranches: result.data.branches, - mergeBranches: result.data.branches, - project_id: result.data.project_id, - id: result.data.id, - merge: returnbar(mergeBranch), - pull: returnbar(pullBranch), - }); - - //判断源分支是否存在 - if(noPullBranch){ - this.setState({ - showMessage: true, - defaultMessage:'源分支不存在', - isCompareSpin: false, - }); - }else{ - if(pullOwner === returnbar(mergeOwner)){ - if (!noMergeBranch) { - this.compareProject(true, branchParams); - } else { - this.setState({ - showMessage: true, - defaultMessage:'目标分支不存在', - isCompareSpin: false, - }); - } - }else{ - this.getBranchList(branchParams); - } - } + axios.get(url).then((result) => { + if (result) { + if(init){ + //页面初始化时调用selectProjectName,给is_original、fork_project_id、merge_user_login赋值 + const initUser = result.data.projects_names && result.data.projects_names.filter((item)=>item.project_user_login === branchParams.mergeOwner); + initUser && initUser[0] && this.selectProjectName(initUser[0].id,false,{projects_names: result.data.projects_names,id: result.data.id}); } - this.setState({ isSpin: false }); - }) - .catch((error) => { - this.setState({ isSpin: false }); - console.log(error); - }); + this.setState({ + // isFork: result.data.is_fork, + projects_names: result.data.projects_names, + mergeProjects: result.data.merge_projects, + // pullBranches: result.data.branches, + // mergeBranches: result.data.branches, + project_id: result.data.project_id, + id: result.data.id, + merge: returnbar(mergeBranch), + pull: returnbar(pullBranch), + }); + this.checkBranch(branchParams); + this.setState({ + isSpin: false,isCompareSpin: false + }); + } + }) + .catch((error) => { + this.setState({ isSpin: false }); + console.log(error); + }); }; + checkBranch=async(branchParams)=>{ + const { mergeBranch , mergeOwner, projectId , pullBranch ,pullOwner} = branchParams; + let getbranch =await this.getBranchList(mergeOwner,projectId,pullBranch,mergeBranch); + // let checkpull =await this.getBranchList(pullOwner,projectId,pullBranch,"pull"); + if(getbranch){ + this.compareProject(mergeOwner === pullOwner, branchParams); + } + } + // compare接口,获取分支对比信息 compareProject = (sameProject, branchParams) => { const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams; @@ -187,8 +164,6 @@ class CreateMerge extends Component { } else { url += `/${Base64.encode(returnbar(mergeBranch))}...${pullOwner}/${projectId}:${Base64.encode(returnbar(pullBranch))}.json`; } - console.log(url); - this.setState({ isSpin: false, isCompareSpin: true }); axios .get(url) .then((result) => { @@ -219,31 +194,40 @@ class CreateMerge extends Component { }; // 根据所有者、仓库名,获取分支列表,目前仅涉及目标仓库分支查询 - getBranchList = (branchParams) => { - const { mergeOwner, projectId, mergeBranch } = branchParams; - this.setState({ isSpin: true }); - const url = `/${mergeOwner}/${projectId}/pulls/get_branches.json`; - axios - .get(url) - .then((result) => { - if (result) { - const noMergeBranch = - (result.data || []).filter((branch) => branch.name === mergeBranch) - .length === 0; + getBranchList =async(owner,identifier,branch,mergebranch) => { + const url = `/${owner}/${identifier}/branches.json`; + let check = await axios.get(url).then((result) => { + if(result.data){ + let pfilter = (result.data || []).filter(i => i.name === branch).length === 0; + let mfilter = (result.data || []).filter(i => i.name === mergebranch).length === 0; + if(pfilter){ this.setState({ - mergeBranches: result.data, - showMessage: noMergeBranch, - defaultMessage: '目标分支不存在', - isCompareSpin: false, + showMessage: branch, + defaultMessage: `源分支不存在`, + isCompareSpin: false }); - !noMergeBranch && this.compareProject(false, branchParams); + return false; } - this.setState({ isSpin: false }); - }) - .catch((error) => { - this.setState({ isSpin: false }); - console.log(error); - }); + if(mfilter){ + this.setState({ + showMessage: mergebranch, + defaultMessage: `目标分支不存在`, + isCompareSpin: false + }); + return false; + } + this.setState({ + pullBranches:result.data, + mergeBranches:result.data + }) + return true; + } + }) + .catch((error) => { + this.setState({ isSpin: false }); + check = false; + }); + return check; }; // 切换分支事件 @@ -291,14 +275,16 @@ class CreateMerge extends Component { }); // 加上是否需要切换url判断 if(isChangeProject){ + const { defaultBranch } = this.props; + let branch = turnbar(defaultBranch) || "master"; if (login === pullOwner) { // 如果切换后, 仓库与源仓库一致了 this.props.history.push( - `/${login}/${identifier}/compare/master...${turnbar(pullBranch)}` + `/${login}/${identifier}/compare/${branch}...${turnbar(pullBranch)}` ); } else { this.props.history.push( - `/${login}/${identifier}/compare/master...${pullOwner}:${turnbar(pullBranch)}` + `/${login}/${identifier}/compare/${branch}...${pullOwner}:${turnbar(pullBranch)}` ); } } @@ -336,6 +322,32 @@ class CreateMerge extends Component { return
; }; + // 源分支-分支搜索 + changePullValue=async(value,cate)=>{ + const branchParams = getBranchParams(this.props.location.pathname); + const { pullOwner, mergeOwner , projectId } = branchParams; + const url = `/${cate === "pull" ? pullOwner :mergeOwner}/${projectId}/pulls/get_branches.json`; + axios.get(url,{ + params:{ + name:value || undefined, + } + }).then(result=>{ + if(result){ + if(cate === "pull"){ + this.setState({ + pullBranches:result.data, + pullBranch:result.data + }) + }else{ + this.setState({ + mergeBranches:result.data, + mergeBranch:result.data + }) + } + } + }).catch(error=>{}) + } + render() { const { data, @@ -355,7 +367,6 @@ class CreateMerge extends Component { } = this.state; let { project } = this.props; - return (
@@ -378,6 +389,8 @@ class CreateMerge extends Component { className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} dropdownClassName="overlihide" + // onSearch={(e)=>this.changePullValue(e,"pull")} + // filterOption={(input,option)=>option} > {this.renderBrances(pullBranches)} @@ -406,6 +419,8 @@ class CreateMerge extends Component { className="merge-flex1 flex1 matchwidth" dropdownMatchSelectWidth={false} dropdownClassName="overlihide" + // onSearch={(e)=>this.changePullValue(e,"merge")} + // filterOption={(input,option)=>option} > {this.renderBrances(mergeBranches)} diff --git a/src/forge/Merge/merge.css b/src/forge/Merge/merge.css index 0ac43c7d..0fc5effb 100644 --- a/src/forge/Merge/merge.css +++ b/src/forge/Merge/merge.css @@ -226,4 +226,7 @@ form .ant-cascader-picker, form .ant-select { /* 距离底部加大 @列表被遮挡 */ .updateMerge{ margin: 30px auto 60px; + } + .searchIcon .ant-select-arrow{ + margin-top:-9px } \ No newline at end of file diff --git a/src/forge/Merge/merge.js b/src/forge/Merge/merge.js index 0f6f1ac8..769d2d47 100644 --- a/src/forge/Merge/merge.js +++ b/src/forge/Merge/merge.js @@ -6,6 +6,7 @@ import "../Order/index.scss"; import NoneData from "./no_data"; import MergeItem from "./MergeItem"; import './Index.scss'; +import { turnbar } from "educoder"; import axios from "axios"; import CheckProfile from '../Component/ProfileModal/Profile'; @@ -210,10 +211,11 @@ class merge extends Component { this.getIssueList(); }; - checkOperation() { + const { defaultBranch } = this.props; const { projectsId,owner } = this.props.match.params; - this.props.history.push(`/${owner}/${projectsId}/compare/master...master`); + let branch = turnbar(defaultBranch) || "master"; + this.props.history.push(`/${owner}/${projectsId}/compare/${branch}...${branch}`); } render() { const { projectsId , owner } = this.props.match.params; @@ -414,7 +416,7 @@ class merge extends Component { ) : ( "" )} - { data && data.issues && data.issues.length === 0 ? :""} + { data && data.issues && data.issues.length === 0 ? :""}
diff --git a/src/forge/Merge/merge_form.js b/src/forge/Merge/merge_form.js index c6de9638..2ad08d4b 100644 --- a/src/forge/Merge/merge_form.js +++ b/src/forge/Merge/merge_form.js @@ -181,7 +181,6 @@ class MergeForm extends Component { this.setState({ isSpin: false, }); - console.log(error); }); } else { let url = `/${owner}/${projectsId}/pulls/${mergeId}.json`; @@ -315,7 +314,16 @@ class MergeForm extends Component { {getFieldDecorator("assigned_to_id", { initialValue: assigned_to_id, })( - } + optionFilterProp="children" + filterOption={(input, option) => + option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + > {this.renderSelect(members)} @@ -330,6 +338,12 @@ class MergeForm extends Component { issue_versions && issue_versions.length > 0? "未选择里程碑": "请添加里程碑" } showSearch + className="searchIcon" + suffixIcon={} + optionFilterProp="children" + filterOption={(input, option) => + option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } > {this.renderSelect(issue_versions)} @@ -345,6 +359,12 @@ class MergeForm extends Component { issue_tags && issue_tags.length > 0 ? "未选择标记" : "请在仓库设置里添加标记" } showSearch + className="searchIcon" + suffixIcon={} + optionFilterProp="children" + filterOption={(input, option) => + option.props.value && option.props.children && option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 + } > {this.renderSelect(issue_tags)} diff --git a/src/forge/Merge/no_data.js b/src/forge/Merge/no_data.js index 76258f8c..e41e1dfa 100644 --- a/src/forge/Merge/no_data.js +++ b/src/forge/Merge/no_data.js @@ -2,7 +2,7 @@ import React , { Component } from 'react'; import { Link } from "react-router-dom"; class Nodata extends Component{ render(){ - const { _html, projectsId , owner , user_admin_or_developer} = this.props; + const { _html, projectsId , owner , user_admin_or_developer , defaultBranch} = this.props; return(
@@ -12,7 +12,7 @@ class Nodata extends Component{

欢迎使用合并请求!

- 合并请求可以帮助您与他人协作编写代码。{ user_admin_or_developer && 在使用之前,请先创建一个 合并请求 } + 合并请求可以帮助您与他人协作编写代码。{ user_admin_or_developer && 在使用之前,请先创建一个 合并请求 }
diff --git a/src/forge/Order/order.css b/src/forge/Order/order.css index 40adc855..ab9a591f 100644 --- a/src/forge/Order/order.css +++ b/src/forge/Order/order.css @@ -11,7 +11,7 @@ } .quillFlag { position: absolute; - bottom: 0px; + bottom: 30px; left: 6px; height: 20px; line-height: 18px; @@ -710,4 +710,8 @@ a.issue-type-button.active:hover { .boder-4{border-radius: 4px;} .pbt20{padding: 20px 0;} .inline-block{display: inline-block;} -.pd10{padding: 10px;} \ No newline at end of file +.pd10{padding: 10px;} + +.searchIcon .ant-select-arrow{ + margin-top:-9px +} \ No newline at end of file diff --git a/src/forge/Order/order_form.js b/src/forge/Order/order_form.js index e3a2eb91..1a942f59 100644 --- a/src/forge/Order/order_form.js +++ b/src/forge/Order/order_form.js @@ -210,17 +210,16 @@ class order_form extends Component { if (result && result.data.id) { this.props.showNotification("任务创建成功!"); this.props.history.push(`/${owner}/${projectsId}/issues/${result.data.id}`); - this.setState({ - description: "", - isSpin: false, - }); const { getDetail } = this.props; getDetail && getDetail(); } + this.setState({ + isSpin: false, + }); }) .catch((error) => { this.setState({ - isSpin: false, + isSpin: false }); }); } else { @@ -240,10 +239,13 @@ class order_form extends Component { const { getDetail } = this.props; getDetail && getDetail(); } + this.setState({ + isSpin: false + }); }) .catch((error) => { this.setState({ - isSpin: false, + isSpin: false }); }); } @@ -437,7 +439,17 @@ class order_form extends Component {
{getFieldDecorator("assigned_to_id", {rules: []})( - } + optionFilterProp="children" + filterOption={(input, option) => + option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + placeholder="搜索成员" + > {this.renderSelect( issue_chosen && issue_chosen.assign_user @@ -485,7 +497,16 @@ class order_form extends Component { {getFieldDecorator("fixed_version_id", {rules: []})( - } + optionFilterProp="children" + filterOption={(input, option) => + option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + > {getFieldDecorator("issue_tag_ids", {rules: []})( - } + optionFilterProp="children" + filterOption={(input, option) => + option.props.children[1] && option.props.children[1].toLowerCase().indexOf(input.toLowerCase()) >= 0 + } + > {branches && branches.length > 0 && branches.map((item, key) => { return ( diff --git a/src/forge/Settings/Branch.js b/src/forge/Settings/Branch.js index 3e19f37e..f7e83101 100644 --- a/src/forge/Settings/Branch.js +++ b/src/forge/Settings/Branch.js @@ -21,24 +21,17 @@ export default ((props)=>{ const [ count , setCount ] = useState(0); const [ page , setPage ] = useState(1); - let defaultBranch = props.defaultBranch; - useEffect(()=>{ - if(defaultBranch){ - setBranch(defaultBranch); - setProtectBranch(defaultBranch); + if(props.defaultBranch){ + setBranch(props.defaultBranch); + setProtectBranch(props.defaultBranch); } - },[defaultBranch]); + },[props.defaultBranch]); const { projectsId , owner } = props.match.params; const projectDetail = props.projectDetail; - useEffect(()=>{ - if(defaultBranch){ - setBranch(defaultBranch); - } - },[defaultBranch]); useEffect(()=>{ if(owner){ diff --git a/src/forge/Upload/attachment.js b/src/forge/Upload/attachment.js index 677b48ee..fe21fbc1 100644 --- a/src/forge/Upload/attachment.js +++ b/src/forge/Upload/attachment.js @@ -52,7 +52,7 @@ class Attachment extends Component { show_video: status === "preview", video_url: status === "preview" - ? "https://forgeplus.trustie.net" + result.data.url + ? "https://www.gitlink.org.cn" + result.data.url : undefined, move_spin: false, }); diff --git a/src/forge/Wiki/EditWiki.jsx b/src/forge/Wiki/EditWiki.jsx index a7b4911d..e605ffac 100644 --- a/src/forge/Wiki/EditWiki.jsx +++ b/src/forge/Wiki/EditWiki.jsx @@ -192,7 +192,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail, /> )} - + { - const { content, reply_content } = this.state; + const { content, reply_content , fileList } = this.state; this.setState({ journal_spin: true, }); if (!content && !reply_content) { this.setState({ journal_spin: false, + quillFlag:true }); return; } @@ -58,15 +59,12 @@ class comments extends Component { const { page, limit, - fileList, orderId, reply_id, is_reply, atWhoLoginList, } = this.state; - - const url = `/issues/${orderId}/journals.json`; axios .post(url, { @@ -343,7 +341,7 @@ class comments extends Component { height="30" /> -
+

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

{}) } - return( + props && props.menuKey === "0" ?
aLimit &&
setPage(p)}/>
}
+ : + ) } export default Index; \ No newline at end of file diff --git a/src/forge/users/Index.css b/src/forge/users/Index.css index 8cad4168..fe496d8e 100644 --- a/src/forge/users/Index.css +++ b/src/forge/users/Index.css @@ -216,7 +216,7 @@ ul.ant-menu.menuStyle li { .infosRightMenu .ant-menu-item { padding: 0px; - margin: 0px 20px !important; + margin: 0px 20px 0px 0px !important; font-size: 17px; height: 32px; line-height: 0px; @@ -224,7 +224,7 @@ ul.ant-menu.menuStyle li { position: relative; } .infosRightMenu .ant-menu-item a > i { - font-size: 15px !important; + font-size: 15px; margin-right: 8px; } .infosRightMenu .ant-menu-item .menuNum { diff --git a/src/forge/users/Index.jsx b/src/forge/users/Index.jsx index 04c867f7..d4d0ff6c 100644 --- a/src/forge/users/Index.jsx +++ b/src/forge/users/Index.jsx @@ -24,7 +24,7 @@ export default withRouter( secondRouter = props.location.pathname.split('/')[2]; } - let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'following', 'followers', 'password']; + let userRouterArr = ['statistics', 'projects', 'notice', 'devops', 'organizes', 'info', 'following', 'followers', 'password' , "general"]; return ( diff --git a/src/forge/users/Index.scss b/src/forge/users/Index.scss index e523323d..6e354f76 100644 --- a/src/forge/users/Index.scss +++ b/src/forge/users/Index.scss @@ -107,6 +107,46 @@ $flex:flex; font-size: 16px; text-align: center; } +.usersDesc{ + padding:20px 10px; + background-color: rgba(239, 247, 255, 1); + margin-top: 24px; + display: flex; + align-items: center; + flex-direction: column; + p{ + text-align: left; + line-height: 20px; + font-size: 14px; + color: #666; + margin-bottom: 20px!important; + } + .emptyBtn{ + width: 118px; + text-align: center; + height: 36px; + line-height: 34px; + border: 1px solid rgba(26, 71, 255, 1); + color: rgba(26, 71, 255, 1); + border-radius: 5px; + &:hover{ + border-color:rgba(102, 132, 254, 1); + color: rgba(102, 132, 254, 1); + } + } + .fullBtn{ + width: 118px; + text-align: center; + height: 36px; + line-height: 34px; + color: #fff!important; + border-radius: 5px; + background-color: rgba(70, 106, 255, 1); + &:hover{ + background-color: rgba(102, 132, 254, 1); + } + } +} .focusBox,.infoBox{ width: 100%!important; display: inline-block; @@ -237,7 +277,7 @@ ul.ant-menu.menuStyle{ .infosRightMenu{ .ant-menu-item{ padding:0px; - margin:0px 20px!important; + margin:0px 30px 0px 0px !important; font-size: 17px; height: 32px; line-height: 0px; @@ -245,9 +285,14 @@ ul.ant-menu.menuStyle{ position: relative; a{ font-size: 16px; + display: flex; + align-items: center; & >i{ font-size: 15px!important; margin-right: 8px; + &.font-20{ + font-size: 17px!important; + } } } .menuNum{ diff --git a/src/forge/users/Infos.js b/src/forge/users/Infos.js index f3ecbaab..d5d54706 100644 --- a/src/forge/users/Infos.js +++ b/src/forge/users/Infos.js @@ -58,6 +58,12 @@ const Notice = Loadable({ loader: () => import("../Notice/Index"), loading: Loading, }) +const Personal = Loadable({ + loader: () => import("./Personal/Index"), + loading: Loading, +}) + + class Infos extends Component { constructor(props) { super(props); @@ -67,15 +73,20 @@ class Infos extends Component { project_type: undefined, route_type: undefined, undo_events:0, - menuKey:"0", + menuKey:"6", avatarVisible:false }; } - renderPath=(pathname)=>{ + renderPath=(pathname,load)=>{ const { username } = this.props.match.params; if(pathname === `/${username}`){ - this.setState({menuKey:"0",route_type:undefined}); + this.setState({route_type:undefined}); + if(load){ + this.setState({ + menuKey:load.show_super_description ? "6" :"0" + }) + } }else if(pathname === `/${username}/statistics`){ this.setState({menuKey:"1",route_type:undefined}); }else if(pathname.indexOf(`/${username}/projects`)>-1){ @@ -97,8 +108,6 @@ class Infos extends Component { componentDidMount = () => { this.fetchUser(); - const { pathname } = this.props.location; - this.renderPath(pathname); }; componentDidUpdate=(prevProps)=>{ @@ -136,6 +145,8 @@ class Infos extends Component { isSpin: false, undo_events:e }); + const { pathname } = this.props.location; + this.renderPath(pathname,result.data); }) .catch((error) => { this.setState({ @@ -211,10 +222,34 @@ class Infos extends Component { } } + chooseTab =(key)=>{ + this.setState({ + menuKey:key + }) + } + + aboutDescFunc =(flag)=>{ + const { user } = this.state; + const url = `/users/${user && user.login}.json`; + const params={ + user: { + user_extension_attributes: { + show_super_description:flag + } + } + } + axios.put(url,params).then(result=>{ + if(result && result.data){ + this.fetchUser(); + } + }) + } + render() { const { current_user } = this.props; const { username } = this.props.match.params; const { user, isSpin, route_type , undo_events , menuKey , avatarVisible } = this.state; + return (
{ @@ -254,34 +289,42 @@ class Infos extends Component {
{user && user.description}
-
- {/* {user && current_user && user.login === current_user.login && ( -
- -
- )} */} - {current_user && user && user.login !== current_user.login && ( -
- -
- )} -
+ + {/* {user && current_user && user.login === current_user.login && ( +
+ +
+ )} */} + {current_user && user && user.login !== current_user.login && ( +
+ +
+ )} + { + current_user && user && user.login === current_user.login && +
+

想全方位展示自己?试试点击下方按钮定制化您的专属个人简介吧!

+ { + user.show_super_description ? this.aboutDescFunc(false)}>隐藏个人简介 : this.aboutDescFunc(true)}>展示个人简介 + } +
+ }
{ !route_type && menuKey && - 活动概览 + { + user && user.show_super_description && + this.chooseTab("6")}>个人简介 + } + this.chooseTab("0")}>活动概览 数据统计 参与项目 { @@ -406,13 +453,19 @@ class Infos extends Component { { - return ; + return ; }} > + {/* { + return ; + }} + > */} { - return ; + return ; }} > diff --git a/src/forge/users/Material/Base.jsx b/src/forge/users/Material/Base.jsx index c17bfbe3..35f4d0ad 100644 --- a/src/forge/users/Material/Base.jsx +++ b/src/forge/users/Material/Base.jsx @@ -115,11 +115,11 @@ export default Form.create()( 在个人主页展示 )} - + {getFieldDecorator("description",{ rules:[] })( -