From da5a9890f33f6c28b48873278db70375cbeab8bf Mon Sep 17 00:00:00 2001 From: Leo Song Date: Fri, 17 Oct 2025 12:17:09 +0800 Subject: [PATCH 1/3] Update PublishCenter.vue --- sau_frontend/src/views/PublishCenter.vue | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/sau_frontend/src/views/PublishCenter.vue b/sau_frontend/src/views/PublishCenter.vue index 94faca7..d54f431 100644 --- a/sau_frontend/src/views/PublishCenter.vue +++ b/sau_frontend/src/views/PublishCenter.vue @@ -529,9 +529,19 @@ const defaultTabInit = { publishStatus: null // 发布状态,包含message和type } -// tab页数据 - 默认只有一个tab +// helper to create a fresh deep-copied tab from defaultTabInit +const makeNewTab = () => { + // prefer structuredClone when available (newer browsers/node), fallback to JSON + try { + return typeof structuredClone === 'function' ? structuredClone(defaultTabInit) : JSON.parse(JSON.stringify(defaultTabInit)) + } catch (e) { + return JSON.parse(JSON.stringify(defaultTabInit)) + } +} + +// tab页数据 - 默认只有一个tab (use deep copy to avoid shared refs) const tabs = reactive([ - defaultTabInit + makeNewTab() ]) // 账号相关状态 @@ -568,9 +578,9 @@ const recommendedTopics = [ // 添加新tab const addTab = () => { tabCounter++ - const newTab = defaultTabInit - newTab['name'] = `tab${tabCounter}` - newTab['label'] = `发布${tabCounter}` + const newTab = makeNewTab() + newTab.name = `tab${tabCounter}` + newTab.label = `发布${tabCounter}` tabs.push(newTab) activeTab.value = newTab.name } From 2dbedcc2067b65b1e57301fe3b666e1eb9536013 Mon Sep 17 00:00:00 2001 From: Leo Song Date: Sat, 18 Oct 2025 13:07:27 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A6=82=E6=9E=9C=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E4=B8=8D=E5=8F=AF=E7=94=A8=EF=BC=8C=E5=85=B3=E6=8E=89=E5=BC=B9?= =?UTF-8?q?=E7=AA=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uploader/douyin_uploader/main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/uploader/douyin_uploader/main.py b/uploader/douyin_uploader/main.py index 9f29122..e0032ab 100644 --- a/uploader/douyin_uploader/main.py +++ b/uploader/douyin_uploader/main.py @@ -321,6 +321,15 @@ class DouYinVideo(object): return False await add_button.click() douyin_logger.debug("[+] 成功点击'添加链接'按钮") + ## 如果链接不可用 + await page.wait_for_timeout(2000) + error_modal = page.locator('text=未搜索到对应商品') + if await error_modal.count(): + confirm_button = page.locator('button:has-text("确定")') + await confirm_button.click() + # await page.wait_for_selector('.semi-modal-content', state='hidden', timeout=5000) + douyin_logger.error("[-] 商品链接无效") + return False # 填写商品短标题 if not await self.handle_product_dialog(page, product_title): From 2f95a5512ce82426219bac3eb66859e8c0f05ea8 Mon Sep 17 00:00:00 2001 From: Leo Song Date: Fri, 24 Oct 2025 16:31:43 +0800 Subject: [PATCH 3/3] wait for elements --- uploader/douyin_uploader/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/uploader/douyin_uploader/main.py b/uploader/douyin_uploader/main.py index e0032ab..d5c9ab8 100644 --- a/uploader/douyin_uploader/main.py +++ b/uploader/douyin_uploader/main.py @@ -257,6 +257,7 @@ class DouYinVideo(object): """处理商品编辑弹窗""" await page.wait_for_timeout(2000) + await page.wait_for_selector('input[placeholder="请输入商品短标题"]', timeout=10000) short_title_input = page.locator('input[placeholder="请输入商品短标题"]') if not await short_title_input.count(): douyin_logger.error("[-] 未找到商品短标题输入框") @@ -292,6 +293,7 @@ class DouYinVideo(object): """设置商品链接功能""" try: # 定位"添加标签"文本,然后向上导航到容器,再找到下拉框 + await page.wait_for_selector('text=添加标签', timeout=10000) dropdown = page.get_by_text('添加标签').locator("..").locator("..").locator("..").locator(".semi-select").first if not await dropdown.count(): douyin_logger.error("[-] 未找到标签下拉框")