Skip to content

Commit

Permalink
feat: 当在后台点击访问隐藏文章时,出现人性化提示#13
Browse files Browse the repository at this point in the history
  • Loading branch information
Mereithhh committed Sep 1, 2022
1 parent 9a5ec77 commit cbf2a56
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
28 changes: 27 additions & 1 deletion packages/admin/src/pages/Article/columns.jsx
Expand Up @@ -137,7 +137,33 @@ export const columns = [
href={`/post/${record.id}`}
onClick={(ev) => {
if (record?.hidden) {
message.warning('隐藏页面无法查看前台!');
Modal.confirm({
title: '此文章为隐藏文章!',
content: (
<div>
<p>
隐藏文章在未开启通过 URL 访问的情况下(默认关闭),会出现 404 页面!
</p>
<p>
您可以在{' '}
<a
onClick={() => {
history.push('/site/setting?subTab=layout');
}}
>
布局配置
</a>{' '}
中修改此项。
</p>
</div>
),
onOk: () => {
window.open(`/post/${record.id}`, '_blank');
return true;
},
okText: '仍然访问',
cancelText: '返回',
});
ev.preventDefault();
}
}}
Expand Down
28 changes: 27 additions & 1 deletion packages/admin/src/pages/Editor/index.jsx
Expand Up @@ -241,7 +241,33 @@ export default function () {
let url = '';
if (type == 'article') {
if (currObj.hidden) {
message.warning('隐藏页面无法查看前台!');
Modal.confirm({
title: '此文章为隐藏文章!',
content: (
<div>
<p>
隐藏文章在未开启通过 URL 访问的情况下(默认关闭),会出现 404 页面!
</p>
<p>
您可以在{' '}
<a
onClick={() => {
history.push('/site/setting?subTab=layout');
}}
>
布局配置
</a>{' '}
中修改此项。
</p>
</div>
),
onOk: () => {
window.open(`/post/${currObj.id}`, '_blank');
return true;
},
okText: '仍然访问',
cancelText: '返回',
});
return;
}
url = `/post/${currObj?.id}`;
Expand Down

0 comments on commit cbf2a56

Please sign in to comment.