帮助中心issue

This commit is contained in:
谢思 2023-07-19 16:04:04 +08:00
parent 8e857acc70
commit 108fc75a76
6 changed files with 379 additions and 354 deletions

698
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -23,7 +23,8 @@ function ProjectSource(props) {
const [autoExpandParent, setAutoExpandParent] = useState(false);
const [searchValue, setSearchValue] = useState("");
const [wikiContMenu, setWikiContMenu] = useState(undefined);
const { temp, history, data } = props;
const [container, setContainer] = useState(undefined);
const { temp, history, data, adminUrl } = props;
let scroller = undefined;
const { owner, identifier, projectId } = (data && data.gitlinkProject) || {};
@ -32,6 +33,7 @@ function ProjectSource(props) {
repo: identifier,
projectId
};
const reg = /[.,/#!$%^&*;:{}=\-_`~():,。¥;「」|?》《~·【】‘、!]/g;
useEffect(() => {
if(!owner) return
@ -102,7 +104,7 @@ function ProjectSource(props) {
[].forEach.call(document.querySelectorAll('.wikiContMenuBox li a'), node => {
node.className = '';
});
const currentNode = document.querySelectorAll(`.wikiContMenuBox li a[href="#${element.id}"]`)[0];
const currentNode = document.querySelectorAll(`.wikiContMenuBox li a[href="#${element.textContent.toLocaleLowerCase()}"]`)[0];
if (currentNode) {
currentNode.className = 'current';
}
@ -116,7 +118,7 @@ function ProjectSource(props) {
let ancher = target.getAttribute('href');
if (ancher && ancher.startsWith('#')) {
event.preventDefault()
let viewEl = document.getElementById(ancher.replace('#', ''))
let viewEl = document.getElementById(ancher.replace(reg,""))
if (viewEl) {
viewEl.scrollIntoView(true);
// 170
@ -182,13 +184,14 @@ function ProjectSource(props) {
});
}
const noDataText = adminUrl ? <a href={`${data && data.gitlinkProject.wiki_url}`} target="_blank" style={{color: '#466aff'}}>前往配置</a> : "正在建设中,敬请期待"
return (
<div className="in_pro">
<div className="boxmain" style={{ paddingTop: "56px" }}>
<p className="in_title mb30">{data && data.helperTitle}</p>
<Spin spinning={loading}>
{
wikiList && (wikiList.length > 0 ? <Box className='zoneHelpBox'>
wikiList && (wikiList.length > 0 ? <Box className='zoneHelpBox' ref={node =>{setContainer(node)}}>
{/* wiki目录导航 */}
<div className='leftMenuHC mr20'>
<Search
@ -210,16 +213,17 @@ function ProjectSource(props) {
<div className='wikiTitleHC font-20 mb5'>{wikiDetail.name}</div>
{wikiDetail.commit && <div className='wikiUpdateTimeHC font-15'>更新时间{wikiDetail.commit.author.date || '刚刚'}</div>}
</div>
<Button onClick={()=>{wiki && window.open(`${data && data.gitlinkProject.wiki_url}/${wiki.titleStr}/${wiki.key}`)}} className='zone_apply_button' style={{width: '90px', height: '34px'}}>配置内容</Button>
{adminUrl && <Button onClick={()=>{wiki && window.open(`${data && data.gitlinkProject.wiki_url}/${wiki.titleStr}/${wiki.key}`)}} className='zone_apply_button' style={{width: '90px', height: '34px'}}>配置内容</Button>}
</FlexAJ>
{wikiDetail.md_content && <RenderHtml className="wikiContentHC editor-content-panel mt20" value={ Base64.decode(wikiDetail.md_content) } url={history.location}/>}
</LongWidth>
{wikiContMenu && wikiContMenu !== "<ul></ul>" && <Affix offsetTop={80}>
{/* target={() => container} */}
{wikiContMenu && wikiContMenu !== "<ul></ul>" && <Affix offsetTop={0}>
<div className='wikiContMenuBox font-15' dangerouslySetInnerHTML={{ __html: wikiContMenu }}></div>
</Affix>}
</Box>
</LongWidth>}
</Box> : (temp === tempEnum.zone1 ? <Nodata _html="正在建设中,敬请期待" img={nodata} /> : <Nodata _html="正在建设中,敬请期待" />))}
</Box> : (temp === tempEnum.zone1 ? <Nodata _html={noDataText} img={nodata} /> : <Nodata _html={noDataText} />))}
</Spin>
</div>
</div>

View File

@ -164,7 +164,7 @@ function Index(props){
{data && data.helperShow === 1 && <Route
path="/zone/:deptId/help"
render={(p) => (
<Help {...props} {...p} id={id} temp={ temp } data={data}/>
<Help {...props} {...p} id={id} temp={ temp } data={data} adminUrl={adminUrl}/>
)}
></Route>}
<Route

View File

@ -1464,8 +1464,17 @@
max-width: 220px;
margin-left: 60px;
background-color: #fff;
max-height: 80vh;
overflow-y: auto;
overflow-x: hidden;
a{
color:#6c7283;
word-break: break-all;
overflow: hidden;
display: inline-block;
width: 190px;
white-space: nowrap;
text-overflow: ellipsis;
&.current{
color: var(--primary-color);
position: relative;

View File

@ -330,7 +330,7 @@ export default (props) => {
}
<Modal title="新增目录" visible={visible} onCancel={()=>{setVisible(false);setAddMenuError(undefined);setMenuName(undefined);}} onOk={addMenu} className="wikiAddMenu myself-modal" width={450} centered>
<div className='mb10'>目录名称: </div>
<Input placeholder='请输入目录名称' value={menuName} onChange={(e)=>{setMenuName(e.target.value);setAddMenuError(undefined)}} maxLength={50}></Input>
<Input placeholder='请输入目录名称' value={menuName} onChange={(e)=>{setMenuName(e.target.value);setAddMenuError(undefined)}} maxLength={50} autoFocus></Input>
<div className='wikiAddMenuError mt5'>{addMenuError}</div>
</Modal>
</Spin>

View File

@ -621,9 +621,9 @@ export default function Sidebar(props) {
</DirectoryTree> : ''}
{/* 新增子目录弹窗 */}
<Modal title={isEditName ? `编辑${isEditName === 1 ? '目录' : '页面'}` : "新增目录"} visible={Boolean(visible)} onCancel={onCancel} onOk={submit} className="wikiAddMenu myself-modal" width={450} centered>
<Modal title={isEditName ? `编辑${isEditName === 1 ? '目录' : '页面'}` : "新增目录"} visible={Boolean(visible)} onCancel={onCancel} onOk={submit} className="wikiAddMenu myself-modal" width={450} centered destroyOnClose>
<div className='mb10'>{isEditName === 2 ? '页面' : '目录'}名称: </div>
<Input placeholder={`请输入${isEditName === 2 ? '页面' : '目录'}名称`} value={menuName} onChange={(e)=>{setMenuName(e.target.value);setAddMenuError(undefined)}} maxLength={50}></Input>
<Input placeholder={`请输入${isEditName === 2 ? '页面' : '目录'}名称`} value={menuName} onChange={(e)=>{setMenuName(e.target.value);setAddMenuError(undefined)}} maxLength={50} autoFocus></Input>
<div className='wikiAddMenuError mt5'>{addMenuError}</div>
</Modal>
</div>