forked from Gitlink/forgeplus-react
issue
This commit is contained in:
parent
44366b8a26
commit
1457bc1adc
|
@ -5,12 +5,12 @@ const { Search } = Input;
|
|||
|
||||
const $ = window.$;
|
||||
const isDev = window.location.port == 3007;
|
||||
export const TEST_HOST = "https://test-newweb.educoder.net"
|
||||
export const TEST_HOST = "https://testforgeplus.trustie.net"
|
||||
export function getImageUrl(path) {
|
||||
// https://www.educoder.net
|
||||
// https://testbdweb.trustie.net
|
||||
// const local = 'http://localhost:3000'
|
||||
const local = 'https://test-newweb.educoder.net'
|
||||
const local = 'https://testforgeplus.trustie.net'
|
||||
if (isDev) {
|
||||
return `${local}/${path}`
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ export function getImageUrl(path) {
|
|||
}
|
||||
|
||||
export function setImagesUrl(path){
|
||||
const local = 'https://test-newweb.educoder.net'
|
||||
const local = 'https://testforgeplus.trustie.net'
|
||||
let firstStr=path.substr(0,1);
|
||||
// console.log(firstStr);
|
||||
if(firstStr=="/"){
|
||||
|
|
|
@ -40,42 +40,28 @@ class Index extends Component{
|
|||
}
|
||||
}
|
||||
componentDidMount=()=>{
|
||||
this.getUserInfo();
|
||||
document.title="forge开源";
|
||||
}
|
||||
|
||||
getUserInfo=()=>{
|
||||
const url = `/users/me.json`;
|
||||
axios.get(url).then(result=>{
|
||||
// result && result.data.login
|
||||
if(result && result.data.login){
|
||||
this.setState({
|
||||
current_user:result.data
|
||||
})
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
render(){
|
||||
const { current_user } = this.state;
|
||||
return(
|
||||
<div className="newMain clearfix">
|
||||
<Switch {...this.props}>
|
||||
<Route path="/projects/:projectsType/new"
|
||||
render={
|
||||
(props) => (<ProjectNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<ProjectNew {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/:author"
|
||||
render={
|
||||
(props) => (<ProjectDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<ProjectDetail {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route exact path="/projects"
|
||||
render={
|
||||
(props) => (<ProjectIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
(props) => (<ProjectIndex {...this.props} {...props} {...this.state}/>)
|
||||
}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
@ -63,10 +63,10 @@ class CoderRootDirectory extends Component{
|
|||
// 获取根目录
|
||||
getProjectRoot=(branch)=>{
|
||||
const { current_user } = this.props;
|
||||
const { projectsId } = this.props.match.params;
|
||||
const { projectsId , author } = this.props.match.params;
|
||||
const { state } = this.props.history.location;
|
||||
console.log(this.props);
|
||||
const url = `/${state ? state : current_user && current_user.login}/${projectsId}/entries.json`;
|
||||
const url = `/${author}/${projectsId}/entries.json`;
|
||||
axios.get((url),{
|
||||
params:{
|
||||
branch
|
||||
|
|
|
@ -138,6 +138,7 @@ class Detail extends Component{
|
|||
forked_count:undefined,
|
||||
http_url: undefined,
|
||||
author:undefined,
|
||||
current_user:undefined,
|
||||
|
||||
branchs:undefined,
|
||||
branchList:undefined,
|
||||
|
@ -161,7 +162,7 @@ class Detail extends Component{
|
|||
|
||||
|
||||
componentDidMount=()=>{
|
||||
// this.getUserInfo();
|
||||
this.getUserInfo();
|
||||
this.getDetail();
|
||||
}
|
||||
|
||||
|
@ -287,7 +288,7 @@ class Detail extends Component{
|
|||
|
||||
render(){
|
||||
|
||||
const { projectDetail , watchers_count , praises_count , forked_count , project_id } = this.state;
|
||||
const { projectDetail , watchers_count , praises_count , forked_count , project_id , current_user } = this.state;
|
||||
const url = this.props.history.location.pathname;
|
||||
const urlFlag = (url.split("/").length === 3);
|
||||
const { isManager , isDeveloper } = this.props;
|
||||
|
@ -348,55 +349,55 @@ class Detail extends Component{
|
|||
{/* 新建文件 */}
|
||||
<Route path="/projects/:projectsId/:author/coder/:branch/newfile/:path"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/:author/coder/:branch/newfile"
|
||||
render={
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<FileNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 标签列表 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/tags"
|
||||
render={
|
||||
(props) => (<TagList {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<TagList {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 仓库设置 */}
|
||||
<Route path="/projects/:projectsId/:author/setting"
|
||||
render={
|
||||
(props) => (<Setting {...this.props} {...props} {...this.state} getDetail={this.getDetail}/>)
|
||||
(props) => (<Setting {...this.props} {...props} {...this.state} getDetail={this.getDetail} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 工单详情 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/:orderId/detail"
|
||||
render={
|
||||
(props) => (<OrderDetail {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 里程碑 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/Milepost"
|
||||
render={
|
||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/* 新建里程碑 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/meilpost"
|
||||
render={
|
||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrdernewMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/*里程碑详情*/ }
|
||||
<Route path="/projects/:projectsId/:author/orders/:meilid/MilepostDetail"
|
||||
render={
|
||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<MilepostDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
{/*修改里程碑*/}
|
||||
<Route path="/projects/:projectsId/:author/orders/:meilid/meilpost"
|
||||
render={
|
||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderupdateMilepost {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
@ -405,28 +406,28 @@ class Detail extends Component{
|
|||
|
||||
<Route path="/projects/:projectsId/:author/orders/new"
|
||||
render={
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderNew {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 修改详情 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/:orderId/updatedetail"
|
||||
render={
|
||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderupdateDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 复制详情 */}
|
||||
<Route path="/projects/:projectsId/:author/orders/:orderId/copyetail"
|
||||
render={
|
||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrdercopyDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
{/* 动态 */}
|
||||
<Route path="/projects/:projectsId/:author/trends"
|
||||
render={
|
||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<TrendsIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
@ -434,66 +435,66 @@ class Detail extends Component{
|
|||
{/* 代码Index */}
|
||||
<Route path="/projects/:projectsId/:author/orders"
|
||||
render={
|
||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<OrderIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/:author/merge/new"
|
||||
render={
|
||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<CreateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/:author/merge/:mergeId/UpdateMerge"
|
||||
render={
|
||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<UpdateMerge {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/:author/merge/:mergeId/Messagecount"
|
||||
render={
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<MessageCount {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/:author/merge/:mergeId/MergeSubmit"
|
||||
render={
|
||||
(props) => (<MergeSubmit {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<MergeSubmit {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/:author/version/new"
|
||||
render={
|
||||
(props) => (<NewVersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<NewVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
||||
<Route path="/projects/:projectsId/:author/version/:versionId/upversion"
|
||||
render={
|
||||
(props) => (<UpVersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<UpVersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
|
||||
<Route path="/projects/:projectsId/:author/version"
|
||||
render={
|
||||
(props) => (<VersionIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<VersionIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
|
||||
<Route path="/projects/:projectsId/:author/merge"
|
||||
render={
|
||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<MergeIndexDetail {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/:author/coder"
|
||||
render={
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
<Route path="/projects/:projectsId/:author"
|
||||
render={
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state}/>)
|
||||
(props) => (<CoderRootIndex {...this.props} {...props} {...this.state} current_user={current_user}/>)
|
||||
}
|
||||
></Route>
|
||||
</Switch>
|
||||
|
|
|
@ -22,10 +22,25 @@ class Index extends Component{
|
|||
LanguageList:undefined,
|
||||
GitignoreList:undefined,
|
||||
LicensesList:undefined,
|
||||
isSpin:false
|
||||
isSpin:false,
|
||||
current_user:undefined
|
||||
}
|
||||
}
|
||||
getUserInfo=()=>{
|
||||
const url = `/users/me.json`;
|
||||
axios.get(url).then(result=>{
|
||||
if(result && result.data.login){
|
||||
this.setState({
|
||||
current_user:result.data
|
||||
})
|
||||
this.getDetail();
|
||||
}
|
||||
}).catch(error=>{
|
||||
console.log(error)
|
||||
})
|
||||
}
|
||||
componentDidMount=()=>{
|
||||
this.getUserInfo();
|
||||
// 获取项目类别
|
||||
this.getCategory();
|
||||
// 获取项目语言
|
||||
|
@ -101,7 +116,7 @@ class Index extends Component{
|
|||
})
|
||||
this.props.form.validateFieldsAndScroll((err, values) => {
|
||||
if(!err){
|
||||
const { current_user } = this.props;
|
||||
const { current_user } = this.state;
|
||||
const { projectsType } =this.props.match.params;
|
||||
const url = projectsType === "deposit" ? "/projects.json" :"/projects/migrate.json";
|
||||
axios.post(url,{
|
||||
|
|
|
@ -429,7 +429,7 @@ class Detail extends Component{
|
|||
<p>
|
||||
{
|
||||
data ?
|
||||
<span className="font-20">【{data.issue_classify === "issue" ? data.tracker : "合并请求"}】</span>
|
||||
<span className="font-20">【{data.issue_classify === "issue" ? (data.tracker ? data.tracker : " 缺陷" ) : "合并请求"}】</span>
|
||||
:
|
||||
""
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ function QuillForEditor({
|
|||
const result = await fetchUploadImage(formData);
|
||||
// 获取上传图片的url
|
||||
if (result.data && result.data.id) {
|
||||
fileUrl = (`http://123.59.135.93:56666/api/attachments/${result.data.id}`);
|
||||
fileUrl = (`https://testforgeplus.trustie.net/api/attachments/${result.data.id}`);
|
||||
}
|
||||
// 根据id获取文件路径
|
||||
const { width, height } = imgAttrs;
|
||||
|
|
Loading…
Reference in New Issue