Skip to content

Commit

Permalink
fix(动态): 修复动态后台视频动态无法展示页面丢失问题
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Nov 15, 2018
1 parent db22494 commit 9603d7d
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions packages/slimkit-plus-feed/admin/pages/feed/modules/preview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ import CloseIcon from '@material-ui/icons/Close';
import VisibilityIcon from '@material-ui/icons/Visibility';
import FavoriteIcon from '@material-ui/icons/Favorite';

function RenderUserAvatar(props) {
let { name, avatar } = props.user;

if (avatar) {
return (<Avatar src={avatar.url} />);
}

return <Avatar>{ name[0] }</Avatar>;
}

export default function Preview(props) {
let { feed, onClose, classes } = props;

Expand All @@ -37,7 +47,7 @@ export default function Preview(props) {
<Paper className={classes.reviewWrap}>
<Card>
<CardHeader
avatar={<Avatar src={user.avatar ? user.avatar.url : null}>{user.name[0]}</Avatar>}
avatar={<RenderUserAvatar user={user} />}
action={<IconButton
onClick={onClose}
>
Expand All @@ -53,8 +63,8 @@ export default function Preview(props) {
className={classes.previewVideo}
component="video"
controls={true}
poster={video.cover.url}
src={video.resource.url}
poster={createRequestURI(`../../../api/v2/files/${video.cover_id}`)}
src={createRequestURI(`../../../api/v2/files/${video.video_id}`)}
/>
) : null}

Expand Down

0 comments on commit 9603d7d

Please sign in to comment.