update bug

This commit is contained in:
caishi 2022-04-07 17:56:55 +08:00
parent 4521977a93
commit 912caedef7
22 changed files with 161 additions and 72 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -234,7 +234,7 @@ const User: FC<PageProps> = ({
},
});
delCookie('autologin_trustie');
delCookie('logintrustie');
delCookie('_educoder_session');
localStorage.removeItem('isfirst');
localStorage.removeItem('SystemUpdateadvtime');
@ -271,17 +271,15 @@ const User: FC<PageProps> = ({
<Menu.Item>
<a onClick={async () => {
const res = await ForgeLoginOut({});
if (res?.status === 1) {
dispatch({
type: 'user/getUserInfo',
payload: {
...payload,
},
});
delCookie('autologin');
window.location.reload();
}
dispatch({
type: 'user/getUserInfo',
payload: {
...payload,
},
});
window.location.reload();
delCookie('autologin');
delCookie('logintrustie');
}}
>退</a>
</Menu.Item>
@ -322,7 +320,7 @@ const User: FC<PageProps> = ({
<a href={`${globalSetting?.setting?.common?.main_site_url}/${user.userInfo?.login}`}>
<img
className={`${styles.userPic} current ml15`}
src={`${ENV?.FORGE_SERVER}/images/${user.userInfo?.image_url}`}
src={`${ENV?.FORGE_SERVER}/${user.userInfo?.image_url}`}
alt=""
/>
{/* {checkIsClientExam() && (

View File

@ -46,18 +46,18 @@
&.actived {
a {
color: @primary;
color: #5091ff;
}
&::after {
content: '';
width: 18px;
height: 2px;
background-color: @primary;
position: absolute;
bottom: 14px;
left: 0;
}
// &::after {
// content: '';
// width: 18px;
// height: 2px;
// background-color: @primary;
// position: absolute;
// bottom: 14px;
// left: 0;
// }
}
a {

View File

@ -262,7 +262,7 @@ const HeaderComponents: FC<PageProps> = ({
<li
key={k}
className={
activeKey === k
v.link === (`${ENV.FORGE_SERVER}/competitions`)
? styles.actived
: ''
}
@ -298,11 +298,11 @@ const HeaderComponents: FC<PageProps> = ({
)
}
})}
{(!checkIsClientExam() && !isLogin && globalSetting.setting?.main_site) && <li
{/* {(!checkIsClientExam() && !isLogin && globalSetting.setting?.main_site) && <li
key={'999'}
>
<a href={``} onClick={handleCert}></a>
</li>}
</li>} */}
</ul>
<div className='search-bar'>
{
@ -310,7 +310,8 @@ const HeaderComponents: FC<PageProps> = ({
<SearchInput />
{!isLogin && !!user?.userInfo?.login && <Join />}
{
!!user?.userInfo?.login && <a className="iconfont icon-xiaoxilingdang c-white ml15 mr15 font18 relative" href ={`${ENV.FORGE_SERVER}/settings/notice`}>{user?.userInfo?.message_unread_total && <span className={styles.newslight}></span>}</a>
!!user?.userInfo?.login &&
<a className="iconfont icon-xiaoxilingdang c-white ml15 mr15 font18 relative" href ={`${ENV.FORGE_SERVER}/settings/notice`}>{user?.userInfo?.message_unread_total > 0 ? <span className={styles.newslight}></span>:""}</a>
}
</>
}

View File

@ -84,7 +84,6 @@ const LoginPopComponents = ({ dispatch,setType,user,setusername,globalSetting }:
type: 'user/ForgeLogin',
payload: { ...values ,autologin: values.autologin?1:0 },
})
console.log(response)
if (response.login) {
//判断用户是否选择【下次自动登录】
setCookie('autologin',values.autologin,1);

View File

@ -4,11 +4,14 @@ import zhCN from 'antd/es/locale/zh_CN';
import UserPopLogin from '@/components/User/PopLoginRegister/PopLogin'
import { Spin, Alert } from 'antd';
import { setLocale } from 'umi';
import { trackEvent, trackEventCustom } from '@/utils/util';
import { delCookie, trackEvent, trackEventCustom } from '@/utils/util';
import moment from 'moment';
import { connect, Loading, GlobalSettingModelState, UserModelState, Dispatch, useLocation } from 'umi';
import { getCourseParam } from '@/components/Header';
import ENV from '@/utils/env';
import { Base64 } from 'js-base64';
import { setCookie } from '@/utils/util';
interface PageProps {
loading: Loading,
globalSetting: GlobalSettingModelState,
@ -46,12 +49,46 @@ const SimpleLayouts: FC<PageProps> = ({ loading, globalSetting, children, user,
},
})
}
if (res?.username && loca.pathname === '/login') {
location.href = "/"
}
};
useEffect(()=>{
delCookie("logintrustie");
console.log("清除了");
if(user?.userInfo?.profile_completed){
getEducoderUserInfo();
}
},[user?.userInfo])
const getEducoderUserInfo=async()=>{
if(user?.userInfo?.profile_completed){
delCookie("logintrustie");
var res = await dispatch({
type:"user/getEducoderUserInfo",
payload:{
websiteName: "gitlink" ,
openkey: Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e"),
sign:"cdf0f69b4d5b4293f7914cc1f1f31742",
login: user?.userInfo?.login,
lastname:user?.userInfo?.real_name,
nickname:user?.userInfo?.nickname,
mail:user?.userInfo?.email,
school_name:user?.userInfo?.custom_department
}
})
if(res && res.token){
setCookie("logintrustie",res.token,1);
}
// setCookie("logintrustie","7e43fe5f1f10a8a78728fabc1d03c6a827e21f7e",1);
}
}
useEffect(() => {
delCookie("logintrustie");
console.log("清除了");
getData();
}, [location.pathname])
useEffect(() => {

View File

@ -1,6 +1,6 @@
import { Effect, Reducer, Subscription, history } from 'umi'
import { Action } from '@@/plugin-dva/connect'
import { LoginIn, getUserInfo, getNavigationInfo , ForgeLogin } from '@/service/user'
import { LoginIn, getUserInfo, getNavigationInfo , ForgeLogin , getEducoderUserInfo } from '@/service/user'
export interface UserModelState {
name: string
@ -21,7 +21,8 @@ export interface UserModelType {
getUserInfo: Effect
getNavigationInfo: Effect
setActionTabs: Effect;
ForgeLogin:Effect
ForgeLogin:Effect;
getEducoderUserInfo:Effect
}
reducers: {
save: Reducer<UserModelState>
@ -75,7 +76,7 @@ const UserModel: UserModelType = {
return response;
},
*getUserInfo({ payload }, { call, put }) {
// location.search
// location.search,,debug:"admin"
const response = yield call(getUserInfo, { ...payload})
localStorage.userInfo = JSON.stringify(response);
@ -84,6 +85,10 @@ const UserModel: UserModelType = {
payload: { userInfo: { ...response } },
})
},
*getEducoderUserInfo({ payload }, { call, put }) {
const response = yield call(getEducoderUserInfo, { ...payload})
return response;
},
*getNavigationInfo({ payload }, { call, put }) {
const response = yield call(getNavigationInfo, { ...payload })
yield put({

View File

@ -12,7 +12,8 @@ import {
} from 'umi';
import styles from './index.less';
import AuthModel from '@/components/AuthenticationModel'
import AddSubmitModel from './AddSubmitModel'
import AddSubmitModel from './AddSubmitModel';
import { Base64 } from 'js-base64';
import { Breadcrumb, Button, Menu, message, Spin, Modal } from 'antd';
//查看内容
import SeeItem from './SeeItem';
@ -21,8 +22,8 @@ import UpItem from './Update';
import RanKing from './Ranking'//排行榜
import Award from './AwardPdf' //获奖证书
import ENV from '@/utils/env';
import { openNewWindow,setDocumentTitle } from '@/utils/util';
import { handleVerifyLogin, handleVerify } from '@/utils/verifyLogin';
import { getCookie, openNewWindow,setCookie,setDocumentTitle } from '@/utils/util';
import { handleVerifyLogin, handleVerify , handleProfleCompletedModal } from '@/utils/verifyLogin';
import { isSuperAdmin } from '@/utils/authority';
import SubmitResult from './SubmitResult'
import QR from './mCode.png';
@ -97,8 +98,6 @@ const competitionDetails: FC<PageProps> = ({
setDocumentTitle('竞赛')
}, [identifier])
useEffect(() => {
// console.log('--------',parseInt(loction?.query?.type)===1);
setisshowType(parseInt(loction?.query?.type) === 1)
}, [loction])
@ -153,12 +152,18 @@ const competitionDetails: FC<PageProps> = ({
}
}
async function gotocourse(e: any, item: any, url: string) {
e.stopPropagation();
if (!handleVerify(dispatch)) {
return;
}
// 判断是否完善资料,未完善资料需弹出提示框
if(!handleProfleCompletedModal()){
return;
}
if (HeaderDetail?.is_authentication && !user?.userInfo?.authentication) {
dispatch({
type: 'shixunsDetail/setActionTabs',
@ -168,6 +173,11 @@ const competitionDetails: FC<PageProps> = ({
})
return
}
if(item.identifier === "gcc-courses-2022" || item.identifier === "gcc_2022_projects_type2"){
let arr = HeaderDetail.competition_modules?.filter((item:any)=>item.name === "赛事发布");
arr && arr.length > 0 && getrightdatas(arr[0]);
return;
}
if (url === "ismodel") {
if (item.member_of_course === true) {
openNewWindow(`/classrooms/${item.course_id}`)
@ -205,10 +215,8 @@ const competitionDetails: FC<PageProps> = ({
}
})
if (competitionTeamsresult) {
message.info('报名成功,预祝您夺得桂冠!')
}
} else {
openNewWindow(url)
}
@ -268,7 +276,6 @@ const competitionDetails: FC<PageProps> = ({
payload: {
identifier: identifier,
user_id: user?.userInfo?.user_id,
//user_id:39416
}
})
setPrize(data);
@ -279,15 +286,11 @@ const competitionDetails: FC<PageProps> = ({
type: 'competitions/Accounts',
payload: {
id: user?.userInfo?.user_id,
//user_id:39416
}
})
SetAccounts(data);
}
// console.log('-------',useLocation().query.type);
return (
<div className={"edu-container minH500"}>
<Breadcrumb className="mt10" separator=">">
@ -322,10 +325,18 @@ const competitionDetails: FC<PageProps> = ({
<span> <br /><span style={{ fontSize: '24px' }}>{parseInt(HeaderDetail && HeaderDetail.visits_count).toLocaleString()}</span></span>
<span> <br /><span style={{ fontSize: '24px' }}>{parseInt(HeaderDetail && HeaderDetail.member_count).toLocaleString()}</span></span>
</p>
{HeaderDetail.competition_status === "ended" ? <Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null}
{HeaderDetail.competition_status === 'nearly_published' ? <Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null}
{HeaderDetail.competition_status !== 'nearly_published' && HeaderDetail.enroll_end && HeaderDetail.competition_status !== 'ended' ? <Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null}
{HeaderDetail.competition_status === 'progressing' && HeaderDetail.enroll_end != true ? <Button type="primary" disabled={StaffDetail.enrolled && !HeaderDetail.need_attachment} className={styles.buttonsize} onClick={
{
HeaderDetail.competition_status === "ended" ?
<Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null
}
{HeaderDetail.competition_status === 'nearly_published' ?
<Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null
}
{
HeaderDetail.competition_status !== 'nearly_published' && HeaderDetail.enroll_end && HeaderDetail.competition_status !== 'ended' ?
<Button type="primary" className={styles.buttonsize} disabled={true} ></Button> : null
}
{HeaderDetail.competition_status === 'progressing' && HeaderDetail.enroll_end != true ? <Button type="primary" disabled={StaffDetail.enrolled && !HeaderDetail.need_attachment} className={styles.buttonsize} style={{fontSize:"18px"}} onClick={
(e) => {
if (StaffDetail.enrolled && HeaderDetail.need_attachment) {
see.current?.handleVisible()
@ -333,7 +344,7 @@ const competitionDetails: FC<PageProps> = ({
}
gotocourse(e, HeaderDetail, HeaderDetail.mode === 2 ? 'ismodel' : HeaderDetail.personal ? 'personal' : `/competitions/index/${HeaderDetail.identifier}/enroll`)
}
}>{StaffDetail.enrolled ? HeaderDetail.need_attachment ? '上传作品' : '已报名' : '立即报名'}</Button> : null}
}>{StaffDetail.enrolled ? HeaderDetail.need_attachment ? '上传作品' : '已报名' : (HeaderDetail.identifier === "gcc-courses-2022" || HeaderDetail.identifier === "gcc_2022_projects_type2" ? "前往“赛事发布”板块报名":'立即报名')}</Button> : null}
{user.userInfo.real_name != "游客" && <span onClick={(e) => gotocourse(e, HeaderDetail, `/competitions/index/${HeaderDetail.identifier}/enroll`)} className={styles.myteam}>{isSuperAdmin() ? '参赛战队>>' : '我的战队>>'}</span>}
</div>
</div>

View File

@ -11,7 +11,7 @@ interface Nulldata{
function Nulldata({setIsAddmodel,setJoin,HeaderDetail,user,dispatch}:Nulldata){
return(
<div className={styles.nullnodata}>
<img src={`https://test-newweb.educoder.net/images/educoder/competitions/Noentry.jpg`} />
<img src={require('@/assets/images/Noentry.jpg')} />
<p style={{fontSize:'16px',color:'#333333'}} className="bootomtext"><span onClick={()=>{
if(HeaderDetail?.is_authentication&&!user?.userInfo?.authentication){
dispatch({

View File

@ -33,7 +33,7 @@ function DownStudent({students,setTeams,Teams,HeaderDetail}:DownStudent){
students.push(item);
setTeams(students)
}}>
<img style={{marginLeft:'10px',marginRight:'3px'}} className={styles.loaderimg} src={ENV.IMG_SERVER+`/images/`+`${item.image_url}`}/>
<img style={{marginLeft:'10px',marginRight:'3px'}} className={styles.loaderimg} src={`${item.image_url}`}/>
<span style={{textAlign:'left',width:'20%',padding:'0px 5px'}} >{item.name||'- -'}</span>
<span style={{textAlign:'left',width:'18%',padding:'0px 5px'}} >{item.phone||'- -'}</span>
<span style={{textAlign:'left',width:'18%',padding:'0px 5px'}} className={styles.task_hide}>{item.student_id?'学号'+item.student_id:'- -'}</span>

View File

@ -31,7 +31,7 @@ function Downteacher({teachers,setTeams,Teams,HeaderDetail}:Downteacher){
teachers.push(item);
setTeams(teachers)
}}>
<img style={{marginLeft:'10px',marginRight:'3px'}} className={styles.loaderimg} src={ENV.IMG_SERVER+`/images/`+`${item.image_url}`}/>
<img style={{marginLeft:'10px',marginRight:'3px'}} className={styles.loaderimg} src={`${item.image_url}`}/>
<span style={{textAlign:'left',width:'20%',padding:'0px 5px'}} >{item.name||'- -'}</span>
<span style={{textAlign:'left',width:'18%',padding:'0px 5px'}} >{item.phone||'- -'}</span>
<span style={{textAlign:'left',width:'18%',padding:'0px 5px'}} className={styles.task_hide}>{item.identity||'- -'}</span>

View File

@ -8,6 +8,7 @@ import Teammember from './Teammembers'
import TeacherList from './DownTeacher'
import StudentList from './DownStudents'
import { Base64 } from 'js-base64';
//设置战队成员
interface Setmember {
Membersshow: any
@ -58,7 +59,9 @@ function Setmembers({ Membersshow,setClose,HeaderDetail, StaffDetail,setMembers,
payload: {
identifier: identifier,
keyword: studentname,
team_id: mydatas && mydatas.id
team_id: mydatas && mydatas.id,
openkey: Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e"),
sign:"cdf0f69b4d5b4293f7914cc1f1f31742",
}
})
if (data) {
@ -71,6 +74,8 @@ function Setmembers({ Membersshow,setClose,HeaderDetail, StaffDetail,setMembers,
let data = await dispatch({
type: 'competitions/getTeacher',
payload: {
openkey: Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e"),
sign:"cdf0f69b4d5b4293f7914cc1f1f31742",
identifier: identifier,
keyword: teachname,
team_id: mydatas && mydatas.id
@ -85,6 +90,7 @@ function Setmembers({ Membersshow,setClose,HeaderDetail, StaffDetail,setMembers,
async function submitTeam() {
let member_ids: any = [];
let teacher_ids: any = [];
let gitlink_users:any=[];
Teams && Teams.map((item: any, index: any) => {
if (item.is_teacher) {
@ -92,7 +98,15 @@ function Setmembers({ Membersshow,setClose,HeaderDetail, StaffDetail,setMembers,
} else {
member_ids.push(item.id)
}
gitlink_users.push({
login: item.login,
lastname:item.lastname,
nickname:item.nickname,
mail:item.mail,
school_name:item.school_name
})
})
console.log("addTeam:",gitlink_users);
setTeacherNumber(teacher_ids.length);
setStudentNumber(member_ids.length);
@ -111,11 +125,14 @@ function Setmembers({ Membersshow,setClose,HeaderDetail, StaffDetail,setMembers,
let data = await dispatch({
type: 'competitions/SubmitTeam',
payload: {
openkey: Base64.encode("05e9081ede2e7425db064df44b5fb1897234f44f922443b89597d17b60dc8f3e"),
sign:"cdf0f69b4d5b4293f7914cc1f1f31742",
identifier: identifier,
teamid: mydatas && mydatas.id,
member_ids: member_ids,
teacher_ids: teacher_ids,
leader: loaderid
leader: loaderid,
gitlink_users:gitlink_users
}
})
if (data && data.status === 0) {

View File

@ -51,7 +51,7 @@ function Teammember({ teamitem, index, setTeams, Teams, setLoaderid }: Teammembe
return (
<div className={styles.teammembers}>
<span className={styles.flex1}><img className={styles.loaderimg} src={ENV.IMG_SERVER + `/images/` + `${teamitem.image_url}`} /></span>
<span className={styles.flex1}><img className={styles.loaderimg} src={`${teamitem.image_url?.indexOf("http") > -1 ? teamitem.image_url : (ENV.IMG_SERVER + `/images/` + teamitem.image_url)}`} /></span>
<span className={styles.flex1}>{teamitem && teamitem.name.length > 6 ? teamitem.name.substring(0, 6) + '...' : teamitem.name}</span>
<span className={styles.flex2}>{teamitem && teamitem.phone || '- -'}</span>
<span className={styles.flex2}>{teamitem && teamitem.school_name.length > 6 ? teamitem.school_name.substring(0, 6) + '...' : teamitem.school_name || '- - '}</span>
@ -67,7 +67,7 @@ function Teammember({ teamitem, index, setTeams, Teams, setLoaderid }: Teammembe
</span>
<div className={styles.flex2}>
<Popconfirm title="设置为队长,权限:编辑战队、设置战队成员、转移队长、删除战队" okText="确认" cancelText="取消" onConfirm={()=>setleader()}><span className={` ${styles.deleteitem}`}>{teamitem && teamitem.role === "leader" || teamitem && teamitem.creator ? '' : '设为队长'}</span></Popconfirm>
{/* <Popconfirm title="设置为队长,权限:编辑战队、设置战队成员、转移队长、删除战队" okText="确认" cancelText="取消" onConfirm={()=>setleader()}><span className={` ${styles.deleteitem}`}>{teamitem && teamitem.role === "leader" || teamitem && teamitem.creator ? '' : '设为队长'}</span></Popconfirm> */}
<span style={{color:'#f73737'}} onClick={()=>deleteitem()} className={` ${styles.deleteitem}`}>{teamitem && teamitem.role === "leader" || teamitem && teamitem.creator ? '' : '删除'}</span>
</div>
</div>

View File

@ -327,7 +327,7 @@ const competitionDetails: FC<PageProps> = ({
}
})}
{isSelect || ManagedTeams && ManagedTeams.map((item: any, index: any) => {
{isSelect || ManagedTeams && ManagedTeams.length>0 && ManagedTeams.map((item: any, index: any) => {
if (index === 0) {
return (
<div key={index}>

View File

@ -18,7 +18,7 @@ import ENV from '@/utils/env'
import AuthModel from '@/components/AuthenticationModel'
import { isSuperAdmins } from '@/utils/authority'
import { openNewWindow } from '@/utils/util';
import { handleVerifyLogin, handleVerify } from '@/utils/verifyLogin';
import { handleVerifyLogin, handleVerify , handleProfleCompletedModal} from '@/utils/verifyLogin';
import StatisticsItem from './Statistics/index'
import { mainbannerBg } from '@/components/ImagesIcon';
import AdverModel from '@/components/HomeModal/Advertisement'
@ -63,7 +63,7 @@ const competitionsPage: FC<PageProps> = ({
// getHomeNotice();
dispatch({
type: 'competitions/getList',
payload: { ...competitions.listParams },
payload: { ...competitions.listParams,external:true },
});
}, [competitions.name]);
useEffect(() => {
@ -95,7 +95,7 @@ const competitionsPage: FC<PageProps> = ({
competitions.listParams.page = current;
dispatch({
type: 'competitions/getList',
payload: { ...competitions.listParams, edu: location.query.edu },
payload: { ...competitions.listParams, edu: location.query.edu , external:true },
});
};
@ -109,6 +109,10 @@ const competitionsPage: FC<PageProps> = ({
if (!handleVerify(dispatch)) {
return;
}
// 判断是否完善资料,未完善资料需弹出提示框
if(!handleProfleCompletedModal()){
return;
}
if (item?.is_authentication && !user?.userInfo?.authentication) {
dispatch({
type: 'shixunsDetail/setActionTabs',
@ -118,6 +122,10 @@ const competitionsPage: FC<PageProps> = ({
})
return
}
if(item.identifier === "gcc-courses-2022" || item.identifier === "gcc_2022_projects_type2"){
openNewWindow(`/competitions/index/${item.identifier}`);
return;
}
if (url === "ismodel") {
if (item.member_of_course === true) {
openNewWindow(`/classrooms/${item.course_id}`)
@ -175,7 +183,7 @@ const competitionsPage: FC<PageProps> = ({
<img
src={
globalSetting?.setting?.competition_banner_url ? `${ENV.IMG_SERVER}/` + globalSetting?.setting?.competition_banner_url :
`${ENV.IMG_SERVER}/images/educoder/competitions/courses.jpg`
require(`@/assets/images/competition_banner.jpg`)
}
alt=""
/>
@ -198,7 +206,7 @@ const competitionsPage: FC<PageProps> = ({
competitions.listParams.page = 1;
dispatch({
type: 'competitions/getList',
payload: { ...competitions.listParams },
payload: { ...competitions.listParams,external:true },
});
}}
>
@ -239,7 +247,7 @@ const competitionsPage: FC<PageProps> = ({
style={{ marginBottom: '0px' }}
avatar={
<div className={styles.divimg}>
<img src={item && item.image ? `${ENV.IMG_SERVER}/` + item.image : mainbannerBg} />
<img src={item && item.image ? `${ENV.IMG_SERVER}/` + item.image : require(`@/assets/images/banner/mainbanner.jpg`)} />
</div>
}
title={<p style={{ alignItems: 'center', display: 'flex' }}><a
@ -270,7 +278,7 @@ const competitionsPage: FC<PageProps> = ({
{item && item.competition_status === 'progressing' && item.enroll_end != true ? <Button className={styles.signup} onClick={
(e) => gotocourse(e, item, item.mode === 2 ? 'ismodel' : item.personal ? 'personal' : `/competitions/index/${item.identifier}/enroll`)
} style={{ cursor: 'pointer' }}></Button> : null}
} style={{ cursor: 'pointer'}}></Button> : null}
</div>

View File

@ -94,14 +94,14 @@ export async function JoinTeam(params:any){
}
//查找老师
export async function getTeacher(params:any){
return Fetch(`/api/competitions/${params.identifier}/teachers.json?`,{
return Fetch(`/api/competitions/${params.identifier}/teachers.json`,{
method:'get',
params
});
}
//查找学生
export async function getStudents(params:any){
return Fetch(`/api/competitions/${params.identifier}/students.json?`,{
return Fetch(`/api/competitions/${params.identifier}/students.json`,{
method:'get',
params
});

View File

@ -31,6 +31,12 @@ export async function getUserInfo(params: any) {
params: {...params,}
});
}
export async function getEducoderUserInfo(params: any) {
return Fetch(`/api/users/get_user_info.json`, {
method: 'get',
params: {...params}
});
}
export async function getNavigationInfo(params: any) {
return Fetch('/api/users/get_navigation_info.json', {
method: 'get',

View File

@ -4,6 +4,7 @@ import { notification, message, Modal } from 'antd'
import hash from 'hash.js'
import { useDispatch, getDvaApp, history } from 'umi'
import { reportData } from 'monitor-error-ll'
import { getCookie } from './util';
let modalConfirm: any;
const codeMessage: any = {
200: '服务器成功返回请求的数据。',
@ -121,10 +122,11 @@ export default function request(url: string, option: any, flag?: boolean) {
const defaultOptions = {
credentials: 'include',
withCredentials: true,
withCredentials: true
}
let newOptions = { ...defaultOptions, ...options }
if (
newOptions.method === 'POST' ||
newOptions.method === 'PUT' ||
@ -140,21 +142,26 @@ export default function request(url: string, option: any, flag?: boolean) {
newOptions.body = JSON.stringify(options.body)
} else {
newOptions.headers = {
...newOptions.headers,
...newOptions.headers
}
newOptions.body = options.body
}
}
if (newOptions.method == 'GET') {
newOptions.headers = {
Accept: 'application/json',
'Content-Type': 'application/json; charset=utf-8',
...newOptions.headers,
...newOptions.headers
}
url += '?' + parseParams(options.params)
}
if(url.indexOf("get_user_info") === -1 && getCookie("logintrustie")){
newOptions.headers={
...newOptions.headers,
Authorization:getCookie("logintrustie")
}
}
// newOptions.headers.Authorization =
// 'Bearer 09cb06de7874a0cfae0608ba5126b3b30dcb5d2a'
// if (localStorage.getItem('xhr-user-info')) {

View File

@ -633,7 +633,7 @@ export function setCookie(cname: string, cvalue: string, exdays: number) {
var d = new Date();
d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
var expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + "; " + expires;
document.cookie = cname + "=" + cvalue + "; " + expires+";path=/;";
}

View File

@ -44,7 +44,7 @@ export const handleProfleCompletedModal = () => {
okText: `立即完善`,
cancelText: "稍后完善",
onOk: () => {
history.push('/account/profile/edit');
window.location.href=`${ENV.FORGE_SERVER}/settings/profile`;
}
})