From bef5c2f4371273eee40de17a33805cd2727c7fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B2=A1=E5=A4=8D=E4=B9=A0?= <2353956224@qq.com> Date: Tue, 10 Feb 2026 19:24:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/en.js | 6 +++++ src/locales/zh.js | 6 +++++ src/stores/countryStore.js | 51 +++++++++++++++++++++++++++++++++++ src/utils/pythonBridge.js | 7 ++++- src/views/tk/FanWorkbench.vue | 17 +++++++++--- src/views/tk/Workbenches.vue | 12 ++++++++- 6 files changed, 94 insertions(+), 5 deletions(-) diff --git a/src/locales/en.js b/src/locales/en.js index 25804f7..a4926f1 100644 --- a/src/locales/en.js +++ b/src/locales/en.js @@ -59,6 +59,9 @@ export default { countryRequired: 'Please enter country name', countrySetSuccess: 'Country Set Successfully', unknown: 'Unknown', + editCountry: 'Edit Country', + editCountryPrompt: 'Please enter country name (in Chinese)', + editCountryTitle: 'Edit Country', }, hostList: { placeCountry: 'Select country', @@ -176,6 +179,9 @@ export default { countryRequired: 'Please enter country name', countrySetSuccess: 'Country Set Successfully', unknown: 'Unknown', + editCountry: 'Edit Country', + editCountryPrompt: 'Please enter country name (in Chinese)', + editCountryTitle: 'Edit Country', }, countries: { // ... (truncated common countries for brevity, or include all if critical. I'll include a subset or all if possible. The file read showed all.) diff --git a/src/locales/zh.js b/src/locales/zh.js index 7cd6ead..6410c99 100644 --- a/src/locales/zh.js +++ b/src/locales/zh.js @@ -59,6 +59,9 @@ export default { countryRequired: '请输入国家名称', countrySetSuccess: '国家设置成功', unknown: '未知', + editCountry: '编辑国家', + editCountryPrompt: '请输入国家名称(中文)', + editCountryTitle: '编辑国家', }, hostList: { placeCountry: '选择国家', @@ -176,6 +179,9 @@ export default { countryRequired: '请输入国家名称', countrySetSuccess: '国家设置成功', unknown: '未知', + editCountry: '编辑国家', + editCountryPrompt: '请输入国家名称(中文)', + editCountryTitle: '编辑国家', }, countries: { AD: "安道尔", AE: "阿拉伯联合酋长国", AF: "阿富汗", AG: "安提瓜和巴布达", AI: "安圭拉", AL: "阿尔巴尼亚", AM: "亚美尼亚", AO: "安哥拉", AQ: "南极洲", AR: "阿根廷", AS: "美属萨摩亚", AT: "奥地利", AU: "澳大利亚", AU1: "澳大利亚", AW: "阿鲁巴", AX: "奥兰群岛", AZ: "阿塞拜疆", diff --git a/src/stores/countryStore.js b/src/stores/countryStore.js index 18161fe..2da3c95 100644 --- a/src/stores/countryStore.js +++ b/src/stores/countryStore.js @@ -126,6 +126,55 @@ export const useCountryStore = defineStore('country', () => { await fetchCountryInfo(t, true) } + /** + * 手动设置国家信息 + * @param {string} countryName - 国家名称(中文) + * @param {Function} t - 国际化函数(可选) + */ + const setCountryManually = (countryName, t = null) => { + if (!countryName || countryName.trim() === '') { + return false + } + + countryData.value = countryName.trim() + countryDataEN.value = countryName.trim() + hasInitialized.value = true + lastFetchTime.value = Date.now() + + if (t) { + ElMessage.success(t('workbenchesSetup.countrySetSuccess') || t('hostsList.countrySetSuccess') || '国家设置成功') + } + + return true + } + + /** + * 显示编辑国家的弹窗 + * @param {Function} t - 国际化函数 + */ + const showEditCountryDialog = (t) => { + ElMessageBox.prompt( + t('workbenchesSetup.editCountryPrompt') || t('hostsList.editCountryPrompt') || '请输入国家名称(中文)', + t('workbenchesSetup.editCountryTitle') || t('hostsList.editCountryTitle') || '编辑国家', + { + confirmButtonText: t('workbenchesSetup.confirm') || t('hostsList.confirm') || '确定', + cancelButtonText: t('workbenchesSetup.cancel') || t('hostsList.cancel') || '取消', + inputPlaceholder: t('workbenchesSetup.countryPlaceholder') || t('hostsList.countryPlaceholder') || '例如:美国、日本、英国', + inputValue: countryData.value, // 预填充当前值 + inputValidator: (value) => { + if (!value || value.trim() === '') { + return t('workbenchesSetup.countryRequired') || t('hostsList.countryRequired') || '请输入国家名称' + } + return true + } + } + ).then(({ value }) => { + setCountryManually(value, t) + }).catch(() => { + // 用户取消编辑 + }) + } + return { // 状态 countryData, @@ -139,5 +188,7 @@ export const useCountryStore = defineStore('country', () => { refreshCountry, showCountryInputDialog, initCountryInfo, + setCountryManually, + showEditCountryDialog, } }) diff --git a/src/utils/pythonBridge.js b/src/utils/pythonBridge.js index b73e3aa..37c4289 100644 --- a/src/utils/pythonBridge.js +++ b/src/utils/pythonBridge.js @@ -36,7 +36,11 @@ export function usePythonBridge() { if (!inElectron) return; await window.electronAPI.tk.loginTikTok(); }; - + // loginTikTok + const loginBigTikTok = async () => { + if (!inElectron) return; + await window.electronAPI.tk.loginBigTikTok(); + }; // loginBackStage const loginBackStage = async (data) => { if (!inElectron) return; @@ -228,6 +232,7 @@ export function usePythonBridge() { fetchDataCount, loginBackStage, loginTikTok, + loginBigTikTok, givePyAnchorId, backStageloginStatus, backStageloginStatusCopy, diff --git a/src/views/tk/FanWorkbench.vue b/src/views/tk/FanWorkbench.vue index e0ce8d4..bbc0ffb 100644 --- a/src/views/tk/FanWorkbench.vue +++ b/src/views/tk/FanWorkbench.vue @@ -112,6 +112,11 @@
{{ $t('hostsList.currentNetwork') || '当前网络' }}: {{ countryData }} + + @@ -431,6 +436,11 @@ onMounted(async () => { }, 1000 * 20) }) +// 编辑国家信息 - 使用共享 store +const editCountry = () => { + countryStore.showEditCountryDialog(t); +}; + // 刷新国家信息 - 使用共享 store const refreshCountry = async () => { await countryStore.refreshCountry(t);