forked from Gitlink/forgeplus-react
issues
This commit is contained in:
parent
338d643862
commit
7017dfedcd
Binary file not shown.
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 393 KiB |
|
@ -8,6 +8,7 @@ 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 { handleProfleCompletedModal } from '@/utils/verifyLogin';
|
||||
import ENV from '@/utils/env';
|
||||
import { Base64 } from 'js-base64';
|
||||
import { setCookie } from '@/utils/util';
|
||||
|
@ -59,38 +60,33 @@ const SimpleLayouts: FC<PageProps> = ({ loading, globalSetting, children, user,
|
|||
};
|
||||
|
||||
useEffect(()=>{
|
||||
delCookie("logintrustie");
|
||||
if(user?.userInfo?.profile_completed){
|
||||
getEducoderUserInfo();
|
||||
}
|
||||
},[user?.userInfo])
|
||||
|
||||
const getEducoderUserInfo=async()=>{
|
||||
if(user?.userInfo?.profile_completed){
|
||||
delCookie("logintrustie");
|
||||
var res = await dispatch({
|
||||
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,
|
||||
phone:user?.userInfo?.phone
|
||||
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,
|
||||
phone:user?.userInfo?.phone
|
||||
}
|
||||
})
|
||||
if(res && res.token){
|
||||
setCookie("logintrustie",res.token,1);
|
||||
}
|
||||
})
|
||||
if(res && res.token){
|
||||
setCookie("logintrustie",res.token,1);
|
||||
}
|
||||
// setCookie("logintrustie","7e43fe5f1f10a8a78728fabc1d03c6a827e21f7e",1);
|
||||
}
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
delCookie("logintrustie");
|
||||
getData();
|
||||
}, [location.pathname])
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ export interface UserModelState {
|
|||
showPopLogin: boolean
|
||||
loading: boolean
|
||||
userInfo?: any
|
||||
eduUserInfo?:any,
|
||||
eduUserInfo?:any
|
||||
navigationInfo: any
|
||||
actionTabs: { key: string; params: any ,phone:string};
|
||||
showClosable: boolean
|
||||
|
|
|
@ -30,6 +30,7 @@ import Entrance from './Entrance'
|
|||
import QR from './mCode.png';
|
||||
import JoinTeam from '../Entered/Enteredmodel/JoinModel'
|
||||
import AddteamsModel from '../Entered/Enteredmodel/Addteams';
|
||||
import InitGitLink from './components/InitGitLink'
|
||||
import PhoneModal from '../components/PhoneModal'
|
||||
import env from '@/utils/env';
|
||||
import ClaModal from '../components/ClaModal';
|
||||
|
@ -82,6 +83,7 @@ const competitionDetails: FC<PageProps> = ({
|
|||
|
||||
const [showmake,setshowmake]=useState<any>(false);
|
||||
const [entrance,setentrance]=useState<any>(false)
|
||||
const [ subGitlinkShow , setSubGitlinkShow ] =useState<any>(false);
|
||||
|
||||
|
||||
const [isshowmodal,setisshowmodal]=useState<any>(false);
|
||||
|
@ -94,16 +96,21 @@ const competitionDetails: FC<PageProps> = ({
|
|||
const [visible,setVisible]=useState<any>(false);
|
||||
|
||||
const loction = useLocation();
|
||||
const see = useRef(null)
|
||||
useEffect(() => {
|
||||
|
||||
if (identifier) {
|
||||
init();
|
||||
//调用默认加载第一条数据
|
||||
}
|
||||
setDocumentTitle('竞赛')
|
||||
}, [identifier])
|
||||
const see = useRef(null);
|
||||
|
||||
useEffect(()=>{
|
||||
if(user?.userInfo?.is_new){
|
||||
setSubGitlinkShow(true);
|
||||
}
|
||||
},[user?.userInfo])
|
||||
|
||||
useEffect(() => {
|
||||
if (identifier) {
|
||||
setTimeout(() => {
|
||||
init();
|
||||
}, 200);
|
||||
}
|
||||
}, [identifier])
|
||||
|
||||
async function init() {
|
||||
setStaffDetail(await dispatch({
|
||||
|
@ -212,6 +219,10 @@ const competitionDetails: FC<PageProps> = ({
|
|||
if (!handleVerify(dispatch)) {
|
||||
return;
|
||||
}
|
||||
if(HeaderDetail.teacher_need_phone||HeaderDetail.member_need_phone){
|
||||
setshowphone(true)
|
||||
return
|
||||
}
|
||||
|
||||
let data =await dispatch({
|
||||
type: 'competitions/GetKylinId',
|
||||
|
@ -227,11 +238,6 @@ const competitionDetails: FC<PageProps> = ({
|
|||
setVisible(true);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
if(HeaderDetail.teacher_need_phone||HeaderDetail.member_need_phone){
|
||||
setshowphone(true)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -520,6 +526,7 @@ async function JoinTeams(name: any) {
|
|||
|
||||
return (
|
||||
<div className={"edu-container minH500"}>
|
||||
<InitGitLink visible={subGitlinkShow} onClose={()=>setSubGitlinkShow(false)}/>
|
||||
<Breadcrumb className="mt10" separator=">">
|
||||
<Breadcrumb.Item><Link to={"/competitions/index"}>在线竞赛</Link></Breadcrumb.Item>
|
||||
<Breadcrumb.Item>{HeaderDetail.name}{HeaderDetail.sub_title ? '-' + HeaderDetail.sub_title : null}</Breadcrumb.Item>
|
||||
|
|
|
@ -13,7 +13,7 @@ function Assembly({ setIsAddmodel, setJoin, HeaderDetail, user, dispatch }: asse
|
|||
return (
|
||||
<div className={styles.backgroundimg} >
|
||||
{/* <p className={styles.titlesize}>在线竞赛平台</p> */}
|
||||
<p className={styles.countsize}>欢迎报名参加本项赛事!头歌全面支持各类竞赛的在线运行管理,</p>
|
||||
<p className={styles.countsize}>欢迎报名参加本项赛事!平台全面支持各类竞赛的在线运行管理,</p>
|
||||
<p className={styles.countsize}>大数据、人工智能、各类芯片架构等竞赛任务均可在线运行、部署和评测。</p>
|
||||
<div className={styles.buttoncoent}>
|
||||
<span onClick={() => {
|
||||
|
@ -40,10 +40,10 @@ function Assembly({ setIsAddmodel, setJoin, HeaderDetail, user, dispatch }: asse
|
|||
setIsAddmodel(true)
|
||||
}} className={styles.createteams}>创建战队</span>
|
||||
</div>
|
||||
<div className={styles.code}>
|
||||
{/* <div className={styles.code}>
|
||||
<p>作品指导张老师微信</p>
|
||||
<div><img width={90} height={90} src={QR} /></div>
|
||||
</div>
|
||||
</div> */}
|
||||
</div>
|
||||
)
|
||||
} export default Assembly;
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 262 KiB After Width: | Height: | Size: 232 KiB |
|
@ -120,7 +120,9 @@ const competitionDetails: FC<PageProps> = ({
|
|||
}
|
||||
}
|
||||
if (identifier) {
|
||||
init();
|
||||
setTimeout(() => {
|
||||
init();
|
||||
}, 200);
|
||||
}
|
||||
}, [identifier])
|
||||
|
||||
|
|
|
@ -319,6 +319,11 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
if (!handleVerify(dispatch)) {
|
||||
return;
|
||||
}
|
||||
if(item.teacher_need_phone||item.member_need_phone){
|
||||
event.stopPropagation();
|
||||
setshowphone(true)
|
||||
return
|
||||
}
|
||||
|
||||
let data =await dispatch({
|
||||
type: 'competitions/GetKylinId',
|
||||
|
@ -335,12 +340,6 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
setVisible(true);
|
||||
return;
|
||||
}
|
||||
}else{
|
||||
if(item.teacher_need_phone||item.member_need_phone){
|
||||
event.stopPropagation();
|
||||
setshowphone(true)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (item.external_url) {
|
||||
|
@ -374,7 +373,7 @@ const competitionsIndexPage: FC<PageProps> = ({
|
|||
return (
|
||||
<section className={styles.bg}>
|
||||
<aside className={styles.banner}>
|
||||
<a href="https://forum.gitlink.org.cn/forums/8451/detail" target="_blank">
|
||||
<a href="https://forum.gitlink.org.cn/forums/8464/detail" target="_blank">
|
||||
<img
|
||||
src={
|
||||
globalSetting?.setting?.competition_banner_url ? `${ENV.IMG_SERVER}/` + globalSetting?.setting?.competition_banner_url :
|
||||
|
|
|
@ -181,7 +181,7 @@ function Addmodal({
|
|||
message.info("请输入验证码");
|
||||
return
|
||||
}
|
||||
const { login } = user.userInfo || {};
|
||||
const { login } = user.eduUserInfo || {};
|
||||
const res = await dispatch({
|
||||
type: 'account/bindPhone',
|
||||
payload: { login, phone,code:PhoneValue }
|
||||
|
|
|
@ -6,7 +6,6 @@ import ENV from '@/utils/env';
|
|||
|
||||
//获取所有频道
|
||||
export async function getGlobalSetting() {
|
||||
console.log("env:",ENV.FORGE_SERVER);
|
||||
return Fetch(`${ENV.FORGE_SERVER}/api/setting.json`, {
|
||||
method: 'Get',
|
||||
});
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export const DEV = {
|
||||
PROXY_SERVER: "https://test-data.educoder.net",
|
||||
PROXY_SERVER: "https://data.educoder.net",
|
||||
API_SERVER: "https://pre-data.educoder.net",
|
||||
REPORT_SERVER: "http://192.168.1.57:3001",
|
||||
IMG_SERVER: 'https://new-testali-cdn.educoder.net',
|
||||
|
|
|
@ -156,18 +156,24 @@ export default function request(url: string, option: any, flag?: boolean) {
|
|||
}
|
||||
url += '?' + parseParams(options.params)
|
||||
}
|
||||
if(url.indexOf("get_user_info") === -1 && getCookie("logintrustie")){
|
||||
newOptions.headers={
|
||||
...newOptions.headers,
|
||||
Authorization:getCookie("logintrustie")
|
||||
}
|
||||
}
|
||||
const { user }: any = getDvaApp()._store.getState();
|
||||
// if(user?.eduUserInfo?.token){
|
||||
// newOptions.headers={
|
||||
// ...newOptions.headers,
|
||||
// Authorization:user?.eduUserInfo?.token
|
||||
// }
|
||||
// }
|
||||
// newOptions.headers.Authorization =
|
||||
// 'Bearer 09cb06de7874a0cfae0608ba5126b3b30dcb5d2a'
|
||||
// if (localStorage.getItem('xhr-user-info')) {
|
||||
// const token = JSON.parse(localStorage.getItem('xhr-user-info')).apiToken
|
||||
// newOptions.headers.Authorization = 'Bearer ' + token
|
||||
// }
|
||||
let token = user?.eduUserInfo?.token || getCookie("logintrustie");
|
||||
if (token) {
|
||||
newOptions.headers={
|
||||
...newOptions.headers,
|
||||
Authorization:token
|
||||
}
|
||||
}
|
||||
console.log("1:",url);
|
||||
console.log("2:",newOptions.headers);
|
||||
|
||||
const expirys = options.expirys && 60
|
||||
/**
|
||||
|
|
|
@ -36,6 +36,7 @@ export const handleProfleCompletedModal = () => {
|
|||
if (!user.userInfo?.profile_completed) {
|
||||
Modal.confirm({
|
||||
title: '提示',
|
||||
visible:true,
|
||||
width: 530,
|
||||
centered: true,
|
||||
content: <div className="tc font16">
|
||||
|
@ -47,10 +48,8 @@ export const handleProfleCompletedModal = () => {
|
|||
window.location.href=`${ENV.FORGE_SERVER}/settings/profile`;
|
||||
}
|
||||
})
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue