Skip to content

Let's use AI to Earn!

feat: 图文发布参数添加账号失效提示

gaoSir9a59224da9b8
diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx
index 15020ef6..37327818 100644
--- a/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx
+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/components/ImageRightSettingCommon.tsx
@@ -21,12 +21,32 @@ import CommonScheduledTimeSelect, {
ICommonScheduledTimeSelectProps,
} from '../../../../../components/CommonComponents/CommonScheduledTimeSelect';
import dayjs from 'dayjs';
+import { AccountRestartLogin } from '../../../../../components/CommonComponents/CommonComponents';
interface DebounceSelectProps<ValueType = any>
extends Omit<SelectProps<ValueType | ValueType[]>, 'options' | 'children'> {}
const { TextArea } = Input;
+// 重新登录
+const ImgTextPubRestartLogin = () => {
+ const { imageAccountItem } = useImagePlatParams();
+ const { accountRestart } = useImagePageStore(
+ useShallow((state) => ({
+ accountRestart: state.accountRestart,
+ })),
+ );
+
+ return (
+ <AccountRestartLogin
+ account={imageAccountItem.account}
+ onAccountRestart={() => {
+ accountRestart(imageAccountItem.account!.type);
+ }}
+ />
+ );
+};
+
// 位置选择器
export const ImgTextLocationSelect = ({
...props
@@ -55,7 +75,9 @@ export const ImgTextLocationSelect = ({
imageAccountItem.account.id,
);
}}
- />
+ >
+ <ImgTextPubRestartLogin />
+ </CommonLocationSelect>
);
};
@@ -95,7 +117,9 @@ export const ImgTextTopicSelect = ({ ...props }: CommonTopicSelectProps) => {
imageAccountItem.account.id,
);
}}
- ></CommonTopicSelect>
+ >
+ <ImgTextPubRestartLogin />
+ </CommonTopicSelect>
);
};
@@ -142,7 +166,9 @@ export const ImgTextUserSelect = ({
imageAccountItem.account.id,
);
}}
- />
+ >
+ <ImgTextPubRestartLogin />
+ </CommonUserSelect>
);
};
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx
index 2403b2a3..bc958435 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/components/VideoPubSetModalCommon.tsx
@@ -1,5 +1,4 @@
-import { AccountStatus } from '@@/AccountEnum';
-import { Button, Input, Tooltip } from 'antd';
+import { Input, Tooltip } from 'antd';
import React from 'react';
import { IVideoChooseItem } from '@/views/publish/children/videoPage/videoPage';
import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPageStore';
@@ -12,6 +11,7 @@ import AICreateTitle from '../../../../../components/AICreateTitle/AICreateTitle
import CommonScheduledTimeSelect, {
ICommonScheduledTimeSelectProps,
} from '../../../../../components/CommonComponents/CommonScheduledTimeSelect';
+import { AccountRestartLogin } from '../../../../../components/CommonComponents/CommonComponents';
const { TextArea } = Input;
@@ -27,22 +27,12 @@ export const VideoPubRestartLogin = ({
);
return (
- <>
- {currChooseAccount.account?.status === AccountStatus.DISABLE && (
- <div className="videoPubSetModal_con-accountDisable">
- 账户已失效,
- <Button
- type="link"
- onClick={() => {
- accountRestart(currChooseAccount.account!.type);
- }}
- >
- 重新登录
- </Button>
- 后可获取
- </div>
- )}
- </>
+ <AccountRestartLogin
+ account={currChooseAccount.account}
+ onAccountRestart={() => {
+ accountRestart(currChooseAccount.account!.type);
+ }}
+ />
);
};
diff --git a/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss b/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
index 8a2cef7b..92677c59 100644
--- a/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
+++ b/src/views/publish/children/videoPage/components/VideoPubSetModal/videoPubSetModal.module.scss
@@ -36,15 +36,6 @@
&-tips {
color: rgb(178, 185, 185);
}
- &-accountDisable {
- display: flex;
- align-items: center;
- button {
- margin: 0;
- padding: 0;
- height: auto;
- }
- }
&_top {
margin-bottom: 10px;
button {
diff --git a/src/views/publish/components/CommonComponents/CommonComponents.tsx b/src/views/publish/components/CommonComponents/CommonComponents.tsx
index e6956bfc..70f131b9 100644
--- a/src/views/publish/components/CommonComponents/CommonComponents.tsx
+++ b/src/views/publish/components/CommonComponents/CommonComponents.tsx
@@ -1,9 +1,12 @@
import { Button } from 'antd';
import styles from './commonComponents.module.scss';
-import { useState } from 'react';
+import React, { useState } from 'react';
import { Outlet } from 'react-router-dom';
import { PlusOutlined, UserAddOutlined } from '@ant-design/icons';
+import { AccountInfo } from '../../../account/comment';
+import { AccountStatus } from '../../../../../commont/AccountEnum';
+
// 本地上传、素材上传展示的块
export const ChooseChunk = ({
onClick,
@@ -61,3 +64,31 @@ export const ChooseAccountChunk = ({ onClick }: { onClick: () => void }) => {
</div>
);
};
+
+// 账户重新登录
+export const AccountRestartLogin = ({
+ account,
+ onAccountRestart,
+}: {
+ account?: AccountInfo;
+ onAccountRestart: () => void;
+}) => {
+ return (
+ <>
+ {account?.status === AccountStatus.DISABLE && (
+ <div className={styles.accountRestartLogin}>
+ 账户已失效,
+ <Button
+ type="link"
+ onClick={() => {
+ onAccountRestart();
+ }}
+ >
+ 重新登录
+ </Button>
+ 后可获取
+ </div>
+ )}
+ </>
+ );
+};
diff --git a/src/views/publish/components/CommonComponents/CommonUserSelect.tsx b/src/views/publish/components/CommonComponents/CommonUserSelect.tsx
index f308321f..70d61c01 100644
--- a/src/views/publish/components/CommonComponents/CommonUserSelect.tsx
+++ b/src/views/publish/components/CommonComponents/CommonUserSelect.tsx
@@ -66,7 +66,7 @@ export default function CommonUserSelect({
return (
<>
- <h1>{props.title || '用户选择'}</h1>
+ <h1>{props.title || '@用户选择'}</h1>
<Select
{...props}
showSearch={
diff --git a/src/views/publish/components/CommonComponents/commonComponents.module.scss b/src/views/publish/components/CommonComponents/commonComponents.module.scss
index 7f609daf..e77cfd28 100644
--- a/src/views/publish/components/CommonComponents/commonComponents.module.scss
+++ b/src/views/publish/components/CommonComponents/commonComponents.module.scss
@@ -217,3 +217,14 @@
text-align: left;
font-size: var(--fs-sm);
}
+
+.accountRestartLogin {
+ display: flex;
+ align-items: center;
+ font-size: var(--fs-sm);
+ button {
+ margin: 0;
+ padding: 0;
+ height: auto;
+ }
+}
\ No newline at end of file
diff --git a/src/views/publish/hooks/usePubParamsVerify.tsx b/src/views/publish/hooks/usePubParamsVerify.tsx
index d25f70ea..05bf12b3 100644
--- a/src/views/publish/hooks/usePubParamsVerify.tsx
+++ b/src/views/publish/hooks/usePubParamsVerify.tsx
@@ -212,8 +212,8 @@ export const PubParamsVerifyInfo = memo(
}
message={
<>
- {paramsWarningList.map((v) => {
- return <p>{v.parErrMsg}</p>;
+ {paramsWarningList.map((v, i) => {
+ return <p key={i}>{v.parErrMsg}</p>;
})}
</>
}