From 2a5823a34720bdc6c3cfa5eaf6d31bcf7c13c289 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Sun, 27 Sep 2020 13:58:44 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=B0=8F=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/index.html | 6 +++--- src/App.js | 12 ++++++------ src/forge/Main/CoderRootDirectory.js | 2 +- src/forge/Merge/MessageCount.js | 14 ++++++-------- src/forge/Order/newMilepost.js | 9 ++------- src/modules/tpm/TPMIndex.css | 2 +- src/modules/tpm/TPMIndexHOC.js | 5 +++-- 7 files changed, 22 insertions(+), 28 deletions(-) diff --git a/public/index.html b/public/index.html index 70396e4c..b024c3b7 100755 --- a/public/index.html +++ b/public/index.html @@ -20,7 +20,7 @@ - --> @@ -43,7 +43,7 @@
- + diff --git a/src/App.js b/src/App.js index 534706b8..28ec0d5f 100644 --- a/src/App.js +++ b/src/App.js @@ -213,13 +213,13 @@ class App extends Component { - + {/* */} this.Modifyloginvalue()}> - - - - - + {/* */} + {/* */} + {/* */} + {/* */} + {/* */} {/*项目*/} diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index aeecf7eb..47c2b0a5 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -427,7 +427,7 @@ class CoderRootDirectory extends Component { width: "60%", render: (text, item) => item.commit && item.commit.message ? - + {item.commit.message} : "" diff --git a/src/forge/Merge/MessageCount.js b/src/forge/Merge/MessageCount.js index c837ccb4..c7052fe7 100644 --- a/src/forge/Merge/MessageCount.js +++ b/src/forge/Merge/MessageCount.js @@ -378,14 +378,12 @@ class MessageCount extends Component { -
- {data.issue.description && - data.issue.description.length > 0 ? ( - this.commentCtx(data.issue.description) - ) : ( - 没有描述 - )} -
+ { + data.issue.description ? +
{this.commentCtx(data.issue.description)}
+ : +

没有描述

+ }
{pr_status === 2 && ( diff --git a/src/forge/Order/newMilepost.js b/src/forge/Order/newMilepost.js index 0e3e25d9..965e5a6a 100644 --- a/src/forge/Order/newMilepost.js +++ b/src/forge/Order/newMilepost.js @@ -52,12 +52,9 @@ class NewMilepost extends Component { const { projectsId , owner } = this.props.match.params; const url = `/${owner}/${projectsId}/milestones.json`; let time = undefined; - if (this.state.selectedValue === undefined) { - - } else { - time = this.state.selectedValue.format("YYYY-MM-DD") + if (this.state.selectedValue) { + time = this.state.selectedValue.format("YYYY-MM-DD"); } - axios.post(url, { ...values, project_id: projectsId, @@ -68,10 +65,8 @@ class NewMilepost extends Component { this.setState({ isSpin: false }) this.props.history.push(`/projects/${owner}/${projectsId}/milestones`); } - }).catch(error => { this.setState({ isSpin: false }) - console.log(error); }) }else{ this.setState({ isSpin: false }) diff --git a/src/modules/tpm/TPMIndex.css b/src/modules/tpm/TPMIndex.css index f47632d3..cf3b7ffe 100644 --- a/src/modules/tpm/TPMIndex.css +++ b/src/modules/tpm/TPMIndex.css @@ -29,7 +29,7 @@ body>.-task-title { width: 100%; height:70px; min-width: 1200px; - z-index: 1000; + z-index: 10000; -moz-box-shadow: 0px 2px 10px 0px rgba(0,0,0,0.1); background:rgba(255,255,255,1); box-shadow:0px 2px 10px 0px rgba(0,0,0,0.1); diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index a4c47d4f..e267d8d3 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -8,7 +8,6 @@ import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; import AccountPhoneemail from '../user/AccountPhoneemail'; -import cookies from 'react-cookies'; export function TPMIndexHOC(WrappedComponent) { return class II extends React.Component { @@ -184,15 +183,16 @@ export function TPMIndexHOC(WrappedComponent) { json[key] = value; } } while (arr); - return json; }; + hideLoginDialog = () => { this.setState({ isRender: false, isloginCancel: undefined }) } + showLoginDialog = () => { this.setState({ isRender: true, @@ -209,6 +209,7 @@ export function TPMIndexHOC(WrappedComponent) { AccountProfiletype: false }) } + showProfileCompleteDialog = () => { this.dialogObj = {} this.setState({ From d7103d44f75e99024c94ec6c1951b7e52f6701dd Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Tue, 29 Sep 2020 10:41:04 +0800 Subject: [PATCH 2/3] decodeURL --- src/AppConfig.js | 6 ------ src/forge/Index.js | 1 - src/forge/Main/CoderRootDirectory.js | 15 ++++++++------- src/modules/tpm/TPMIndexHOC.js | 19 +++++++++++++------ 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index 153780b3..644676c7 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -4,9 +4,6 @@ import { broadcastChannelOnmessage , isDev, queryString } from 'educoder'; import { notification } from 'antd'; import cookie from 'react-cookies'; import './index.css'; -const $ = window.$; -let timestamp; -let checkSubmitFlg = false; let message501 = false; broadcastChannelOnmessage('refreshPage', () => { @@ -39,9 +36,7 @@ function clearAllCookie() { } clearAllCookie(); function setpostcookie() { - const str = window.location.pathname; - let newdomain = ".educoder.net" if (str.indexOf("/wxcode") !== -1) { console.log("123") cookie.remove('_educoder_session', { path: '/' }); @@ -53,7 +48,6 @@ function setpostcookie() { cookie.save('_educoder_session', _educoder_sessions[1], { domain: '.educoder.net', path: '/' }); let autologin_trusties = _search.split('&')[1].split('='); cookie.save('autologin_trustie', autologin_trusties[1], { domain: '.educoder.net', path: '/' }); - } } } diff --git a/src/forge/Index.js b/src/forge/Index.js index 6157aa64..eca6d871 100644 --- a/src/forge/Index.js +++ b/src/forge/Index.js @@ -52,7 +52,6 @@ class Index extends Component { )} > ( diff --git a/src/forge/Main/CoderRootDirectory.js b/src/forge/Main/CoderRootDirectory.js index 47c2b0a5..affbd514 100644 --- a/src/forge/Main/CoderRootDirectory.js +++ b/src/forge/Main/CoderRootDirectory.js @@ -89,9 +89,9 @@ class CoderRootDirectory extends Component { if (search && search.indexOf("?url=") > -1) { let url = search.split("?url=")[1]; this.setState({ - filePath: url, + filePath: decodeURI(url), }); - this.getFileDetail(url); + this.getFileDetail(decodeURI(url)); } else { const { branch } = this.state; this.getProjectRoot(branchName || branch); @@ -195,6 +195,9 @@ class CoderRootDirectory extends Component { } }).then((result)=>{ let entries = result.data && result.data.entries; + this.setState({ + isSpin:false + }) if( entries && entries.length > 0){ let { chooseType } = this.state; // 当前返回的子目录只有一条数据,且这条数据返回的是文件类型 @@ -202,14 +205,12 @@ class CoderRootDirectory extends Component { this.setState({ fileDetail:entries, rootList:undefined, - isSpin:false, subFileType:false }) }else{ this.setState({ fileDetail:undefined, rootList:entries, - isSpin:false, branchLastCommit:result.data.last_commit && result.data.last_commit.commit, lastCommitAuthor:result.data.last_commit && (result.data.last_commit.author || (result.data.last_commit.commit && result.data.last_commit.commit.author)) }) @@ -326,9 +327,9 @@ class CoderRootDirectory extends Component { if (search && search.indexOf("?url=") > -1) { let url = search.split("?url=")[1]; this.setState({ - filePath: url, + filePath: decodeURI(url), }); - this.getFileDetail(url, value); + this.getFileDetail(decodeURI(url), value); } else { this.getProjectRoot(value); } @@ -448,7 +449,7 @@ class CoderRootDirectory extends Component { const urlRoot = filePath === undefined ? "" : `/${filePath}`; let array = filePath && filePath.split("/"); return ( - +
diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index e267d8d3..0084c333 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -153,7 +153,7 @@ export function TPMIndexHOC(WrappedComponent) { this.gettablogourlnull(); }); } - + fetchUsers = () => { let url = `/users/get_user_info.json`; axios.get(url).then((response) => { @@ -162,6 +162,9 @@ export function TPMIndexHOC(WrappedComponent) { this.setState({ tpmLoading: false }) + if (this.props.match.path === "/" && response.data.login) { + this.props.history.push(`/users/${response.data.login}`); + } } }).catch((error) => { console.log(error) @@ -394,11 +397,15 @@ export function TPMIndexHOC(WrappedComponent) { tip={this._gLoadingTip || "加载中..."} >
- this.initCommonState(user)} - {...this.props} {...this.state} - {...common} - > - + { + current_user && + this.initCommonState(user)} + {...this.props} {...this.state} + {...common} + > + + } +
Date: Tue, 29 Sep 2020 11:21:00 +0800 Subject: [PATCH 3/3] editor --- src/AppConfig.js | 16 +++++----------- src/forge/Main/CoderRootFileDetail.js | 5 ----- src/forge/Newfile/m_editor.js | 7 ++++--- 3 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/AppConfig.js b/src/AppConfig.js index 644676c7..69d3cc31 100644 --- a/src/AppConfig.js +++ b/src/AppConfig.js @@ -1,6 +1,6 @@ import axios from 'axios'; import { requestProxy } from "./indexEduplus2RequestProxy"; -import { broadcastChannelOnmessage , isDev, queryString } from 'educoder'; +import { broadcastChannelOnmessage, isDev, queryString } from 'educoder'; import { notification } from 'antd'; import cookie from 'react-cookies'; import './index.css'; @@ -57,9 +57,9 @@ window._debugType = debugType; export function initAxiosInterceptors(props) { initOnlineOfflineListener() // TODO 避免重复的请求 https://github.com/axios/axios#cancellation - var - // proxy = "http://localhost:3000" - proxy = "https://forgeplus.trustie.net" + var + // proxy = "http://localhost:3000" + proxy = "https://testforgeplus.trustie.net" const requestMap = {}; window.setfalseInRequestMap = function (keyName) { @@ -103,12 +103,10 @@ export function initAxiosInterceptors(props) { }); axios.interceptors.response.use(function (response) { - - // console.log(".............") if (response === undefined) { return } - const config = response.config + const config = response.config; if (response.data.status === -1) { if (window.location.pathname.startsWith('/tasks/')) { props.showSnackbar(response.data.message || '服务器异常,请联系管理员。') @@ -121,12 +119,10 @@ export function initAxiosInterceptors(props) { }, }); } - throw new axios.Cancel('Operation canceled by the user.'); } if (response.data.status === 403 || response.data.status === "403") { - locationurl('/403'); } @@ -153,8 +149,6 @@ export function initAxiosInterceptors(props) { message501 = false }, 2000); } - - requestMap[response.config.url] = false; setpostcookie(); return response; diff --git a/src/forge/Main/CoderRootFileDetail.js b/src/forge/Main/CoderRootFileDetail.js index f0c9d06a..7b4081d9 100644 --- a/src/forge/Main/CoderRootFileDetail.js +++ b/src/forge/Main/CoderRootFileDetail.js @@ -107,13 +107,8 @@ class CoderRootFileDetail extends Component { EditFile = (flag) => { const { onEdit } = this.props; onEdit && onEdit(flag); - // this.setState({ - // readOnly: false, - // }); }; - // 编辑文件 - changeMmirror = (e, e1, value) => { this.setState({ value, diff --git a/src/forge/Newfile/m_editor.js b/src/forge/Newfile/m_editor.js index 806154b0..a2b4216c 100644 --- a/src/forge/Newfile/m_editor.js +++ b/src/forge/Newfile/m_editor.js @@ -1,6 +1,5 @@ import React, { Component } from "react"; import Editor from "react-monaco-editor"; - import UserSubmitComponent from "./UserSubmitComponent"; import "./index.css"; @@ -29,6 +28,7 @@ class m_editor extends Component { lineHeight: 24, renderLineHighlight: "line", revealHorizontalRightPadding: 5, + placeholder:"请输入内容", readOnly: readOnly, cursorStyle: readOnly ? "underline-thin" : "line", folding: true, @@ -46,16 +46,17 @@ class m_editor extends Component {
+ {!readOnly && (