Let's use AI to Earn!
TypeScript auto-publishdouyindouyin-apielectron-appelectron-reactkuaishoukwaipublishedshipinhaotoolxiaohongshu
feat: 图文发布静态页开发中
gaoSir19565d57e0be
diff --git a/commont/publish/PublishEnum.ts b/commont/publish/PublishEnum.tsindex 08cab26b..01547b7f 100644--- a/commont/publish/PublishEnum.ts+++ b/commont/publish/PublishEnum.ts@@ -2,6 +2,7 @@export enum PubType {VIDEO = 'video', // 视频ARTICLE = 'article', // 文章+ ImageText = 'image-text', // 图文}// 可见性diff --git a/src/var.css b/src/var.cssindex 02342590..4dfc70bc 100644--- a/src/var.css+++ b/src/var.css@@ -5,7 +5,7 @@/* 浅灰色 */--lightGreyColor: #888;/* 超浅灰色 */- --superLightGreyColor: #d2d2d2;+ --superLightGreyColor: #e0e0e0;/* 超大号字 */--fs-xl: 20px;diff --git a/src/views/account/comment.ts b/src/views/account/comment.tsindex 77f1bc43..f0df7805 100644--- a/src/views/account/comment.ts+++ b/src/views/account/comment.ts@@ -42,7 +42,7 @@ export interface IAccountPlatInfo {}// 支持所有发布-const PubTypeAll = new Set([PubType.ARTICLE, PubType.VIDEO]);+const PubTypeAll = new Set([PubType.ARTICLE, PubType.VIDEO, PubType.ImageText]);// 各个平台的信息export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([[@@ -51,7 +51,7 @@ export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([name: '快手',icon: ksSvg,url: 'https://cp.kuaishou.com/profile',- pubTypes: PubTypeAll,+ pubTypes: new Set([PubType.VIDEO]),commonPubParamsConfig: {timingMax: {maxDate: 13,@@ -99,7 +99,7 @@ export const AccountPlatInfoMap = new Map<AccountType, IAccountPlatInfo>([name: '微信视频号',icon: wxSphSvg,url: 'https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/helper/hepler_merlin_mmdata?_rid=67b30b55-6e3ea588',- pubTypes: PubTypeAll,+ pubTypes: new Set([PubType.VIDEO]),commonPubParamsConfig: {timingMax: {maxDate: 30,diff --git a/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx b/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsxnew file mode 100644index 00000000..a351b572--- /dev/null+++ b/src/views/publish/children/imagePage/components/ImageLeftSetting/ImageLeftSetting.tsx@@ -0,0 +1,79 @@+import React, { ForwardedRef, forwardRef, memo } from 'react';+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';++const { TextArea } = Input;++export interface IImageLeftSettingRef {}++export interface IImageLeftSettingProps {}++const ImageLeftSetting = memo(+ forwardRef(+ ({}: IImageLeftSettingProps, ref: ForwardedRef<IImageLeftSettingRef>) => {+ return (+ <div className={styles.imageLeftSetting}>+ <div className="imageLeftSetting-upload">+ <ImgChoose+ onMultipleChoose={(e) => {+ console.log(e);+ }}+ >+ <ChooseChunk+ text="本地上传"+ imgUrl={localUpload}+ color="linear-gradient(to right, rgb(255, 142, 28), rgb(255, 124, 24))"+ hoverColor="rgb(255, 142, 28)"+ style={{ marginRight: '15px', width: '260px', height: '180px' }}+ />+ </ImgChoose>+ </div>++ <div className="imageLeftSetting-commonPar">+ <div className="imageLeftSetting-commonPar-titles">+ <label>通用发布设置</label>+ <div className="imageLeftSetting-commonPar-titles-operate">+ <Button icon={<ArrowRightOutlined />}>同步至右侧</Button>+ </div>+ </div>++ <div className="imageLeftSetting-commonPar-item">+ <label>一键设置标题:</label>+ <Input+ placeholder="请输入标题"+ showCount+ variant="filled"+ onChange={(e) => {+ console.log(e.target.value);+ }}+ />+ </div>++ <div+ className="imageLeftSetting-commonPar-item"+ style={{ alignItems: 'baseline' }}+ >+ <label>一键设置简介:</label>+ <TextArea+ maxLength={1000}+ placeholder="请输入简介"+ showCount+ variant="filled"+ onChange={(e) => {+ console.log(e.target.value);+ }}+ />+ </div>+ </div>+ </div>+ );+ },+ ),+);+ImageLeftSetting.displayName = 'ImageLeftSetting';++export default ImageLeftSetting;diff --git a/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx b/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsxnew file mode 100644index 00000000..9888b6aa--- /dev/null+++ b/src/views/publish/children/imagePage/components/ImageRightSetting/ImageRightSetting.tsx@@ -0,0 +1,28 @@+import { ForwardedRef, forwardRef, memo } from 'react';+import styles from '../../image.module.scss';+import { PubType } from '../../../../../../../commont/publish/PublishEnum';+import SupportPlat from '../../../../components/SupportPlat/SupportPlat';++export interface IImageRightSettingRef {}++export interface IImageRightSettingProps {}++const ImageRightSetting = memo(+ forwardRef(+ ({}: IImageRightSettingProps, ref: ForwardedRef<IImageRightSettingRef>) => {+ return (+ <div className={styles.imageRightSetting}>+ <SupportPlat+ pubType={PubType.ImageText}+ style={{ marginTop: '15px' }}+ />++ <h2 className="imageRightSetting-title">发布账户</h2>+ </div>+ );+ },+ ),+);+ImageRightSetting.displayName = 'ImageRightSetting';++export default ImageRightSetting;diff --git a/src/views/publish/children/imagePage/image.module.scss b/src/views/publish/children/imagePage/image.module.scssindex fe07add3..ee9483ca 100644--- a/src/views/publish/children/imagePage/image.module.scss+++ b/src/views/publish/children/imagePage/image.module.scss@@ -1,4 +1,73 @@.image {+ display: flex;+ flex-direction: column;+ width: 100%;+ height: 100%;:global {+ .image-wrapper {+ width: 80%;+ margin: 0 auto;+ height: 100%;+ min-height: 0;+ box-sizing: border-box;+ padding: 15px 0;+ display: flex;+ }+ .image-footer {+ border-top: 1px solid var(--superLightGreyColor);+ padding: 15px 0;+ }+ }+}++.imageLeftSetting {+ width: 65%;+ display: flex;+ flex-direction: column;+ height: 100%;+ min-height: 0;+ box-sizing: border-box;+ padding: 25px 20px 0 0;+ margin-right: 20px;+ border-right: 1px solid var(--superLightGreyColor);+ :global {+ .imageLeftSetting-upload {+ width: 100%;+ display: flex;+ justify-content: center;+ border-bottom: 1px solid var(--superLightGreyColor);+ padding-bottom: 30px;+ margin-bottom: 25px;+ }+ .imageLeftSetting-commonPar {+ overflow: auto;+ height: 100%;+ &-titles, &-item {+ display: flex;+ align-items: center;+ justify-content: space-between;+ font-size: var(--fs-sm);+ margin-bottom: 30px;+ & > label {+ flex-shrink: 0;+ }+ }+ &-item {+ textarea {+ height: 150px;+ resize: none;+ }+ }+ }+ }+}++.imageRightSetting {+ :global {+ .imageRightSetting-title {+ text-align: left;+ font-size: var(--fs-sm);+ margin: 25px 0 5px 0;+ }}}diff --git a/src/views/publish/children/imagePage/page.tsx b/src/views/publish/children/imagePage/page.tsxindex 53161007..880ead95 100644--- a/src/views/publish/children/imagePage/page.tsx+++ b/src/views/publish/children/imagePage/page.tsx@@ -1,9 +1,31 @@import styles from './image.module.scss';import { useShallow } from 'zustand/react/shallow';import { useImagePageStore } from './useImagePageStore';+import ImageLeftSetting from './components/ImageLeftSetting/ImageLeftSetting';+import ImageRightSetting from './components/ImageRightSetting/ImageRightSetting';+import { Button, Popconfirm } from 'antd';export default function Page() {const {} = useImagePageStore(useShallow((state) => ({})));- return <div className={styles.image}>图片发布</div>;+ return (+ <div className={styles.image}>+ <div className="image-wrapper">+ <ImageLeftSetting />+ <ImageRightSetting />+ </div>+ <div className="image-footer">+ <Popconfirm+ title="温馨提示"+ description="是否确认清空内容和账号?"+ onConfirm={() => {}}+ okText="确认"+ cancelText="取消"+ >+ <Button style={{ marginRight: '20px' }}>一键清空</Button>+ </Popconfirm>+ <Button type="primary">一键发布</Button>+ </div>+ </div>+ );}diff --git a/src/views/publish/children/videoPage/components/NoChoosePage.tsx b/src/views/publish/children/videoPage/components/NoChoosePage.tsxindex 1ef2241f..91c1e98e 100644--- a/src/views/publish/children/videoPage/components/NoChoosePage.tsx+++ b/src/views/publish/children/videoPage/components/NoChoosePage.tsx@@ -6,10 +6,11 @@ import { useVideoPageStore } from '@/views/publish/children/videoPage/useVideoPaimport { useShallow } from 'zustand/react/shallow';import localUpload from '../images/localUpload.png';import importRecord from '../images/importRecord.png';-import { Alert, Button, message, Modal } from 'antd';+import { Alert, message, Modal } from 'antd';import PubRecord from '../../pubRecord/page';import { icpGetPubVideoRecord } from '../../../../../icp/publish';import { useAccountStore } from '../../../../../store/account';+import { ChooseChunk } from '../../../components/CommonComponents/CommonComponents';export interface INoChoosePageRef {}@@ -82,27 +83,26 @@ const NoChoosePage = memo(setLoadingPageLoading(false);}}>- <img src={localUpload} />- <Button type="primary" size="large">- 本地上传- </Button>+ <ChooseChunk+ text="本地上传"+ imgUrl={localUpload}+ color="linear-gradient(to right, rgb(255, 142, 28), rgb(255, 124, 24))"+ hoverColor="rgb(255, 142, 28)"+ style={{ marginRight: '15px' }}+ /></VideoChoose>- <div- className="videoChoose"+ <ChooseChunk+ text="导入发布记录"+ imgUrl={importRecord}+ color="#a66ae4"onClick={() => {setImportPubRecordOpen(true);- console.log('click');}}- >- <img src={importRecord} />- <Button type="primary" size="large">- 导入发布记录- </Button>- </div>+ /></div>- <SupportPlat pubType={PubType.VIDEO} type={1} />+ <SupportPlat pubType={PubType.VIDEO} style={{ marginTop: '15px' }} /></div>);}),diff --git a/src/views/publish/children/videoPage/video.module.scss b/src/views/publish/children/videoPage/video.module.scssindex 4426ba7f..24d711e9 100644--- a/src/views/publish/children/videoPage/video.module.scss+++ b/src/views/publish/children/videoPage/video.module.scss@@ -23,50 +23,6 @@h1 {font-size: 24px;}- .videoChoose {- display: flex;- cursor: pointer;- flex-direction: column;- background: rgb(247, 250, 250);- width: 160px;- height: 160px;- box-sizing: border-box;- padding: 20px;- justify-content: center;- align-items: center;- border-radius: 10px;- margin-bottom: 25px;- border: 1px solid transparent;- transition: 0.3s;- margin-right: 15px;- &:last-of-type {- margin-right: 0;- }- img {- width: 50px;- height: 45px;- object-fit: contain;- }- button {- margin-top: 20px;- background-image: linear-gradient(to right, rgb(255, 142, 28), rgb(255, 124, 24)) !important;- width: 100%;- &:hover {- opacity: 0.8;- }- }- &:hover {- border-color: rgb(255, 142, 28);- }- &:nth-child(2) {- &:hover {- border-color: var(--colorPrimary6) !important;- }- button {- background: var(--colorPrimary6) !important;- }- }- }&-tip {font-size: var(--fs-sm);color: var(--darkGreyColor);@@ -126,7 +82,7 @@overflow: auto;}&-footer {- border-top: 1px solid #ccc;+ border-top: 1px solid var(--superLightGreyColor);padding: 15px;}}diff --git a/src/views/publish/components/CommonComponents/CommonComponents.tsx b/src/views/publish/components/CommonComponents/CommonComponents.tsxnew file mode 100644index 00000000..496205df--- /dev/null+++ b/src/views/publish/components/CommonComponents/CommonComponents.tsx@@ -0,0 +1,47 @@+import { Button } from 'antd';+import styles from './commonComponents.module.scss';+import { useState } from 'react';++export const ChooseChunk = ({+ onClick,+ imgUrl,+ color,+ text,+ hoverColor,+ style,+}: {+ onClick?: () => void;+ imgUrl: string;+ hoverColor?: string;+ color: string;+ text: string;+ style?: React.CSSProperties;+}) => {+ const [isHovered, setIsHovered] = useState(false);++ return (+ <>+ <div+ className={styles.chooseChunk}+ onClick={() => {+ if (onClick) onClick();+ }}+ style={+ isHovered+ ? {+ borderColor: hoverColor || color,+ ...(style || {}),+ }+ : style || {}+ }+ onMouseEnter={() => setIsHovered(true)}+ onMouseLeave={() => setIsHovered(false)}+ >+ <img src={imgUrl} />+ <Button type="primary" size="large" style={{ background: color }}>+ {text}+ </Button>+ </div>+ </>+ );+};diff --git a/src/views/publish/components/CommonComponents/commonComponents.module.scss b/src/views/publish/components/CommonComponents/commonComponents.module.scssnew file mode 100644index 00000000..f705b2c6--- /dev/null+++ b/src/views/publish/components/CommonComponents/commonComponents.module.scss@@ -0,0 +1,27 @@+.chooseChunk {+ display: flex;+ cursor: pointer;+ flex-direction: column;+ background: rgb(247, 250, 250);+ width: 160px;+ height: 160px;+ box-sizing: border-box;+ padding: 20px;+ justify-content: center;+ align-items: center;+ border-radius: 10px;+ border: 1px solid transparent;+ transition: 0.3s;+ img {+ width: 50px;+ height: 45px;+ object-fit: contain;+ }+ button {+ margin-top: 20px;+ width: 110px;+ &:hover {+ opacity: 0.8;+ }+ }+}\ No newline at end of filediff --git a/src/views/publish/components/SupportPlat/SupportPlat.tsx b/src/views/publish/components/SupportPlat/SupportPlat.tsxindex 292f414e..5894eff0 100644--- a/src/views/publish/components/SupportPlat/SupportPlat.tsx+++ b/src/views/publish/components/SupportPlat/SupportPlat.tsx@@ -7,26 +7,27 @@ export interface ISupportPlatRef {}export interface ISupportPlatProps {pubType: PubType;- // 0=视频发布样式、1=文章、图片 样式- type: 0 | 1;+ style?: React.CSSProperties;}const SupportPlat = memo(forwardRef((- { pubType, type }: ISupportPlatProps,+ { pubType, style }: ISupportPlatProps,ref: ForwardedRef<ISupportPlatRef>,) => {return (- <div className={styles.supportPlat}>+ <div+ className={`${styles.supportPlat} ${pubType !== PubType.VIDEO && styles.supportPlatBg}`}+ style={style}+ >+ <div className="supportPlatBg-title">支持平台</div><div className="supportPlat-tip"><p className="supportPlat-tip--line" /><p className="supportPlat-tip-text">支持以下平台</p><p className="supportPlat-tip--line" /></div>- <ul- className={`supportPlat-con ${type === 1 ? 'supportPlat-centerCon' : ''}`}- >+ <ul className="supportPlat-con">{Array.from(AccountPlatInfoMap).map(([k, v]) => {if (!v.pubTypes.has(pubType)) return null;return (diff --git a/src/views/publish/components/SupportPlat/supportPlat.module.scss b/src/views/publish/components/SupportPlat/supportPlat.module.scssindex c2892e94..3faf2f3a 100644--- a/src/views/publish/components/SupportPlat/supportPlat.module.scss+++ b/src/views/publish/components/SupportPlat/supportPlat.module.scss@@ -17,18 +17,44 @@}}.supportPlat-con {- display: grid;- grid-template-columns: repeat(8, 1fr);+ //display: grid;+ //grid-template-columns: repeat(8, 1fr);gap: 20px;+ display: flex;+ justify-content: center;+ align-items: center;min-width: 340px;img {width: 25px;}}- .supportPlat-centerCon {- display: flex;- justify-content: center;- align-items: center;+ .supportPlatBg-title {+ display: none;+ }+ }+}++.supportPlatBg {+ padding: 15px;+ display: flex;+ border-radius: 10px;+ background: rgb(247, 250, 250);+ :global {+ .supportPlat-tip {+ display: none;+ }+ .supportPlat-con {+ display: grid;+ gap: 10px;+ grid-template-columns: repeat(7, 1fr);+ }+ .supportPlatBg-title {+ display: block;+ font-weight: 900;+ font-size: var(--fs-xs);+ color: rgb(157, 164, 164);+ margin: 3px 10px 0 0;+ white-space: nowrap;}}}\ No newline at end of file