diff --git a/src/forge/Information/Component/comments/list.jsx b/src/forge/Information/Component/comments/list.jsx index 4f5168704..3aeb842ba 100644 --- a/src/forge/Information/Component/comments/list.jsx +++ b/src/forge/Information/Component/comments/list.jsx @@ -10,6 +10,7 @@ import CheckProfile from '../../../Component/ProfileModal/Profile'; import './list.scss'; import { Link } from 'react-router-dom'; import { getCommentList, deleteComment } from '../../api' +import { normalizeUrl } from '../../../common/util'; function IssueCommentList(props){ const{docId, history: {location}, reload, reloadComment, showNotification, current_user:{login, admin, image_url, username}, isManager, showLoginDialog, author} = props; @@ -127,9 +128,9 @@ function IssueCommentList(props){
{ item.user.login ? - + : - + }
{/* 判断是否是编辑状态 */} @@ -171,7 +172,7 @@ function IssueCommentList(props){ {(showEdit === 4 && updateId === i.id) ?
:
- + {i.user.name} {i.reply_user && 回复} {i.reply_user && i.reply_user.name} diff --git a/src/forge/common/util.js b/src/forge/common/util.js index 1b35ea23b..4eb59b427 100644 --- a/src/forge/common/util.js +++ b/src/forge/common/util.js @@ -13,4 +13,14 @@ export function timeFormat(SecondsStr){ const hour = time.getHours()<10?"0".concat(time.getHours()):time.getHours(); const minutes = time.getMinutes()<10?"0".concat(time.getMinutes()):time.getMinutes(); return time.getFullYear()+"-"+(time.getMonth()+1)+"-"+time.getDate()+" "+hour+":"+minutes; +} + +// 提取原 URL 中的路径部分,然后用当前页面的协议和主机名重新构建 URL +export function normalizeUrl(url) { + if (!url) return ''; + const match = url.match(/:4000\/(.+)/); + if (match && match[1]) { + return `${window.location.protocol}//${window.location.hostname}:4000/${match[1]}`; + } + return url; } \ No newline at end of file diff --git a/src/news/detail/index.jsx b/src/news/detail/index.jsx index 61f50eff9..32930f951 100644 --- a/src/news/detail/index.jsx +++ b/src/news/detail/index.jsx @@ -8,6 +8,7 @@ import Nodata from "../../forge/Nodata"; import { BrowserRouter as Router, Route, Link } from "react-router-dom"; import { getNewsDetail, getSubDocList } from "../../forge/Information/api"; import CommentList from "../../forge/Information/Component/comments/list"; +import { normalizeUrl } from "../../forge/common/util"; function detail(props) { const { match: { params: { id } } } = props; @@ -58,7 +59,7 @@ function detail(props) { {dirId === 34 ? detail.summary : detail.name}
- + {detail.publishUserNickname} {moment(detail.publishTime).format('YYYY-MM-DD')}