diff --git a/apps/web/src/pages/feeds/index.tsx b/apps/web/src/pages/feeds/index.tsx index 15f432a..734a89c 100644 --- a/apps/web/src/pages/feeds/index.tsx +++ b/apps/web/src/pages/feeds/index.tsx @@ -60,32 +60,38 @@ const Feeds = () => { const [currentMpId, setCurrentMpId] = useState(id || ''); const handleConfirm = async () => { + console.log("wxsLink", wxsLink) // TODO show operation in progress - const res = await getMpInfo({ wxsLink: wxsLink }); - if (res[0]) { - const item = res[0]; - await addFeed({ - id: item.id, - mpName: item.name, - mpCover: item.cover, - mpIntro: item.intro, - updateTime: item.updateTime, - status: 1, - }); - await refreshMpArticles({ mpId: item.id }); - - toast.success('添加成功', { - description: `公众号 ${item.name}`, - }); - refetchFeedList(); - setWxsLink(''); - onClose(); - await queryUtils.article.list.reset(); - } else { - toast.error('添加失败', { description: '请检查链接是否正确' }); + const wxsLinks = wxsLink.split('\n').filter(link=>link.trim()!==''); + for (const link of wxsLinks){ + console.log('add wxsLink',link) + const res = await getMpInfo({ wxsLink: link }); + if (res[0]) { + const item = res[0]; + await addFeed({ + id: item.id, + mpName: item.name, + mpCover: item.cover, + mpIntro: item.intro, + updateTime: item.updateTime, + status: 1, + }); + await refreshMpArticles({ mpId: item.id }); + toast.success('添加成功', { + description: `公众号 ${item.name}`, + }); + await queryUtils.article.list.reset(); + } else { + toast.error('添加失败', { description: '请检查链接是否正确' }); + } } + refetchFeedList(); + setWxsLink(''); + onClose(); }; + + const isActive = (key: string) => { return currentMpId === key; }; @@ -334,7 +340,7 @@ const Feeds = () => { onValueChange={setWxsLink} autoFocus label="分享链接" - placeholder="输入公众号文章分享链接,如 https://mp.weixin.qq.com/s/xxxxxx" + placeholder="输入公众号文章分享链接,一行一条,如 https://mp.weixin.qq.com/s/xxxxxx https://mp.weixin.qq.com/s/xxxxxx" variant="bordered" />