资源发布/合并请求

This commit is contained in:
caishi 2023-07-13 09:29:30 +08:00
parent 738d0608db
commit a72edbaeb0
7 changed files with 74 additions and 47 deletions

View File

@ -5,6 +5,7 @@ import { Link } from 'react-router-dom';
import axios from 'axios';
import { getSourceTypeList , getSourceList , getSourceZoneList } from '../api';
import Nodata from '../../Nodata';
import ImgGreen from '../img/green_nodata.png';
import '../indexZone1.scss';
const { Search } = Input;
@ -83,36 +84,40 @@ function Source(props){
/>
</div>
</div>
<div className="sources">
<div className="sources" style={{alignItems:(sourceList && sourceList.length>0) ? "flex-start":"center"}}>
<div className="source_left_ul">
<ul className="source_l_u">
<p>资源领域</p>
<div>
{ temp === "zone1" && <li onClick={()=>setChooseZoneId(undefined)} className={!chooseZoneId ?"active":""}>全部</li>}
{
zoneList && zoneList.length>0&&
zoneList.map((i,k)=>{
return(
<li key={k} onClick={()=>{setChooseZoneId(i.id === chooseZoneId ?undefined : i.id)}} className={chooseZoneId && chooseZoneId === i.id ? "active":"" }>{i.name}</li>
)
})
}
</div>
</ul>
<ul className="source_l_u">
<p>资源类别</p>
<div>
{ temp === "zone1" && <li onClick={()=>setChooseTypeId(undefined)} className={!chooseTypeId ?"active":""}>全部</li>}
{
typeList && typeList.length>0&&
typeList.map((i,k)=>{
return(
<li key={k} onClick={()=>{setChooseTypeId(i.id === chooseTypeId ?undefined : i.id)}} className={chooseTypeId && chooseTypeId === i.id ? "active":"" }>{i.name}</li>
)
})
}
</div>
</ul>
{
zoneList && zoneList.length>0&&
<ul className="source_l_u">
<p>资源领域</p>
<div>
<li onClick={()=>setChooseZoneId(undefined)} className={!chooseZoneId ?"active":""}>全部</li>
{
zoneList.map((i,k)=>{
return(
<li key={k} onClick={()=>{setChooseZoneId(i.id)}} className={chooseZoneId && chooseZoneId === i.id ? "active":"" }>{i.name}</li>
)
})
}
</div>
</ul>
}
{
typeList && typeList.length>0 &&
<ul className="source_l_u">
<p className="borderRight">资源类别</p>
<div>
<li onClick={()=>setChooseTypeId(undefined)} className={!chooseTypeId ?"active":""}>全部</li>
{
typeList.map((i,k)=>{
return(
<li key={k} onClick={()=>{setChooseTypeId(i.id)}} className={chooseTypeId && chooseTypeId === i.id ? "active":"" }>{i.name}</li>
)
})
}
</div>
</ul>
}
</div>
<Spin spinning={isSpin}>
<div className="s_m_list">
@ -142,7 +147,7 @@ function Source(props){
}
{sourceList && sourceList.length === 0 &&
<div style={{textAlign:'center'}}>
<Nodata _html="暂无数据"/>
<Nodata _html="暂无数据" img={temp === "zone1" ? ImgGreen : undefined}/>
</div>
}
{

View File

@ -5,6 +5,7 @@ import RenderHtml from '../../../components/render-html';
import { getSourceDetail } from '../api';
import { Link } from 'react-router-dom';
import axios from 'axios';
import { Base64 } from 'js-base64';
function SourceDetail(props){
@ -57,7 +58,7 @@ function SourceDetail(props){
<div style={{padding:"20px 0px"}}>
<RenderHtml
className="source_detail imageLayerParent"
value={detail.introduction}
value={detail.introduction ? Base64.decode(detail.introduction):""}
url={props.history.location}
/>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -1226,7 +1226,13 @@
}
}
.zone_source_box{
padding-top: 56px;
padding-bottom: 40px;
.source_h{
background-color: rgba(240, 244, 255, 0.94);
padding:56px 0px;
box-sizing: border-box;
min-height: 278px;
}
.source_search_box{
.ant-input-lg{
border-color: #fff;
@ -1235,20 +1241,30 @@
.sources{
display: flex;
align-items: flex-start;
padding:45px 0px;
padding:40px 0px;
width: 1200px;
margin: 0px auto;
background-color: #f7f9fc;
border: 2px solid #ffffff;
border-radius: 4px;
margin-top: -70px;
box-sizing: border-box;
.ant-spin-nested-loading{
flex: 1;
}
.source_left_ul{
width: 610px;
background-image:linear-gradient(89.9deg,#f5f7fa 0%,#f5f7fa 70.54%,rgba(255, 255, 255, 0.97) 100%);
display: flex;
flex-direction: column;
align-items: flex-end;
padding:5px 0px;
margin-right: 6px;
p,li{
height: 60px;
line-height: 60px;
padding-left: 34px;
width: 250px;
width: 215px;
}
p.borderRight{
border-right: 2px solid #fff;
}
p{
font-weight:700;
@ -1268,9 +1284,6 @@
}
}
}
.s_m_list{
width: 945px;
}
.source_lists{
width: 100%;
display: flex;
@ -1286,6 +1299,7 @@
background-image: url(./img/sourceCardBack.png);
background-size: 100% 100%;
border-radius: 2px;
box-shadow: 0px 0px 11px rgba(197, 197,197, 0.1);
a.task-hide{
color:#1f2329;
font-size:16px;

View File

@ -372,7 +372,7 @@ function CoderDepot(props){
// forkpr
function compare() {
if (projectDetail && projectDetail.fork_info) {
urlLink(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${turnbar(branchName || defaultBranch)}...${owner + ':' + turnbar(branchName || defaultBranch)}`)
urlLink(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${turnbar(branchName || defaultBranch)}...${owner +'/' + projectsId + ':' + turnbar(branchName || defaultBranch)}`)
} else {
urlLink(`/${owner}/${projectsId}/compare/${turnbar(defaultBranch)}...${turnbar(branchName || defaultBranch)}`);
}

View File

@ -51,7 +51,14 @@ function getBranchParams(pathname) {
if (pullObj.indexOf(':') > -1) {
// 存在源仓库
const [pullOwner, pullBranch] = pullObj.split(':');
result.pullOwner = pullOwner;
if(pullOwner.indexOf("/")>-1){
const [ ownerO , onwerP ] = pullOwner.split('/');
result.pullOwner = ownerO;
result.pullIdentity = onwerP;
}else{
result.pullOwner = pullOwner;
}
result.pullBranch = pullBranch;
} else {
result.pullBranch = pullObj;
@ -129,8 +136,8 @@ class CreateMerge extends Component {
//获取新建合并请求数据
getMergeInfo = (branchParams,init) => {
this.setState({ isSpin: true });
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId } = branchParams;
const url = `/${pullOwner}/${projectId}/pulls/new.json`;
const { pullOwner, pullBranch, mergeOwner, mergeBranch, projectId , pullIdentity } = branchParams;
const url = `/${pullOwner}/${pullIdentity || projectId}/pulls/new.json`;
axios.get(url).then((result) => {
if (result) {
if(init){
@ -283,7 +290,7 @@ class CreateMerge extends Component {
// 切换仓库响应事件,目前仅目标分支可切换仓库
selectProjectName = (value, isChangeProject, initPro) => {
const { projects_names, id } = isChangeProject ? this.state : initPro;
const { pullOwner, pullBranch } = getBranchParams(
const { pullOwner, pullBranch , pullIdentity , projectId } = getBranchParams(
this.props.location.pathname
);
let arr =
@ -315,7 +322,7 @@ class CreateMerge extends Component {
);
} else {
this.props.history.push(
`/${login}/${identifier}/compare/${branch}...${pullOwner}:${turnbar(pullBranch)}`
`/${login}/${identifier}/compare/${branch}...${pullOwner}/${pullIdentity || projectId}:${turnbar(pullBranch)}`
);
}
}

View File

@ -233,7 +233,7 @@ class merge extends Component {
const { projectsId,owner } = this.props.match.params;
let branch = turnbar(defaultBranch) || "master";
if (projectDetail && projectDetail.fork_info) {
this.props.history.push(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${branch}...${owner + ':' + branch}`)
this.props.history.push(`/${projectDetail.fork_info.fork_project_user_login}/${projectDetail.fork_info.fork_project_identifier}/compare/${branch}...${owner + '/' + projectsId +':' + branch}`)
} else {
this.props.history.push(`/${owner}/${projectsId}/compare/${branch}...${branch}`);
}