mirror of
https://github.com/cooderl/wewe-rss.git
synced 2026-08-28 23:15:10 +08:00
Merge pull request #306 from AmbroseX/main
feat: Enable multi-line link submission for WeChat Official Account s…
This commit is contained in:
@@ -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"
|
||||
/>
|
||||
</ModalBody>
|
||||
|
||||
Reference in New Issue
Block a user