Merge branch 'develop'

This commit is contained in:
caishi 2021-05-21 19:21:32 +08:00
commit eb58f91dbf
16 changed files with 209 additions and 75 deletions

8
package-lock.json generated
View File

@ -14030,13 +14030,13 @@
}, },
"qr.js": { "qr.js": {
"version": "0.0.0", "version": "0.0.0",
"resolved": "https://registry.npmjs.org/qr.js/-/qr.js-0.0.0.tgz", "resolved": "https://registry.npm.taobao.org/qr.js/download/qr.js-0.0.0.tgz",
"integrity": "sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8=" "integrity": "sha1-ys6GOG9ZoNuAUPqQ2baw6IoeNk8="
}, },
"qrcode.react": { "qrcode.react": {
"version": "1.0.0", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/qrcode.react/-/qrcode.react-1.0.0.tgz", "resolved": "https://registry.npm.taobao.org/qrcode.react/download/qrcode.react-1.0.1.tgz",
"integrity": "sha512-jBXleohRTwvGBe1ngV+62QvEZ/9IZqQivdwzo9pJM4LQMoCM2VnvNBnKdjvGnKyDZ/l0nCDgsPod19RzlPvm/Q==", "integrity": "sha1-KDS7UOXidf/lr2kG7/FTkf6eOKU=",
"requires": { "requires": {
"loose-envify": "^1.4.0", "loose-envify": "^1.4.0",
"prop-types": "^15.6.0", "prop-types": "^15.6.0",

View File

@ -63,7 +63,7 @@
"postcss-loader": "2.0.8", "postcss-loader": "2.0.8",
"promise": "8.0.1", "promise": "8.0.1",
"prop-types": "^15.6.1", "prop-types": "^15.6.1",
"qrcode.react": "^1.0.0", "qrcode.react": "^1.0.1",
"qs": "^6.9.3", "qs": "^6.9.3",
"quill": "^1.3.7", "quill": "^1.3.7",
"quill-delta-to-html": "^0.11.0", "quill-delta-to-html": "^0.11.0",

View File

@ -205,7 +205,7 @@ class App extends Component {
<ConfigProvider locale={zhCN}> <ConfigProvider locale={zhCN}>
<MuiThemeProvider theme={theme}> <MuiThemeProvider theme={theme}>
<LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog> <LoginDialog {...this.props} {...this.state} Modifyloginvalue={() => this.Modifyloginvalue()}></LoginDialog>
<SiderBar /> <SiderBar/>
<Router> <Router>
<Switch> <Switch>
{/*项目*/} {/*项目*/}

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接 // 判断网络是否连接
initOnlineOfflineListener(); initOnlineOfflineListener();
var proxy = "http://192.168.1.37:3000"; var proxy = "https://testforgeplus.trustie.net";
//响应前的设置 //响应前的设置
axios.interceptors.request.use( axios.interceptors.request.use(
config => { config => {

View File

@ -205,17 +205,33 @@ li.ant-menu-item{
@media screen and (max-width: 1920px){ @media screen and (max-width: 1920px){
.-task-sidebar{ .-task-sidebar{
right:240px; right:220px;
} }
} }
@media screen and (max-width: 1500px){ @media screen and (max-width: 1750px){
.-task-sidebar{ .-task-sidebar{
right:100px; right:160px;
}
}
@media screen and (max-width: 1650px){
.-task-sidebar{
right:115px;
}
}
@media screen and (max-width: 1550px){
.-task-sidebar{
right:90px;
}
}
@media screen and (max-width: 1450px){
.-task-sidebar{
right:45px;
} }
} }
@media screen and (max-width: 1200px){ @media screen and (max-width: 1200px){
.-task-sidebar{ .-task-sidebar{
right:0px; right:0px;
display: none;
} }
} }
.-task-sidebar>div { .-task-sidebar>div {
@ -246,6 +262,9 @@ li.ant-menu-item{
.helpBox{ .helpBox{
width: 260px; width: 260px;
z-index: 103; z-index: 103;
&.shareContent{
width: 200px;
}
.ant-popover-inner-content{ .ant-popover-inner-content{
padding:0px; padding:0px;
} }
@ -281,6 +300,17 @@ li.ant-menu-item{
} }
} }
} }
.shareUl{
padding:10px 0px;
display: flex;
align-items: center;
.titlecontent{
margin-right: 20px;
}
li > i{
font-size: 32px!important;
}
}
} }

View File

@ -2,6 +2,7 @@ import React, { useEffect, useState } from 'react';
import { Popover , Tooltip } from 'antd'; import { Popover , Tooltip } from 'antd';
import './Component.scss'; import './Component.scss';
import axios from 'axios'; import axios from 'axios';
import ShareModal from './SiderBarShareModal';
const $ = window.$; const $ = window.$;
@ -21,6 +22,7 @@ $(window).scroll(function () {
function SiderBar() { function SiderBar() {
const [ data , setData ] = useState([]); const [ data , setData ] = useState([]);
const [ visible , setVisible ] = useState(false);
useEffect(()=>{ useEffect(()=>{
getFAQ(); getFAQ();
@ -48,8 +50,18 @@ function SiderBar() {
</ul> </ul>
</div> </div>
} }
function shareContent(){
return <div>
<ul className="shareUl">
<p className="titlecontent">分享到</p>
<li onClick={()=>setVisible(true)}><i className="iconfont icon-weixin2" style={{color:"#62b900"}}></i></li>
</ul>
</div>
}
return ( return (
<div className={"-task-sidebar"} > <div className={"-task-sidebar"} >
<ShareModal visible={visible} urlValue={window.location.href} onCancel={()=>setVisible(false)}/>
{ {
data && data.length > 0 && (data[0] && data[0].question) ? data && data.length > 0 && (data[0] && data[0].question) ?
<Popover content={content(data)} overlayClassName="helpBox" placement={"left"}> <Popover content={content(data)} overlayClassName="helpBox" placement={"left"}>
@ -61,14 +73,14 @@ function SiderBar() {
} }
{/* <div className="scan pr" title=""> {/* <div className="scan pr" title="">
<span className="inline erweima"><i className="iconfont icon-erweima color-white font-22 fl"></i></span> <span className="inline erweima"><i className="iconfont icon-erweima color-white font-22 fl"></i></span>
</div>*/}
<Popover content={shareContent()} overlayClassName="helpBox shareContent" placement={"left"}>
<div className="consult">
<i className="iconfont icon-fenxiang1"></i>
</div> </div>
<div className="consult" title='在线咨询'> </Popover>
<a target="_blank" className="color_white" href="//shang.qq.com/wpa/qunwpa?idkey=2f2043d88c1bd61d182b98bf1e061c6185e23055bec832c07d8148fe11c5a6cd">
<i className="iconfont icon-qqzaixianzixun color-white font-22"></i>
</a>
</div> */}
<div className="gotop"> <div className="gotop">
<Tooltip title="返回顶部" placement={"left"}> <Tooltip title="返回顶部" placement={"right"}>
<a><i className="iconfont icon-huidaodingbu1"></i></a> <a><i className="iconfont icon-huidaodingbu1"></i></a>
</Tooltip> </Tooltip>
</div> </div>

View File

@ -0,0 +1,27 @@
import React from 'react';
import { Modal } from 'antd';
import QRCode from 'qrcode.react';
function SiderBarShareModal({visible,urlValue,onCancel}) {
return(
<Modal
title={"分享到微信"}
visible={visible}
width="500px"
closable={true}
footer={false}
onCancel={onCancel}
>
<div style={{textAlign:"center"}}>
{urlValue &&<QRCode
value={urlValue}
size={200}
fgColor="#000000"
style={{margin:"20px"}}
/>}
<p>打开微信扫一扫,点击右上角菜单即可将网页分享至朋友圈</p>
</div>
</Modal>
)
}
export default SiderBarShareModal;

View File

@ -45,19 +45,22 @@ function CoderDepot(props){
const [ desc , setDesc ] = useState(undefined); const [ desc , setDesc ] = useState(undefined);
const [ website , setWebsite ] = useState(undefined); const [ website , setWebsite ] = useState(undefined);
const [ lesson_url , setLessonUrl ] = useState(undefined); const [ lesson_url , setLessonUrl ] = useState(undefined);
const [ readme , setReadme ] = useState(undefined)
const owner = props.match.params.owner; const owner = props.match.params.owner;
const projectsId = props.match.params.projectsId; const projectsId = props.match.params.projectsId;
const branchName = props.match.params.branchName; const branchName = props.match.params.branchName;
const details = props.projectDetail;
let pathname = props.history.location.pathname; let pathname = props.history.location.pathname;
useEffect(()=>{ useEffect(()=>{
if(props.projectDetail){ if(details){
setProjectDetail(props.projectDetail); setProjectDetail(details);
setDesc(props.projectDetail.description); setDesc(details.description);
setWebsite(props.projectDetail.website); setWebsite(details.website);
setLessonUrl(props.projectDetail.lesson_url); setLessonUrl(details.lesson_url);
} }
},[props]) },[details])
useEffect(()=>{ useEffect(()=>{
if(treeValue){ if(treeValue){
@ -67,18 +70,19 @@ function CoderDepot(props){
} }
},[treeValue]) },[treeValue])
useEffect(()=>{ useEffect(()=>{
if (pathname && projectDetail){ if (projectsId && owner){
if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) { if(pathname.indexOf(`/projects/${owner}/${projectsId}`) > -1 && pathname.indexOf(`/tree/${branchName}/`) > -1) {
let url = pathname.split(`/tree/${branchName}/`)[1]; let url = pathname.split(`/tree/${branchName}/`)[1];
setTreeValue(url); setTreeValue(url);
getFileInfo(url,branchName); getFileInfo(url,branchName);
}else{ }else{
setTreeValue(undefined); setTreeValue(undefined);
getDirInfo(branchName ||projectDetail.default_branch); getDirInfo(branchName ||(projectDetail && projectDetail.default_branch));
} }
} }
},[pathname,projectDetail]) },[projectsId,owner,pathname])
// //
function getDirInfo(branch){ function getDirInfo(branch){
@ -98,6 +102,7 @@ function CoderDepot(props){
setLastCommitAuthor(c && c.committer); setLastCommitAuthor(c && c.committer);
setMainFlag(true); setMainFlag(true);
setReadOnly(true); setReadOnly(true);
setReadme(result.data.readme);
} }
setTimeout(function(){setIsSpin(false);},500); setTimeout(function(){setIsSpin(false);},500);
}).catch(error=>{setIsSpin(false);}) }).catch(error=>{setIsSpin(false);})
@ -373,7 +378,7 @@ function CoderDepot(props){
(dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :"" (dirInfo && dirInfo.length === 0) && (fileInfo && fileInfo.length === 0) ? <Nodata _html="暂未发现文件"/> :""
} }
{/* readme文件显示(显示文件详情时不显示readme文件) */} {/* readme文件显示(显示文件详情时不显示readme文件) */}
{ dirInfo && (projectDetail && projectDetail.readme) ? <ReadMe ChangeFile={ChangeFile} readme={projectDetail && projectDetail.readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" } { dirInfo && readme ? <ReadMe ChangeFile={ChangeFile} readme={readme} operate={props && (props.isManager || props.isDeveloper) && projectDetail.type !==2 } history={props.history} /> :"" }
</div> </div>
</LongWidth> </LongWidth>
{ {

View File

@ -6,9 +6,15 @@ const $ = window.$;
function CoderDepotReadme({ operate , history , readme , ChangeFile }){ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
const [ menuList ,setMenuList ] = useState(undefined); const [ menuList ,setMenuList ] = useState(undefined);
const [ content ,setContent ] = useState(undefined);
useEffect(()=>{ useEffect(()=>{
if(readme && readme.content){ if(readme && readme.content){
setContent(readme.content);
}
},[readme])
useEffect(()=>{
let path = history.location.pathname; let path = history.location.pathname;
const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) { const items = $.map($("#readme").find("h1,h2,h3,h4,h5,h6"), function (el, _) {
const anchor = el.id; const anchor = el.id;
@ -17,8 +23,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
return { href:`${path}${href}`,text:el.textContent , level:level } return { href:`${path}${href}`,text:el.textContent , level:level }
}); });
setMenuList(items); setMenuList(items);
} },[content])
},[readme])
function menu(){ function menu(){
if(menuList && menuList.length > 0){ if(menuList && menuList.length > 0){
@ -54,7 +59,7 @@ function CoderDepotReadme({ operate , history , readme , ChangeFile }){
} }
</div> </div>
<div className="commonBox-info"> <div className="commonBox-info">
<RenderHtml className="break_word_comments imageLayerParent" value={readme && readme.content} url={history.location}/> <RenderHtml className="break_word_comments imageLayerParent" value={content} url={history.location}/>
</div> </div>
</div> </div>
) )

View File

@ -0,0 +1,21 @@
.i_open{
color: #28BD6C!important;
}
.i_merged{
color: #4C9ED3!important;
}
.i_closed{
color: #FA6400!important;
}
.pr_tags_open{
border:1px solid #28BD6C;
color: #28BD6C;
}
.pr_tags_merged{
border:1px solid #4C9ED3;
color: #4C9ED3;
}
.pr_tags_closed{
border:1px solid #FA6400;
color: #FA6400;
}

View File

@ -49,10 +49,12 @@ class MergeItem extends Component {
const renderList = () => { const renderList = () => {
if (issues && issues.length > 0) { if (issues && issues.length > 0) {
return issues.map((item, key) => { return issues.map((item, key) => {
let status = item.pull_request_staus;
return ( return (
<div className="issueItem"> <div className="issueItem">
<div className="flex-1"> <div className="flex-1">
<p className="mb15 df" style={{ alignItems: "center" }}> <p className="mb15 df" style={{ alignItems: "center" }}>
<i className={`iconfont icon-hebingqingqiu1 font-14 mr3 i_${status}`}></i>
<Link <Link
to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`} to={`/projects/${owner}/${projectsId}/pulls/${item.pull_request_id}/Messagecount`}
className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10" className="hide-1 font-15 color-grey-3 fwb lineh-30 mr10"
@ -60,10 +62,10 @@ class MergeItem extends Component {
> >
{item.name} {item.name}
</Link> </Link>
<Tag className={`pr_tags_${item.pull_request_staus}`}> <Tag className={`pr_tags_${status}`}>
{item.pull_request_staus === "merged" {status === "merged"
? "已合并" ? "已合并"
: item.pull_request_staus === "closed" : status === "closed"
? "已拒绝" ? "已拒绝"
: "开启的"} : "开启的"}
</Tag> </Tag>

View File

@ -241,6 +241,34 @@ class MessageCount extends Component {
) )
} }
// 点击按钮复制功能
jsCopy = () => {
const copyEle = document.querySelector('#descContent') // 获取要复制的节点
const range = document.createRange(); // 创造range
window.getSelection().removeAllRanges(); //清除页面中已有的selection
range.selectNode(copyEle); // 选中需要复制的节点
window.getSelection().addRange(range); // 执行选中元素
document.execCommand("Copy"); // 执行copy操作
}
mergeabledMes=()=>{
return(
<div className="clearfix">
<p className="fl">该分支存在冲突无法自动合并你可以尝试通过如下命令手动合并</p>
<i className="iconfont icon-fuzhi font-16 fr" onClick={()=>this.jsCopy()}></i>
</div>
)
}
mergeabledDesc=(base,head)=>{
return(
<ul id="descContent">
<li>git fetch origin</li>
<li>git checkout -b {`${base}`} origin/{`${base}`}</li>
<li>git merge {`${head}`}</li>
</ul>
)
}
render() { render() {
const { projectsId, mergeId , owner } = this.props.match.params; const { projectsId, mergeId , owner } = this.props.match.params;
@ -323,7 +351,6 @@ class MessageCount extends Component {
to={`/projects/${owner}/${projectsId}/tree/${data.pull_request.base}`} to={`/projects/${owner}/${projectsId}/tree/${data.pull_request.base}`}
className="ver-middle" className="ver-middle"
> >
{/* {data.pull_request.is_fork ? data.pull_request.base : `${data.pull_request.pull_request_user}:${data.pull_request.base}`} */}
{data.issue.project_author_name}:{data.pull_request.base} {data.issue.project_author_name}:{data.pull_request.base}
</Link> </Link>
</Tag> </Tag>
@ -388,12 +415,6 @@ class MessageCount extends Component {
</div> </div>
<div className="ml10"> <div className="ml10">
<div className="mt15 text-right" style={{display:"flex",justifyContent:"flex-end"}}> <div className="mt15 text-right" style={{display:"flex",justifyContent:"flex-end"}}>
{/* <span className="composeButton">
<Dropdown overlay={this.copyItem()} visible={copyVisible} onClick={(e)=>this.setCopyVisible(e)}>
<span>复制</span>
</Dropdown>
<span>下载为<i className="iconfont icon-sanjiaoxing-down color-blue"></i></span>
</span> */}
{operate && ( {operate && (
<Button <Button
type="green" type="green"
@ -440,18 +461,14 @@ class MessageCount extends Component {
type="success" type="success"
/> />
)} )}
{pr_status === 0 && projectDetail && projectDetail.permission !=="Reporter" && ( {operate && (
<Spin spinning={SpinFlag}> <Spin spinning={SpinFlag}>
<div <div
style={{ style={{
display: display:
this.state.mergekey === "rebase" this.state.mergekey === "rebase"
? this.state.buttonshow === "none" ? this.state.buttonshow === "none" ? "block" : "none"
? "block" : !ismesrge ? "block" : "none",
: "none"
: !ismesrge
? "block"
: "none",
}} }}
> >
<p className="mb15"> <p className="mb15">
@ -460,15 +477,25 @@ class MessageCount extends Component {
type="primary" type="primary"
onClick={this.submitmerge} onClick={this.submitmerge}
icon={<Icon type="caret-down" />} icon={<Icon type="caret-down" />}
disabled={!pull_request || (pull_request && !pull_request.mergeable) }
> >
{this.state.mergename} {this.state.mergename}
</Dropdown.Button> </Dropdown.Button>
</p> </p>
{pull_request && pull_request.mergeable
?
<Alert <Alert
message="该合并请求可以进行自动合并操作" message="该合并请求可以进行自动合并操作"
type="success" type="success"
showIcon showIcon
/>:
<Alert
message={this.mergeabledMes()}
type="error"
description={this.mergeabledDesc(pull_request.base,pull_request.head)}
showIcon
/> />
}
</div> </div>
<div> <div>
<div <div

View File

@ -5,6 +5,7 @@ import "../Order/order.css";
import "../Order/index.scss"; import "../Order/index.scss";
import NoneData from "./no_data"; import NoneData from "./no_data";
import OrderItem from "./MergeItem"; import OrderItem from "./MergeItem";
import './Index.scss';
import axios from "axios"; import axios from "axios";
@ -282,6 +283,7 @@ class merge extends Component {
className={status_type === "1" ? "active" : ""} className={status_type === "1" ? "active" : ""}
onClick={() => this.openorder("1")} onClick={() => this.openorder("1")}
> >
<i className="iconfont icon-hebingqingqiu1 font-14 mr3 i_open"></i>
<label>开启的</label> <label>开启的</label>
<span>{data && data.open_count}</span> <span>{data && data.open_count}</span>
</li> </li>
@ -289,6 +291,7 @@ class merge extends Component {
className={status_type === "11" ? "active" : ""} className={status_type === "11" ? "active" : ""}
onClick={() => this.openorder("11")} onClick={() => this.openorder("11")}
> >
<i className="iconfont icon-hebingqingqiu1 font-14 mr3 i_merged"></i>
<label>已合并</label> <label>已合并</label>
<span>{data && data.merged_issues_size}</span> <span>{data && data.merged_issues_size}</span>
</li> </li>
@ -296,6 +299,7 @@ class merge extends Component {
className={status_type === "2" ? "active" : ""} className={status_type === "2" ? "active" : ""}
onClick={() => this.openorder("2")} onClick={() => this.openorder("2")}
> >
<i className="iconfont icon-hebingqingqiu1 font-14 mr3 i_closed"></i>
<label>已拒绝</label> <label>已拒绝</label>
<span>{data && data.close_count}</span> <span>{data && data.close_count}</span>
</li> </li>

View File

@ -64,7 +64,7 @@ class m_editor extends Component {
/> />
</div> </div>
{!readOnly && ( {!readOnly && (
<div style={{marginTop:"20px"}}> <div style={{marginTop:"20px",padding:"20px"}}>
<UserSubmitComponent <UserSubmitComponent
{...this.props} {...this.props}
{...this.state} {...this.state}

View File

@ -553,7 +553,7 @@ class order extends Component {
<div className="topWrapper" style={{borderBottom:"none"}}> <div className="topWrapper" style={{borderBottom:"none"}}>
<div className="target-detail-search"> <div className="target-detail-search">
<Search <Search
placeholder="输入issue名称进行搜索" placeholder="输入关键字搜索易修"
enterButton enterButton
onSearch={this.searchFunc} onSearch={this.searchFunc}
style={{ width: 300 }} style={{ width: 300 }}

View File

@ -54,6 +54,7 @@ class Home extends React.Component {
this.getSchoolDetail(); this.getSchoolDetail();
} }
getSchoolDetail() { getSchoolDetail() {
axios.get(`/schools/${this.state.schoolId}/detail.json`).then(result => { axios.get(`/schools/${this.state.schoolId}/detail.json`).then(result => {
if(result.status === 200){ if(result.status === 200){