增加特色专区banner的下拉内容

This commit is contained in:
caishi 2024-04-25 09:50:17 +08:00
parent 7265aca9e0
commit a407064ab1
7 changed files with 110 additions and 58 deletions

View File

@ -120,3 +120,39 @@
width: 80px;
// box-shadow: 0 0 5px rgba(0, 255, 249, 0.6);
}
.dropLi{
display: flex;
flex-direction: column;
align-items: center;
.dropDown {
position: fixed;
top: 58px;
background-color: #ffffff;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
transition: height 0.2s ease-in-out;
overflow: hidden;
padding-left: 0px!important;
box-shadow:0px 0px 6px rgba(6, 44, 107, 0.15);
.dropDownItem {
height: 46px !important;
line-height: 46px !important;
padding-right:unset;
position: relative;
margin-right: 0px!important;
padding:0px 20px;
a {
color: #252b3a !important;
display: inline-block;
height: 100%;
max-width: 160px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
&:hover {
background-color: #ebf0ff;
}
}
}
}

View File

@ -97,6 +97,8 @@ const HeaderComponents: FC<PageProps> = ({
const [openSearch, setOpenSearch] = useState(false)
const [activeKey, setActiveKey] = useState(-1)
const [QQVisible, setQQVisible] = useState<boolean>(false)
const [ zoneList , setZoneList ] = useState<[]>()
const [ showSubMenu , setShowSubMenu ] = useState<boolean>(false);
const payload = getCourseParam()
let pathname = location.pathname;
useEffect(() => {
@ -106,9 +108,30 @@ const HeaderComponents: FC<PageProps> = ({
...payload,
},
})
getZoneList();
}, [globalSetting.name])
// console.log('-----------',location.pathname==='/classrooms'?'1':'2');
const { userInfo } = user;
// 获取特色专区列表
async function getZoneList(){
let res = await dispatch({
type: 'user/ForgeGetZoneList',
payload: {
...payload,
},
})
if(res?.data){
let newArray:any = [];
res.data.forEach((e:any, i:number) => {
newArray[i] = {
name: e.name,
link: `/zone/${e.key}`
}
});
setZoneList(newArray);
}
}
useEffect(() => {
@ -257,7 +280,24 @@ const HeaderComponents: FC<PageProps> = ({
v: { name: string, link: string, hidden: boolean },
k: number,
) {
if (!v.hidden) {
if (v.name === '特色专区') {
// 特色专区下拉菜单
return zoneList && zoneList.length > 0 ? <li
className={`${styles.dropLi}`}
onMouseOver={ () => { setShowSubMenu(true) } }
onMouseOut={ () => { setShowSubMenu(false) } }
>
<a onClick={ () => { setShowSubMenu(true) } }></a>
<ul className={ `${styles.dropDown} ${ showSubMenu ? `${styles.dropDownStem}` : '' }` } style={{ height : showSubMenu ? `${ userInfo?.login ? ((zoneList.length+1) * 46) : (zoneList.length * 46)}px` : 0 }}>
{
zoneList.map((e:any, k:number) => {
return <li className={`${styles.dropDownItem}`} key={ k }><a href={ `${ENV.FORGE_SERVER}${e?.link}` } title={ e?.name } target="_blank">{ e?.name }</a></li>
})
}
{userInfo?.login && <li className={`${styles.dropDownItem}`}><a href={`${ENV.FORGE_SERVER}/zone/apply`} target="_blank">+</a></li> }
</ul>
</li> : ''
} else {
return (
<li
key={k}
@ -266,6 +306,7 @@ const HeaderComponents: FC<PageProps> = ({
? styles.actived
: ''
}
style={{display:v?.hidden?"none":"flex"}}
>
{v?.name === '教学课堂' && <Link onClick={() => {
if (localStorage.getItem('Noviceguide') === '0') {
@ -282,7 +323,6 @@ const HeaderComponents: FC<PageProps> = ({
},
})
}
}} className={shixunHomeworks.actionTabs.type === 4 ? styles.classromediv : ''} dangerouslySetInnerHTML={{ __html: v.name }} to={v.link}></Link>}
{v?.name != '教学课堂' && v.link.indexOf("http") < 0 && <Link onClick={() => {
dispatch({

View File

@ -1,6 +1,6 @@
import { Effect, Reducer, Subscription, history } from 'umi'
import { Action } from '@@/plugin-dva/connect'
import { LoginIn, getUserInfo, getNavigationInfo , ForgeLogin , getEducoderUserInfo , ForgeCheckName , ForgeSaveUserInfo , ForgeCheckEmail } from '@/service/user'
import { LoginIn, getUserInfo, getNavigationInfo , getZoneList , ForgeLogin , getEducoderUserInfo , ForgeCheckName , ForgeSaveUserInfo , ForgeCheckEmail } from '@/service/user'
export interface UserModelState {
name: string
@ -26,7 +26,8 @@ export interface UserModelType {
getEducoderUserInfo:Effect,
ForgeCheckName:Effect,
ForgeCheckEmail:Effect,
ForgeSaveUserInfo:Effect
ForgeSaveUserInfo:Effect,
ForgeGetZoneList:Effect
}
reducers: {
save: Reducer<UserModelState>
@ -109,6 +110,10 @@ const UserModel: UserModelType = {
})
return response;
},
*ForgeGetZoneList({ payload }, { call, put }) {
const response = yield call(getZoneList, { ...payload})
return response;
},
*getNavigationInfo({ payload }, { call, put }) {
const response = yield call(getNavigationInfo, { ...payload })
yield put({

View File

@ -8,8 +8,14 @@
overflow: hidden;
.flex_box_container();
.flex_box_center();
a{
display: block;
width: 100%;
}
img {
height: 300px;
width: 100%;
object-fit: cover;
}
}
.info{

View File

@ -1,6 +1,11 @@
import Fetch from '@/utils/fetch';
import ENV from '@/utils/env';
export async function getZoneList() {
return Fetch(`${ENV.ZONE_SERVER}/api/zone/open/list`, {
method: 'get'
});
}
export async function ForgeLogin(params: any) {
return Fetch(`${ENV.FORGE_SERVER}/api/accounts/login.json`, {
method: 'post',

View File

@ -17,6 +17,7 @@ export interface ConfigProps {
FORGE: String
QQLoginCB: string,
FORGE_SERVER:string,
ZONE_SERVER:string
}
}
@ -28,29 +29,11 @@ export const GlobalConfig: ConfigProps = {
FORGE: "https://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
FORGE_SERVER:"https://testforgeplus.trustie.net",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
},
dev: DEV,
newReactTest: {
// API_SERVER: 'https://test-data.educoder.net',
API_SERVER: ((() => {
let api = 'https://test-data.educoder.net'
const domain = document.domain
let str = document.domain.split(".")
str[0] = str[0] + "-data";
if (domain !== 'test.educoder.net' && domain !== 'localhost') {
api = api.replace("test-data.educoder.net", str.join("."))
}
return api
})()),
SSH_SERVER: "wss://webssh.educoder.net",
IMG_SERVER: 'https://new-testali-cdn.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://test-oldweb.educoder.net/",
QQLoginCB: encodeURIComponent("https://test-data.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
},
preNewBuild: {
API_SERVER: 'https://pre-data.educoder.net',
// API_SERVER: ((() => {
@ -68,7 +51,8 @@ export const GlobalConfig: ConfigProps = {
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://forge.educoder.net/",
QQLoginCB: encodeURIComponent("https://pre.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
FORGE_SERVER:"https://testforgeplus.trustie.net",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
},
newBuild: {
// API_SERVER: 'https://data.educoder.net',
@ -87,17 +71,8 @@ export const GlobalConfig: ConfigProps = {
IMG_SERVER: 'https://test-data.educoder.net/',
FORGE: "https://code.educoder.net/",
QQLoginCB: encodeURIComponent("https://www.educoder.net"),
FORGE_SERVER:"https://testforgeplus.educoder.cn"
},
// test
newTest: {
API_SERVER: 'https://test-data.educoder.net',
IMG_SERVER: 'https://test-data.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
SSH_SERVER: "wss://pre-webssh.educoder.net",
FORGE: "http://test-oldweb.educoder.net/",
QQLoginCB: encodeURIComponent("https://test-data.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
FORGE_SERVER:"https://testforgeplus.educoder.cn",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
},
test: {
API_SERVER: 'https://test-data.educoder.net/',
@ -106,25 +81,8 @@ export const GlobalConfig: ConfigProps = {
FORGE: "http://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.educoder.net"
},
preBuild: {
API_SERVER: 'https://pre-data.educoder.net',
IMG_SERVER: 'https://preali-cdn.educoder.net',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "https://forge.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://pre.gitlink.org.cn",
},
newWeb: {
API_SERVER: 'https://test-newweb.educoder.net',
IMG_SERVER: 'https://test-newweb.educoder.net/',
REPORT_SERVER: "http://192.168.1.57:3001",
FORGE: "http://test-oldweb.educoder.net/",
SSH_SERVER: "wss://pre-webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.educoder.net"
FORGE_SERVER:"https://testforgeplus.educoder.net",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
},
build: {
API_SERVER: 'https://data.educoder.net',
@ -134,6 +92,7 @@ export const GlobalConfig: ConfigProps = {
SSH_SERVER: "wss://webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://www.educoder.net"),
FORGE_SERVER:"https://www.gitlink.org.cn",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
},
};
export default GlobalConfig[window.ENV || "dev"]

View File

@ -6,7 +6,8 @@ export const DEV = {
FORGE: "https://code.educoder.net/",
SSH_SERVER:"wss://webssh.educoder.net",
QQLoginCB: encodeURIComponent("https://test-newweb.educoder.net"),
FORGE_SERVER:"https://testforgeplus.trustie.net"
FORGE_SERVER:"https://testforgeplus.trustie.net",
ZONE_SERVER:"https://gateway.gitlink.org.cn"
}
export default DEV