解决由于IP问题导致用户头像不显示
This commit is contained in:
parent
1c66354b94
commit
adfc323e7f
|
|
@ -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){
|
|||
<div className='commentOperationBor'></div>
|
||||
{
|
||||
item.user.login ?
|
||||
<Link to={`/${item.user.login}`}><img src={item.user.image_url} alt="" className='commentUserImg mr15'/></Link>
|
||||
<Link to={`/${item.user.login}`}><img src={normalizeUrl(item.user.image_url)} alt="" className='commentUserImg mr15'/></Link>
|
||||
:
|
||||
<span><img src={item.user.image_url} alt="" className='commentUserImg mr15'/></span>
|
||||
<span><img src={normalizeUrl(item.user.image_url)} alt="" className='commentUserImg mr15'/></span>
|
||||
}
|
||||
<div className='commentContentRight'>
|
||||
{/* 判断是否是编辑状态 */}
|
||||
|
|
@ -171,7 +172,7 @@ function IssueCommentList(props){
|
|||
{(showEdit === 4 && updateId === i.id) ? <div className='mr20'><EditComment {...props} cancelMd={cancelMd} updateId={updateId} reloadComment={reloadComment} content={i.notes} defaultFileList={i.attachments}/></div> : <div>
|
||||
<div className='flexCenter'>
|
||||
<div>
|
||||
<Link to={`/${i.user.login}`}><img src={getImageUrl(i.user.image_url)} alt="" className='commentUserImg mr8'/></Link>
|
||||
<Link to={`/${i.user.login}`}><img src={normalizeUrl(i.user.image_url)} alt="" className='commentUserImg mr8'/></Link>
|
||||
<Link to={`/${i.user.login}`}>{i.user.name}</Link>
|
||||
{i.reply_user && <span className='ml5 timeAgo mr3'>回复</span>}
|
||||
<span>{i.reply_user && i.reply_user.name}</span>
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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}
|
||||
</div>
|
||||
<div className="opacity8 mt8">
|
||||
<img src={detail.publishUserImage} alt="" className="user-img" />
|
||||
<img src={normalizeUrl(detail.publishUserImage)} alt="" className="user-img" />
|
||||
{detail.publishUserNickname}
|
||||
<span className="ml10">{moment(detail.publishTime).format('YYYY-MM-DD')}</span>
|
||||
<img src={icon12} width={14} className="mb3 mr5 ml15" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue