기준코드 링크 기능 추가.
parent
4e58a20acf
commit
a4eb7eb850
|
|
@ -78,6 +78,7 @@ const URL = {
|
||||||
//기준코드
|
//기준코드
|
||||||
STANDARD_CODE_LIST : "/standardCode/list", //건설기준코드/리스트
|
STANDARD_CODE_LIST : "/standardCode/list", //건설기준코드/리스트
|
||||||
STANDARD_CODE_VIEWER : "/standardCode/viewer", //건설기준코드/뷰어
|
STANDARD_CODE_VIEWER : "/standardCode/viewer", //건설기준코드/뷰어
|
||||||
|
STANDARD_CODE_VIEWER_LINK : "/standardCode/viewer/:linkedDocCode", //건설기준코드/뷰어/새 창 링크
|
||||||
}
|
}
|
||||||
|
|
||||||
export default URL;
|
export default URL;
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import React, { useState, useEffect, useCallback } from 'react';
|
import React, { useState, useEffect, useCallback } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation, useParams } from 'react-router-dom';
|
||||||
import SbItem from './SbItem'
|
import SbItem from './SbItem'
|
||||||
import {SbContainer, VwDiv, VwPtag} from './Sb.style'
|
import {SbContainer, VwDiv, VwPtag} from './Sb.style'
|
||||||
import Row from 'react-bootstrap/Row';
|
import Row from 'react-bootstrap/Row';
|
||||||
|
|
@ -7,7 +7,8 @@ import Col from 'react-bootstrap/Col';
|
||||||
import * as EgovNet from 'api/egovFetch';
|
import * as EgovNet from 'api/egovFetch';
|
||||||
|
|
||||||
function CodeViewer(props) {
|
function CodeViewer(props) {
|
||||||
const [docCode, setDocCode] = useState(props.docCode);
|
const {linkedDocCode} = useParams();
|
||||||
|
const [docCode, setDocCode] = useState(linkedDocCode !== undefined?linkedDocCode:props.docCode);
|
||||||
const [docName, setDocName] = useState(props.docName);
|
const [docName, setDocName] = useState(props.docName);
|
||||||
const [codeTree, setCodeTree] = useState();
|
const [codeTree, setCodeTree] = useState();
|
||||||
const [docSummary, setDocSummary] = useState();
|
const [docSummary, setDocSummary] = useState();
|
||||||
|
|
@ -99,8 +100,12 @@ function CodeViewer(props) {
|
||||||
}
|
}
|
||||||
if(reg.test(item.full_content)){
|
if(reg.test(item.full_content)){
|
||||||
const docCode = item.full_content.match(reg)[0]
|
const docCode = item.full_content.match(reg)[0]
|
||||||
const fullContent = item.full_content.split(docCode);
|
const content = item.full_content.split(docCode);
|
||||||
item.full_content = fullContent[0]+'<key class="docLink">'+docCode+'</key>'+fullContent[1];
|
item.full_content = content[0] +
|
||||||
|
'<a class="docLink" href="/standardCode/viewer/'+docCode+'" target="_blank">'+
|
||||||
|
docCode+
|
||||||
|
'</a>' +
|
||||||
|
content[1];
|
||||||
}
|
}
|
||||||
detailTag.push(
|
detailTag.push(
|
||||||
<VwDiv depth={item.cont_level} isTitle={isTitle} id={item.cont_type_cd} dangerouslySetInnerHTML={ {__html: item.full_content} }></VwDiv>
|
<VwDiv depth={item.cont_level} isTitle={isTitle} id={item.cont_type_cd} dangerouslySetInnerHTML={ {__html: item.full_content} }></VwDiv>
|
||||||
|
|
|
||||||
|
|
@ -227,6 +227,7 @@ const SecondRoutes = () => {
|
||||||
|
|
||||||
{/*기준코드 뷰어*/}
|
{/*기준코드 뷰어*/}
|
||||||
<Route path={URL.STANDARD_CODE_VIEWER} element={<CodeViewer mode={CODE.MODE_READ} />} />
|
<Route path={URL.STANDARD_CODE_VIEWER} element={<CodeViewer mode={CODE.MODE_READ} />} />
|
||||||
|
<Route path={URL.STANDARD_CODE_VIEWER_LINK} element={<CodeViewer mode={CODE.MODE_READ} />} />
|
||||||
|
|
||||||
</Routes>
|
</Routes>
|
||||||
<EgovFooter />
|
<EgovFooter />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue