Merge branch 'dev_m_copy' into dev_military

# Conflicts:
#	src/forge/DevOps/Index.jsx
#	src/forge/Index.js
#	src/forge/Main/Detail.js
#	src/forge/Merge/MessageCount.js
#	src/forge/Settings/Collaborator.js
#	src/forge/Settings/CollaboratorMember.jsx
#	src/forge/users/watch_users.js
#	src/modules/tpm/NewHeader.js
This commit is contained in:
caishi 2021-04-12 15:57:30 +08:00
commit c32b333bc2
13 changed files with 157 additions and 621 deletions

View File

@ -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 || 'p86402359'
window.location.search.indexOf('debug=a') !== -1 ? 'admin' : parsed.debug || 's'
}
function clearAllCookie() {
cookie.remove('_educoder_session', { path: '/' });

View File

@ -10,40 +10,55 @@ const About = Loadable({
loader: () => import('./About'),
loading: Loading,
})
const Infos = Loadable({
loader: () => import('./Infos'),
const New = Loadable({
loader: () => import('./disposePipeline'),
loading: Loading,
})
const Dispose = Loadable({
loader: () => import('./Dispose'),
loading: Loading,
})
const Stucture = Loadable({
loader: () => import('./Structure'),
loading: Loading,
})
const Mould = Loadable({
loader: () => import('./Mould'),
loading: Loading,
})
export default ((props)=>{
const { projectsId , owner } = props.match.params;
const open_devops = props.projectDetail && props.projectDetail.open_devops;
//
useEffect(()=>{
if(open_devops !== undefined){
if(open_devops){
props.history.replace(`/projects/${owner}/${projectsId}/devops/list`);
}else{
props.history.replace(`/projects/${owner}/${projectsId}/devops`);
}
}
},[open_devops])
return(
<WhiteBack className="opsPanel">
<Switch {...props}>
<Route path="/projects/:owner/:projectsId/devops/dispose"
<Route path="/projects/:owner/:projectsId/devops/dispose/:disposeId"
render={
() => (<Infos {...props} />)
(p) => (<New {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/list"
<Route path="/projects/:owner/:projectsId/devops/mould"
render={
() => (<Infos {...props} />)
(p) => (<Mould {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/dispose/new"
render={
(p) => (<New {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/dispose"
render={
(p) => (<Dispose {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops/list/:branch"
render={
(p) => (<Stucture {...props} {...p}/>)
}
></Route>
<Route path="/projects/:owner/:projectsId/devops"
render={
() => (<About {...props} />)
(p) => (<About {...props} {...p}/>)
}
></Route>
</Switch>

View File

@ -6,6 +6,7 @@ import { withRouter } from "react-router";
import { SnackbarHOC } from "educoder";
import { CNotificationHOC } from "../modules/courses/common/CNotificationHOC";
import { TPMIndexHOC } from "../modules/tpm/TPMIndexHOC";
import Handbook from './Component/Handbook';
import "./css/index.scss";
import Loadable from "react-loadable";
@ -13,7 +14,7 @@ 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({
@ -30,13 +31,18 @@ const Infos = Loadable({
loader: () => import("./users/Infos"),
loading: Loading,
});
class Index extends Component {
render() {
return (
<div className="newMain clearfix">
<Handbook />
<Switch {...this.props}>
<Route
path="/projects/:projectsType/new/:OIdentifier"
render={(props) => (
<ProjectNew {...this.props} {...props} />
)}
></Route>
<Route
path="/projects/:projectsType/new"
render={(props) => (

View File

@ -145,7 +145,7 @@ class CoderRootCommit extends Component{
)
})
}
{commitDatas && commitDatas.length > 0 && <Nodata _html="暂无数据"/>}
{commitDatas && commitDatas.length === 0 && <Nodata _html="暂无数据"/>}
</div>
</div>
{

View File

@ -251,7 +251,7 @@ class CoderRootDirectory extends Component {
// readme文件内容
renderReadMeContent = (readMeContent, permission) => {
const { fileDetail, readMeFile } = this.state;
if (fileDetail) {
if (fileDetail && fileDetail.length !== 0) {
return;
}
if (readMeContent && readMeContent.length > 0) {

View File

@ -115,22 +115,23 @@ const DevIndex = Loadable({
/**
* permissionManager:管理员Reporter报告人员(只有读取权限)Developer开发人员除不能设置仓库信息外
*/
function checkPathname(pathname){
function checkPathname(projectsId,owner,pathname){
let name = "";
if(pathname){
if(pathname.indexOf("/about")>-1){
if(pathname && pathname !== `/projects/${owner}/${projectsId}`){
let url = pathname.split(`/projects/${owner}/${projectsId}`)[1];
if(url.indexOf("/about")>-1){
name="about"
}else if(pathname.indexOf("/issues")>-1 ||pathname.indexOf("Milepost") > 0){
}else if(url.indexOf("/issues")>-1 ||url.indexOf("Milepost") > 0){
name = "issues";
}else if(pathname.indexOf("/pulls")>-1){
}else if(url.indexOf("/pulls")>-1){
name="pulls"
}else if(pathname.indexOf("/milestones")>-1){
}else if(url.indexOf("/milestones")>-1){
name="milestones"
}else if(pathname.indexOf("/activity")>-1){
}else if(url.indexOf("/activity")>-1){
name="activity"
}else if(pathname.indexOf("/setting")>-1){
}else if(url.indexOf("/setting")>-1){
name="setting"
}else if(pathname.indexOf("/devops")>-1){
}else if(url.indexOf(`/devops`)>-1){
name="devops"
}
}
@ -369,6 +370,7 @@ class Detail extends Component {
const url = `/${owner}/${projectsId}/sync_mirror.json`;
axios.post(url).then(result => {
if (result && result.data && result.data.status === 0) {
this.props.showNotification("镜像同步成功!");
this.getProject(2);
} else {
this.props.showNotification("镜像同步失败!");
@ -399,9 +401,9 @@ class Detail extends Component {
const url = this.props.history.location.pathname;
const urlArr = url.split("/");
const urlFlag = (urlArr.length === 3);
let pathname = checkPathname(url);
const { projectsId , owner } = this.props.match.params;
let pathname = checkPathname(projectsId,owner,url);
const { state } = this.props.history.location;
@ -729,7 +731,7 @@ class Detail extends Component {
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}
></Route>
<Route path="/projects/:owner/:projectsId/branch/:branchName"
<Route path="/projects/:owner/:projectsId/tree/:branchName"
render={
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} {...common} />)
}

View File

@ -122,12 +122,12 @@ class MessageCount extends Component {
SpinMerge: true,
});
const { projectsId , owner } = this.props.match.params;
const { title, body, mergekey, pull_request } = this.state;
const url = `/${owner}/${projectsId}/pulls/${pull_request.id}/pr_merge.json`;
const { data, title, body, mergekey, pr_status } = this.state;
const url = `/${owner}/${projectsId}/pulls/${data.pull_request.id}/pr_merge.json`;
axios
.post(url, {
project_id: projectsId,
id: pull_request.id,
id: data.pull_request.id,
do: mergekey,
body: body,
title: title,
@ -255,11 +255,6 @@ class MessageCount extends Component {
pull_request
} = this.state;
const { current_user, projectDetail } = this.props;
const permission = projectDetail && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner" || projectDetail.permission === "Manager");
const userLogin = current_user && current_user.login;
const operate = userLogin && projectDetail && pr_status === 0 && permission;
const menu = (
<Menu onClick={(e) => this.getOption(e)}>
<Menu.Item key={"merge"} value="合并请求">
@ -276,9 +271,11 @@ class MessageCount extends Component {
</Menu.Item>
</Menu>
);
const permission = projectDetail && (projectDetail.permission === "Admin" || projectDetail.permission === "Owner" || projectDetail.permission === "Manager");
const userLogin = current_user && current_user.login;
const operate = userLogin && projectDetail && pr_status === 0 && permission;
return (
<div className="">
<div>
{data ? (
<div>
<div className="main">
@ -288,13 +285,13 @@ class MessageCount extends Component {
<div className="ver-middle">
<span className="mr10 ver-middle">
<span className="font-18 fwb">
{ data.issue && data.issue.subject}
{data.issue.subject}
</span>
</span>
{pull_request && (
{data.pull_request && (
<Tag
className={`pr_tags_${pull_request.pull_request_staus}`}
className={`pr_tags_${data.pull_request.pull_request_staus}`}
>
{pr_status === 1
? "已合并"
@ -308,10 +305,10 @@ class MessageCount extends Component {
<div className="mt15">
<Tag className="pr-branch-tag">
<Link
to={`/projects/${owner}/${pull_request.is_original?data.project_identifier:projectsId}/branch/${pull_request.head}`}
to={`/projects/${owner}/${data.pull_request.is_original?data.project_identifier:projectsId}/branch/${data.pull_request.head}`}
className="ver-middle"
>
{pull_request.is_original ? pull_request.fork_project_user : data.issue.project_author_name}:{pull_request.head}
{data.pull_request.is_original ? data.pull_request.fork_project_user : data.issue.project_author_name}:{data.pull_request.head}
</Link>
</Tag>
<span className="mr8 ver-middle">
@ -323,11 +320,11 @@ class MessageCount extends Component {
</span>
<Tag className="pr-branch-tag">
<Link
to={`/projects/${owner}/${projectsId}/branch/${pull_request.base}`}
to={`/projects/${owner}/${projectsId}/branch/${data.pull_request.base}`}
className="ver-middle"
>
{/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */}
{data.issue.project_author_name}:{pull_request.base}
{data.issue.project_author_name}:{data.pull_request.base}
</Link>
</Tag>
</div>

View File

@ -1,528 +1,53 @@
import React, { Component } from "react";
import { Link } from "react-router-dom";
import {
Input,
AutoComplete,
Dropdown,
Menu,
Icon,
Spin,
Pagination,
Button,
Table,
Tooltip
} from "antd";
import NoneData from "../Nodata";
import axios from "axios";
import { getImageUrl } from "educoder";
import React, { useState } from "react";
import {WhiteBack} from '../Component/layout';
import AddMember from '../Component/AddMember';
import AddGroup from '../Component/AddGroup';
import Member from './CollaboratorMember';
import Group from './CollaboratorGroup';
const { Search } = Input;
function Collaborator(props){
const [ nav , setNav] = useState("1");
const [ newId , setNewId] = useState(undefined);
const [ newGroupId , setNewGroupId] = useState(undefined);
const {projectsId ,owner} = props.match.params;
const { Option } = AutoComplete;
const MENU_LIST = [
{
id: "Manager",
name: "管理员",
},
{
id: "Developer",
name: "开发者",
},
{
id: "Reporter",
name: "报告者",
},
];
const LIMIT = 15;
class Collaborator extends Component {
constructor(props) {
super(props);
this.state = {
listData: undefined,
user: undefined,
user_id: undefined,
userDataSource: undefined,
page: 1,
total_count: undefined,
isSpin: true,
searchKey: undefined,
search: undefined,
role: undefined,
otherSpin: false,
searchSpin: false,
roleName: undefined,
};
const author = props.projectDetail && props.projectDetail.author;
function getID(id){
setNewId(id);
}
componentDidUpdate=(prevPros)=>{
if(prevPros && this.props && !this.props.checkIfLogin()){
this.props.history.push("/403")
return
}
function getGroupID(id){
setNewGroupId(id);
}
componentDidMount = () => {
// this.check_is_login()
if (this.props.project_id) {
this.getMember();
}
};
// check_is_login =() =>{
// if(!this.props.checkIfLogin()){
// this.props.history.push("/403")
// return
// }
// };
componentDidUpdate = (prevState) => {
if (
this.props.project_id &&
this.props.project_id !== prevState.project_id
) {
this.getMember();
}
};
// 获取项目协作者
getMember = () => {
const { page, search, role } = this.state;
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators.json`;
axios
.get(url, {
params: {
page,
search: search,
role: role,
limit: LIMIT,
},
})
.then((result) => {
if (result) {
this.setState({
listData: result.data.members,
isSpin: false,
otherSpin: false,
searchSpin: false,
total_count: result.data.total_count,
});
}
})
.catch((error) => {
this.setState({
isSpin: false,
otherSpin: false,
searchSpin: false,
});
console.log(error);
});
};
// 输入用户
changeInputUser = (e) => {
this.setState({
searchKey: e,
});
this.getUserList(e);
};
searchMember = (e) => {
this.state.search = e;
this.setState({
searchSpin: true,
});
this.getMember();
};
orderMember = (id, name) => {
this.setState({
isSpin: true
})
this.state.role = id;
this.state.roleName = name;
this.getMember();
};
// 选择用户
selectInputUser = (e, option) => {
this.setState({
user_id: e,
searchKey: option.props.searchValue,
});
this.getUserList(option.props.searchValue);
};
getUserList = (e) => {
const url = `/users/list.json`;
axios
.get(url, {
params: {
search: e,
},
})
.then((result) => {
if (result) {
this.setState({
userDataSource: result.data.users,
});
}
})
.catch((error) => {
console.log(error);
});
};
// 增加协作者
addCollaborator = () => {
// const { project_id } = this.props;
const { user_id } = this.state;
if(user_id){
this.setState({
otherSpin: true,
});
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators.json`;
axios.post(url, {
user_id,
})
.then((result) => {
if (result) {
this.setState({
isSpin: true,
otherSpin: false,
});
this.getMember();
}
})
.catch((error) => {
this.setState({
isSpin: false,
otherSpin: false,
});
console.log(error);
});
}
};
// 修改权限
changeOperaiton = (e, id) => {
// const { project_id, page } = this.state;
this.setState({
isSpin: true,
});
const {projectsId ,owner} = this.props.match.params;
const url = `/${owner}/${projectsId}/collaborators/change_role.json`;
axios
.put(url, {
user_id: id,
role: e.key,
})
.then((result) => {
if (result) {
this.setState({
isSpin: true,
});
this.props.showNotification("权限修改成功!");
this.getMember();
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
};
// 删除协作者
deleteUser = (id) => {
const { page } = this.state;
const {projectsId ,owner} = this.props.match.params;
this.props.confirm({
content: "确认将此成员从项目中移除?",
onOk: () => {
const { project_id } = this.props;
const url = `/${owner}/${projectsId}/collaborators/remove.json`;
axios
.delete(url, {
data: {
user_id: id,
},
})
.then((result) => {
if (result) {
this.setState({
isSpin: true,
});
this.props.showNotification("成员删除成功!");
this.getMember();
}
})
.catch((error) => {
this.setState({
isSpin: false,
});
console.log(error);
});
},
});
};
changePage = (page) => {
this.state.page = page;
this.setState({
isSpin: true,
});
this.getMember();
};
render() {
const {
userDataSource,
listData,
isSpin,
page,
total_count,
searchKey,
otherSpin,
searchSpin,
roleName,
} = this.state;
// 获取当前项目的拥有者
const { author } = this.props;
const get_color = (role) => {
if (role === "Manager") {
return "text-green";
} else if (role === "Developer") {
return "text-primary";
} else if(role === "Reporter"){
return "text-yellow";
}else{
return "text-gray";
}
};
const member_roles = (item) => {
const operation = MENU_LIST.filter((i) => i.id === item.role);
return (
<span>
{author && author.login === item.login ? (
<label className={get_color(item.role)}>
{operation && operation[0].name}
</label>
) :
item.is_apply_signature ?
<label className="text-grey">外围贡献者</label>
return (
<WhiteBack>
<div className="flex-a-center baseForm bbr">
{
author && author.type === "Organization" ?
<span>
<span style={{cursor:"pointer"}} className={nav === "1" ? "font-18 text-black color-blue":"font-18 text-black"} onClick={()=>setNav("1")}>协作者管理</span>
<span style={{cursor:"pointer"}} className={nav === "2" ? "font-18 text-black ml30 color-blue":"font-18 text-black ml30"} onClick={()=>setNav("2")}>团队管理</span>
</span>
:
(
<Dropdown overlay={setRoles(`${item.id}`)} placement={"bottomCenter"}>
<span className={get_color(item.role)}>
{operation && operation[0].name}
<Icon type="caret-down" className="ml2" size="13" />
</span>
</Dropdown>
)}
</span>
);
};
const roleTitle = (
<div><span className="mr3">角色</span>
<Tooltip placement='bottom' title={<div>
<div className="mb3">管理员拥有仓库设置功能代码库读写操作</div>
<div className="mb3">开发人员只拥有代码库读写操作</div>
<div className="mb3">报告者只拥有代码库读操作</div>
</div>
}>
<Icon type="question-circle"></Icon>
</Tooltip>
</div>
);
const columns = [
{
title: "头像",
dataIndex: "image_url",
render: (text, item) => (
<span className="f-wrap-alignCenter">
<Link
to={`/users/${item.login}`}
className="show-user-link"
>
<img
src={getImageUrl(`images/${text}`)}
alt=""
width="32px"
height="32px"
className="mr3 radius"
/>
</Link>
</span>
),
},
{
title: "用户名",
dataIndex: "name",
render: (text, item) => (
<Link to={`/users/${item.login}`} className="show-user-link">
{text}
</Link>
),
},
{
title: "邮箱",
dataIndex: "email",
render: (text) => <span>{text}</span>,
},
{
title: "Token值",
dataIndex: "token",
render: (text) => <span>{text}</span>,
},
{
title: roleTitle,
dataIndex: "role_name",
render: (text, item) => member_roles(item),
},
{
title: "操作",
dataIndex: "action",
render: (text, item) => (
<span style={{ justifyContent: "center" }}>
{author && author.login !== item.login && (
<a
className="text-delete"
onClick={() => this.deleteUser(item.id)}
>
删除
</a>
)}
</span>
),
},
];
const roles = (id) => (
<Menu>
<Menu.Item
key={0}
value={undefined}
onClick={(e) => this.orderMember(undefined, "角色筛选")}
>
全部
</Menu.Item>
{MENU_LIST.map((item, key) => {
return (
<Menu.Item
key={item.id}
value={item.id}
onClick={(e) => this.orderMember(item.id, item.name)}
>
{item.name}
</Menu.Item>
);
})}
</Menu>
);
const setRoles = (id) => (
<Menu>
{MENU_LIST.map((item, key) => {
return (
<Menu.Item
key={item.id}
value={item.id}
onClick={(e) => this.changeOperaiton(e,id)}
>
{item.name}
</Menu.Item>
);
})}
</Menu>
);
const source =
userDataSource &&
userDataSource.map((item, key) => {
return (
<Option
key={key}
value={`${item.user_id}`}
searchValue={`${item.username}`}
>
<img
className="user_img radius"
width="28"
height="28"
src={getImageUrl(`images/${item && item.image_url}`)}
alt=""
/>
<span className="ml10" style={{ "vertical-align": "middle" }}>
{item.username}
<span className="color-grey ml10">({item.login})</span>
</span>
</Option>
);
});
return (
<WhiteBack>
<div className="flex-a-center baseForm bbr">
<span className="font-18 text-black">协作者管理</span>
<div className="addPanel">
<AutoComplete
dataSource={source}
value={searchKey}
style={{ width: 300 }}
onChange={this.changeInputUser}
onSelect={this.selectInputUser}
placeholder="搜索需要添加的用户..."
/>
<Button
type="primary"
ghost
onClick={this.addCollaborator}
className="ml15"
loading={otherSpin}
>
<Icon type="plus" size="16"></Icon>
添加成员
</Button>
</div>
</div>
<div className="grid-item-left baseForm">
<Search
placeholder="搜索项目成员..."
enterButton="搜索"
loading={searchSpin}
onSearch={(value) => this.searchMember(value)}
/>
<Dropdown overlay={roles} placement={"bottomCenter"}>
<a className="ml180 text-primary">
{roleName ? roleName : "角色筛选"}
<Icon type="caret-down" size="16"></Icon>
</a>
</Dropdown>
</div>
<Spin spinning={isSpin}>
<div className="collaboratorList baseForm">
{listData && listData.length>0 ? (
<Table
pagination={false}
columns={columns}
dataSource={listData}
rowKey={(record) => record.id}
></Table>
) : (
<NoneData _html="暂时还没有相关数据!" />
)}
</div>
</Spin>
{total_count && total_count > LIMIT ? (
<div className="edu-txt-center mt20 mb20">
<Pagination
showQuickJumper
pageSize={LIMIT}
current={page}
total={total_count}
onChange={this.changePage}
></Pagination>
</div>
) : (
""
)}
</WhiteBack>
);
}
}
{
nav === "1" ?
<AddMember getID={getID} login/>
:
<AddGroup getGroupID={getGroupID} organizeId={owner}/>
}
</div>
<div>
{
nav === "1" ?
<Member newId={newId} projectsId={projectsId} owner={owner} project_id={props.project_id} author={props.author} showNotification={props.showNotification}/>
:
<Group owner={owner} projectsId={projectsId} newGroupId={newGroupId}/>
}
</div>
</WhiteBack>
);
}
export default Collaborator;

View File

@ -166,7 +166,11 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
<label className={get_color(item.role)}>
{operation && operation[0].name}
</label>
) : (
)
:
item.is_apply_signature ?
<label className="text-grey">外围贡献者</label>
:(
<Dropdown overlay={setRoles(`${item.id}`)} placement={"bottomCenter"}>
<span className={get_color(item.role)}>
{operation && operation[0].name}
@ -262,13 +266,7 @@ function CollaboratorMember({projectsId,owner,project_id,author,showNotification
</Spin>
{total > LIMIT ?
<div className="edu-txt-center mt20 pb20">
<Pagination
simple
pageSize={LIMIT}
current={page}
total={total}
onChange={(page)=>setPage(page)}
></Pagination>
<Pagination simple current={page} pageSize={LIMIT} total={total} onChange={(page)=>setPage(page)}/>
</div>
:""}
</React.Fragment>

View File

@ -137,7 +137,7 @@ class Infos extends Component {
render() {
const { current_user, mygetHelmetapi } = this.props;
const { current_user, main_web_site_url } = this.props;
const { username } = this.props.match.params;
const { user, isSpin, project_type, route_type } = this.state;
@ -167,7 +167,7 @@ class Infos extends Component {
<Button
block
className="text-button-grey"
href={`/users/${user.login}/profiles`}
href={`${main_web_site_url || "https://osredm.com/"}users/${user.login}/profiles`}
>
{" "}
<i className="iconfont icon-shezhi4 font-15 mr5"></i>

View File

@ -5,8 +5,8 @@ class WatcherUsers extends Component {
const {user, current_user} = this.props
return (
<div className="minH-650">
{user && user.login && <CommonLists userType="watch_users" login={user.login} current_user={current_user} />}
</div>
{user && user.login && <CommonLists userType="watch_users" login={user.login} current_user={current_user} />}
</div>
);
}
}

View File

@ -580,9 +580,9 @@ class LoginDialog extends Component {
<label htmlFor="p_autolog" style={{ top: '0px' }}>下次自动登录</label>
</span>
<span className="fr">
<a onClick={(url) => this.getloginurl("http://39.105.176.215/account/lost_password")}
<a onClick={(url) => this.getloginurl("https://osredm.com/account/lost_password")}
className="mr3 color-grey-9">找回密码</a><em className="vertical-line"></em>
<a onClick={(url) => this.getloginurl("http://39.105.176.215/user_join")} className="color-grey-9">注册</a>
<a onClick={(url) => this.getloginurl("https://osredm.com/user_join")} className="color-grey-9">注册</a>
</span>
</p>

View File

@ -13,9 +13,12 @@ import 'antd/lib/radio/style/index.css';
import 'antd/lib/input/style/index.css';
import './TPMIndex.css';
import logo from './images/logo.png';
import { result } from 'lodash';
const $ = window.$
// TODO 这部分脚本从公共脚本中直接调用
const { Search } = Input;
let old_url;
window._header_componentHandler = null;
// 非trustie链接则新开页跳转
const str = ['www.trustie.net','forgeplus.trustie.net','forum.trustie.net','testforgeplus.trustie.net']
@ -46,7 +49,7 @@ class NewHeader extends Component {
headtypess: "/",
mygetHelmetapi2: null,
goshowqqgtounp: false,
visiblemyss: false
visiblemyss: false,
}
}
componentDidMount() {
@ -93,6 +96,10 @@ class NewHeader extends Component {
this.setState({
user: newProps.user
})
if (newProps.Headertop !== undefined) {
old_url = newProps.Headertop.old_url
}
}
getCookie = (key) => {
var arr, reg = RegExp('(^| )' + key + '=([^;]+)(;|$)');
@ -388,7 +395,6 @@ class NewHeader extends Component {
}
inputjoinclassvalue = (e) => {
console.log(e.target.value.length);
if (e.target.value.length >= 7) {
this.openNotification("请输入6位项目邀请码!");
return
@ -546,6 +552,8 @@ class NewHeader extends Component {
axios.get(url).then((response) => {
if (response && response.data) {
this.setState({ mygetHelmetapi2: response.data.setting });
// localStorage.setItem('chromesetting', JSON.stringify(response.data.setting));
// localStorage.setItem('chromesettingresponse', JSON.stringify(response));
try {
if (response.data.setting.tab_logo_url) {
this.gettablogourldata(response);
@ -602,7 +610,7 @@ class NewHeader extends Component {
headtypesonClickbool,
headtypess,
mygetHelmetapi2,
goshowqqgtounp
goshowqqgtounp,
} = this.state;
/*用户名称 用户头像url*/
let activeIndex = false;
@ -705,7 +713,7 @@ class NewHeader extends Component {
mygetHelmetapi2 && mygetHelmetapi2.nav_logo_url ?
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={getImageUrl(mygetHelmetapi2.nav_logo_url)}></img>
:
<img alt="可控开源社区" className="logoimg" style={{ heigth: "40px" }} src={logo}></img>
""
}
</a>
<div className="head-nav pr" id={"head-navpre1"}>
@ -753,10 +761,11 @@ class NewHeader extends Component {
<div className="overPart"></div>
{
coursestypes === true && this.props.user && this.props.user.main_site === false ? "" :
<ul className="edu-txt-center">
<li><Link to={"/projects/mirror/new"}>新建镜像项目</Link></li>
<li><Link to={"/projects/deposit/new"}>新建托管项目</Link></li>
</ul>
<ul className="edu-txt-center">
<li><Link to={"/projects/mirror/new"}>新建镜像项目</Link></li>
<li><Link to={"/projects/deposit/new"}>新建托管项目</Link></li>
<li><Link to={"/organize/new"}>新建组织</Link></li>
</ul>
}
</div>
</div>
@ -825,33 +834,17 @@ class NewHeader extends Component {
<ul className="edu-menu-list" style={{ top: '60px', textAlign: 'center' }}>
<li className="bor-bottom-greyE" style={{cursor:"default",background:"#fff"}}>{this.props.current_user.username}</li>
<li>
<a href={`/users/${user.login}`}>个人中心</a>
<Link to={`/users/${this.props.current_user.login}`}>个人中心</Link>
</li>
<li>
<a
href={`${mygetHelmetapi2 && mygetHelmetapi2.main_web_site_url}users/${user.login}/profiles`}
>
账号管理
</a>
</li>
<li>
<a
href={`${mygetHelmetapi2 && mygetHelmetapi2.main_web_site_url}users/${user.login}/user_tidings`}
>
我的消息
</a>
</li>
<li>
<a href={`${mygetHelmetapi2 && mygetHelmetapi2.main_web_site_url}my/account`}>
账号安全
</a>
</li>
<li>
<a href={`${mygetHelmetapi2 && mygetHelmetapi2.main_web_site_url}tasks/my_tasks`}>
创客管理
</a>
</li>
<li className="border-Tgrey-eb">
{
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_courses &&
<li><a href={`${mygetHelmetapi2.new_course.my_courses}`} target="_blank">我的课程</a></li>
}
{
mygetHelmetapi2 && mygetHelmetapi2.new_course && mygetHelmetapi2.new_course.my_organ &&
<li><a href={`/users/${this.props.current_user.login}/organizes`} target="_blank">我的组织</a></li>
}
<li className="bor-top-greyE">
<a onClick={() => this.educoderloginysl()}>退出</a>
</li>
</ul>