Skip to content

Let's use AI to Earn!

feat: 【图文发布】通用发布设置改为实时同步

gaoSir5f0cdbe8ba70
diff --git a/src/components/WindowControlButtons/windowControlButtons.module.scss b/src/components/WindowControlButtons/windowControlButtons.module.scss
index ed9d9323..2f2a35b2 100644
--- a/src/components/WindowControlButtons/windowControlButtons.module.scss
+++ b/src/components/WindowControlButtons/windowControlButtons.module.scss
@@ -12,7 +12,7 @@
justify-content: center;
background: transparent;
transition: 0.3s;
- width: 50px;
+ width: 45px;
color: #595959;
font-size: 14px;
&:hover {
diff --git a/src/layout/Navigation/navigation.module.scss b/src/layout/Navigation/navigation.module.scss
index d932608f..e5e63f00 100644
--- a/src/layout/Navigation/navigation.module.scss
+++ b/src/layout/Navigation/navigation.module.scss
@@ -71,7 +71,7 @@
padding-right: 0;
:global {
.navigation-userinfo {
- margin-right: 20px;
+ margin-right: 10px;
}
}
}
diff --git a/src/router/index.tsx b/src/router/index.tsx
index 10332488..bc127736 100644
--- a/src/router/index.tsx
+++ b/src/router/index.tsx
@@ -33,7 +33,7 @@ import Publish from '@/views/publish/page';
import VideoPage from '@/views/publish/children/videoPage/page';
import ImagePage from '@/views/publish/children/imagePage/page';
import PubRecord from '@/views/publish/children/pubRecord/page';
-import Statistics from '@/views/statistics/statistics';
+import Statistics from '@/views/statistics/statistics';
import Task from '@/views/task/task';
// import HotTopic from '@/views/trending/hotTopic';
// import CarTask from '@/views/task/carTask';
@@ -47,7 +47,6 @@ import Reply from '@/views/reply';
import Replyother from '@/views/replyother/replyother';
import ErrorBoundary from '../components/ErrorBoundary/ErrorBoundary';
import Test from '@/views/test';
-import Interaction from '@/views/interaction';
interface IRouterMeta {
// 路由名称
@@ -152,11 +151,11 @@ export const router: CustomRouteObject[] = [
// element: <Interaction />,
// meta: { name: '互动', icon: ShopOutlined },
// },
- {
- path: '/test',
- element: <Test />,
- meta: { name: '测试', icon: ShopOutlined },
- },
+ // {
+ // path: '/test',
+ // element: <Test />,
+ // meta: { name: '测试', icon: ShopOutlined },
+ // },
],
},
{ path: '/login', element: <Login /> },
diff --git a/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx b/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx
index 5304961f..17af8f7d 100644
--- a/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx
+++ b/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx
@@ -3,8 +3,7 @@ import styles from '../../image.module.scss';
import { ChooseChunk } from '../../../../components/CommonComponents/CommonComponents';
import localUpload from '../../../videoPage/images/localUpload.png';
import ImgChoose from '../../../../../../components/Choose/ImgChoose';
-import { Button, Input } from 'antd';
-import { ArrowRightOutlined } from '@ant-design/icons';
+import { Input } from 'antd';
import { useShallow } from 'zustand/react/shallow';
import { useImagePageStore } from '../../useImagePageStore';
import ImgTextImagesView from './ImgTextImagesView';
@@ -18,21 +17,16 @@ export interface IImageLeftSettingProps {}
const ImageLeftSetting = memo(
forwardRef(
({}: IImageLeftSettingProps, ref: ForwardedRef<IImageLeftSettingRef>) => {
- const {
- setAllPubParams,
- commonPubParams,
- setCommonPubParams,
- addImages,
- images,
- } = useImagePageStore(
- useShallow((state) => ({
- setAllPubParams: state.setAllPubParams,
- commonPubParams: state.commonPubParams,
- setCommonPubParams: state.setCommonPubParams,
- addImages: state.addImages,
- images: state.images,
- })),
- );
+ const { commonPubParams, setCommonPubParams, addImages, images } =
+ useImagePageStore(
+ useShallow((state) => ({
+ setAllPubParams: state.setAllPubParams,
+ commonPubParams: state.commonPubParams,
+ setCommonPubParams: state.setCommonPubParams,
+ addImages: state.addImages,
+ images: state.images,
+ })),
+ );
return (
<div className={styles.imageLeftSetting}>
@@ -65,19 +59,6 @@ const ImageLeftSetting = memo(
<div className="imageLeftSetting-commonPar">
<div className="imageLeftSetting-commonPar-titles">
<label>通用发布设置</label>
- <div className="imageLeftSetting-commonPar-titles-operate">
- <Button
- icon={<ArrowRightOutlined />}
- onClick={() => {
- setAllPubParams({
- title: commonPubParams.title,
- describe: commonPubParams.describe,
- });
- }}
- >
- 同步至右侧
- </Button>
- </div>
</div>
<div className="imageLeftSetting-commonPar-item">
diff --git a/src/views/publish/children/imagePage/page.tsx b/src/views/publish/children/imagePage/page.tsx
index 8594a562..c46d0864 100644
--- a/src/views/publish/children/imagePage/page.tsx
+++ b/src/views/publish/children/imagePage/page.tsx
@@ -262,42 +262,6 @@ export default function Page() {
return;
}
}
- if (commonPubParams.title !== '') {
- const titleNullData = imageAccounts.find(
- (v) => v.pubParams.title === '',
- );
- if (titleNullData) {
- confirm({
- title: '温馨提示',
- icon: <ExclamationCircleFilled />,
- content: `检测到通用发布设置存在标题,但是${AccountPlatInfoMap.get(titleNullData!.account.type)?.name}详情参数的标题为空,您是否忘记同步通用发布参数?`,
- okText: '继续发布',
- cancelText: '放弃发布',
- onOk() {
- pubClick();
- },
- });
- return;
- }
- }
- if (commonPubParams.describe !== '') {
- const titleNullData = imageAccounts.find(
- (v) => v.pubParams.describe === '',
- );
- if (titleNullData) {
- confirm({
- title: '温馨提示',
- icon: <ExclamationCircleFilled />,
- content: `检测到通用发布设置存在描述,但是${AccountPlatInfoMap.get(titleNullData!.account.type)?.name}详情参数的描述为空,您是否忘记同步通用发布参数?`,
- okText: '继续发布',
- cancelText: '放弃发布',
- onOk() {
- pubClick();
- },
- });
- return;
- }
- }
pubClick();
}}
>
diff --git a/src/views/publish/children/imagePage/useImagePageStore.ts b/src/views/publish/children/imagePage/useImagePageStore.ts
index f728265f..c22faadf 100644
--- a/src/views/publish/children/imagePage/useImagePageStore.ts
+++ b/src/views/publish/children/imagePage/useImagePageStore.ts
@@ -182,13 +182,21 @@ export const useImagePageStore = create(
// 设置通用发布参数
setCommonPubParams(pubParmas: IPubParams) {
const commonPubParams = { ...get().commonPubParams };
+ const imageAccounts = [...get().imageAccounts];
+
for (const key in commonPubParams) {
if (pubParmas.hasOwnProperty(key)) {
- commonPubParams[key as 'topics'] = pubParmas[key as 'topics'];
+ const keyType = key as 'title';
+ const val = pubParmas[keyType];
+ commonPubParams[keyType] = pubParmas[keyType];
+ imageAccounts.map((v) => {
+ v.pubParams[keyType] = val;
+ });
}
}
set({
commonPubParams,
+ imageAccounts,
});
},
@@ -241,7 +249,7 @@ export const useImagePageStore = create(
for (const account of notAddAccount) {
imageAccounts.push({
account,
- pubParams: useVideoPageStore.getState().pubParamsInit(),
+ pubParams: lodash.cloneDeep(get().commonPubParams),
});
}