Merge pull request '更新wiki、个人建站、专区导航栏配置' (#599) from durian/forgeplus-react:gitlink_server into gitlink_server

This commit is contained in:
durian 2023-12-22 13:49:54 +08:00
commit 5c01ea9cf3
23 changed files with 1514 additions and 1485 deletions

2836
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ export function initAxiosInterceptors(props) {
// 判断网络是否连接
initOnlineOfflineListener();
var proxy = "https://testforgeplus.trustie.net";
var proxy = "http://172.20.32.202:4000";
//响应前的设置
axios.interceptors.request.use(
@ -55,6 +55,7 @@ export function initAxiosInterceptors(props) {
config.url = url;
}
}
config.withCredentials = false;
return config;
},
err => {

View File

@ -205,7 +205,7 @@ function AboutUs(){
<img src={earth} className="earthImg"/>
<div className="statistics_cont df">
<div>
<CountUp {...countUpProps} start={0} end={50000} />
<CountUp {...countUpProps} start={0} end={85000} />
<p>开发者</p>
</div>
<div>
@ -275,7 +275,7 @@ function AboutUs(){
</div>
</div>
</Carousel>
<p className="delivery">简历投递邮箱zengyt#csxjy.com.cn 曾先生 (@符号替换#)</p>
<p className="delivery">简历投递邮箱48630328#qq.com 徐女士 (@符号替换#)</p>
</div>
</div>
{/* 精选组织 */}

View File

@ -10,7 +10,7 @@ function PublicBanner(props){
const [ key , setKey ] = useState("1");
const { deptId } = props.match.params;
const { pathname } = props.history.location;
const { data , adminUrl, temp } = props;
const { data:{sectionHomepageShow, sectionHomepageTitle, sectionProjectShow, sectionProjectTitle, sectionResourceShow, sectionResourceTitle, sectionCmsShow, sectionCmsTitle, sectionMemberShow, sectionMemberTitle, sectionHelperShow, sectionHelperTitle}, data , adminUrl, temp } = props;
useEffect(()=>{
if(pathname){
@ -53,13 +53,13 @@ function PublicBanner(props){
}
<div className="bannerMenus">
<Menu mode={"horizontal"} selectedKeys={[key]}>
<Menu.Item key={"1"}><Link to={`/zone/${deptId}`}><img src={require(`../img/${temp}Menu1.png`)} alt="" width="29px"/>首页</Link></Menu.Item>
<Menu.Item key={"2"}><Link to={`/zone/${deptId}/projects`}><img src={require(`../img/${temp}Menu2.png`)} alt="" width="34px"/>开源项目</Link></Menu.Item>
<Menu.Item key={"3"}><Link to={`/zone/${deptId}/source`}><img src={require(`../img/${temp}Menu3.png`)} alt="" width="33px"/>资源发布</Link></Menu.Item>
<Menu.Item key={"4"}><Link to={`/zone/${deptId}/news`}><img src={require(`../img/${temp}Menu4.png`)} alt="" width="32px"/>{ tempConfig[temp].mainTitle }</Link></Menu.Item>
{sectionHomepageShow && <Menu.Item key={"1"}><Link to={`/zone/${deptId}`}><img src={require(`../img/${temp}Menu1.png`)} alt="" width="29px"/>{sectionHomepageTitle}</Link></Menu.Item>}
{sectionProjectShow && <Menu.Item key={"2"}><Link to={`/zone/${deptId}/projects`}><img src={require(`../img/${temp}Menu2.png`)} alt="" width="34px"/>{sectionProjectTitle}</Link></Menu.Item>}
{sectionResourceShow && <Menu.Item key={"3"}><Link to={`/zone/${deptId}/source`}><img src={require(`../img/${temp}Menu3.png`)} alt="" width="33px"/>{sectionResourceTitle}</Link></Menu.Item>}
{sectionCmsShow && <Menu.Item key={"4"}><Link to={`/zone/${deptId}/news`}><img src={require(`../img/${temp}Menu4.png`)} alt="" width="32px"/>{sectionCmsTitle}</Link></Menu.Item>}
{/* <Menu.Item key={"5"}><img src={Menu5} alt="" width="27px"/>Sig小组</Menu.Item> */}
<Menu.Item key={"6"}><Link to={`/zone/${deptId}/VIP`}><img src={require(`../img/${temp}Menu6.png`)} alt="" width="36px"/>{ tempConfig[temp].member }</Link></Menu.Item>
{data && data.helperShow === 1 && <Menu.Item key={"8"}><Link to={`/zone/${deptId}/help`}><img src={require(`../img/${temp}Menu8.png`)} alt="" width="36px"/>{data.helperTitle}</Link></Menu.Item>}
{sectionMemberShow && <Menu.Item key={"6"}><Link to={`/zone/${deptId}/VIP`}><img src={require(`../img/${temp}Menu6.png`)} alt="" width="36px"/>{ sectionMemberTitle }</Link></Menu.Item>}
{sectionHelperShow && <Menu.Item key={"8"}><Link to={`/zone/${deptId}/help`}><img src={require(`../img/${temp}Menu8.png`)} alt="" width="36px"/>{data.sectionHelperTitle}</Link></Menu.Item>}
{ adminUrl && <Menu.Item key={"7"}><a onClick={()=>{window.location.href=adminUrl}}><img src={require(`../img/${temp}Menu7.png`)} alt="" width="34px"/>后台管理</a></Menu.Item> }
</Menu>
</div>

View File

@ -209,7 +209,7 @@ function ProjectSource(props) {
return (
<div className="in_pro">
<div className="boxmain" style={{ paddingTop: "56px" }}>
<p className="in_title mb30">{data && data.helperTitle}</p>
<p className="in_title mb30">{data && data.sectionHelperTitle}</p>
<Spin spinning={loading}>
{
wikiList && (wikiList.length > 0 ? <Box className='zoneHelpBox'>

View File

@ -24,7 +24,7 @@ function Main(props){
const [ isSpin , setIsSpin ] = useState(true);
const [ newCateId , setNewCateId ] = useState(undefined);
const { deptId , cateId } = props.match.params;
const { id, temp, role, history } = props;
const { id, temp, role, history, sectionCmsTitle } = props;
const menu = (
<Menu>
@ -121,7 +121,7 @@ function Main(props){
<div className="main_content">
<div className="boxmain">
<div className='titleButBox'>
<p className="in_title">{tempConfig[temp].mainTitle}</p>
<p className="in_title">{sectionCmsTitle}</p>
{role && role.role !== "None" && <div className='createButs mt10'>
{role.role === "Member" && <Button type="primary" ghost className='mr20'>
<Link to={`/zone/${deptId}/news/self`}>我的文章</Link>

View File

@ -22,7 +22,7 @@ function ProjectSource(props){
const [ searchName , setSearchName ] = useState(undefined);
const [ value , setValue ] = useState(undefined);
const [ loading , setLoading ] = useState(false);
const { id, temp } = props;
const { id, temp, sectionProjectTitle } = props;
useEffect(()=>{
if(id){
@ -79,7 +79,7 @@ function ProjectSource(props){
<div className="in_pro">
{/* <Banner {...props}/> */}
<div className="boxmain" style={{paddingTop:"56px"}}>
<p className="in_title">开源项目</p>
<p className="in_title">{sectionProjectTitle}</p>
{ temp === tempEnum.zone1 && <p className="project_sub_title">聚合开源特色项目搭建硬件开源服务桥梁</p> }
<Box>
<ul className="in_pro_menu">

View File

@ -23,7 +23,7 @@ function Source(props){
const [ search , setSearch ] = useState(undefined);
const [ isSpin , setIsSpin ] = useState(true);
const limit = 20;
const { id , temp, history, role } = props;
const { id , temp, history, role, sectionResourceTitle } = props;
useEffect(()=>{
id && getLists();
@ -80,7 +80,7 @@ function Source(props){
return(
<div className={`${temp}_source_box`}>
<div className="source_h">
<p className="in_title">资源发布</p>
<p className="in_title">{sectionResourceTitle}</p>
<div style={{marginTop:"30px",textAlign:"center"}} className='titleButBox'>
<Search
placeholder="请输入资源名称"

View File

@ -23,7 +23,7 @@ function ZoneVIP(props){
const [ isSpin , setIsSpin ] = useState(true);
const [ applyVisible , setApplyVisible ] = useState(false);
const [ memberStatus , setMemberStatus] = useState(memberStatusEnum.notMember);
const { id, showNotification, checkIfLogin, showLoginDialog, temp } = props;
const { id, showNotification, checkIfLogin, showLoginDialog, temp, sectionMemberTitle } = props;
useEffect(()=>{
if(id){
@ -74,7 +74,7 @@ function ZoneVIP(props){
return(
<div className={`boxmain ${temp}_VIP_box`}>
<p className="in_title">{ tempConfig[temp].member }</p>
<p className="in_title">{ sectionMemberTitle }</p>
<p className="vip_sub_title">{ tempConfig[temp].vipDesc }</p>
{ memberStatus === memberStatusEnum.notMember && <Button className="zone_apply_button" onClick={ apply }>申请加入</Button> }
{ memberStatus === memberStatusEnum.applying && <div className="mt20 tips" ><Icon type="check-circle" theme="filled" />您的申请已提交请耐心等待管理员审核!</div> }

View File

@ -177,7 +177,7 @@ function Index(props){
<Route
path="/zone/:deptId/news/:cateId"
render={(p) => (
<Main {...props} {...p} id={id} temp={ temp } role={role}/>
<Main {...props} {...p} id={id} temp={ temp } role={role} sectionCmsTitle={data && data.sectionCmsTitle}/>
)}
></Route>
<Route
@ -213,25 +213,25 @@ function Index(props){
<Route
path="/zone/:deptId/source"
render={(p) => (
<Source {...props} {...p} id={id} temp={ temp } role={role}/>
<Source {...props} {...p} id={id} temp={ temp } role={role} sectionResourceTitle={data && data.sectionResourceTitle}/>
)}
></Route>
<Route
path="/zone/:deptId/VIP"
render={(p) => (
<VIP {...props} {...p} id={id} temp={ temp }/>
<VIP {...props} {...p} id={id} temp={ temp } sectionMemberTitle={data && data.sectionMemberTitle}/>
)}
></Route>
<Route
path="/zone/:deptId/projects"
render={(p) => (
<ProjectSource {...props} {...p} id={id} temp={ temp }/>
<ProjectSource {...props} {...p} id={id} temp={ temp } sectionProjectTitle={data && data.sectionProjectTitle}/>
)}
></Route>
<Route
path="/zone/:deptId/news"
render={(p) => (
<Main {...props} {...p} id={id} temp={ temp } role={role}/>
<Main {...props} {...p} id={id} temp={ temp } role={role} sectionCmsTitle={data && data.sectionCmsTitle}/>
)}
></Route>
{data && data.helperShow === 1 && <Route

View File

@ -308,7 +308,7 @@ function Details(props){
}).then(result=>{
if(result && result.data && result.data.project_issues_index){
window.scrollTo(0,0);
props.showNotification("任务复制成功!");
props.showNotification("疑修复制成功!");
props.history.push(`/${owner}/${projectsId}/issues/${result.data.project_issues_index}`);
}
}).catch(error=>{})

View File

@ -6,6 +6,8 @@ import axios from "axios";
import { AlignCenter, AlignTop } from "../../Component/layout";
import { Link } from "react-router-dom";
import { getImageUrl } from "../../../common/UrlTool";
import { ImageLayerOfCommentHOC } from "../../../modules/page/layers/ImageLayerOfCommentHOC";
import { withRouter } from "react-router";
const { TextArea } = Input;
function CreateSite(props) {
@ -18,6 +20,11 @@ function CreateSite(props) {
useEffect(() => {
document.title = "创建站点";
setFieldsValue({
identifier: `http://${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`,
repository_name: `${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`,
name: `${current_user.login}.${site_page_deploy_domain || 'gitlink.net'}`
})
}, []);
useEffect(()=>{
@ -56,7 +63,8 @@ function CreateSite(props) {
...values,
clone_addr: theme && theme.clone_url,
theme: theme && theme.name,
user_id: current_user.user_id
user_id: current_user.user_id,
identifier: values.identifier.split("http://")[1]
}).then(res=>{
if(res && res.status === 200){
message.success("新建成功");
@ -94,18 +102,20 @@ function CreateSite(props) {
>
{getFieldDecorator("identifier", {
rules: [{ required: true, message: "请输入站点标识" },
{pattern: /^[a-zA-Z0-9]{2,100}$/, message: '长度2-100只能包含数字和字母'}],
// {pattern: /^[a-zA-Z0-9]{2,100}$/, message: '2-100'}
],
})(
<Input
onChange={(e) => {
setTag(e.target.value);
}}
placeholder="请输入站点标识"
disabled
/>
)}
<span style={{wordBreak: 'break-all'}}>
{/* <span style={{wordBreak: 'break-all'}}>
http://{current_user.login}.{site_page_deploy_domain}/{tag}
</span>
</span> */}
</Form.Item>
<Form.Item name="建站工具" label="建站工具">
{getFieldDecorator("language_frame", {initialValue: 0})(
@ -124,9 +134,9 @@ function CreateSite(props) {
<AlignTop style={{flexWrap: 'wrap'}}>
{themes && themes.map(item=>{
const {image, name, clone_url} = item;
return <div className="mr20 themeBox" onClick={()=>{setTheme(item)}}>
return <div className="mr20 themeBox imageLayerParent" onClick={()=>{setTheme(item)}}>
<i className={`iconfont icon-wancheng ${theme && theme.clone_url === clone_url ? 'active' : ''}`}></i>
<img src={getImageUrl(image)} alt="" width="125px" height="85px"/>
<img src={getImageUrl(image)} alt="" width="125px" height="85px" className="imageTarget"/>
<p className="task-hide" style={{maxWidth: '120px'}}>{name}</p>
</div>
})}
@ -147,7 +157,7 @@ function CreateSite(props) {
rules: [{ required: true, message: "请输入项目标识" },
{pattern: /^[a-zA-Z0-9][a-zA-Z0-9_.-]{2,100}[a-zA-Z0-9]$/, message: "长度2-100只能包含数字、字母、下划线、中划线、英文句号必须以数字和字母开头不能以下划线/中划线/英文句号开头和结尾"}],
})(
<Input placeholder="请输入项目标识"/>
<Input placeholder="请输入项目标识" disabled/>
)}
</Form.Item>
</AlignCenter>
@ -159,7 +169,7 @@ function CreateSite(props) {
rules: [{ required: true, message: "请输入项目名称" },
{type: 'string', max: 50, min: 1, message: "长度1-50"}],
})(
<Input placeholder="请输入项目名称"/>
<Input placeholder="请输入项目名称" disabled/>
)}
</Form.Item>
<Form.Item name="项目简介" label="项目简介">
@ -185,4 +195,7 @@ function CreateSite(props) {
</Fragment>
);
}
export default Form.create()(CreateSite);
export default withRouter(ImageLayerOfCommentHOC({
imgSelector: ".imageLayerParent img, .imageLayerParent .imageTarget",
parentSelector: ".newContainer",
})(Form.create()(CreateSite)));

View File

@ -1,6 +1,5 @@
.mySites_head{
height: 65px;
line-height: 64px;
border-bottom: 1px solid rgba(224, 230, 245, 1);
color:#151d40;
font-size:17px;

View File

@ -1,5 +1,5 @@
import React, { useState, useEffect, Fragment } from "react";
import { Button, Pagination, Spin } from "antd";
import { Button, Pagination, Spin, Tooltip } from "antd";
import './index.scss';
import '../../users/Material/Index.scss';
import '../bot/exploit/index.scss'
@ -38,7 +38,9 @@ function MySiteList(props){
return <Spin spinning={loading}>
<FlexAJ className="mySites_head">
<span>我的站点</span>
{id_card_verify && website_permission && <Button type="primary" onClick={()=>{history.push(`/settings/mysite/create`)}}>新建站点</Button>}
{id_card_verify && website_permission && total >= 1 ? <Tooltip title="您已存在站点,请勿重复创建">
<Button type="primary" disabled>新建站点</Button>
</Tooltip> : <Button type="primary" onClick={()=>{history.push(`/settings/mysite/create`)}}>新建站点</Button>}
</FlexAJ>
{/* 站点权限被管理员关闭 */}
{id_card_verify && !website_permission && <div className="tipsBox font-15 mt20">您的站点权限被锁定请联系平台管理员</div>}

View File

@ -48,7 +48,7 @@ function ServerIndex(props){
}
></Route>
{/* 个人建站服务 */}
{projectDetail && projectDetail.author.type === "User" && <Route path="/:owner/:projectsId/service/pages"
{projectDetail && projectDetail.web_site && projectDetail.author.type === "User" && <Route path="/:owner/:projectsId/service/pages"
render={
() => (<Pages {...props}/>)
}

View File

@ -64,7 +64,8 @@ function Main(props){
<Link to={`/${owner}/${projectsId}/service/reposyncer`} className="btnhover">查看详情</Link>
</span>
</li> */}
{projectDetail && projectDetail.author.type === "User" && <li>
{/* 是站点仓库则显示,否则隐藏 */}
{projectDetail && projectDetail.web_site && projectDetail.author.type === "User" && <li>
<span className="servername">
<img src={require('./img/logo.png')} alt=""/>
<a onClick={openDetail}>个人建站服务</a>

View File

@ -5,7 +5,7 @@ import SelectBranch from '../../../forge/Branch/Select';
import './index.scss';
function Pages(props) {
const {current_user, history, form, projectDetail, defaultBranch, isManager} = props;
const {current_user, history, form, projectDetail, defaultBranch, isManager, mygetHelmetapi:{site_page_deploy_domain}} = props;
const { owner , projectsId } = props.match.params;
const {id_card_verify} = current_user;
const { getFieldDecorator, validateFieldsAndScroll } = form;
@ -126,7 +126,7 @@ function Pages(props) {
/>
)}
<span style={{wordBreak: 'break-all'}}>
http://{current_user.login}.kingchan.cn/{tag}
http://{current_user.login}.{site_page_deploy_domain}/{tag}
</span>
</Form.Item>
<Form.Item name="建站工具" label="建站工具">

View File

@ -277,6 +277,8 @@ class Setting extends Component {
let mirror = projectDetail && projectDetail.mirror;
let type = projectDetail && projectDetail.type;
const forked_from_project_id = this.props && this.props.projectDetail && this.props.projectDetail.forked_from_project_id;
// 站点仓库不允许修改项目名称和标识
const isWebSiteRepo = projectDetail && projectDetail.web_site;
return (
<div>
<DivertModal
@ -298,7 +300,7 @@ class Setting extends Component {
message: "请输入项目名称",
},
],
})(<Input placeholder="请输入项目名称" />)}
})(<Input placeholder="请输入项目名称" disabled={isWebSiteRepo}/>)}
{
projectDetail && projectDetail.type && projectDetail.type !== 0 ?
<span className="color-grey-9">该项目导入于 <a className="color-grey-6" target="_blank" href={projectDetail.mirror_url}>{projectDetail.mirror_url}</a></span>
@ -335,7 +337,7 @@ class Setting extends Component {
},
],
})(
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" />
<Input placeholder="项目标识请使用与项目相关的英文关键字" maxLength="100" disabled={isWebSiteRepo}/>
)}
</Form.Item>
<Form.Item label="项目简介">

View File

@ -54,7 +54,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
const content = Base64.decode(res.data.md_content);
setContent(content);
setFieldsValue({
title: res.data.name,
title: search === "?copy" ? `${res.data.name}(复制)` : res.data.name,
md_content: content,
});
}
@ -123,7 +123,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
return;
}
const {md_content, title} = values;
if (wikiName) {
if (wikiName && search!== "?copy") {
updateWiki({
owner,
repo: projectsId,
@ -160,7 +160,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
function dealRes(res, title) {
if (res && (res.message === "201" || res.message === "200")) {
if(wikiName){
if(wikiName && search!== "?copy"){
// wikisidebar
if(wikiName === title){
message.success("操作成功");
@ -173,7 +173,14 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
}
}else{
//
if(search.includes("?key")){
if(search === "?copy"){
// keykey
const keyArr = key.split('-');
keyArr.pop();
const list = menuList;
addChildrenByKey(list, keyArr.join('-'), title);
updateSidebar(treeToMd(list), title);
}else if(search.includes("?key")){
// menuListkeychildren push[[]]
const list = menuList;
addChildrenByKey(list, key, title);
@ -316,7 +323,7 @@ export default Form.create()(({ form, history, showNotification, projectDetail,
return (
<div className="wiki-main">
<div className="wiki-head">
<span className="head-title"><span className="back-wiki" onClick={goBack}>Wiki</span> <Icon type="right" /> {wikiName ? '编辑' : '新增'}页面</span>
<span className="head-title"><span className="back-wiki" onClick={goBack}>Wiki</span> <Icon type="right" /> {wikiName ? search === "?copy" ? '复制' : '编辑' : '新增'}页面</span>
</div>
<div >

View File

@ -101,6 +101,7 @@ export default (props) => {
...firstWiki,
key: firstWikiNode.key
})
if(window.location.pathname.indexOf('/wiki') === -1) return
history.push(`/${owner}/${projectsId}/wiki/${title}/${firstWikiNode.key}`);
} else {
setFileArr([]);
@ -231,8 +232,8 @@ export default (props) => {
});
}
function goEdit() {
history.push(`/${owner}/${projectsId}/wiki/${encodeURI(checkItem.name)}/${checkItem.key}/edit`);
function goEdit(params) {
history.push(`/${owner}/${projectsId}/wiki/${encodeURI(checkItem.name)}/${checkItem.key}/edit${params}`);
}
function preview() {
@ -327,7 +328,8 @@ export default (props) => {
</span>
<span className="time-ago font-14">上次修改于{checkItem.commit ? timeAgo(checkItem.commit.author.date) : '刚刚'}</span>
</div>
{permission && <Button type="primary" onClick={goEdit}>编辑</Button>}
{permission && <Button type="primary" ghost onClick={()=>{goEdit(`?copy`)}} className='mr10'>复制</Button>}
{permission && <Button type="primary" onClick={()=>{goEdit("")}}>编辑</Button>}
</div>
{itemDetail&&itemDetail.md_content&&<RenderHtml className="wiki-content-detail editor-content-panel imageLayerParent" value={ itemDetail && Base64.decode(itemDetail.md_content) } url={history.location}/>}

View File

@ -179,14 +179,14 @@ export function findNodeByKey(list, key){
}
// 找到children中有相同key的数组
export function findNodeByChildrenKey(list, key){
export function findBrotherNodesByKey(list, key){
for (let index = 0; index < list.length; index++) {
const element = list[index];
if (element.key == key) {
return list;
}else if (element.children.length) {
let result = findNodeByChildrenKey(element.children, key);
if (result) {
}else if (element.children && element.children.length) {
let result = findBrotherNodesByKey(element.children, key);
if (result.length) {
return result;
}
}

View File

@ -3,7 +3,7 @@ import { Tree, Dropdown, Menu, message, Modal, Input } from 'antd';
import DelModal from '../../components/ModalFun';
import './index.scss';
import '../../components/ModalFun/index.scss';
import { deleteWiki, findNodeByChildrenKey, findNodeByKey, getWiki, treeToMd, updateWiki } from '../../api';
import { deleteWiki, findBrotherNodesByKey, findNodeByKey, getWiki, treeToMd, updateWiki } from '../../api';
import { useEffect } from 'react';
import { Base64 } from 'js-base64';
import { splicingTabs } from '../../utils';
@ -356,20 +356,21 @@ export default function Sidebar(props) {
}else{
// isEditName 1 2
const titleToJudge = isEditName === 2 ? `[[${menuName}]]` : `- ${menuName}`;
const {children, node, title, key} = visible;
const list = findNodeByChildrenKey(menuList, key) || [];
const {title, key} = visible;
if(title.trim() === titleToJudge){
setAddMenuError("请修改名称");
return
}
//
const list = findBrotherNodesByKey(menuList, key) || [];
if(list.map(item=>item.title.trim()).includes(titleToJudge)){
message.error("不能与同级目录名称相同");
setAddMenuError("不能与同级目录名称相同");
return
}
// wiki
const sameNameWiki = fileArrInit.filter(item=>item.name === menuName)
if(isEditName === 2 && sameNameWiki.length){
message.error("wiki名称不可重复");
setAddMenuError("wiki名称不可重复");
return
}
// sidebar

View File

@ -21,10 +21,10 @@ export default function UploadWiki(props) {
},
beforeUpload: beforeUpload,
onChange(info) {
//
const fileName = info.file.name.substring(0,info.file.name.lastIndexOf("."))
if (info.file.status === 'done') {
if (info.file.response.message === '201') {
//
const fileName = info.file.name.substring(0,info.file.name.lastIndexOf("."))
// sidebar
if(!fileArrInit.length){
// wiki
@ -42,13 +42,14 @@ export default function UploadWiki(props) {
message.success(`${fileName} 上传成功`);
history.push(`/${owner}/${projectsId}/wiki/${encodeURI(fileName)}/0`);
setReload(Math.random());
} else if (info.file.response.message === '500') {
message.error(info.file.response.data || '文件上传失败');
} else {
message.error('文件上传失败');
}
} else if (info.file.status === 'error') {
message.error(`${info.file.name} 上传失败`);
const {message: responseMes} = info.file.response;
if(responseMes.indexOf('wiki page already exists') !== -1){
message.error("已存在相同文件名的文件")
}else{
message.error(responseMes || `${fileName} 上传失败`);
}
}
},
};