Skip to content

Let's use AI to Earn!

feat: 图文发布前端50%

gaoSir8ac1db190f8e
diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx
index 9888b6aa..af4ae050 100644
--- a/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx
+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx
@@ -1,7 +1,12 @@
-import { ForwardedRef, forwardRef, memo } from 'react';
+import { ForwardedRef, forwardRef, memo, useState } from 'react';
import styles from '../../image.module.scss';
import { PubType } from '../../../../../../../commont/publish/PublishEnum';
import SupportPlat from '../../../../components/SupportPlat/SupportPlat';
+import { ChooseAccountChunk } from '../../../../components/CommonComponents/CommonComponents';
+import { Steps } from 'antd';
+import ChooseAccountModule from '../../../../components/ChooseAccountModule/ChooseAccountModule';
+import { useShallow } from 'zustand/react/shallow';
+import { useImagePageStore } from '../../useImagePageStore';
export interface IImageRightSettingRef {}
@@ -10,14 +15,54 @@ export interface IImageRightSettingProps {}
const ImageRightSetting = memo(
forwardRef(
({}: IImageRightSettingProps, ref: ForwardedRef<IImageRightSettingRef>) => {
+ const [chooseAccountOpen, setChooseAccountOpen] = useState(false);
+ const { imageTextData } = useImagePageStore(
+ useShallow((state) => ({
+ imageTextData: state.imageTextData,
+ })),
+ );
+
return (
<div className={styles.imageRightSetting}>
+ <ChooseAccountModule
+ open={chooseAccountOpen}
+ onClose={setChooseAccountOpen}
+ choosedAccounts={imageTextData.imageAccounts
+ .map((v) => v.account)
+ .filter((v) => v !== undefined)}
+ onPlatConfirm={(aList) => {
+ console.log(aList);
+ }}
+ pubType={PubType.ImageText}
+ />
+
<SupportPlat
pubType={PubType.ImageText}
style={{ marginTop: '15px' }}
/>
<h2 className="imageRightSetting-title">发布账户</h2>
+ <ChooseAccountChunk
+ onClick={() => {
+ setChooseAccountOpen(true);
+ }}
+ />
+
+ <Steps
+ direction="vertical"
+ size="small"
+ items={[
+ {
+ title: '选择发布账号',
+ description: '选择将要推文的账号',
+ },
+ {
+ title: '调整发文规则',
+ description:
+ '完成账号选择后,撰写推文,按需调整各个平台发文规则',
+ },
+ ]}
+ />
</div>
);
},
diff --git a/src/views/publish/children/imagePage/image.module.scss b/src/views/publish/children/imagePage/image.module.scss
index ee9483ca..3707f0b1 100644
--- a/src/views/publish/children/imagePage/image.module.scss
+++ b/src/views/publish/children/imagePage/image.module.scss
@@ -69,5 +69,20 @@
font-size: var(--fs-sm);
margin: 25px 0 5px 0;
}
+
+ .ant-steps {
+ margin-top: 30px;
+ .ant-steps-item {
+ height: 70px;
+ }
+ .ant-steps-item-title {
+ color: #222 !important;
+ font-weight: 900;
+ }
+ .ant-steps-item-description {
+ color: var(--lightGreyColor) !important;
+ font-size: var(--fs-xs);
+ }
+ }
}
}
diff --git a/src/views/publish/children/imagePage/imagePage.type.ts b/src/views/publish/children/imagePage/imagePage.type.ts
new file mode 100644
index 00000000..b12f71da
--- /dev/null
+++ b/src/views/publish/children/imagePage/imagePage.type.ts
@@ -0,0 +1,7 @@
+import { AccountInfo } from '../../../account/comment';
+import { IPubParams } from '../videoPage/videoPage';
+
+export interface IImageAccountItem {
+ account?: AccountInfo;
+ pubParams: IPubParams;
+}
diff --git a/src/views/publish/children/imagePage/useImagePageStore.ts b/src/views/publish/children/imagePage/useImagePageStore.ts
index 60c6dc33..6a09ccec 100644
--- a/src/views/publish/children/imagePage/useImagePageStore.ts
+++ b/src/views/publish/children/imagePage/useImagePageStore.ts
@@ -1,18 +1,41 @@
import { create } from 'zustand';
import { combine } from 'zustand/middleware';
+import { IImgFile } from '../../../../components/Choose/ImgChoose';
+import { IImageAccountItem } from './imagePage.type';
+import lodash from 'lodash';
-interface IVideoPageStore {}
+interface IImagePageStore {
+ imageTextData: {
+ image: IImgFile[];
+ imageAccounts: IImageAccountItem[];
+ };
+}
-const store: IVideoPageStore = {};
+const store: IImagePageStore = {
+ imageTextData: {
+ image: [],
+ imageAccounts: [],
+ },
+};
+
+const getStore = () => {
+ return lodash.cloneDeep(store);
+};
// 视频发布所有组件的共享状态和方法
export const useImagePageStore = create(
combine(
{
- ...store,
+ ...getStore(),
},
(set, get, storeApi) => {
- const methods = {};
+ const methods = {
+ clear() {
+ set({
+ ...getStore(),
+ });
+ },
+ };
return methods;
},
),
diff --git a/src/views/publish/components/CommonComponents/CommonComponents.tsx b/src/views/publish/components/CommonComponents/CommonComponents.tsx
index 496205df..e6956bfc 100644
--- a/src/views/publish/components/CommonComponents/CommonComponents.tsx
+++ b/src/views/publish/components/CommonComponents/CommonComponents.tsx
@@ -1,7 +1,10 @@
import { Button } from 'antd';
import styles from './commonComponents.module.scss';
import { useState } from 'react';
+import { Outlet } from 'react-router-dom';
+import { PlusOutlined, UserAddOutlined } from '@ant-design/icons';
+// 本地上传、素材上传展示的块
export const ChooseChunk = ({
onClick,
imgUrl,
@@ -45,3 +48,16 @@ export const ChooseChunk = ({
</>
);
};
+
+// 选择账户展示的块
+export const ChooseAccountChunk = ({ onClick }: { onClick: () => void }) => {
+ return (
+ <div className={styles.chooseAccountChunk} onClick={onClick}>
+ <UserAddOutlined className="chooseAccountChunk-user" />
+ <Button icon={<PlusOutlined />} type="primary">
+ 选择发布账号
+ </Button>
+ <Outlet />
+ </div>
+ );
+};
diff --git a/src/views/publish/components/CommonComponents/commonComponents.module.scss b/src/views/publish/components/CommonComponents/commonComponents.module.scss
index f705b2c6..81295203 100644
--- a/src/views/publish/components/CommonComponents/commonComponents.module.scss
+++ b/src/views/publish/components/CommonComponents/commonComponents.module.scss
@@ -24,4 +24,26 @@
opacity: 0.8;
}
}
+}
+
+.chooseAccountChunk {
+ height: 180px;
+ background: var(--colorPrimary1);
+ border: 1px dashed transparent;
+ border-radius: 8px;
+ cursor: pointer;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ &:hover {
+ border-color: var(--colorPrimary6);
+ }
+ :global {
+ .chooseAccountChunk-user {
+ font-size: 60px;
+ color: var(--colorPrimary4);
+ margin-bottom: 10px;
+ }
+ }
}
\ No newline at end of file
diff --git a/vite.config.ts b/vite.config.ts
index 80febfff..6779b258 100644
--- a/vite.config.ts
+++ b/vite.config.ts
@@ -28,6 +28,13 @@ export default defineConfig(({ command }) => {
buffer: 'buffer',
},
},
+ css: {
+ preprocessorOptions: {
+ scss: {
+ api: 'modern-compiler',
+ },
+ },
+ },
plugins: [
react(),
electron({