This commit is contained in:
caicai8 2020-04-24 18:01:09 +08:00
parent 0f884343d6
commit d8d4c133b3
3 changed files with 39 additions and 72 deletions

View File

@ -55,6 +55,7 @@
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>

View File

@ -1,5 +1,5 @@
import React , { Component } from 'react';
import { Spin } from 'antd';
import { Spin , Tooltip } from 'antd';
import { Link , Route , Switch,withRouter } from 'react-router-dom';
import '../css/index.css'
@ -302,7 +302,6 @@ class Detail extends Component{
const { projectsId } = this.props.match.params;
const { state } = this.props.history.location;
return(
<div>
<Spin spinning={isSpin}>
@ -317,29 +316,45 @@ class Detail extends Component{
</Link>
}
<span className="ml5 mr5">/</span>
<span className="hide-1 flex-1">
<span className="hide-1 flex-1 df">
<Link to={`/projects/${projectsId}/coders`} className="color-white">{ projectDetail && projectDetail.name }</Link>
</span>
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
<Tooltip placement={'right'}
title={`forked from ${ projectDetail.fork_info.fork_project_user_name} / ${ projectDetail.fork_info.fork_form_name }`}>
<a href={`/users/${ projectDetail.fork_info.fork_project_user_login}/projects`}
target="_blank"
className="ml20" >
<i className="iconfont icon-fork color-grey-74 font-20 fl"></i>
</a>
</Tooltip>:""
}
</span>
</p>
{
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ?
<div className="fork-css font-14 color-grey-ccc df flex-1 lineH2" style={{alignItems:"center"}}>
<span className="mr10">
<img src={img_fork} alt="" width="13px"/>
</span>
<span className="mr10">forked from</span>
<Link to={`/users/${projectDetail.fork_info.fork_project_user_login}/projects`} className="show-user-link color-grey-ccc">
{projectDetail.fork_info.fork_project_user_name}
</Link>
<span className="ml5 mr5">/</span>
<span className="hide-1 flex-1">
<Link to={`/projects/${projectDetail.forked_from_project_id}/coders`} className="color-grey-ccc">{ projectDetail.fork_info.fork_form_name }</Link>
</span>
</div>
:
{/* {
projectDetail && projectDetail.forked_from_project_id && projectDetail.fork_info ? */}
{/* <a href={`/users/${ projectDetail && projectDetail.fork_info && projectDetail.fork_info.fork_project_user_login}/projects`}
className="fl mt5"
target="_blank"
data-tip-right={`forked from ${projectDetail && projectDetail.fork_info &&projectDetail.fork_info.fork_project_user_name} / ${projectDetail && projectDetail.fork_info &&projectDetail.fork_info.fork_form_name}`}>
<i className="iconfont icon-fork color-grey-74 font-20 fl"></i>
</a> */}
{/* // <div className="fork-css font-14 color-grey-ccc df flex-1 lineH2" style={{alignItems:"center"}}>
// <span className="mr10">
// <img src={img_fork} alt="" width="13px"/>
// </span>
// <span className="mr10">forked from</span>
// <Link to={`/users/${projectDetail.fork_info.fork_project_user_login}/projects`} className="show-user-link color-grey-ccc">
// {projectDetail.fork_info.fork_project_user_name}
// </Link>
// <span className="ml5 mr5">/</span>
// <span className="hide-1 flex-1">
// <Link to={`/projects/${projectDetail.forked_from_project_id}/coders`} className="color-grey-ccc">{ projectDetail.fork_info.fork_form_name }</Link>
// </span>
// </div> */}
{/* :
""
}
} */}
</div>
<div className="f-wrap-between">

View File

@ -13,37 +13,6 @@ import update from 'immutability-helper'
import axios from 'axios';
// import { getUrl } from 'educoder'
// let _url_origin = getUrl()
// const $ = window.$
// let prefix = '/react/build'
// if (window.location.port == 3007) {
// prefix = ''
// } else {
// }
// 下面这个加载方式有问题改到html 写script标签
// if (!window['TPIScriptLoaded']) {
// // $('head').append($('<link rel="stylesheet" type="text/css" />')
// // .attr('href', `${_url_origin}${prefix}/js/xterm/xterm.css`));
// $.when(
// $.getScript( `${_url_origin}/assets/kindeditor/kindeditor.js` ),
// $.getScript( `${_url_origin}${prefix}/js/create_kindeditor.js` ),
// $.getScript( `${_url_origin}/javascripts/educoder/edu_application.js` ),
// $.Deferred(function( deferred ){
// $( deferred.resolve );
// })
// ).done(function(){
// window.TPIScriptLoaded = true
// //place your code here, the scripts are all loaded
// // callback && callback()
// });
// } else {
// // callback && callback()
// }
class Index extends Component {
constructor(props) {
super(props)
@ -53,31 +22,16 @@ class Index extends Component {
styles += 'overflow: hidden !important;'
window.$('body').attr('style', styles);
window.$('#root').css('position', 'absolute')
// TPI浏览器缩放
// setTimeout(() => {
// const agent = navigator.userAgent;
// if (agent.indexOf('Mac OS') == -1) {
// window._initZoomCheck()
// }
// }, 800)
this.onDrawerButtonClick = this.onDrawerButtonClick.bind(this)
this.onStarChange = this.onStarChange.bind(this)
this.saveChallengeStar = this.saveChallengeStar.bind(this)
this.onChallengesDrawerClose = this.onChallengesDrawerClose.bind(this)
this.starArray = [];
// 将原本放置在Header.js中的state上提到Index.js
this.state = {
challengesDrawerOpen: false,
taskListLoading: true,
challenges: [], // 任务列表
}
}
@ -92,7 +46,6 @@ class Index extends Component {
return;
}
const { shixun, myshixun } = this.props;
// var getChallengesUrl = `/api/v1/games/${this.props.game.identifier}/challenges`;
var getChallengesUrl = `/myshixuns/${myshixun.identifier}/challenges.json`;
this.setState({
@ -100,9 +53,7 @@ class Index extends Component {
challengesDrawerOpen:true
})
axios.get(getChallengesUrl, {
// withCredentials: true,
})
axios.get(getChallengesUrl)
.then((response) => {
if (response.data.status == -1) {