diff --git a/src/components/Header/components/Join/index.tsx b/src/components/Header/components/Join/index.tsx index 73c20e06..209425b6 100644 --- a/src/components/Header/components/Join/index.tsx +++ b/src/components/Header/components/Join/index.tsx @@ -95,79 +95,84 @@ const Join: FC = ({ if (globalSetting?.setting?.is_local) { if (!user?.userInfo?.is_shixun_marker) isShixunsHidden = true; } + // const JoinOverlay = (joinProps: any) => { + // return <> + // + // + // { + // user.userInfo?.user_identity !== '学生' && + // !isClassroomsHidden && + // + // handleAddVerify('/classrooms/new')}> + // { + // user.userInfo?.main_site ? + // '新建教学课堂' : + // '新建课堂' + // } + // + // + // } + // { + // !isShixunsHidden && + // + // handleAddVerify('/shixuns/new', VerifyType.Shixuns)}> + // 新建实践项目 + // + // + // } + // { + // ( + // user.userInfo?.main_site && user.navigationInfo?.top || + // ( + // !user.userInfo?.main_site && user.navigationInfo?.top && !isPathsHidden && + // (user.userInfo?.admin || user.userInfo?.is_teacher || user.userInfo?.business) + // ) + // ) && + // + // handleAddVerify('/paths/new')}>新建实践课程 + // + // } + // { + // !globalSetting?.setting?.is_local && + // user.userInfo?.main_site && + // + // handleAddVerify(`${user.navigationInfo?.top?.old_url}/projects/new`, VerifyType.Projects)}>新建开发项目 + // + // } + // + // + //
+ // + // + // { + // !isClassroomsHidden && + // // user.userInfo?.main_site && + // + // handleJoinVerify(VerifyType.Classrooms)}> + // { + // user.userInfo?.main_site ? + // '加入教学课堂' : + // '加入课堂' + // } + // + // + // } + // { + // user.userInfo?.main_site && + // !globalSetting?.setting?.is_local && + // + // handleJoinVerify(VerifyType.Projects)}> + // 加入开发项目 + // + // + // } + // + //
+ // + // } const JoinOverlay = (joinProps: any) => { return <> - - - { - user.userInfo?.user_identity !== '学生' && - !isClassroomsHidden && - - handleAddVerify('/classrooms/new')}> - { - user.userInfo?.main_site ? - '新建教学课堂' : - '新建课堂' - } - - - } - { - !isShixunsHidden && - - handleAddVerify('/shixuns/new', VerifyType.Shixuns)}> - 新建实践项目 - - - } - { - ( - user.userInfo?.main_site && user.navigationInfo?.top || - ( - !user.userInfo?.main_site && user.navigationInfo?.top && !isPathsHidden && - (user.userInfo?.admin || user.userInfo?.is_teacher || user.userInfo?.business) - ) - ) && - - handleAddVerify('/paths/new')}>新建实践课程 - - } - { - !globalSetting?.setting?.is_local && - user.userInfo?.main_site && - - handleAddVerify(`${user.navigationInfo?.top?.old_url}/projects/new`, VerifyType.Projects)}>新建开发项目 - - } - - -
- - - { - !isClassroomsHidden && - // user.userInfo?.main_site && - - handleJoinVerify(VerifyType.Classrooms)}> - { - user.userInfo?.main_site ? - '加入教学课堂' : - '加入课堂' - } - - - } - { - user.userInfo?.main_site && - !globalSetting?.setting?.is_local && - - handleJoinVerify(VerifyType.Projects)}> - 加入开发项目 - - - } - -
+ } diff --git a/src/components/Header/components/User/index.less b/src/components/Header/components/User/index.less index 2a8af5ba..86c49ea1 100644 --- a/src/components/Header/components/User/index.less +++ b/src/components/Header/components/User/index.less @@ -6,7 +6,24 @@ border-radius: 34px; cursor: pointer; } - +.currentMenu{ + width: 120px; + text-align: center; + padding: 0; + [class~='currentName']{ + padding: 0 8px; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + display: block; + } + li{ + border-bottom: 1px solid #eee; + } + li:last-child{ + border-top: none; + } +} .rightMenu { width: 120px; text-align: center; diff --git a/src/components/Header/components/User/index.tsx b/src/components/Header/components/User/index.tsx index 54bf1e2b..296d1b45 100644 --- a/src/components/Header/components/User/index.tsx +++ b/src/components/Header/components/User/index.tsx @@ -14,7 +14,7 @@ import { import { Menu, Row, Col, Dropdown, message, Modal } from 'antd'; import styles from './index.less'; import { isLogin } from '@/utils/authority'; -import { LoginOut } from '@/service/user'; +import { LoginOut , ForgeLoginOut } from '@/service/user'; import ENV from '@/utils/env'; import { handleVerify } from '@/utils/verifyLogin'; import { checkIsClientExam } from '@/utils/util'; @@ -254,12 +254,63 @@ const User: FC = ({ } }; + const OwnerDownMenu=()=>{ + return ( + + + {user.userInfo?.username} + + { + globalSetting?.setting?.personal && globalSetting?.setting?.personal.map(function(item:any,key:number){ + return( +
  • {item.name}
  • + ) + }) + } + {/*
  • 设置
  • */} + + { + const res = await ForgeLoginOut({}); + if (res?.status === 1) { + dispatch({ + type: 'user/getUserInfo', + payload: { + ...payload, + }, + }); + + delCookie('autologin'); + window.location.reload(); + } + }} + >退出 + +
    + ) + } + + const educoderloginysl=()=>{ + //退出账号时清除登录页面的下次自动登录(用户再次打开登录页面时下次自动登录框不勾选) + // cookie.remove("autologin"); + delCookie("autologin"); + //退出账号 + // var url = `/accounts/logout.json`; + // axios.get((url)).then((result) => { + // if (result !== undefined) { + // window.location.href = "/"; + // } + // }).catch((error) => { + // console.log(error); + // }) + + } + if (isLogin()) { return (
    diff --git a/src/service/user.ts b/src/service/user.ts index 24e5bf5e..da6a5b27 100755 --- a/src/service/user.ts +++ b/src/service/user.ts @@ -7,6 +7,12 @@ export async function ForgeLogin(params: any) { body: { ...params }, }); } +export async function ForgeLoginOut(params: any) { + return Fetch(`${ENV.FORGE_SERVER}/api/accounts/logout.json`, { + method: 'get', + // body: { ...params }, + }); +} export async function LoginIn(params: any) { return Fetch('/api/accounts/login.json', { method: 'post',