From 1457bc1adc9f13a0a270e1d220f513994dea3163 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 20 Mar 2020 18:54:02 +0800 Subject: [PATCH] issue --- src/common/UrlTool.js | 6 ++-- src/forge/Index.js | 22 +++--------- src/forge/Main/CoderRootDirectory.js | 4 +-- src/forge/Main/Detail.js | 53 ++++++++++++++-------------- src/forge/New/Index.js | 19 ++++++++-- src/forge/Order/Detail.js | 2 +- src/forge/quillForEditor/index.js | 2 +- 7 files changed, 55 insertions(+), 53 deletions(-) diff --git a/src/common/UrlTool.js b/src/common/UrlTool.js index c33fe4a7..2c42b7bd 100644 --- a/src/common/UrlTool.js +++ b/src/common/UrlTool.js @@ -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=="/"){ diff --git a/src/forge/Index.js b/src/forge/Index.js index 3ba1672e..6dae5853 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -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(
() + (props) => () } > () + (props) => () } > () + (props) => () } > diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 0bfd64ce..ff6e3235 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -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 diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index 95634b04..01133e20 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -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{ {/* 新建文件 */} () + (props) => () } > () + (props) => () } > {/* 标签列表 */} () + (props) => () } > {/* 仓库设置 */} () + (props) => () } > {/* 工单详情 */} () + (props) => () } > {/* 里程碑 */} () + (props) => () } > {/* 新建里程碑 */} () + (props) => () } > {/*里程碑详情*/ } () + (props) => () } > {/*修改里程碑*/} () + (props) => () } > @@ -405,28 +406,28 @@ class Detail extends Component{ () + (props) => () } > {/* 修改详情 */} () + (props) => () } > {/* 复制详情 */} () + (props) => () } > {/* 动态 */} () + (props) => () } > @@ -434,66 +435,66 @@ class Detail extends Component{ {/* 代码Index */} () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > () + (props) => () } > diff --git a/src/forge/New/Index.js b/src/forge/New/Index.js index a8c6bec1..0ccb1a9c 100644 --- a/src/forge/New/Index.js +++ b/src/forge/New/Index.js @@ -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,{ diff --git a/src/forge/Order/Detail.js b/src/forge/Order/Detail.js index f915dbe5..ecbf0ead 100644 --- a/src/forge/Order/Detail.js +++ b/src/forge/Order/Detail.js @@ -429,7 +429,7 @@ class Detail extends Component{

{ data ? - 【{data.issue_classify === "issue" ? data.tracker : "合并请求"}】 + 【{data.issue_classify === "issue" ? (data.tracker ? data.tracker : " 缺陷" ) : "合并请求"}】 : "" } diff --git a/src/forge/quillForEditor/index.js b/src/forge/quillForEditor/index.js index f90b58e2..98f8dba6 100644 --- a/src/forge/quillForEditor/index.js +++ b/src/forge/quillForEditor/index.js @@ -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;