调用educoder接口,获取浏览数、报名数、总奖金
This commit is contained in:
parent
d071ddf54a
commit
44aca44014
Binary file not shown.
|
After Width: | Height: | Size: 796 KiB |
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 393 KiB |
|
|
@ -187,11 +187,12 @@ const HeaderComponents: FC<PageProps> = ({
|
|||
setActiveKey(key)
|
||||
}
|
||||
})
|
||||
if (activeKey === -1) {
|
||||
setDocumentTitle(globalSetting.setting.name)
|
||||
} else {
|
||||
setDocumentTitle(globalSetting.setting.navbar[activeKey]?.name || globalSetting.setting.name)
|
||||
}
|
||||
// if (activeKey === -1) {
|
||||
// setDocumentTitle(globalSetting.setting.name)
|
||||
// }
|
||||
// else {
|
||||
// setDocumentTitle(globalSetting.setting.navbar[activeKey]?.name || globalSetting.setting.name)
|
||||
// }
|
||||
|
||||
}
|
||||
}, [globalSetting?.setting])
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { Effect, Reducer, Subscription, history } from 'umi'
|
||||
import { Action } from '@@/plugin-dva/connect'
|
||||
import { LoginIn, getUserInfo, getNavigationInfo , getZoneList , ForgeLogin , getEducoderUserInfo , ForgeCheckName , ForgeSaveUserInfo , ForgeCheckEmail } from '@/service/user'
|
||||
import { LoginIn, getUserInfo, getNavigationInfo , getCount , getZoneList , ForgeLogin , getEducoderUserInfo , ForgeCheckName , ForgeSaveUserInfo , ForgeCheckEmail } from '@/service/user'
|
||||
|
||||
export interface UserModelState {
|
||||
name: string
|
||||
|
|
@ -27,7 +27,8 @@ export interface UserModelType {
|
|||
ForgeCheckName:Effect,
|
||||
ForgeCheckEmail:Effect,
|
||||
ForgeSaveUserInfo:Effect,
|
||||
ForgeGetZoneList:Effect
|
||||
ForgeGetZoneList:Effect,
|
||||
GetCount:Effect
|
||||
}
|
||||
reducers: {
|
||||
save: Reducer<UserModelState>
|
||||
|
|
@ -77,6 +78,10 @@ const UserModel: UserModelType = {
|
|||
payload: { showPopLogin: payload.showPopLogin, showClosable: payload.showClosable },
|
||||
})
|
||||
},
|
||||
*GetCount({ payload }, { call, put }) {
|
||||
const response = yield call(getCount, { ...payload})
|
||||
return response;
|
||||
},
|
||||
*ForgeLogin({ payload }, { call, put }) {
|
||||
const { to } = payload
|
||||
const response = yield call(ForgeLogin, { ...payload })
|
||||
|
|
@ -93,7 +98,7 @@ const UserModel: UserModelType = {
|
|||
},
|
||||
*getUserInfo({ payload }, { call, put }) {
|
||||
// location.search,,debug:"admin"
|
||||
const response = yield call(getUserInfo, { ...payload})
|
||||
const response = yield call(getUserInfo, { ...payload,debug:"admin"})
|
||||
localStorage.userInfo = JSON.stringify(response);
|
||||
|
||||
yield put({
|
||||
|
|
|
|||
|
|
@ -127,8 +127,8 @@ const competitionDetails: FC<PageProps> = ({
|
|||
}, [identifier])
|
||||
|
||||
useEffect(() => {
|
||||
setDocumentTitle('在线竞赛');
|
||||
});
|
||||
setDocumentTitle('第七届CCF开源创新大赛');
|
||||
},[]);
|
||||
async function selectlist(keyword: any) {
|
||||
let data = await dispatch({
|
||||
type: 'competitions/getTeamList',
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
});
|
||||
}, [competitions.name]);
|
||||
useEffect(() => {
|
||||
setDocumentTitle('在线竞赛');
|
||||
setDocumentTitle('第七届CCF开源创新大赛');
|
||||
});
|
||||
|
||||
async function getHomeNotice() {
|
||||
|
|
@ -187,7 +187,11 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
}
|
||||
|
||||
function tourl(url: string) {
|
||||
openNewWindow(url);
|
||||
let u = url;
|
||||
if(u.indexOf('www.educoder.net') > -1){
|
||||
u = u + `?login=${user?.eduUserInfo?.login}&websiteName=gitlink`;
|
||||
}
|
||||
openNewWindow(u);
|
||||
}
|
||||
|
||||
//创建战队 AddTeam
|
||||
|
|
@ -383,7 +387,7 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
<img
|
||||
src={
|
||||
globalSetting?.setting?.competition_banner_url ? globalSetting?.setting?.competition_banner_url :
|
||||
require(`@/assets/images/competition_banner.jpg`)
|
||||
require(`@/assets/images/competition_banner.png`)
|
||||
}
|
||||
alt=""
|
||||
/>
|
||||
|
|
@ -392,7 +396,7 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
<img
|
||||
src={
|
||||
globalSetting?.setting?.competition_banner_url ? globalSetting?.setting?.competition_banner_url :
|
||||
require(`@/assets/images/competition_banner.jpg`)
|
||||
require(`@/assets/images/competition_banner.png`)
|
||||
}
|
||||
alt=""
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -13,21 +13,8 @@
|
|||
<meta name="format-detection" content="telephone=no">
|
||||
<meta name="viewport" content="width=1226">
|
||||
<title>GitLink</title>
|
||||
<meta name="keywords" content="头歌,EduCoder,信息技术实践教学,精品课程网,慕课MOOC">
|
||||
<meta name="google" content="notranslate" />
|
||||
<meta http-equiv="Content-language" content="en">
|
||||
<!-- <meta name="Keywords" content="实践课程,项目实战,java实训,python实战,人工智能技术,后端开发学习,移动开发入门">
|
||||
<meta name="Keywords" content="翻转课堂,高效课堂创建,教学模式">
|
||||
<meta name="Keywords" content="实践项目,python教程,C语言入门,java书,php后端开发,app前端开发,数据库技术">
|
||||
<meta name="Keywords" content="在线竞赛,计算机应用大赛,编程大赛,大学生计算机设计大赛,全国高校绿色计算机大赛"> -->
|
||||
<meta name="description"
|
||||
content="头歌(EduCoder)是信息技术类实践教学平台。头歌(EduCoder)涵盖了计算机、大数据、云计算、人工智能、软件工程、物联网等专业课程。超60000个实训案例,建立学、练、评、测一体化实验环境。">
|
||||
<!-- <meta name="Description"
|
||||
content="EduCoder实践课程,旨在于通过企业级实战实训案例,帮助众多程序员提升各项业务能力。解决学生、学员、企业员工等程序设计能力、算法设计能力、问题求解能力、应用开发能力、系统运维能力等。">
|
||||
<meta name="Description"
|
||||
content="EduCoder翻转课堂教学模式,颠覆了传统教学模式,让教师与学生的关系由“权威变成了“伙伴。将学习的主动权转交给学生,使学生可个性化化学,学生的学习主体得到了彰显。">
|
||||
<meta name="Description" content="EduCoder实践项目为单个知识点关卡实践训练,帮助学生巩固单一弱点,强化学习。" >
|
||||
<meta name="Description" content="EduCoder实践教学平台,各类大赛为进一步提高各类学生综合运用高级语言程序设计能力,培养创新意识和实践探索精神,发掘优秀软件人才。" > -->
|
||||
<!--[if IE]>
|
||||
<script>
|
||||
window.location.replace('/upgrade-browser.html');
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ const IndexPage: FC<PageProps> = ({
|
|||
// }
|
||||
// },[user?.userInfo?.user_id])
|
||||
|
||||
useEffect(() => {
|
||||
setDocumentTitle(globalSetting?.setting?.name || '头歌实践教学平台')
|
||||
}, [globalSetting.setting])
|
||||
// useEffect(() => {
|
||||
// setDocumentTitle(globalSetting?.setting?.name || '头歌实践教学平台')
|
||||
// }, [globalSetting.setting])
|
||||
|
||||
async function getHomeNotice() {
|
||||
//调用接口 获取广告
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import http from './index'
|
||||
|
||||
import { config } from './info';
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,15 @@
|
|||
import './index.less';
|
||||
import MenuBanner from './menu';
|
||||
import SubBanner from '../img/subBanner.png';
|
||||
import { useModel } from 'umi';
|
||||
import { useEffect } from 'react';
|
||||
import { setDocumentTitle } from '@/utils/util'
|
||||
|
||||
|
||||
function Banner(props) {
|
||||
const { mainInfo } = useModel('defaultConfig');
|
||||
useEffect(()=>{
|
||||
setDocumentTitle(mainInfo?.name);
|
||||
})
|
||||
return(
|
||||
<div className='mainroot'>
|
||||
<div className='mainBanner'>
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
import { useRef, useState, useEffect } from 'react';
|
||||
import {useState, useEffect} from 'react';
|
||||
import {
|
||||
Link , useModel
|
||||
Link , useModel
|
||||
}from 'umi';
|
||||
import './index.less';
|
||||
import { getBaseInfo, getPartnerList , gethomePageDocList , getDocDetail } from '../api.js';
|
||||
import { getCount } from '@/service/user';
|
||||
import Left from '../img/left.png';
|
||||
import Right from '../img/right.png';
|
||||
import Arrow from '../img/arrow.png';
|
||||
|
|
@ -18,19 +19,19 @@ import trackBack2 from '../img/track2.png';
|
|||
import Dynamics from '../img/dynamics.png';
|
||||
import Dynamicsicon from '../img/dynamicsicon.png';
|
||||
|
||||
|
||||
function Home(){
|
||||
const [ partner, setPartner ] = useState([]);
|
||||
const [newsList, setNewsList] = useState([]);
|
||||
const [ visits , setVisits ] = useState(0);
|
||||
const [ counts , setCounts ] = useState({});
|
||||
const { mainInfo } = useModel('defaultConfig');
|
||||
|
||||
useEffect(()=>{
|
||||
getPartner();
|
||||
getNewsList();
|
||||
getCountForEdu();
|
||||
getVisit();
|
||||
},[])
|
||||
|
||||
// 获取浏览次数
|
||||
const getVisit=()=>{
|
||||
getDocDetail(656).then(res=>{
|
||||
|
|
@ -39,6 +40,13 @@ function Home(){
|
|||
}
|
||||
|
||||
|
||||
const getCountForEdu=()=>{
|
||||
getCount().then(res=>{
|
||||
// res && setCounts(res);
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 合作单位
|
||||
const getPartner = () => {
|
||||
getPartnerList().then(res => {
|
||||
|
|
@ -51,6 +59,20 @@ function Home(){
|
|||
setNewsList(res.rows)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function formatMoney (value){
|
||||
if (value === 0) {
|
||||
return value;
|
||||
};
|
||||
if (value == '' || !value) {
|
||||
return 0;
|
||||
}
|
||||
value = Number(value);
|
||||
if (isNaN(value)) return '';
|
||||
|
||||
return value.toFixed(0).replace(/\B(?=(\d{3})+(?!\d))/g, ',');
|
||||
}
|
||||
return(
|
||||
<div className="page headpage">
|
||||
{/* <div className="banner">
|
||||
|
|
@ -63,17 +85,17 @@ function Home(){
|
|||
{/* <a className='applicationBtn hoverBtn'>立即报名<img src={Arrow} width={19}/></a> */}
|
||||
<ul className='numbersData'>
|
||||
<li>
|
||||
<span className='number'><em>{visits}</em>次</span>
|
||||
<span className='number'><em>{counts?.visits || visits}</em>次</span>
|
||||
<div className='line'><img src={Diamond} alt="" width={23} /></div>
|
||||
<span className='btn'>浏览次数</span>
|
||||
</li>
|
||||
<li>
|
||||
<span className='number'><em>0</em>人</span>
|
||||
{/* <span className='number'><em>{counts?.count}</em>人</span> */}
|
||||
<div className='line'><img src={Diamond} alt="" width={23} /></div>
|
||||
<span className='btn'>报名人数</span>
|
||||
{/* <span className='btn'>报名人数</span> */}
|
||||
</li>
|
||||
<li>
|
||||
<span className='number'>¥<em>2,100,000</em></span>
|
||||
<span className='number'>¥<em>{counts?.bonus ? formatMoney(counts?.bonus):'2,100,000'}</em></span>
|
||||
<div className='line'><img src={Diamond} alt="" width={23} /></div>
|
||||
<span className='btn'>奖金总数</span>
|
||||
</li>
|
||||
|
|
@ -82,6 +104,7 @@ function Home(){
|
|||
<div className='part'>
|
||||
<p className='homeMaintitle'><img src={Left} /><span>大赛流程</span><img src={Right} /></p>
|
||||
<p className="homeSubtitle"><span>COMPETITION PROCESS</span></p>
|
||||
<p className='homeDesc' style={{textAlign:'center'}}>大赛整体分为热身赛、初赛和决赛三个阶段,具体由各赛事根据各自特点进行组织</p>
|
||||
<ul className='team'>
|
||||
<li>
|
||||
<p className='t-title'><img src={Team} width={33}/><span>热身赛</span><img src={Number1} width={80}/></p>
|
||||
|
|
@ -112,7 +135,7 @@ function Home(){
|
|||
<p style={{opacity:"0.71"}}>参赛队伍解决开源项目疑修,提交代码,创新应用并移植工具,凭贡献获奖。</p>
|
||||
</div>
|
||||
<a className='applicationBtn' href='/competitions/2024/track/675'>查看详情<img src={ArrowPurple} width={19}/></a>
|
||||
<span className='money'><span>约 ¥</span>600,000</span>
|
||||
{/* <span className='money'><span>约 ¥</span>600,000</span> */}
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -123,7 +146,7 @@ function Home(){
|
|||
<p style={{opacity:"0.71"}}>根据指定任务汇聚优秀算法和解决方案,可持续优化更新,结合性能和效果评奖。</p>
|
||||
</div>
|
||||
<a className='applicationBtn' href='/competitions/2024/track/677'>查看详情<img src={ArrowPurple} width={19}/></a>
|
||||
<span className='money'><span>约 ¥</span>1,100,000</span>
|
||||
{/* <span className='money'><span>约 ¥</span>1,100,000</span> */}
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -134,7 +157,7 @@ function Home(){
|
|||
<p style={{opacity:"0.71"}}>在线汇聚高校实践教学案例,助力实践教学创新,依据案例质量与应用成效评奖。</p>
|
||||
</div>
|
||||
<a className='applicationBtn' href='/competitions/2024/track/679'>查看详情<img src={ArrowPurple} width={19}/></a>
|
||||
<span className='money'><span>约 ¥</span>200,000</span>
|
||||
{/* <span className='money'><span>约 ¥</span>200,000</span> */}
|
||||
</div>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -145,7 +168,7 @@ function Home(){
|
|||
<p style={{opacity:"0.71"}}>研读开源项目代码,撰写技术评注、代码注释及缺陷报告,按数量、质量及贡献评奖。</p>
|
||||
</div>
|
||||
<a className='applicationBtn' href='/competitions/2024/track/678'>查看详情<img src={ArrowPurple} width={19}/></a>
|
||||
<span className='money'><span>约 ¥</span>200,000</span>
|
||||
{/* <span className='money'><span>约 ¥</span>200,000</span> */}
|
||||
</div>
|
||||
</li>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@
|
|||
background: #fff;
|
||||
color: #6233DE;
|
||||
margin-left: 66px;
|
||||
display: none;
|
||||
// display: none;
|
||||
margin-top: 0px;
|
||||
}
|
||||
&:hover{
|
||||
|
|
|
|||
|
|
@ -60,6 +60,15 @@ export async function getEducoderUserInfo(params: any) {
|
|||
params: {...params}
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 从头歌获取浏览数、报名人数、奖金总额
|
||||
* @returns
|
||||
*/
|
||||
export function getCount(){
|
||||
return Fetch(`/api/competitions/ccf_count.json`, {
|
||||
method: 'get'
|
||||
});
|
||||
}
|
||||
export async function getNavigationInfo(params: any) {
|
||||
return Fetch('/api/users/get_navigation_info.json', {
|
||||
method: 'get',
|
||||
|
|
|
|||
Loading…
Reference in New Issue