diff --git a/src/pages/dashboard/index.tsx b/src/pages/dashboard/index.tsx index 83b0691..97b73ed 100644 --- a/src/pages/dashboard/index.tsx +++ b/src/pages/dashboard/index.tsx @@ -322,7 +322,7 @@ const Dashboard: React.FC = () => { { - handleJump('/content/page'); + handleJump('/archive/page'); }} > @@ -330,7 +330,7 @@ const Dashboard: React.FC = () => { { - handleJump('/content/attachment'); + handleJump('/archive/attachment'); }} > diff --git a/src/pages/plugin/guestbook/index.tsx b/src/pages/plugin/guestbook/index.tsx index 18c45df..5ca1504 100644 --- a/src/pages/plugin/guestbook/index.tsx +++ b/src/pages/plugin/guestbook/index.tsx @@ -1,5 +1,5 @@ import { Button, message, Modal, Space } from 'antd'; -import React, { useState, useRef } from 'react'; +import React, { useState, useRef, useEffect } from 'react'; import { PageContainer } from '@ant-design/pro-layout'; import type { ProColumns, ActionType } from '@ant-design/pro-table'; import ProTable from '@ant-design/pro-table'; @@ -8,6 +8,7 @@ import { pluginDeleteGuestbook, pluginExportGuestbook, pluginGetGuestbooks, + pluginGetGuestbookSetting, } from '@/services/plugin/guestbook'; import GuestbookForm from './components/guestbookForm'; import { exportFile } from '@/utils'; @@ -18,6 +19,94 @@ const PluginGuestbook: React.FC = () => { const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [currentGuestbook, setCurrentGuestbook] = useState({}); const [editVisible, setEditVisible] = useState(false); + const [setting, setSetting] = useState({ fields: [] }); + const [columns, setColumns] = useState[]>([]); + + useEffect(() => { + getSetting(); + }, []); + + const getSetting = async () => { + const res = await pluginGetGuestbookSetting(); + let setting = res.data || { fields: [] }; + setSetting(setting); + initColumns(setting.fields || []); + }; + + const initColumns = (fields: any[]) => { + let tmpColumns: ProColumns[] = [ + { + title: '时间', + width: 160, + dataIndex: 'created_time', + render: (text, record) => moment(record.created_time * 1000).format('YYYY-MM-DD HH:mm'), + }, + ]; + if (fields.length == 0) { + tmpColumns.push( + { + title: '用户名', + width: 100, + dataIndex: 'user_name', + }, + { + title: '联系方式', + width: 160, + dataIndex: 'contact', + }, + { + title: '留言内容', + dataIndex: 'content', + render: (text, record) =>
{text}
, + }, + ); + } else { + for (let i in fields) { + tmpColumns.push({ + title: fields[i].name, + dataIndex: fields[i].field_name, + }); + } + } + tmpColumns.push( + { + title: 'IP', + dataIndex: 'ip', + width: 100, + }, + { + title: '操作', + width: 150, + dataIndex: 'option', + valueType: 'option', + render: (_, record) => ( + + { + handlePreview(record); + }} + > + 查看 + + { + await handleRemove([record.id]); + setSelectedRowKeys([]); + actionRef.current?.reloadAndRest?.(); + }} + > + 删除 + + + ), + }, + ); + + setColumns(tmpColumns); + }; const handleRemove = async (selectedRowKeys: any[]) => { Modal.confirm({ @@ -57,64 +146,6 @@ const PluginGuestbook: React.FC = () => { exportFile(res.data?.header, res.data?.content, 'xls'); }; - const columns: ProColumns[] = [ - { - title: '时间', - width: 160, - dataIndex: 'created_time', - render: (text, record) => moment(record.created_time * 1000).format('YYYY-MM-DD HH:mm'), - }, - { - title: '用户名', - width: 100, - dataIndex: 'user_name', - }, - { - title: '联系方式', - width: 160, - dataIndex: 'contact', - }, - { - title: '留言内容', - dataIndex: 'content', - render: (text, record) =>
{text}
, - }, - { - title: 'IP', - dataIndex: 'ip', - width: 100, - }, - { - title: '操作', - width: 150, - dataIndex: 'option', - valueType: 'option', - render: (_, record) => ( - - { - handlePreview(record); - }} - > - 查看 - - { - await handleRemove([record.id]); - setSelectedRowKeys([]); - actionRef.current?.reloadAndRest?.(); - }} - > - 删除 - - - ), - }, - ]; - return ( diff --git a/src/pages/plugin/htmlcache/index.tsx b/src/pages/plugin/htmlcache/index.tsx index 12306cb..f45532a 100644 --- a/src/pages/plugin/htmlcache/index.tsx +++ b/src/pages/plugin/htmlcache/index.tsx @@ -253,7 +253,8 @@ const PluginHtmlCache: React.FC = () => { 如果需要启用静态网站,则需要模板类型为自适应模板才行。开启静态网站需要填写静态网站服务器信息,通信成功后系统会自动传输静态页面到静态网站服务器。

- 启用静态网站前,需要开启静态页面缓存。启用静态网站后,搜索、留言、评论、301跳转等需要提交数据到后台的功能,均会失效,网站仅有展示效果。 + 启用静态网站前,需要先开启静态页面缓存 + 。启用静态网站后,搜索、留言、评论、301跳转等需要提交数据到后台的功能,均会失效,网站仅有展示效果。

启用静态网站后,以下的操作不会自动重新生成,需要手动执行静态页面生成操作: diff --git a/src/pages/plugin/push/index.tsx b/src/pages/plugin/push/index.tsx index 467ea44..521b980 100644 --- a/src/pages/plugin/push/index.tsx +++ b/src/pages/plugin/push/index.tsx @@ -178,6 +178,16 @@ const PluginPush: React.FC = (props) => { extra="如:https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlbatch?apikey=sampleapikeyEDECC1EA4AE341CC8B6(注意该APIkey在必应工具右上角的设置中设置)" /> + + + actionRef={actionRef} diff --git a/src/pages/plugin/robots/index.tsx b/src/pages/plugin/robots/index.tsx index df97c54..b4c1774 100644 --- a/src/pages/plugin/robots/index.tsx +++ b/src/pages/plugin/robots/index.tsx @@ -6,7 +6,7 @@ import { pluginGetRobots, pluginSaveRobots } from '@/services/plugin/robots'; import { useModel } from 'umi'; const PluginRobots: React.FC = (props) => { - const { initialState } = useModel('@@initialState'); + const { initialState, setInitialState } = useModel('@@initialState'); const [pushSetting, setPushSetting] = useState({}); const [fetched, setFetched] = useState(false); @@ -29,14 +29,43 @@ const PluginRobots: React.FC = (props) => { }) .catch((err) => { console.log(err); - }).finally(() => { + }) + .finally(() => { hide(); }); }; + + const getFrontUrl = async (link: string) => { + let baseUrl = ''; + if (!initialState.system) { + const system = await initialState?.fetchSystemSetting?.(); + if (system) { + await setInitialState((s) => ({ + ...s, + system: system, + })); + } + baseUrl = system?.base_url || ''; + } else { + baseUrl = initialState.system?.base_url || ''; + } + + return baseUrl + link; + }; + return ( - + + Robots是网站告诉搜索引擎蜘蛛哪些页面可以抓取,哪些页面不能抓取的配置。Q:{' '} + + robots.txt文件的格式 + +
+ } + />
{fetched && ( @@ -58,15 +87,16 @@ const PluginRobots: React.FC = (props) => { )}
-
- -
+
+ +
); diff --git a/src/pages/setting/safe.tsx b/src/pages/setting/safe.tsx index 9930cd5..4c40f12 100644 --- a/src/pages/setting/safe.tsx +++ b/src/pages/setting/safe.tsx @@ -57,7 +57,7 @@ const SettingSafeFrom: React.FC = (props) => { /> = (props) => { label: '开启', }, ]} - extra="如需开启验证码,请参考验证码标签使用js调用刷新验证码和提交验证数据" + extra="如需开启验证码,请参考验证码标签使用js调用刷新验证码和提交验证数据。开启后,前台用户登录、留言、评论都需要验证码" />