diff --git a/src/pages/content/archive/index.less b/src/pages/content/archive/index.less
index 0b0dfd3..721f3a7 100644
--- a/src/pages/content/archive/index.less
+++ b/src/pages/content/archive/index.less
@@ -15,6 +15,9 @@
.update-tag {
color: #f30;
}
+.extract-tag {
+ color: rgba(0, 0, 0, 0.88);
+}
.relation-item {
display: flex;
padding: 8px 0;
diff --git a/src/pages/content/category/archive/detail.tsx b/src/pages/content/category/archive/detail.tsx
index 5d50b8d..6df4756 100644
--- a/src/pages/content/category/archive/detail.tsx
+++ b/src/pages/content/category/archive/detail.tsx
@@ -1,5 +1,6 @@
import NewContainer from '@/components/NewContainer';
import AttachmentSelect from '@/components/attachment';
+import CollapseItem from '@/components/collaspeItem';
import WangEditor from '@/components/editor';
import MarkdownEditor from '@/components/markdown';
import {
@@ -371,165 +372,328 @@ const ArchiveCategoryDetail: React.FC = () => {
id: 'content.category.status.description',
})}
/>
- {currentModule.category_fields?.map(
- (item: any, index: number) => (
-
- {item.type === 'text' ? (
-
- ) : item.type === 'number' ? (
-
- ) : item.type === 'textarea' ? (
-
- ) : item.type === 'editor' ? (
- ''
- ) : item.type === 'radio' ? (
-
{
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
- }
- return data;
- }}
- />
- ) : item.type === 'checkbox' ? (
- {
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
- }
- return data;
- }}
- />
- ) : item.type === 'select' ? (
- {
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
+ {currentModule.category_fields && (
+
+
+ {currentModule.category_fields?.map(
+ (item: any, index: number) =>
+ item.type !== 'editor' && (
+
+ {item.type === 'text' ? (
+
+ ) : item.type === 'number' ? (
+
+ ) : item.type === 'textarea' ? (
+
+ ) : item.type === 'radio' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
+ }
+ return data;
+ }}
+ />
+ ) : item.type === 'checkbox' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
+ }
+ return data;
+ }}
+ />
+ ) : item.type === 'select' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
+ }
+ return data;
+ }}
+ />
+ ) : item.type === 'image' ? (
+
+ {category.extra[item.field_name] ? (
+
+
+
+ handleCleanExtraField(item.field_name)
+ }
+ >
+
+
+
+ ) : (
+
+ handleUploadExtraField(
+ item.field_name,
+ row,
+ )
+ }
+ open={false}
+ >
+
+
+ )}
+
+ ) : item.type === 'file' ? (
+
+ {category.extra[item.field_name] ? (
+
+
+ {category.extra[item.field_name]}
+
+
+ handleCleanExtraField(item.field_name)
+ }
+ >
+
+
+
+ ) : (
+
+ handleUploadExtraField(
+ item.field_name,
+ row,
+ )
+ }
+ open={false}
+ >
+
+
+ )}
+
+ ) : null}
+
+ ),
+ )}
+
+ {currentModule.category_fields?.map(
+ (item: any, index: number) =>
+ item.type === 'editor' ? (
+
- ) : item.type === 'image' ? (
-
- {category.extra[item.field_name] ? (
-
-
+ {contentSetting.editor === 'markdown' ? (
+
+ updateExtraContent(item.field_name, html)
+ }
+ content={extraContent[item.field_name] || ''}
+ ref={null}
/>
-
- handleCleanExtraField(item.field_name)
+ ) : (
+
+ updateExtraContent(item.field_name, html)
}
- >
-
-
-
- ) : (
-
- handleUploadExtraField(item.field_name, row)
+ content={extraContent[item.field_name] || ''}
+ key={item.field_name}
+ field={item.field_name}
+ ref={null}
+ />
+ )}
+
+ ) : item.type === 'radio' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
}
- open={false}
- >
+ return data;
+ }}
+ />
+ ) : item.type === 'checkbox' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
+ }
+ return data;
+ }}
+ />
+ ) : item.type === 'select' ? (
+ {
+ const tmpData = item.content.split('\n');
+ const data = [];
+ for (const item1 of tmpData) {
+ data.push({ label: item1, value: item1 });
+ }
+ return data;
+ }}
+ />
+ ) : item.type === 'image' ? (
+
+ {category.extra[item.field_name] ? (
-
-
-
-
+
+
+ handleCleanExtraField(item.field_name)
+ }
+ >
+
+
+
+ ) : (
+
+ handleUploadExtraField(item.field_name, row)
+ }
+ open={false}
+ >
+
+
+ )}
+
+ ) : item.type === 'file' ? (
+
+ {category.extra[item.field_name] ? (
+
+ {category.extra[item.field_name]}
+
+ handleCleanExtraField(item.field_name)
+ }
+ >
+
+
-
- )}
-
- ) : item.type === 'file' ? (
-
- {category.extra[item.field_name] ? (
-
-
{category.extra[item.field_name]}
-
- handleCleanExtraField(item.field_name)
+ ) : (
+
+ handleUploadExtraField(item.field_name, row)
}
+ open={false}
>
-
-
-
- ) : (
-
- handleUploadExtraField(item.field_name, row)
- }
- open={false}
- >
-
-
- )}
-
- ) : (
- ''
- )}
-
- ),
+
+
+ )}
+
+ ) : (
+ ''
+ ),
+ )}
+
)}
{loaded && (
<>
@@ -556,155 +720,6 @@ const ArchiveCategoryDetail: React.FC = () => {
)}
>
)}
- {currentModule.category_fields?.map(
- (item: any, index: number) =>
- item.type === 'editor' ? (
-
- {contentSetting.editor === 'markdown' ? (
-
- updateExtraContent(item.field_name, html)
- }
- content={extraContent[item.field_name] || ''}
- ref={null}
- />
- ) : (
-
- updateExtraContent(item.field_name, html)
- }
- content={extraContent[item.field_name] || ''}
- key={item.field_name}
- field={item.field_name}
- ref={null}
- />
- )}
-
- ) : item.type === 'radio' ? (
-
{
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
- }
- return data;
- }}
- />
- ) : item.type === 'checkbox' ? (
- {
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
- }
- return data;
- }}
- />
- ) : item.type === 'select' ? (
- {
- const tmpData = item.content.split('\n');
- const data = [];
- for (const item1 of tmpData) {
- data.push({ label: item1, value: item1 });
- }
- return data;
- }}
- />
- ) : item.type === 'image' ? (
-
- {category.extra[item.field_name] ? (
-
-
-
- handleCleanExtraField(item.field_name)
- }
- >
-
-
-
- ) : (
-
- handleUploadExtraField(item.field_name, row)
- }
- open={false}
- >
-
-
- )}
-
- ) : item.type === 'file' ? (
-
- {category.extra[item.field_name] ? (
-
- {category.extra[item.field_name]}
-
- handleCleanExtraField(item.field_name)
- }
- >
-
-
-
- ) : (
-
- handleUploadExtraField(item.field_name, row)
- }
- open={false}
- >
-
-
- )}
-
- ) : (
- ''
- ),
- )}
diff --git a/src/pages/content/module/components/moduleForm/index.tsx b/src/pages/content/module/components/moduleForm/index.tsx
index 36e1584..6030377 100644
--- a/src/pages/content/module/components/moduleForm/index.tsx
+++ b/src/pages/content/module/components/moduleForm/index.tsx
@@ -390,7 +390,13 @@ const ModuleForm: React.FC
= (props) => {
key="add"
type="primary"
onClick={() => {
- setCurrentField({ form: 'archive' });
+ setCurrentField({
+ form: 'archive',
+ type: 'text',
+ required: false,
+ follow_level: false,
+ is_filter: false,
+ });
setEditVisible(true);
}}
>
@@ -427,7 +433,13 @@ const ModuleForm: React.FC = (props) => {
key="add"
type="primary"
onClick={() => {
- setCurrentField({ form: 'category' });
+ setCurrentField({
+ form: 'category',
+ type: 'text',
+ required: false,
+ follow_level: false,
+ is_filter: false,
+ });
setEditVisible(true);
}}
>
diff --git a/src/pages/login/index.tsx b/src/pages/login/index.tsx
index 6d05c36..ea35aaf 100644
--- a/src/pages/login/index.tsx
+++ b/src/pages/login/index.tsx
@@ -19,7 +19,7 @@ import React, { useEffect, useState } from 'react';
import CopyToClipboard from 'react-copy-to-clipboard';
import { getSiteInfo } from '@/services';
-import { setStore } from '@/utils/store';
+import { setSessionStore, setStore } from '@/utils/store';
import styles from './index.less';
const LoginMessage: React.FC<{
@@ -85,7 +85,9 @@ const Login: React.FC = () => {
});
message.success(defaultLoginSuccessMessage);
- setStore('adminToken', res.data.token);
+ // 后台快速登录的,存 session
+ setSessionStore('site-id', res.data.site_id);
+ setSessionStore('adminToken', res.data.token);
await fetchUserInfo();
/** 此方法会跳转到 redirect 参数所在的位置 */
if (!history) return;
diff --git a/src/pages/plugin/guestbook/components/setting/index.tsx b/src/pages/plugin/guestbook/components/setting/index.tsx
index 9f6bd4e..f93039a 100644
--- a/src/pages/plugin/guestbook/components/setting/index.tsx
+++ b/src/pages/plugin/guestbook/components/setting/index.tsx
@@ -1,4 +1,7 @@
-import { pluginGetGuestbookSetting, pluginSaveGuestbookSetting } from '@/services/plugin/guestbook';
+import {
+ pluginGetGuestbookSetting,
+ pluginSaveGuestbookSetting,
+} from '@/services/plugin/guestbook';
import {
ActionType,
ModalForm,
@@ -38,8 +41,12 @@ const GuestbookSetting: React.FC = (props) => {
const handleRemoveItem = (index: number) => {
Modal.confirm({
- title: intl.formatMessage({ id: 'plugin.guestbook.field.delete.confirm' }),
- content: intl.formatMessage({ id: 'plugin.guestbook.field.delete.confirm.content' }),
+ title: intl.formatMessage({
+ id: 'plugin.guestbook.field.delete.confirm',
+ }),
+ content: intl.formatMessage({
+ id: 'plugin.guestbook.field.delete.confirm.content',
+ }),
onOk: async () => {
setting.fields.splice(index, 1);
setting.fields = [].concat(setting.fields);
@@ -118,11 +125,15 @@ const GuestbookSetting: React.FC = (props) => {
valueEnum: {
false: {
- text: intl.formatMessage({ id: 'content.module.field.isrequired.no' }),
+ text: intl.formatMessage({
+ id: 'content.module.field.isrequired.no',
+ }),
status: 'Default',
},
true: {
- text: intl.formatMessage({ id: 'content.module.field.isrequired.yes' }),
+ text: intl.formatMessage({
+ id: 'content.module.field.isrequired.yes',
+ }),
status: 'Success',
},
},
@@ -208,7 +219,7 @@ const GuestbookSetting: React.FC = (props) => {
key="add"
type="primary"
onClick={() => {
- setCurrentField({});
+ setCurrentField({ type: 'text', required: false });
setEditVisible(true);
}}
>
@@ -232,7 +243,8 @@ const GuestbookSetting: React.FC = (props) => {
width={600}
title={
currentField.name
- ? currentField.name + intl.formatMessage({ id: 'content.module.field.edit' })
+ ? currentField.name +
+ intl.formatMessage({ id: 'content.module.field.edit' })
: intl.formatMessage({ id: 'content.module.field.add' })
}
open={editVisible}
@@ -251,39 +263,67 @@ const GuestbookSetting: React.FC = (props) => {
name="name"
required
label={intl.formatMessage({ id: 'content.module.field.name' })}
- extra={intl.formatMessage({ id: 'content.module.field.name.description' })}
+ extra={intl.formatMessage({
+ id: 'content.module.field.name.description',
+ })}
/>
= (props) => {
fieldProps={{
rows: 4,
}}
- extra={intl.formatMessage({ id: 'content.module.field.default.description' })}
+ extra={intl.formatMessage({
+ id: 'content.module.field.default.description',
+ })}
/>
)}
diff --git a/src/pages/plugin/user/components/setting/index.tsx b/src/pages/plugin/user/components/setting/index.tsx
index 0040e6d..b80f1c5 100644
--- a/src/pages/plugin/user/components/setting/index.tsx
+++ b/src/pages/plugin/user/components/setting/index.tsx
@@ -39,8 +39,12 @@ const UserFieldSetting: React.FC = (props) => {
const handleRemoveItem = (record: any, index: number) => {
Modal.confirm({
- title: intl.formatMessage({ id: 'plugin.guestbook.field.delete.confirm' }),
- content: intl.formatMessage({ id: 'plugin.guestbook.field.delete.confirm.content' }),
+ title: intl.formatMessage({
+ id: 'plugin.guestbook.field.delete.confirm',
+ }),
+ content: intl.formatMessage({
+ id: 'plugin.guestbook.field.delete.confirm.content',
+ }),
onOk: async () => {
pluginDeleteUserField({ field_name: record.field_name });
setting.fields.splice(index, 1);
@@ -171,7 +175,7 @@ const UserFieldSetting: React.FC = (props) => {
key="add"
type="primary"
onClick={() => {
- setCurrentField({});
+ setCurrentField({ type: 'text', required: false });
setEditVisible(true);
}}
>
@@ -199,7 +203,8 @@ const UserFieldSetting: React.FC = (props) => {
width={600}
title={
currentField.name
- ? currentField.name + intl.formatMessage({ id: 'content.module.field.edit' })
+ ? currentField.name +
+ intl.formatMessage({ id: 'content.module.field.edit' })
: intl.formatMessage({ id: 'content.module.field.add' })
}
open={editVisible}
@@ -218,27 +223,49 @@ const UserFieldSetting: React.FC = (props) => {
name="name"
required
label={intl.formatMessage({ id: 'content.module.field.name' })}
- extra={intl.formatMessage({ id: 'plugin.user.setting.name.description' })}
+ extra={intl.formatMessage({
+ id: 'plugin.user.setting.name.description',
+ })}
/>
= (props) => {
fieldProps={{
rows: 4,
}}
- extra={intl.formatMessage({ id: 'content.module.field.default.description' })}
+ extra={intl.formatMessage({
+ id: 'content.module.field.default.description',
+ })}
/>
)}
diff --git a/src/pages/setting/diyfield.tsx b/src/pages/setting/diyfield.tsx
index b86d713..0bcbdcc 100644
--- a/src/pages/setting/diyfield.tsx
+++ b/src/pages/setting/diyfield.tsx
@@ -52,7 +52,7 @@ const SettingDiyFieldFrom: React.FC = () => {
const handleEditField = (index: number) => {
if (index === -1) {
- setCurrentField({});
+ setCurrentField({ type: 'text', required: false });
} else {
setCurrentField(setting[index]);
}
diff --git a/src/services/anqi.ts b/src/services/anqi.ts
index 91a0c91..9d9189e 100644
--- a/src/services/anqi.ts
+++ b/src/services/anqi.ts
@@ -8,7 +8,10 @@ export async function anqiLogin(body: any, options?: { [key: string]: any }) {
});
}
-export async function getAnqiInfo(params?: any, options?: { [key: string]: any }) {
+export async function getAnqiInfo(
+ params?: any,
+ options?: { [key: string]: any },
+) {
return get({
url: '/anqi/info',
params,
@@ -16,7 +19,10 @@ export async function getAnqiInfo(params?: any, options?: { [key: string]: any }
});
}
-export async function checkAnqiInfo(params?: any, options?: { [key: string]: any }) {
+export async function checkAnqiInfo(
+ params?: any,
+ options?: { [key: string]: any },
+) {
return get({
url: '/anqi/check',
params,
@@ -32,7 +38,10 @@ export async function anqiUpload(body: any, options?: { [key: string]: any }) {
});
}
-export async function anqiShareTemplate(body: any, options?: { [key: string]: any }) {
+export async function anqiShareTemplate(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/template/share',
body,
@@ -40,7 +49,10 @@ export async function anqiShareTemplate(body: any, options?: { [key: string]: an
});
}
-export async function anqiDownloadTemplate(body: any, options?: { [key: string]: any }) {
+export async function anqiDownloadTemplate(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/template/download',
body,
@@ -48,7 +60,10 @@ export async function anqiDownloadTemplate(body: any, options?: { [key: string]:
});
}
-export async function anqiSendFeedback(body: any, options?: { [key: string]: any }) {
+export async function anqiSendFeedback(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/feedback',
body,
@@ -64,7 +79,10 @@ export async function anqiRestart(body: any, options?: { [key: string]: any }) {
});
}
-export async function anqiTranslateArchive(body: any, options?: { [key: string]: any }) {
+export async function anqiTranslateArchive(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/translate',
body,
@@ -72,7 +90,10 @@ export async function anqiTranslateArchive(body: any, options?: { [key: string]:
});
}
-export async function anqiAiPseudoArchive(body: any, options?: { [key: string]: any }) {
+export async function anqiAiPseudoArchive(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/ai/pseudo',
body,
@@ -80,7 +101,10 @@ export async function anqiAiPseudoArchive(body: any, options?: { [key: string]:
});
}
-export async function anqiAiGenerateStream(body: any, options?: { [key: string]: any }) {
+export async function anqiAiGenerateStream(
+ body: any,
+ options?: { [key: string]: any },
+) {
return post({
url: '/anqi/ai/stream',
body,
@@ -88,10 +112,35 @@ export async function anqiAiGenerateStream(body: any, options?: { [key: string]:
});
}
-export async function anqiAiGenerateStreamData(params?: any, options?: { [key: string]: any }) {
+export async function anqiAiGenerateStreamData(
+ params?: any,
+ options?: { [key: string]: any },
+) {
return get({
url: '/anqi/ai/stream/data',
params,
options,
});
}
+
+export async function anqiExtractDescription(
+ body: any,
+ options?: { [key: string]: any },
+) {
+ return post({
+ url: '/anqi/extract/description',
+ body,
+ options,
+ });
+}
+
+export async function anqiExtractKeywords(
+ body: any,
+ options?: { [key: string]: any },
+) {
+ return post({
+ url: '/anqi/extract/keywords',
+ body,
+ options,
+ });
+}