Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 【内容安全检测】检测流程动画完成
gaoSir25db65eea542
diff --git a/src/utils/index.ts b/src/utils/index.tsindex 2d61cd94..87f5389c 100644--- a/src/utils/index.ts+++ b/src/utils/index.ts@@ -1,5 +1,6 @@import dayjs from 'dayjs';-import { getFilePathNameCommon } from '../../commont/utils';+import { getFilePathNameCommon, sleep } from '../../commont/utils';+import { message } from 'antd';/*** 生成唯一ID*/@@ -80,3 +81,25 @@ export function parseTopicString(input: string): {return { topics, cleanedString };}++// 敏感词检测-多余检测动画+export async function sensitivityLoading() {+ const key = generateUUID();+ const msgs = [+ '敏感词检测中',+ '色情检测中',+ 'abuse检测中',+ '广告法检测中',+ 'Error检测中',+ ];++ for (const msg of msgs) {+ message.open({+ key,+ type: 'loading',+ content: `${msg} ...`,+ });+ await sleep(200);+ }+ message.destroy(key);+}diff --git a/src/views/publish/children/imagePage/page.tsx b/src/views/publish/children/imagePage/page.tsxindex 0075bd91..22b5d6ba 100644--- a/src/views/publish/children/imagePage/page.tsx+++ b/src/views/publish/children/imagePage/page.tsx@@ -27,6 +27,7 @@ import { ExclamationCircleFilled } from '@ant-design/icons';import { signInApi } from '@/api/signIn';import { toolsApi } from '@/api/tools';import { IImageAccountItem } from '@/views/publish/children/imagePage/imagePage.type';+import { sensitivityLoading } from '@/utils';const { confirm } = Modal;@@ -271,26 +272,32 @@ export default function Page() {disabled={imageAccounts.length === 0 || images.length === 0}onClick={async () => {setSensitiveDetLoading(true);- const tasks: Promise<{- // 作品- accountItem: IImageAccountItem;- // 是否敏感 true=敏感 false=正常- sensitive: boolean;- }>[] = [];- // 如果检测内容重复不会进行检测- const contentSet = new Set<string>();+ const core = async () => {+ const tasks: Promise<{+ // 作品+ accountItem: IImageAccountItem;+ // 是否敏感 true=敏感 false=正常+ sensitive: boolean;+ }>[] = [];+ // 如果检测内容重复不会进行检测+ const contentSet = new Set<string>();- imageAccounts.map((v) => {- const content = `+ imageAccounts.map((v) => {+ const content = `${v.pubParams.title}${v.pubParams.describe}`;- if (content.trim() !== '' && !contentSet.has(content)) {- contentSet.add(content);- tasks.push(sensitiveDetCore(content, v));- }- });- const res = await Promise.all(tasks);+ if (content.trim() !== '' && !contentSet.has(content)) {+ contentSet.add(content);+ tasks.push(sensitiveDetCore(content, v));+ }+ });+ return await Promise.all(tasks);+ };++ const taskRes = await Promise.all([core(), sensitivityLoading()]);+ const res = taskRes[0];+setSensitiveDetLoading(false);if (res.length === 0) return message.success('检测正常');diff --git a/src/views/publish/children/videoPage/page.tsx b/src/views/publish/children/videoPage/page.tsxindex 5daf3cf0..01f2b67f 100644--- a/src/views/publish/children/videoPage/page.tsx+++ b/src/views/publish/children/videoPage/page.tsx@@ -17,8 +17,8 @@ import CommonPubSetting from '@/views/publish/children/videoPage/components/Commimport VideoPubSetModal from '@/views/publish/children/videoPage/components/VideoPubSetModal/VideoPubSetModal';import { usePubStroe } from '../../../../store/pubStroe';import { IVideoChooseItem } from '@/views/publish/children/videoPage/videoPage';-import {IImageAccountItem} from "@/views/publish/children/imagePage/imagePage.type";-import {toolsApi} from "@/api/tools";+import { toolsApi } from '@/api/tools';+import { sensitivityLoading } from '@/utils';export enum AccountChooseType {// 多选@@ -244,30 +244,37 @@ export default function Page() {disabled={!videoListChoose.every((v) => v.account && v.video)}onClick={async () => {setSensitiveDetLoading(true);- const tasks: Promise<{- // 作品- videoItem: IVideoChooseItem;- // 是否敏感 true=敏感 false=正常- sensitive: boolean;- }>[] = [];- // 如果检测内容重复不会进行检测- const contentSet = new Set<string>();-- videoListChoose.map((v) => {- const content = `+ const core = async () => {+ const tasks: Promise<{+ // 作品+ videoItem: IVideoChooseItem;+ // 是否敏感 true=敏感 false=正常+ sensitive: boolean;+ }>[] = [];+ // 如果检测内容重复不会进行检测+ const contentSet = new Set<string>();+ videoListChoose.map((v) => {+ const content = `${v.pubParams.title}${v.pubParams.describe}`;- if (content.trim() !== '' && !contentSet.has(content)) {- contentSet.add(content);- tasks.push(sensitiveDetCore(content, v));- }- });- const res = await Promise.all(tasks);+ if (content.trim() !== '' && !contentSet.has(content)) {+ contentSet.add(content);+ tasks.push(sensitiveDetCore(content, v));+ }+ });+ return await Promise.all(tasks);+ };++ const taskRes = await Promise.all([+ core(),+ sensitivityLoading(),+ ]);+ const res = taskRes[0];+setSensitiveDetLoading(false);if (res.length === 0) return message.success('检测正常');-if (res.every((v) => !v.sensitive)) {message.success('检测正常');return;